25w09a, broken shapes
This commit is contained in:
1 parent
1928b4f866
commit
9a62566b2a
9 files changed
+81
-80
No files matched your search
+1
-1
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check https://fabricmc.net/develop/
|
# check https://fabricmc.net/develop/
|
||||||
minecraft_version=25w08a
|
minecraft_version=25w09a
|
||||||
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
|
||||||
|
|||||||
@@ -136,12 +136,12 @@ public abstract class PistonMovingBlockEntity_movableBEMixin extends BlockEntity
|
|||||||
@Inject(method = "loadAdditional", at = @At(value = "TAIL"))
|
@Inject(method = "loadAdditional", at = @At(value = "TAIL"))
|
||||||
private void onFromTag(CompoundTag NbtCompound_1, HolderLookup.Provider registries, CallbackInfo ci)
|
private void onFromTag(CompoundTag NbtCompound_1, HolderLookup.Provider registries, CallbackInfo ci)
|
||||||
{
|
{
|
||||||
if (CarpetSettings.movableBlockEntities && NbtCompound_1.contains("carriedTileEntityCM", 10))
|
if (CarpetSettings.movableBlockEntities && NbtCompound_1.contains("carriedTileEntityCM"))
|
||||||
{
|
{
|
||||||
if (this.movedState.getBlock() instanceof EntityBlock)
|
if (this.movedState.getBlock() instanceof EntityBlock)
|
||||||
this.carriedBlockEntity = ((EntityBlock) (this.movedState.getBlock())).newBlockEntity(worldPosition, movedState);// this.world);
|
this.carriedBlockEntity = ((EntityBlock) (this.movedState.getBlock())).newBlockEntity(worldPosition, movedState);// this.world);
|
||||||
if (carriedBlockEntity != null) //Can actually be null, as BlockPistonMoving.createNewTileEntity(...) returns null
|
if (carriedBlockEntity != null) //Can actually be null, as BlockPistonMoving.createNewTileEntity(...) returns null
|
||||||
this.carriedBlockEntity.loadWithComponents(NbtCompound_1.getCompound("carriedTileEntityCM"), registries);
|
this.carriedBlockEntity.loadWithComponents(NbtCompound_1.getCompound("carriedTileEntityCM").orElseThrow(), registries);
|
||||||
setCarriedBlockEntity(carriedBlockEntity);
|
setCarriedBlockEntity(carriedBlockEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public class CarpetClient
|
|||||||
ListTag outputTag = (ListTag) tag.get("output");
|
ListTag outputTag = (ListTag) tag.get("output");
|
||||||
for (int i = 0; i < outputTag.size(); i++)
|
for (int i = 0; i < outputTag.size(); i++)
|
||||||
{
|
{
|
||||||
CarpetSettings.LOG.info(" - response: " + Component.Serializer.fromJson(outputTag.getString(i), clientPlayer.registryAccess()).getString());
|
CarpetSettings.LOG.info(" - response: " + Component.Serializer.fromJson(outputTag.getString(i).orElseThrow(), clientPlayer.registryAccess()).getString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,18 +23,18 @@ public class ClientNetworkHandler
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
dataHandlers.put(CarpetClient.HI, (p, t) -> onHi(t.getAsString()));
|
dataHandlers.put(CarpetClient.HI, (p, t) -> onHi(t.asString().orElseThrow()));
|
||||||
dataHandlers.put("Rules", (p, t) -> {
|
dataHandlers.put("Rules", (p, t) -> {
|
||||||
CompoundTag ruleset = (CompoundTag) t;
|
CompoundTag ruleset = (CompoundTag) t;
|
||||||
for (String ruleKey : ruleset.getAllKeys())
|
for (String ruleKey : ruleset.keySet())
|
||||||
{
|
{
|
||||||
CompoundTag ruleNBT = (CompoundTag) ruleset.get(ruleKey);
|
CompoundTag ruleNBT = (CompoundTag) ruleset.get(ruleKey);
|
||||||
SettingsManager manager = null;
|
SettingsManager manager = null;
|
||||||
String ruleName;
|
String ruleName;
|
||||||
if (ruleNBT.contains("Manager"))
|
if (ruleNBT.contains("Manager"))
|
||||||
{
|
{
|
||||||
ruleName = ruleNBT.getString("Rule");
|
ruleName = ruleNBT.getString("Rule").orElseThrow();
|
||||||
String managerName = ruleNBT.getString("Manager");
|
String managerName = ruleNBT.getString("Manager").orElseThrow();
|
||||||
if (managerName.equals("carpet"))
|
if (managerName.equals("carpet"))
|
||||||
{
|
{
|
||||||
manager = CarpetServer.settingsManager;
|
manager = CarpetServer.settingsManager;
|
||||||
@@ -60,7 +60,7 @@ public class ClientNetworkHandler
|
|||||||
CarpetRule<?> rule = (manager != null) ? manager.getCarpetRule(ruleName) : null;
|
CarpetRule<?> rule = (manager != null) ? manager.getCarpetRule(ruleName) : null;
|
||||||
if (rule != null)
|
if (rule != null)
|
||||||
{
|
{
|
||||||
String value = ruleNBT.getString("Value");
|
String value = ruleNBT.getString("Value").orElseThrow();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
rule.set(null, value);
|
rule.set(null, value);
|
||||||
@@ -116,7 +116,7 @@ public class ClientNetworkHandler
|
|||||||
|
|
||||||
public static void onServerData(CompoundTag compound, LocalPlayer player)
|
public static void onServerData(CompoundTag compound, LocalPlayer player)
|
||||||
{
|
{
|
||||||
for (String key : compound.getAllKeys())
|
for (String key : compound.keySet())
|
||||||
{
|
{
|
||||||
if (dataHandlers.containsKey(key))
|
if (dataHandlers.containsKey(key))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class ServerNetworkHandler
|
|||||||
private static final Set<ServerPlayer> validCarpetPlayers = new HashSet<>();
|
private static final Set<ServerPlayer> validCarpetPlayers = new HashSet<>();
|
||||||
|
|
||||||
private static final Map<String, BiConsumer<ServerPlayer, Tag>> dataHandlers = Map.of(
|
private static final Map<String, BiConsumer<ServerPlayer, Tag>> dataHandlers = Map.of(
|
||||||
CarpetClient.HELLO, (p, t) -> onHello(p, t.getAsString()),
|
CarpetClient.HELLO, (p, t) -> onHello(p, t.asString().orElseThrow()),
|
||||||
"clientCommand", (p, t) -> handleClientCommand(p, (CompoundTag) t)
|
"clientCommand", (p, t) -> handleClientCommand(p, (CompoundTag) t)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -79,8 +79,8 @@ public class ServerNetworkHandler
|
|||||||
|
|
||||||
private static void handleClientCommand(ServerPlayer player, CompoundTag commandData)
|
private static void handleClientCommand(ServerPlayer player, CompoundTag commandData)
|
||||||
{
|
{
|
||||||
String command = commandData.getString("command");
|
String command = commandData.getString("command").orElseThrow();
|
||||||
String id = commandData.getString("id");
|
String id = commandData.getString("id").orElseThrow();
|
||||||
List<Component> output = new ArrayList<>();
|
List<Component> output = new ArrayList<>();
|
||||||
Component[] error = {null};
|
Component[] error = {null};
|
||||||
int[] returnValue = {0};
|
int[] returnValue = {0};
|
||||||
@@ -116,7 +116,7 @@ public class ServerNetworkHandler
|
|||||||
|
|
||||||
public static void onClientData(ServerPlayer player, CompoundTag compound)
|
public static void onClientData(ServerPlayer player, CompoundTag compound)
|
||||||
{
|
{
|
||||||
for (String key : compound.getAllKeys())
|
for (String key : compound.keySet())
|
||||||
{
|
{
|
||||||
if (dataHandlers.containsKey(key))
|
if (dataHandlers.containsKey(key))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ public class ShapeDispatcher
|
|||||||
public static ExpiringShape fromTag(CompoundTag tag, Level level)
|
public static ExpiringShape fromTag(CompoundTag tag, Level level)
|
||||||
{
|
{
|
||||||
Map<String, Value> options = new HashMap<>();
|
Map<String, Value> options = new HashMap<>();
|
||||||
for (String key : tag.getAllKeys())
|
for (String key : tag.keySet())
|
||||||
{
|
{
|
||||||
Param decoder = Param.of.get(key);
|
Param decoder = Param.of.get(key);
|
||||||
if (decoder == null)
|
if (decoder == null)
|
||||||
@@ -252,7 +252,7 @@ public class ShapeDispatcher
|
|||||||
Value shapeValue = options.get("shape");
|
Value shapeValue = options.get("shape");
|
||||||
if (shapeValue == null)
|
if (shapeValue == null)
|
||||||
{
|
{
|
||||||
CarpetScriptServer.LOG.info("Shape id missing in " + String.join(", ", tag.getAllKeys()));
|
CarpetScriptServer.LOG.info("Shape id missing in " + String.join(", ", tag.keySet()));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BiFunction<Map<String, Value>, RegistryAccess, ExpiringShape> factory = ExpiringShape.shapeProviders.get(shapeValue.getString());
|
BiFunction<Map<String, Value>, RegistryAccess, ExpiringShape> factory = ExpiringShape.shapeProviders.get(shapeValue.getString());
|
||||||
@@ -1559,11 +1559,11 @@ public class ShapeDispatcher
|
|||||||
{
|
{
|
||||||
if (tag instanceof final ListTag list)
|
if (tag instanceof final ListTag list)
|
||||||
{
|
{
|
||||||
return ListValue.wrap(list.stream().map(x -> BooleanValue.of(((NumericTag) x).getAsNumber().doubleValue() != 0)));
|
return ListValue.wrap(list.stream().map(x -> BooleanValue.of(((NumericTag) x).doubleValue() != 0)));
|
||||||
}
|
}
|
||||||
if (tag instanceof final ByteTag booltag)
|
if (tag instanceof final ByteTag booltag)
|
||||||
{
|
{
|
||||||
return BooleanValue.of(booltag.getAsByte() != 0);
|
return BooleanValue.of(booltag.byteValue() != 0);
|
||||||
}
|
}
|
||||||
return Value.NULL;
|
return Value.NULL;
|
||||||
}
|
}
|
||||||
@@ -1599,7 +1599,7 @@ public class ShapeDispatcher
|
|||||||
@Override
|
@Override
|
||||||
public Value decode(Tag tag, Level level)
|
public Value decode(Tag tag, Level level)
|
||||||
{
|
{
|
||||||
return new StringValue(tag.getAsString());
|
return new StringValue(tag.asString().get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1643,9 +1643,9 @@ public class ShapeDispatcher
|
|||||||
{
|
{
|
||||||
BlockState bs = NbtUtils.readBlockState(level.holderLookup(Registries.BLOCK), (CompoundTag) tag);
|
BlockState bs = NbtUtils.readBlockState(level.holderLookup(Registries.BLOCK), (CompoundTag) tag);
|
||||||
CompoundTag compoundTag2 = null;
|
CompoundTag compoundTag2 = null;
|
||||||
if (((CompoundTag) tag).contains("TileEntityData", 10))
|
if (((CompoundTag) tag).contains("TileEntityData"))
|
||||||
{
|
{
|
||||||
compoundTag2 = ((CompoundTag) tag).getCompound("TileEntityData");
|
compoundTag2 = ((CompoundTag) tag).getCompound("TileEntityData").get();
|
||||||
}
|
}
|
||||||
return new BlockValue(bs, compoundTag2);
|
return new BlockValue(bs, compoundTag2);
|
||||||
}
|
}
|
||||||
@@ -1724,7 +1724,7 @@ public class ShapeDispatcher
|
|||||||
@Override
|
@Override
|
||||||
public Value decode(Tag tag, Level level)
|
public Value decode(Tag tag, Level level)
|
||||||
{
|
{
|
||||||
return FormattedTextValue.deserialize(tag.getAsString(), level.registryAccess());
|
return FormattedTextValue.deserialize(tag.asString().get(), level.registryAccess());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1818,7 +1818,7 @@ public class ShapeDispatcher
|
|||||||
@Override
|
@Override
|
||||||
public Value decode(Tag tag, Level level)
|
public Value decode(Tag tag, Level level)
|
||||||
{
|
{
|
||||||
return BooleanValue.of(((ByteTag) tag).getAsByte() > 0);
|
return BooleanValue.of(((ByteTag) tag).byteValue() > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1832,7 +1832,7 @@ public class ShapeDispatcher
|
|||||||
@Override
|
@Override
|
||||||
public Value decode(Tag tag, Level level)
|
public Value decode(Tag tag, Level level)
|
||||||
{
|
{
|
||||||
return new NumericValue(((FloatTag) tag).getAsFloat());
|
return new NumericValue(((FloatTag) tag).floatValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1871,7 +1871,7 @@ public class ShapeDispatcher
|
|||||||
@Override
|
@Override
|
||||||
public Value decode(Tag tag, Level level)
|
public Value decode(Tag tag, Level level)
|
||||||
{
|
{
|
||||||
return new NumericValue(((FloatTag) tag).getAsFloat());
|
return new NumericValue(((FloatTag) tag).floatValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1892,7 +1892,7 @@ public class ShapeDispatcher
|
|||||||
@Override
|
@Override
|
||||||
public Value decode(Tag tag, Level level)
|
public Value decode(Tag tag, Level level)
|
||||||
{
|
{
|
||||||
return new NumericValue(((IntTag) tag).getAsInt());
|
return new NumericValue(((IntTag) tag).intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1913,7 +1913,7 @@ public class ShapeDispatcher
|
|||||||
@Override
|
@Override
|
||||||
public Value decode(Tag tag, Level level)
|
public Value decode(Tag tag, Level level)
|
||||||
{
|
{
|
||||||
return new NumericValue(((IntTag) tag).getAsInt());
|
return new NumericValue(((IntTag) tag).intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1944,7 +1944,7 @@ public class ShapeDispatcher
|
|||||||
@Override
|
@Override
|
||||||
public Value decode(Tag tag, Level level)
|
public Value decode(Tag tag, Level level)
|
||||||
{
|
{
|
||||||
return new NumericValue(((FloatTag) tag).getAsFloat());
|
return new NumericValue(((FloatTag) tag).floatValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2036,9 +2036,9 @@ public class ShapeDispatcher
|
|||||||
{
|
{
|
||||||
ListTag ctag = (ListTag) tag;
|
ListTag ctag = (ListTag) tag;
|
||||||
return ListValue.of(
|
return ListValue.of(
|
||||||
new NumericValue(ctag.getDouble(0)),
|
new NumericValue(ctag.getDouble(0).orElseThrow()),
|
||||||
new NumericValue(ctag.getDouble(1)),
|
new NumericValue(ctag.getDouble(1).orElseThrow()),
|
||||||
new NumericValue(ctag.getDouble(2))
|
new NumericValue(ctag.getDouble(2).orElseThrow())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2083,11 +2083,11 @@ public class ShapeDispatcher
|
|||||||
List<Value> points = new ArrayList<>();
|
List<Value> points = new ArrayList<>();
|
||||||
for (int i = 0, ll = ltag.size(); i < ll; i++)
|
for (int i = 0, ll = ltag.size(); i < ll; i++)
|
||||||
{
|
{
|
||||||
ListTag ptag = ltag.getList(i);
|
ListTag ptag = ltag.getList(i).orElseThrow();
|
||||||
points.add(ListValue.of(
|
points.add(ListValue.of(
|
||||||
new NumericValue(ptag.getDouble(0)),
|
new NumericValue(ptag.getDouble(0).orElseThrow()),
|
||||||
new NumericValue(ptag.getDouble(1)),
|
new NumericValue(ptag.getDouble(1).orElseThrow()),
|
||||||
new NumericValue(ptag.getDouble(2))
|
new NumericValue(ptag.getDouble(2).orElseThrow())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return ListValue.wrap(points);
|
return ListValue.wrap(points);
|
||||||
@@ -2122,7 +2122,7 @@ public class ShapeDispatcher
|
|||||||
@Override
|
@Override
|
||||||
public Value decode(Tag tag, Level level)
|
public Value decode(Tag tag, Level level)
|
||||||
{
|
{
|
||||||
return new NumericValue(((IntTag) tag).getAsInt());
|
return new NumericValue(((IntTag) tag).intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2164,7 +2164,7 @@ public class ShapeDispatcher
|
|||||||
@Override
|
@Override
|
||||||
public Value decode(Tag tag, Level level)
|
public Value decode(Tag tag, Level level)
|
||||||
{
|
{
|
||||||
return new NumericValue(((IntTag) tag).getAsInt());
|
return new NumericValue(((IntTag) tag).intValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
|||||||
import com.mojang.blaze3d.vertex.MeshData;
|
import com.mojang.blaze3d.vertex.MeshData;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.Tesselator;
|
import com.mojang.blaze3d.vertex.Tesselator;
|
||||||
import com.mojang.blaze3d.vertex.VertexBuffer;
|
//import com.mojang.blaze3d.vertex.VertexBuffer;
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat.Mode;
|
import com.mojang.blaze3d.vertex.VertexFormat.Mode;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
@@ -120,18 +120,18 @@ public class ShapesRenderer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
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();
|
||||||
// too bright
|
// too bright
|
||||||
//RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO);
|
//RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO);
|
||||||
// meh
|
// meh
|
||||||
//RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
//RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
RenderSystem.disableCull();
|
////RenderSystem.disableCull();
|
||||||
RenderSystem.depthMask(false);
|
////RenderSystem.depthMask(false);
|
||||||
//RenderSystem.polygonOffset(-3f, -3f);
|
//RenderSystem.polygonOffset(-3f, -3f);
|
||||||
//RenderSystem.enablePolygonOffset();
|
//RenderSystem.enablePolygonOffset();
|
||||||
|
|
||||||
@@ -184,10 +184,10 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
RenderSystem.enableCull();
|
////RenderSystem.enableCull();
|
||||||
RenderSystem.depthMask(true);
|
////RenderSystem.depthMask(true);
|
||||||
RenderSystem.enableBlend();
|
////RenderSystem.enableBlend();
|
||||||
RenderSystem.defaultBlendFunc();
|
////RenderSystem.defaultBlendFunc();
|
||||||
token.run();
|
token.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ public class ShapesRenderer
|
|||||||
Runnable token = Carpet.startProfilerSection("Scarpet client");
|
Runnable token = Carpet.startProfilerSection("Scarpet client");
|
||||||
for (int i = 0, count = tag.size(); i < count; i++)
|
for (int i = 0, count = tag.size(); i < count; i++)
|
||||||
{
|
{
|
||||||
addShape(tag.getCompound(i));
|
addShape(tag.getCompound(i).orElseThrow());
|
||||||
}
|
}
|
||||||
token.run();
|
token.run();
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ public class ShapesRenderer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BiFunction<Minecraft, ShapeDispatcher.ExpiringShape, RenderedShape<? extends ShapeDispatcher.ExpiringShape>> shapeFactory;
|
BiFunction<Minecraft, ShapeDispatcher.ExpiringShape, RenderedShape<? extends ShapeDispatcher.ExpiringShape>> shapeFactory;
|
||||||
shapeFactory = renderedShapes.get(tag.getString("shape"));
|
shapeFactory = renderedShapes.get(tag.getString("shape").orElseThrow());
|
||||||
if (shapeFactory == null)
|
if (shapeFactory == null)
|
||||||
{
|
{
|
||||||
CarpetScriptServer.LOG.info("Unrecognized shape: " + tag.getString("shape"));
|
CarpetScriptServer.LOG.info("Unrecognized shape: " + tag.getString("shape"));
|
||||||
@@ -373,9 +373,9 @@ public class ShapesRenderer
|
|||||||
matrices.mulPose(Axis.YP.rotationDegrees(180));
|
matrices.mulPose(Axis.YP.rotationDegrees(180));
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.depthMask(true);
|
////RenderSystem.depthMask(true);
|
||||||
RenderSystem.enableCull();
|
////RenderSystem.enableCull();
|
||||||
RenderSystem.enableDepthTest();
|
////RenderSystem.enableDepthTest();
|
||||||
|
|
||||||
blockPos = BlockPos.containing(v1);
|
blockPos = BlockPos.containing(v1);
|
||||||
int light = 0;
|
int light = 0;
|
||||||
@@ -409,7 +409,7 @@ public class ShapesRenderer
|
|||||||
} else {
|
} else {
|
||||||
type = ItemBlockRenderTypes.getRenderType(blockState);
|
type = ItemBlockRenderTypes.getRenderType(blockState);
|
||||||
}
|
}
|
||||||
client.getBlockRenderer().getModelRenderer().renderModel(matrices.last(), immediate.getBuffer(type), blockState, bakedModel, red, green, blue, light, OverlayTexture.NO_OVERLAY);
|
client.getBlockRenderer().getModelRenderer().renderModel(matrices.last(), immediate.getBuffer(type), bakedModel, red, green, blue, light, OverlayTexture.NO_OVERLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the block`s entity part
|
// draw the block`s entity part
|
||||||
@@ -450,9 +450,9 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
matrices.popPose();
|
matrices.popPose();
|
||||||
immediate.endBatch();
|
immediate.endBatch();
|
||||||
RenderSystem.disableCull();
|
////RenderSystem.disableCull();
|
||||||
RenderSystem.disableDepthTest();
|
////RenderSystem.disableDepthTest();
|
||||||
RenderSystem.depthMask(false);
|
////RenderSystem.depthMask(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,11 +484,11 @@ public class ShapesRenderer
|
|||||||
Font textRenderer = client.font;
|
Font textRenderer = client.font;
|
||||||
if (shape.doublesided)
|
if (shape.doublesided)
|
||||||
{
|
{
|
||||||
RenderSystem.disableCull();
|
//// RenderSystem.disableCull(); TODO culling
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RenderSystem.enableCull();
|
//// RenderSystem.enableCull();
|
||||||
}
|
}
|
||||||
matrices.pushPose();
|
matrices.pushPose();
|
||||||
matrices.translate(v1.x - cx, v1.y - cy, v1.z - cz);
|
matrices.translate(v1.x - cx, v1.y - cy, v1.z - cz);
|
||||||
@@ -527,7 +527,7 @@ public class ShapesRenderer
|
|||||||
textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.NORMAL, shape.textbck, 15728880);
|
textRenderer.drawInBatch(shape.value, text_x, 0.0F, shape.textcolor, false, matrices.last().pose(), immediate, Font.DisplayMode.NORMAL, shape.textbck, 15728880);
|
||||||
immediate.endBatch();
|
immediate.endBatch();
|
||||||
matrices.popPose();
|
matrices.popPose();
|
||||||
RenderSystem.enableCull();
|
////RenderSystem.enableCull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -617,7 +617,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void drawWithShader(MeshData mesh) {
|
private static void drawWithShader(MeshData mesh) {
|
||||||
RenderType.debugTriangleFan().draw(mesh);
|
RenderType.debugLineStrip(1.0).draw(mesh);
|
||||||
//VertexBuffer buffre = mesh.drawState().format().getImmediateDrawVertexBuffer();
|
//VertexBuffer buffre = mesh.drawState().format().getImmediateDrawVertexBuffer();
|
||||||
//buffre.bind();
|
//buffre.bind();
|
||||||
//buffre.upload(mesh);
|
//buffre.upload(mesh);
|
||||||
@@ -645,11 +645,11 @@ public class ShapesRenderer
|
|||||||
|
|
||||||
if (shape.doublesided)
|
if (shape.doublesided)
|
||||||
{
|
{
|
||||||
RenderSystem.disableCull();
|
////RenderSystem.disableCull(); // todo culling
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RenderSystem.enableCull();
|
////RenderSystem.enableCull();
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferBuilder builder = tesselator.begin(faceIndices[shape.mode], DefaultVertexFormat.POSITION_COLOR);
|
BufferBuilder builder = tesselator.begin(faceIndices[shape.mode], DefaultVertexFormat.POSITION_COLOR);
|
||||||
@@ -664,8 +664,8 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
drawWithShader(builder.buildOrThrow());
|
drawWithShader(builder.buildOrThrow());
|
||||||
|
|
||||||
RenderSystem.disableCull();
|
////RenderSystem.disableCull();
|
||||||
RenderSystem.depthMask(false);
|
////RenderSystem.depthMask(false);
|
||||||
//RenderSystem.enableDepthTest();
|
//RenderSystem.enableDepthTest();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -587,13 +587,13 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
|
|||||||
{
|
{
|
||||||
throw new NBTSerializableValue.IncompatibleTypeException(this);
|
throw new NBTSerializableValue.IncompatibleTypeException(this);
|
||||||
}
|
}
|
||||||
tags.forEach(t -> tag.add(StringTag.valueOf(t.getAsString())));
|
tags.forEach(t -> tag.add(StringTag.valueOf(t.asString().orElseThrow())));
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
// only numbers / mixed types
|
// only numbers / mixed types
|
||||||
tags.forEach(cases.contains(TagTypeCompat.DBL)
|
tags.forEach(cases.contains(TagTypeCompat.DBL)
|
||||||
? (t -> tag.add(DoubleTag.valueOf(((NumericTag) t).getAsDouble())))
|
? (t -> tag.add(DoubleTag.valueOf(((NumericTag) t).doubleValue())))
|
||||||
: (t -> tag.add(LongTag.valueOf(((NumericTag) t).getAsLong()))));
|
: (t -> tag.add(LongTag.valueOf(((NumericTag) t).longValue()))));
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
|||||||
private Tag nbtTag = null;
|
private Tag nbtTag = null;
|
||||||
private Supplier<Tag> nbtSupplier = null;
|
private Supplier<Tag> nbtSupplier = null;
|
||||||
private boolean owned = false;
|
private boolean owned = false;
|
||||||
|
private static TagParser<Tag> tagParser = TagParser.create(NbtOps.INSTANCE);
|
||||||
|
|
||||||
private NBTSerializableValue()
|
private NBTSerializableValue()
|
||||||
{
|
{
|
||||||
@@ -75,7 +76,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return TagParser.parseAsArgument(NbtOps.INSTANCE, new StringReader(nbtString));
|
return tagParser.parseAsArgument( new StringReader(nbtString));
|
||||||
}
|
}
|
||||||
catch (CommandSyntaxException e)
|
catch (CommandSyntaxException e)
|
||||||
{
|
{
|
||||||
@@ -128,7 +129,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Tag tag = TagParser.parseAsArgument(NbtOps.INSTANCE, new StringReader(nbtString));
|
Tag tag = tagParser.parseAsArgument(new StringReader(nbtString));
|
||||||
NBTSerializableValue value = new NBTSerializableValue(tag);
|
NBTSerializableValue value = new NBTSerializableValue(tag);
|
||||||
value.nbtString = null;
|
value.nbtString = null;
|
||||||
return value;
|
return value;
|
||||||
@@ -386,11 +387,11 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
|||||||
if (t instanceof final NumericTag number)
|
if (t instanceof final NumericTag number)
|
||||||
{
|
{
|
||||||
// short and byte will never exceed float's precision, even int won't
|
// short and byte will never exceed float's precision, even int won't
|
||||||
return t instanceof LongTag || t instanceof IntTag ? NumericValue.of(number.getAsLong()) : NumericValue.of(number.getAsNumber());
|
return t instanceof LongTag || t instanceof IntTag ? NumericValue.of(number.longValue()) : NumericValue.of(number.asNumber().orElseThrow());
|
||||||
}
|
}
|
||||||
if (t instanceof StringTag)
|
if (t instanceof StringTag stringTag)
|
||||||
{
|
{
|
||||||
return StringValue.of(t.getAsString());
|
return StringValue.of(stringTag.value());
|
||||||
}
|
}
|
||||||
if (t instanceof EndTag)
|
if (t instanceof EndTag)
|
||||||
{
|
{
|
||||||
@@ -409,13 +410,13 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
|||||||
if (t instanceof final CompoundTag ctag)
|
if (t instanceof final CompoundTag ctag)
|
||||||
{
|
{
|
||||||
Map<Value, Value> pairs = new HashMap<>();
|
Map<Value, Value> pairs = new HashMap<>();
|
||||||
for (String key : ctag.getAllKeys())
|
for (String key : ctag.keySet())
|
||||||
{
|
{
|
||||||
pairs.put(new StringValue(key), decodeTagDeep(ctag.get(key)));
|
pairs.put(new StringValue(key), decodeTagDeep(ctag.get(key)));
|
||||||
}
|
}
|
||||||
return MapValue.wrap(pairs);
|
return MapValue.wrap(pairs);
|
||||||
}
|
}
|
||||||
if (t instanceof final CollectionTag<?> ltag)
|
if (t instanceof final CollectionTag ltag)
|
||||||
{
|
{
|
||||||
List<Value> elems = new ArrayList<>();
|
List<Value> elems = new ArrayList<>();
|
||||||
for (Tag elem : ltag)
|
for (Tag elem : ltag)
|
||||||
@@ -478,17 +479,17 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
|||||||
{
|
{
|
||||||
return !(ctag).isEmpty();
|
return !(ctag).isEmpty();
|
||||||
}
|
}
|
||||||
if (tag instanceof final CollectionTag<?> ltag)
|
if (tag instanceof final CollectionTag ltag)
|
||||||
{
|
{
|
||||||
return !(ltag).isEmpty();
|
return !(ltag).isEmpty();
|
||||||
}
|
}
|
||||||
if (tag instanceof final NumericTag number)
|
if (tag instanceof final NumericTag number)
|
||||||
{
|
{
|
||||||
return number.getAsDouble() != 0.0;
|
return number.doubleValue() != 0.0;
|
||||||
}
|
}
|
||||||
if (tag instanceof StringTag)
|
if (tag instanceof StringTag st)
|
||||||
{
|
{
|
||||||
return !tag.getAsString().isEmpty();
|
return !st.value().isEmpty();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -570,7 +571,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
|||||||
boolean modified = false;
|
boolean modified = false;
|
||||||
for (Tag target : targets)
|
for (Tag target : targets)
|
||||||
{
|
{
|
||||||
if (!(target instanceof final CollectionTag<?> targetList))
|
if (!(target instanceof final CollectionTag targetList))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user