From aa42aedecd2d2842351088085e8fd9d69ec79565 Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Fri, 14 Apr 2017 07:58:16 +0300 Subject: Colourful lights --- ihl/ServerProxy.java | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'ihl/ServerProxy.java') diff --git a/ihl/ServerProxy.java b/ihl/ServerProxy.java index 385bcec..d22751c 100644 --- a/ihl/ServerProxy.java +++ b/ihl/ServerProxy.java @@ -38,6 +38,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.client.event.TextureStitchEvent.Pre; +import net.minecraftforge.event.world.BlockEvent.BreakEvent; +import net.minecraftforge.event.world.BlockEvent.PlaceEvent; public class ServerProxy { @@ -273,6 +275,50 @@ public class ServerProxy { } } } + @SubscribeEvent + public void onBlockBreak(BreakEvent event) { + int x = event.x; + int y = event.y; + int z = event.z; + ByteBuf bb = Unpooled.buffer(20); + ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb); + try + { + byteBufOutputStream.write(4); + byteBufOutputStream.writeInt(x); + byteBufOutputStream.writeInt(y); + byteBufOutputStream.writeInt(z); + channel.sendToAllAround(new FMLProxyPacket(byteBufOutputStream.buffer(),IHLModInfo.MODID), new TargetPoint(event.world.provider.dimensionId, x, y, z, 256d)); + byteBufOutputStream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + @SubscribeEvent + public void onBlockPlace(PlaceEvent event) { + int x = event.x; + int y = event.y; + int z = event.z; + ByteBuf bb = Unpooled.buffer(20); + ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(bb); + try + { + byteBufOutputStream.write(5); + byteBufOutputStream.writeInt(x); + byteBufOutputStream.writeInt(y); + byteBufOutputStream.writeInt(z); + channel.sendToAllAround(new FMLProxyPacket(byteBufOutputStream.buffer(),IHLModInfo.MODID), new TargetPoint(event.world.provider.dimensionId, x, y, z, 256d)); + byteBufOutputStream.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + public void addEntityToServerList(INetworkListener entity) { -- cgit v1.2.3