fixes #486
This commit is contained in:
1 parent
8a2ddcbf2a
commit
1c1fb5eb59
5 files changed
+18
-9
No files matched your search
@@ -3777,7 +3777,7 @@ Consult section about container operations in `Expression` to learn about possib
|
|||||||
Excapes all the special characters in the string or nbt tag and returns a string that can be stored in nbt directly
|
Excapes all the special characters in the string or nbt tag and returns a string that can be stored in nbt directly
|
||||||
as a string value.
|
as a string value.
|
||||||
|
|
||||||
### parse_nbt(tag)
|
### `parse_nbt(tag)`
|
||||||
|
|
||||||
Converts NBT tag to a scarpet value, which you can navigate through much better.
|
Converts NBT tag to a scarpet value, which you can navigate through much better.
|
||||||
|
|
||||||
@@ -3787,7 +3787,7 @@ Converts:
|
|||||||
- Numbers (Ints, Floats, Doubles, Longs) into a number
|
- Numbers (Ints, Floats, Doubles, Longs) into a number
|
||||||
- Rest is converted to strings.
|
- Rest is converted to strings.
|
||||||
|
|
||||||
### encode_nbt(expr, force?)
|
### `encode_nbt(expr, force?)`
|
||||||
|
|
||||||
Encodes value of the expression as an NBT tag. By default (or when `force` is false), it will only allow
|
Encodes value of the expression as an NBT tag. By default (or when `force` is false), it will only allow
|
||||||
to encode values that are guaranteed to return the same value when applied the resulting tag to `parse_nbt()`.
|
to encode values that are guaranteed to return the same value when applied the resulting tag to `parse_nbt()`.
|
||||||
@@ -4032,11 +4032,11 @@ world-localized block, so not `block('stone')`, or a string representing a dimen
|
|||||||
### `view_distance()`
|
### `view_distance()`
|
||||||
Returns the view distance of the server.
|
Returns the view distance of the server.
|
||||||
|
|
||||||
### `mob_counts()`, `mob_counts(category)` 1.16+
|
### `get_mob_counts()`, `get_mob_counts(category)` 1.16+
|
||||||
|
|
||||||
Returns either a map of mob categories with its respective counts and capacities (a.k.a. mobcaps) or just a tuple
|
Returns either a map of mob categories with its respective counts and capacities (a.k.a. mobcaps) or just a tuple
|
||||||
of count and limit for a specific category. If a category was not spawning for whatever reason it may not be
|
of count and limit for a specific category. If a category was not spawning for whatever reason it may not be
|
||||||
returned from `mob_counts()`, but could be retrieved for `mob_counts(category)`. Returned counts is what spawning
|
returned from `get_mob_counts()`, but could be retrieved for `get_mob_counts(category)`. Returned counts is what spawning
|
||||||
algorithm has taken in to account last time mobs spawned.
|
algorithm has taken in to account last time mobs spawned.
|
||||||
|
|
||||||
### `schedule(delay, function, args...)`
|
### `schedule(delay, function, args...)`
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ Consult section about container operations in `Expression` to learn about possib
|
|||||||
Excapes all the special characters in the string or nbt tag and returns a string that can be stored in nbt directly
|
Excapes all the special characters in the string or nbt tag and returns a string that can be stored in nbt directly
|
||||||
as a string value.
|
as a string value.
|
||||||
|
|
||||||
### parse_nbt(tag)
|
### `parse_nbt(tag)`
|
||||||
|
|
||||||
Converts NBT tag to a scarpet value, which you can navigate through much better.
|
Converts NBT tag to a scarpet value, which you can navigate through much better.
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ Converts:
|
|||||||
- Numbers (Ints, Floats, Doubles, Longs) into a number
|
- Numbers (Ints, Floats, Doubles, Longs) into a number
|
||||||
- Rest is converted to strings.
|
- Rest is converted to strings.
|
||||||
|
|
||||||
### encode_nbt(expr, force?)
|
### `encode_nbt(expr, force?)`
|
||||||
|
|
||||||
Encodes value of the expression as an NBT tag. By default (or when `force` is false), it will only allow
|
Encodes value of the expression as an NBT tag. By default (or when `force` is false), it will only allow
|
||||||
to encode values that are guaranteed to return the same value when applied the resulting tag to `parse_nbt()`.
|
to encode values that are guaranteed to return the same value when applied the resulting tag to `parse_nbt()`.
|
||||||
@@ -418,11 +418,11 @@ world-localized block, so not `block('stone')`, or a string representing a dimen
|
|||||||
### `view_distance()`
|
### `view_distance()`
|
||||||
Returns the view distance of the server.
|
Returns the view distance of the server.
|
||||||
|
|
||||||
### `mob_counts()`, `mob_counts(category)` 1.16+
|
### `get_mob_counts()`, `get_mob_counts(category)` 1.16+
|
||||||
|
|
||||||
Returns either a map of mob categories with its respective counts and capacities (a.k.a. mobcaps) or just a tuple
|
Returns either a map of mob categories with its respective counts and capacities (a.k.a. mobcaps) or just a tuple
|
||||||
of count and limit for a specific category. If a category was not spawning for whatever reason it may not be
|
of count and limit for a specific category. If a category was not spawning for whatever reason it may not be
|
||||||
returned from `mob_counts()`, but could be retrieved for `mob_counts(category)`. Returned counts is what spawning
|
returned from `get_mob_counts()`, but could be retrieved for `get_mob_counts(category)`. Returned counts is what spawning
|
||||||
algorithm has taken in to account last time mobs spawned.
|
algorithm has taken in to account last time mobs spawned.
|
||||||
|
|
||||||
### `schedule(delay, function, args...)`
|
### `schedule(delay, function, args...)`
|
||||||
|
|||||||
@@ -5,4 +5,6 @@ import net.minecraft.util.math.GravityField;
|
|||||||
public interface SpawnHelperInnerInterface
|
public interface SpawnHelperInnerInterface
|
||||||
{
|
{
|
||||||
GravityField getPotentialCalculator();
|
GravityField getPotentialCalculator();
|
||||||
|
|
||||||
|
int cmGetChunkCount();
|
||||||
}
|
}
|
||||||
@@ -31,12 +31,18 @@ public class SpawnHelperInnerMixin implements SpawnHelperInnerInterface
|
|||||||
cir.setReturnValue(groupToCount.getInt(entityCategory) < i);
|
cir.setReturnValue(groupToCount.getInt(entityCategory) < i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GravityField getPotentialCalculator()
|
public GravityField getPotentialCalculator()
|
||||||
{
|
{
|
||||||
return densityField;
|
return densityField;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int cmGetChunkCount() {
|
||||||
|
return spawningChunkCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package carpet.script.api;
|
package carpet.script.api;
|
||||||
|
|
||||||
|
import carpet.fakes.SpawnHelperInnerInterface;
|
||||||
import carpet.script.CarpetContext;
|
import carpet.script.CarpetContext;
|
||||||
import carpet.script.Expression;
|
import carpet.script.Expression;
|
||||||
import carpet.script.LazyValue;
|
import carpet.script.LazyValue;
|
||||||
@@ -30,7 +31,7 @@ public class Monitoring {
|
|||||||
SpawnHelper.Info info = world.getChunkManager().getSpawnInfo();
|
SpawnHelper.Info info = world.getChunkManager().getSpawnInfo();
|
||||||
if (info == null) return LazyValue.NULL;
|
if (info == null) return LazyValue.NULL;
|
||||||
Object2IntMap<SpawnGroup> mobcounts = info.getGroupToCount();
|
Object2IntMap<SpawnGroup> mobcounts = info.getGroupToCount();
|
||||||
int chunks = info.getSpawningChunkCount();
|
int chunks = ((SpawnHelperInnerInterface)info).cmGetChunkCount();
|
||||||
Value retVal;
|
Value retVal;
|
||||||
if (lv.size() == 0)
|
if (lv.size() == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user