public static TileEntity GetBlockEntityById(string blockEntityId) { TileEntity tileEntity = null; if (blockEntityId == "Sign") tileEntity = new SignTileEntity(); return tileEntity; }
public static TileEntity GetBlockEntityById(string blockEntityId) { TileEntity tileEntity = null; if (blockEntityId == "Sign") { tileEntity = new SignTileEntity(); } return(tileEntity); }
public void TestSignTile() { SignTileEntity entity = new SignTileEntity(); entity.Text1 = "Test1"; entity.Text2 = "Test2"; entity.Text3 = "Test3"; entity.Text4 = "Test4"; var serializer = new NbtSerializer(typeof(SignTileEntity)); var obj = serializer.Serialize(entity); var result = (SignTileEntity)serializer.Deserialize(obj); Assert.AreEqual(entity.Id, result.Id); Assert.AreEqual(entity.Text1, result.Text1); Assert.AreEqual(entity.Text2, result.Text2); Assert.AreEqual(entity.Text3, result.Text3); Assert.AreEqual(entity.Text4, result.Text4); }
public static void UpdateSign(MinecraftClient client, IPacket _packet) { var packet = (UpdateSignPacket)_packet; var position = new Vector3(packet.X, packet.Y, packet.Z); var signTileEntity = new SignTileEntity { Text1 = packet.Text1, Text2 = packet.Text2, Text3 = packet.Text3, Text4 = packet.Text4 }; client.OnSignUpdateReceived(new SignUpdateReceivedEventArgs(position, signTileEntity)); var chunk = client.World.GetChunk(position); if (chunk == null || chunk.Chunk == null) { return; } chunk.Chunk.TileEntities[position] = signTileEntity; }
public SignUpdateReceivedEventArgs(Vector3 position, SignTileEntity sign) { Sign = sign; Position = position; }