This commit is contained in:
gnembon committed 2021-03-01 23:43:22 -04:00
commit 4c12f0bdb7
9 files changed
+80 -16

No files matched your search

+8
View File
@@ -532,6 +532,14 @@ public class CarpetSettings
)
public static int maxEntityCollisions = 0;
@Rule(
desc = "Customizable server list ping (Multiplayer menu) playerlist sample limit",
options = {"0", "12", "20", "40"},
category = CREATIVE,
strict = false,
validate = Validator.NONNEGATIVE_NUMBER.class
)
public static int pingPlayerListLimit = 12;
/*
@Rule(
@@ -0,0 +1,19 @@
package carpet.mixins;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import carpet.CarpetSettings;
import net.minecraft.server.MinecraftServer;
@Mixin(MinecraftServer.class)
public abstract class MinecraftServer_pingPlayerSampleLimit
{
@ModifyConstant(method = "tick", constant = @Constant(intValue = 12), require = 0, allow = 1)
private int modifyPlayerSampleLimit(int value)
{
return CarpetSettings.pingPlayerListLimit;
}
}
@@ -416,7 +416,7 @@ public class EntityValue extends Value
put("motion_z", (e, a) -> new NumericValue(e.getVelocity().z));
put("on_ground", (e, a) -> new NumericValue(e.isOnGround()));
put("name", (e, a) -> new StringValue(e.getName().getString()));
put("display_name", (e, a) -> new StringValue(e.getDisplayName().getString()));
put("display_name", (e, a) -> new FormattedTextValue(e.getDisplayName()));
put("command_name", (e, a) -> new StringValue(e.getEntityName()));
put("custom_name", (e, a) -> e.hasCustomName()?new StringValue(e.getCustomName().getString()):Value.NULL);
put("type", (e, a) -> new StringValue(nameFromRegistryId(Registry.ENTITY_TYPE.getId(e.getType()))));
@@ -341,7 +341,7 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
int from = normalizeIndex(fromDesc, size);
if (toDesc == null)
return new ListValue((Collection<? extends Value>) getItems().subList(from, size));
int to = normalizeIndex(toDesc, size);
int to = normalizeIndex(toDesc, size+1);
if (from > to)
return ListValue.of();
return new ListValue((Collection<? extends Value>) getItems().subList(from, to));
+1 -1
View File
@@ -186,7 +186,7 @@ public abstract class Value implements Comparable<Value>, Cloneable
int size = value.length();
int from = ListValue.normalizeIndex(fromDesc, size);
if (toDesc == null) return new StringValue(value.substring(from));
int to = ListValue.normalizeIndex(toDesc, size);
int to = ListValue.normalizeIndex(toDesc, size+1);
if (from > to) return StringValue.EMPTY;
return new StringValue(value.substring(from, to));
}