mappings
This commit is contained in:
1 parent
1c46393c4d
commit
0b22359f8c
7 files changed
+27
-21
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
package carpet.fakes;
|
package carpet.fakes;
|
||||||
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.PacketByteBuf;
|
import net.minecraft.network.PacketByteBuf;
|
||||||
|
|
||||||
public interface CustomPayloadC2SPacketInterface
|
public interface CustomPayloadC2SPacketInterface
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins;
|
||||||
|
|
||||||
import carpet.fakes.CustomPayloadC2SPacketInterface;
|
import carpet.fakes.CustomPayloadC2SPacketInterface;
|
||||||
|
import net.minecraft.network.PacketByteBuf;
|
||||||
import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
|
import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.PacketByteBuf;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,12 @@ import net.minecraft.client.network.ClientPlayerEntity;
|
|||||||
import net.minecraft.nbt.AbstractNumberTag;
|
import net.minecraft.nbt.AbstractNumberTag;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
|
import net.minecraft.network.PacketByteBuf;
|
||||||
import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
|
import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
|
||||||
import net.minecraft.util.PacketByteBuf;
|
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -42,7 +45,7 @@ public class ClientNetworkHandler
|
|||||||
CompoundTag boxData = (CompoundTag)t;
|
CompoundTag boxData = (CompoundTag)t;
|
||||||
CarpetClient.shapes.addShape(
|
CarpetClient.shapes.addShape(
|
||||||
boxData.getString("type"),
|
boxData.getString("type"),
|
||||||
DimensionType.byRawId(boxData.getInt("dim")),
|
RegistryKey.of(Registry.DIMENSION, new Identifier(boxData.getString("dim"))),
|
||||||
boxData
|
boxData
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ import carpet.settings.ParsedRule;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
|
import net.minecraft.network.PacketByteBuf;
|
||||||
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
|
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.util.PacketByteBuf;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|||||||
@@ -2710,7 +2710,7 @@ public class CarpetExpression
|
|||||||
}
|
}
|
||||||
ShapeDispatcher.sendShape(
|
ShapeDispatcher.sendShape(
|
||||||
(player==null)?cc.s.getWorld().getPlayers():Collections.singletonList(player),
|
(player==null)?cc.s.getWorld().getPlayers():Collections.singletonList(player),
|
||||||
cc.s.getWorld().getDimension().getType(),
|
cc.s.getWorld().method_27983(),
|
||||||
new ShapeDispatcher.Box(duration, from.vec, to.vec, color)
|
new ShapeDispatcher.Box(duration, from.vec, to.vec, color)
|
||||||
);
|
);
|
||||||
return LazyValue.TRUE;
|
return LazyValue.TRUE;
|
||||||
@@ -2756,7 +2756,7 @@ public class CarpetExpression
|
|||||||
}
|
}
|
||||||
ShapeDispatcher.sendShape(
|
ShapeDispatcher.sendShape(
|
||||||
(player==null)?cc.s.getWorld().getPlayers():Collections.singletonList(player),
|
(player==null)?cc.s.getWorld().getPlayers():Collections.singletonList(player),
|
||||||
cc.s.getWorld().getDimension().getType(),
|
cc.s.getWorld().method_27983(),
|
||||||
new ShapeDispatcher.Line(duration, from.vec, to.vec, color)
|
new ShapeDispatcher.Line(duration, from.vec, to.vec, color)
|
||||||
);
|
);
|
||||||
return LazyValue.TRUE;
|
return LazyValue.TRUE;
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import net.minecraft.particle.ParticleEffect;
|
|||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -26,7 +27,7 @@ public class ShapeDispatcher
|
|||||||
{
|
{
|
||||||
private static final Map<String, ParticleEffect> particleCache = new HashMap<>();
|
private static final Map<String, ParticleEffect> particleCache = new HashMap<>();
|
||||||
|
|
||||||
public static void sendShape(List<ServerPlayerEntity> players, DimensionType dim, ExpiringShape shape)
|
public static void sendShape(List<ServerPlayerEntity> players, RegistryKey<World> dim, ExpiringShape shape)
|
||||||
{
|
{
|
||||||
Consumer<ServerPlayerEntity> alternative = null;
|
Consumer<ServerPlayerEntity> alternative = null;
|
||||||
CompoundTag tag = null;
|
CompoundTag tag = null;
|
||||||
@@ -35,7 +36,7 @@ public class ShapeDispatcher
|
|||||||
if (ServerNetworkHandler.validCarpetPlayers.contains(player))
|
if (ServerNetworkHandler.validCarpetPlayers.contains(player))
|
||||||
{
|
{
|
||||||
if (tag == null) tag = shape.toTag();
|
if (tag == null) tag = shape.toTag();
|
||||||
tag.putInt("dim", dim.getRawId());
|
tag.putString("dim", dim.getValue().toString());
|
||||||
ServerNetworkHandler.sendCustomCommand(player,"renderShape", tag);
|
ServerNetworkHandler.sendCustomCommand(player,"renderShape", tag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ import net.minecraft.client.MinecraftClient;
|
|||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.util.math.Matrix4f;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
import net.minecraft.util.math.Matrix4f;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -20,7 +21,7 @@ import java.util.function.BiFunction;
|
|||||||
|
|
||||||
public class ShapesRenderer
|
public class ShapesRenderer
|
||||||
{
|
{
|
||||||
private final Map<DimensionType, List<RenderedShape<? extends ShapeDispatcher.ExpiringShape>>> shapes;
|
private final Map<RegistryKey<World>, List<RenderedShape<? extends ShapeDispatcher.ExpiringShape>>> shapes;
|
||||||
private MinecraftClient client;
|
private MinecraftClient client;
|
||||||
|
|
||||||
private Map<String, BiFunction<MinecraftClient, CompoundTag, RenderedShape<? extends ShapeDispatcher.ExpiringShape >>> renderedShapes
|
private Map<String, BiFunction<MinecraftClient, CompoundTag, RenderedShape<? extends ShapeDispatcher.ExpiringShape >>> renderedShapes
|
||||||
@@ -34,16 +35,16 @@ public class ShapesRenderer
|
|||||||
{
|
{
|
||||||
this.client = minecraftClient;
|
this.client = minecraftClient;
|
||||||
shapes = new HashMap<>();
|
shapes = new HashMap<>();
|
||||||
shapes.put(DimensionType.OVERWORLD, new ArrayList<>());
|
shapes.put(World.field_25179, new ArrayList<>());
|
||||||
shapes.put(DimensionType.THE_NETHER, new ArrayList<>());
|
shapes.put(World.field_25180, new ArrayList<>());
|
||||||
shapes.put(DimensionType.THE_END, new ArrayList<>());
|
shapes.put(World.field_25181, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, double cameraX, double cameraY, double cameraZ)
|
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, double cameraX, double cameraY, double cameraZ)
|
||||||
{
|
{
|
||||||
//Camera camera = this.client.gameRenderer.getCamera();
|
//Camera camera = this.client.gameRenderer.getCamera();
|
||||||
IWorld iWorld = this.client.world;
|
ClientWorld iWorld = this.client.world;
|
||||||
DimensionType dimensionType = iWorld.getDimension().getType();
|
RegistryKey<World> dimensionType = iWorld.method_27983();
|
||||||
if (shapes.get(dimensionType).isEmpty()) return;
|
if (shapes.get(dimensionType).isEmpty()) return;
|
||||||
//BlockPos blockPos = new BlockPos(camera.getPos().x, 0.0D, camera.getPos().z);
|
//BlockPos blockPos = new BlockPos(camera.getPos().x, 0.0D, camera.getPos().z);
|
||||||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getLines());
|
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getLines());
|
||||||
@@ -60,7 +61,7 @@ public class ShapesRenderer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void addShape(String type, DimensionType dim, CompoundTag tag)
|
public void addShape(String type, RegistryKey<World> dim, CompoundTag tag)
|
||||||
{
|
{
|
||||||
BiFunction<MinecraftClient, CompoundTag, RenderedShape<? extends ShapeDispatcher.ExpiringShape >> shapeFactory;
|
BiFunction<MinecraftClient, CompoundTag, RenderedShape<? extends ShapeDispatcher.ExpiringShape >> shapeFactory;
|
||||||
shapeFactory = renderedShapes.get(type);
|
shapeFactory = renderedShapes.get(type);
|
||||||
|
|||||||
Reference in new issue
Block a user