24w09a
This commit is contained in:
1 parent
2dd8674ea6
commit
4e57eecf2d
37 files changed
+534
-481
No files matched your search
@@ -144,7 +144,7 @@ public class ShapeDispatcher
|
||||
return new ShapeWithConfig(ShapeDispatcher.create(server, shapeType, params), params);
|
||||
}
|
||||
|
||||
public static void sendShape(Collection<ServerPlayer> players, List<ShapeWithConfig> shapes)
|
||||
public static void sendShape(Collection<ServerPlayer> players, List<ShapeWithConfig> shapes, RegistryAccess regs)
|
||||
{
|
||||
List<ServerPlayer> clientPlayers = new ArrayList<>();
|
||||
List<ServerPlayer> alternativePlayers = new ArrayList<>();
|
||||
@@ -158,7 +158,7 @@ public class ShapeDispatcher
|
||||
int tagcount = 0;
|
||||
for (ShapeWithConfig s : shapes)
|
||||
{
|
||||
tag.add(ExpiringShape.toTag(s.config())); // 4000 shapes limit boxes
|
||||
tag.add(ExpiringShape.toTag(s.config(), regs)); // 4000 shapes limit boxes
|
||||
if (tagcount++ > 1000)
|
||||
{
|
||||
tagcount = 0;
|
||||
@@ -312,11 +312,11 @@ public class ShapeDispatcher
|
||||
{
|
||||
}
|
||||
|
||||
public static CompoundTag toTag(Map<String, Value> params)
|
||||
public static CompoundTag toTag(Map<String, Value> params, RegistryAccess regs)
|
||||
{
|
||||
CompoundTag tag = new CompoundTag();
|
||||
params.forEach((k, v) -> {
|
||||
Tag valTag = Param.of.get(k).toTag(v);
|
||||
Tag valTag = Param.of.get(k).toTag(v, regs);
|
||||
if (valTag != null)
|
||||
{
|
||||
tag.put(k, valTag);
|
||||
@@ -724,7 +724,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
else
|
||||
{
|
||||
this.item = ItemStack.of(((NBTSerializableValue) options.get("item")).getCompoundTag());
|
||||
this.item = ItemStack.parseOptional(regs, ((NBTSerializableValue) options.get("item")).getCompoundTag());
|
||||
}
|
||||
blockLight = NumericValue.asNumber(options.getOrDefault("blocklight", optional.get("blocklight"))).getInt();
|
||||
if (blockLight > 15)
|
||||
@@ -1532,7 +1532,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public abstract Tag toTag(Value value); //validates value, returning null if not necessary to keep it and serialize
|
||||
public abstract Tag toTag(Value value, final RegistryAccess regs); //validates value, returning null if not necessary to keep it and serialize
|
||||
|
||||
public abstract Value validate(Map<String, Value> options, MinecraftServer server, Value value); // makes sure the value is proper
|
||||
|
||||
@@ -1547,9 +1547,9 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
return value.toTag(true);
|
||||
return value.toTag(true, regs);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1589,7 +1589,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
return StringTag.valueOf(value.getString());
|
||||
}
|
||||
@@ -1621,7 +1621,7 @@ public class ShapeDispatcher
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
if (value instanceof final BlockValue blv)
|
||||
{
|
||||
@@ -1661,11 +1661,11 @@ public class ShapeDispatcher
|
||||
public Value validate(Map<String, Value> options, MinecraftServer server, Value value)
|
||||
{
|
||||
ItemStack item = ValueConversions.getItemStackFromValue(value, true, server.registryAccess());
|
||||
return new NBTSerializableValue(item.save(new CompoundTag()));
|
||||
return new NBTSerializableValue(item.save(server.registryAccess()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
return ((NBTSerializableValue) value).getTag();
|
||||
}
|
||||
@@ -1710,19 +1710,19 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
if (!(value instanceof FormattedTextValue))
|
||||
{
|
||||
value = new FormattedTextValue(Component.literal(value.getString()));
|
||||
}
|
||||
return StringTag.valueOf(((FormattedTextValue) value).serialize());
|
||||
return StringTag.valueOf(((FormattedTextValue) value).serialize(regs));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Value decode(Tag tag, Level level)
|
||||
{
|
||||
return FormattedTextValue.deserialize(tag.getAsString());
|
||||
return FormattedTextValue.deserialize(tag.getAsString(), level.registryAccess());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1808,7 +1808,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
return ByteTag.valueOf(value.getBoolean());
|
||||
}
|
||||
@@ -1834,7 +1834,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
return FloatTag.valueOf(NumericValue.asNumber(value, id).getFloat());
|
||||
}
|
||||
@@ -1873,7 +1873,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
return FloatTag.valueOf(NumericValue.asNumber(value, id).getFloat());
|
||||
}
|
||||
@@ -1894,7 +1894,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
return IntTag.valueOf(NumericValue.asNumber(value, id).getInt());
|
||||
}
|
||||
@@ -1915,7 +1915,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
return IntTag.valueOf(NumericValue.asNumber(value, id).getInt());
|
||||
}
|
||||
@@ -1946,7 +1946,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
return FloatTag.valueOf(NumericValue.asNumber(value, id).getFloat());
|
||||
}
|
||||
@@ -2041,7 +2041,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
List<Value> lv = ((ListValue) value).getItems();
|
||||
ListTag tag = new ListTag();
|
||||
@@ -2092,7 +2092,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value pointsValue)
|
||||
public Tag toTag(Value pointsValue, final RegistryAccess regs)
|
||||
{
|
||||
List<Value> lv = ((ListValue) pointsValue).getItems();
|
||||
ListTag ltag = new ListTag();
|
||||
@@ -2124,7 +2124,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
return IntTag.valueOf(NumericValue.asNumber(value, id).getInt());
|
||||
}
|
||||
@@ -2139,7 +2139,7 @@ public class ShapeDispatcher
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag toTag(Value value)
|
||||
public Tag toTag(Value value, final RegistryAccess regs)
|
||||
{
|
||||
return IntTag.valueOf(NumericValue.asNumber(value, id).getInt());
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ import net.minecraft.world.level.biome.BiomeManager;
|
||||
import net.minecraft.world.level.biome.MultiNoiseBiomeSource;
|
||||
import net.minecraft.world.level.border.BorderChangeListener;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.storage.RegionFile;
|
||||
import net.minecraft.world.level.chunk.storage.RegionStorageInfo;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
|
||||
Reference in new issue
Block a user