removed ability to query for entire system_info in one go.

This commit is contained in:
gnembon committed 2022-02-16 00:25:35 +01:00
1 parent bf00051482
commit aaea11d82d
5 files changed
+6 -16

No files matched your search

+2 -1
View File
@@ -683,7 +683,8 @@ it could either mean your input is wrong, or statistic effectively has a value o
### `system_info()`, `system_info(property)`
Fetches the value of a system property or returns all inforation as a map when called without any arguments. It can be used to
Fetches the value of one of the following system properties. If called without arguments, it returns a list of
available system_info options. It can be used to
fetch various information, mostly not changing, or only available via low level
system calls. In all circumstances, these are only provided as read-only.
@@ -5,6 +5,4 @@ import net.minecraft.world.level.PotentialCalculator;
public interface SpawnHelperInnerInterface
{
PotentialCalculator getPotentialCalculator();
int cmGetChunkCount();
}
@@ -10,8 +10,6 @@ import org.spongepowered.asm.mixin.Shadow;
@Mixin(NaturalSpawner.SpawnState.class)
public class SpawnState_scarpetMixin implements SpawnHelperInnerInterface
{
@Shadow @Final private int spawnableChunkCount;
@Shadow @Final private PotentialCalculator spawnPotential;
@Override
@@ -19,11 +17,4 @@ public class SpawnState_scarpetMixin implements SpawnHelperInnerInterface
{
return spawnPotential;
}
@Override
public int cmGetChunkCount() {
return spawnableChunkCount;
}
}
@@ -27,7 +27,7 @@ public class Monitoring {
{
if (lv.size() == 0)
{
return SystemInfo.getAll((CarpetContext) c);
return SystemInfo.getAll();
}
if (lv.size() == 1) {
String what = lv.get(0).getString();
@@ -45,7 +45,7 @@ public class Monitoring {
NaturalSpawner.SpawnState info = world.getChunkSource().getLastSpawnState();
if (info == null) return Value.NULL;
Object2IntMap<MobCategory> mobcounts = info.getMobCategoryCounts();
int chunks = ((SpawnHelperInnerInterface)info).cmGetChunkCount();
int chunks = info.getSpawnableChunkCount();
if (lv.size() == 0)
{
Map<Value, Value> retDict = new HashMap<>();
@@ -215,9 +215,9 @@ public class SystemInfo {
{
return options.getOrDefault(what, c -> null).apply(cc);
}
public static Value getAll(CarpetContext cc)
public static Value getAll()
{
return MapValue.wrap(options.entrySet().stream().collect(Collectors.toMap(e -> new StringValue(e.getKey()), e -> e.getValue().apply(cc))));
return ListValue.wrap(options.keySet().stream().map(StringValue::of).collect(Collectors.toList()));
}
}