This commit is contained in:
gnembon committed 2025-02-13 22:38:20 +01:00
1 parent 4079ef1419
commit 9be8d5c77b
7 files changed
+30 -26

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check https://fabricmc.net/develop/ # check https://fabricmc.net/develop/
minecraft_version=25w06a minecraft_version=25w07a
loader_version=0.16.10 loader_version=0.16.10
jsr305_version=3.0.2 jsr305_version=3.0.2
fabric_version=0.110.5+1.21.4 fabric_version=0.110.5+1.21.4
@@ -26,6 +26,7 @@ import net.minecraft.server.ServerScoreboard;
import net.minecraft.server.bossevents.CustomBossEvent; import net.minecraft.server.bossevents.CustomBossEvent;
import net.minecraft.server.bossevents.CustomBossEvents; import net.minecraft.server.bossevents.CustomBossEvents;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.BossEvent; import net.minecraft.world.BossEvent;
import net.minecraft.world.scores.DisplaySlot; import net.minecraft.world.scores.DisplaySlot;
import net.minecraft.world.scores.Objective; import net.minecraft.world.scores.Objective;
@@ -579,12 +580,12 @@ public class Scoreboards
BossEvent.BossBarColor color = (bossBar).getColor(); BossEvent.BossBarColor color = (bossBar).getColor();
return color == null ? Value.NULL : StringValue.of(color.getName()); return color == null ? Value.NULL : StringValue.of(color.getName());
} }
BossEvent.BossBarColor color = BossEvent.BossBarColor.byName(propertyValue.getString()); BossEvent.BossBarColor color = ((StringRepresentable.EnumCodec<BossEvent.BossBarColor>)BossEvent.BossBarColor.CODEC).byName(propertyValue.getString());
if (color == null) if (color == null)
{ {
return Value.NULL; return Value.NULL;
} }
bossBar.setColor(BossEvent.BossBarColor.byName(propertyValue.getString())); bossBar.setColor(color);
return Value.TRUE; return Value.TRUE;
} }
case "max" -> { case "max" -> {
@@ -662,7 +663,7 @@ public class Scoreboards
{ {
return StringValue.of(bossBar.getOverlay().getName()); return StringValue.of(bossBar.getOverlay().getName());
} }
BossEvent.BossBarOverlay style = BossEvent.BossBarOverlay.byName(propertyValue.getString()); BossEvent.BossBarOverlay style = ((StringRepresentable.EnumCodec<BossEvent.BossBarOverlay>)BossEvent.BossBarOverlay.CODEC).byName(propertyValue.getString());
if (style == null) if (style == null)
{ {
throw new InternalExpressionException("'" + propertyValue.getString() + "' is not a valid value for property " + property); throw new InternalExpressionException("'" + propertyValue.getString() + "' is not a valid value for property " + property);
@@ -43,6 +43,7 @@ import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.NbtOps;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.DistanceManager; import net.minecraft.server.level.DistanceManager;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@@ -887,7 +888,7 @@ public class WorldAccess
ItemStack tool; ItemStack tool;
if (tag != null) if (tag != null)
{ {
tool = ItemStack.parseOptional(regs, tag); tool = ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), tag).result().orElse(null);
} }
else else
{ {
@@ -955,7 +956,7 @@ public class WorldAccess
{ {
return Value.NULL; return Value.NULL;
} }
return new NBTSerializableValue(() -> tool.saveOptional(regs)); return new NBTSerializableValue(() -> ItemStack.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), tool).getOrThrow());
}); });
@@ -34,11 +34,13 @@ import net.minecraft.nbt.DoubleTag;
import net.minecraft.nbt.FloatTag; import net.minecraft.nbt.FloatTag;
import net.minecraft.nbt.IntTag; import net.minecraft.nbt.IntTag;
import net.minecraft.nbt.ListTag; import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtOps;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.StringTag; import net.minecraft.nbt.StringTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.nbt.NumericTag; import net.minecraft.nbt.NumericTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.resources.RegistryOps;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@@ -724,7 +726,7 @@ public class ShapeDispatcher
} }
else else
{ {
this.item = ItemStack.parseOptional(regs, ((NBTSerializableValue) options.get("item")).getCompoundTag()); this.item = ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), ((NBTSerializableValue) options.get("item")).getCompoundTag() ).result().orElse(null);
} }
blockLight = NumericValue.asNumber(options.getOrDefault("blocklight", optional.get("blocklight"))).getInt(); blockLight = NumericValue.asNumber(options.getOrDefault("blocklight", optional.get("blocklight"))).getInt();
if (blockLight > 15) if (blockLight > 15)
@@ -1661,7 +1663,7 @@ public class ShapeDispatcher
public Value validate(Map<String, Value> options, MinecraftServer server, Value value) public Value validate(Map<String, Value> options, MinecraftServer server, Value value)
{ {
ItemStack item = ValueConversions.getItemStackFromValue(value, true, server.registryAccess()); ItemStack item = ValueConversions.getItemStackFromValue(value, true, server.registryAccess());
return new NBTSerializableValue(item.saveOptional(server.registryAccess())); return new NBTSerializableValue(ItemStack.CODEC.encodeStart(server.registryAccess().createSerializationContext(NbtOps.INSTANCE), item).result().orElse(null));
} }
@Override @Override
@@ -26,8 +26,6 @@ import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font; import net.minecraft.client.gui.Font;
import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.CoreShaders;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
@@ -123,7 +121,7 @@ public class ShapesRenderer
} }
long currentTime = client.level.getGameTime(); long currentTime = client.level.getGameTime();
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
RenderSystem.setShader(CoreShaders.POSITION_COLOR); //RenderSystem.setShader(CoreShaders.POSITION_COLOR);
RenderSystem.depthFunc(515); RenderSystem.depthFunc(515);
RenderSystem.enableBlend(); RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc(); RenderSystem.defaultBlendFunc();
@@ -619,10 +617,11 @@ public class ShapesRenderer
} }
private static void drawWithShader(MeshData mesh) { private static void drawWithShader(MeshData mesh) {
VertexBuffer buffre = mesh.drawState().format().getImmediateDrawVertexBuffer(); RenderType.debugTriangleFan().draw(mesh);
buffre.bind(); //VertexBuffer buffre = mesh.drawState().format().getImmediateDrawVertexBuffer();
buffre.upload(mesh); //buffre.bind();
buffre.drawWithShader(RenderSystem.getModelViewMatrix(), RenderSystem.getProjectionMatrix(), RenderSystem.getShader()); //buffre.upload(mesh);
//buffre.drawWithShader(RenderSystem.getModelViewMatrix(), RenderSystem.getProjectionMatrix(), RenderType. RenderSystem.getShader());
} }
@@ -530,15 +530,16 @@ public class EntityValue extends Value
put("spawn_point", (e, a) -> { put("spawn_point", (e, a) -> {
if (e instanceof ServerPlayer spe) if (e instanceof ServerPlayer spe)
{ {
if (spe.getRespawnPosition() == null) if (spe.getRespawnConfig() == null)
{ {
return Value.FALSE; return Value.FALSE;
} }
ServerPlayer.RespawnConfig spec = spe.getRespawnConfig();
return ListValue.of( return ListValue.of(
ValueConversions.of(spe.getRespawnPosition()), ValueConversions.of(spec.pos()),
ValueConversions.of(spe.getRespawnDimension()), ValueConversions.of(spec.dimension()),
new NumericValue(spe.getRespawnAngle()), new NumericValue(spec.angle()),
BooleanValue.of(spe.isRespawnForced()) BooleanValue.of(spec.forced())
); );
} }
return Value.NULL; return Value.NULL;
@@ -1366,7 +1367,7 @@ public class EntityValue extends Value
} }
if (a == null) if (a == null)
{ {
spe.setRespawnPosition(null, null, 0, false, false); spe.setRespawnPosition(null, false);
} }
else if (a instanceof ListValue lv) else if (a instanceof ListValue lv)
{ {
@@ -1389,7 +1390,7 @@ public class EntityValue extends Value
} }
} }
} }
spe.setRespawnPosition(world, pos, angle, forced, false); spe.setRespawnPosition(new ServerPlayer.RespawnConfig(world, pos, angle, forced), false);
} }
else if (a instanceof BlockValue bv) else if (a instanceof BlockValue bv)
{ {
@@ -1397,11 +1398,11 @@ public class EntityValue extends Value
{ {
throw new InternalExpressionException("block for spawn modification should be localised in the world"); throw new InternalExpressionException("block for spawn modification should be localised in the world");
} }
spe.setRespawnPosition(bv.getWorld().dimension(), bv.getPos(), e.getYRot(), true, false); // yaw spe.setRespawnPosition(new ServerPlayer.RespawnConfig(bv.getWorld().dimension(), bv.getPos(), e.getYRot(), true), false); // yaw
} }
else if (a.isNull()) else if (a.isNull())
{ {
spe.setRespawnPosition(null, null, 0, false, false); spe.setRespawnPosition(null, false);
} }
else else
{ {
@@ -108,7 +108,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
public static Value fromStack(ItemStack stack, RegistryAccess regs) public static Value fromStack(ItemStack stack, RegistryAccess regs)
{ {
NBTSerializableValue value = new NBTSerializableValue(); NBTSerializableValue value = new NBTSerializableValue();
value.nbtSupplier = () -> stack.saveOptional(regs); value.nbtSupplier = () -> ItemStack.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), stack).getOrThrow();
return value; return value;
} }
@@ -346,7 +346,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
public static ItemStack parseItem(String itemString, @Nullable CompoundTag customTag, RegistryAccess regs) public static ItemStack parseItem(String itemString, @Nullable CompoundTag customTag, RegistryAccess regs)
{ {
if (customTag != null) { if (customTag != null) {
return ItemStack.parseOptional(regs, customTag); return ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), customTag).resultOrPartial().orElse(null);
} }
try try
{ {