From ec2040cccc0b034a8ab7502d7ec96aaf2945caad Mon Sep 17 00:00:00 2001 From: "Aidan C. Brady" Date: Sun, 1 Jun 2014 17:42:23 +0200 Subject: [PATCH] Work on networking update --- src/main/java/mekanism/api/Coord4D.java | 13 +++- .../client/gui/GuiDigitalMinerConfig.java | 10 +-- .../client/gui/GuiMOreDictFilter.java | 6 +- .../mekanism/client/gui/GuiRobitRepair.java | 8 +-- .../client/render/RenderPartTransmitter.java | 61 +++---------------- .../common/item/ItemBlockMachine.java | 4 +- .../common/multipart/PartGlowPanel.java | 6 +- .../multipart/PartLogisticalTransporter.java | 19 ++++-- .../common/network/PacketElectricChest.java | 29 ++++----- .../common/network/PacketPipeline.java | 8 +-- .../common/tile/TileEntityDigitalMiner.java | 9 +-- .../tile/TileEntityElectrolyticSeparator.java | 4 +- .../tile/TileEntityLogisticalSorter.java | 5 +- .../tile/TileEntitySalinationController.java | 4 +- .../common/tile/TileEntityTeleporter.java | 4 +- .../mekanism/common/util/MekanismUtils.java | 4 +- 16 files changed, 86 insertions(+), 108 deletions(-) diff --git a/src/main/java/mekanism/api/Coord4D.java b/src/main/java/mekanism/api/Coord4D.java index cd9d8770c..a920dec63 100644 --- a/src/main/java/mekanism/api/Coord4D.java +++ b/src/main/java/mekanism/api/Coord4D.java @@ -5,7 +5,6 @@ import io.netty.buffer.ByteBuf; import java.util.ArrayList; import net.minecraft.block.Block; -import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; @@ -16,6 +15,8 @@ import net.minecraftforge.common.util.ForgeDirection; import com.google.common.io.ByteArrayDataInput; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; + /** * Coord4D - an integer-based way to keep track of and perform operations on blocks in a Minecraft-based environment. This also takes * in account the dimension the coordinate is in. @@ -248,6 +249,16 @@ public class Coord4D { return world.isAirBlock(xCoord+side.offsetX, yCoord+side.offsetY, zCoord+side.offsetZ); } + + /** + * Gets a TargetPoint with the defined range from this Coord4D with the appropriate coordinates and dimension ID. + * @param range - the range the packet can be sent in of this Coord4D + * @return TargetPoint relative to this Coord4D + */ + public TargetPoint getTargetPoint(double range) + { + return new TargetPoint(dimensionId, xCoord, yCoord, zCoord, range); + } /** * Steps this Coord4D in the defined side's offset without creating a new value. diff --git a/src/main/java/mekanism/client/gui/GuiDigitalMinerConfig.java b/src/main/java/mekanism/client/gui/GuiDigitalMinerConfig.java index 368d3ba7c..33f10d95c 100644 --- a/src/main/java/mekanism/client/gui/GuiDigitalMinerConfig.java +++ b/src/main/java/mekanism/client/gui/GuiDigitalMinerConfig.java @@ -173,17 +173,17 @@ public class GuiDigitalMinerConfig extends GuiMekanism if(filter instanceof MItemStackFilter) { playClickSound(); - Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 1, getFilterIndex()+i)); + Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 1, getFilterIndex()+i, 0)); } else if(filter instanceof MOreDictFilter) { playClickSound(); - Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 2, getFilterIndex()+i)); + Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 2, getFilterIndex()+i, 0)); } else if(filter instanceof MMaterialFilter) { playClickSound(); - Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 3, getFilterIndex()+i)); + Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 3, getFilterIndex()+i, 0)); } } } @@ -192,7 +192,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16) { playClickSound(); - Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 4)); + Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 4, 0, 0)); } if(xAxis >= 39 && xAxis <= 50 && yAxis >= 67 && yAxis <= 78) @@ -285,7 +285,7 @@ public class GuiDigitalMinerConfig extends GuiMekanism if(guibutton.id == 0) { - Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 5)); + Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 5, 0, 0)); } } diff --git a/src/main/java/mekanism/client/gui/GuiMOreDictFilter.java b/src/main/java/mekanism/client/gui/GuiMOreDictFilter.java index c4a0c6939..4e791e8cf 100644 --- a/src/main/java/mekanism/client/gui/GuiMOreDictFilter.java +++ b/src/main/java/mekanism/client/gui/GuiMOreDictFilter.java @@ -136,7 +136,7 @@ public class GuiMOreDictFilter extends GuiMekanism Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), false, origFilter, filter)); } - Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0)); + Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0)); } else { status = EnumColor.DARK_RED + "No key"; @@ -146,7 +146,7 @@ public class GuiMOreDictFilter extends GuiMekanism else if(guibutton.id == 1) { Mekanism.packetPipeline.sendToServer(new PacketEditFilter(Coord4D.get(tileEntity), true, origFilter)); - Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0)); + Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0)); } } @@ -263,7 +263,7 @@ public class GuiMOreDictFilter extends GuiMekanism if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16) { playClickSound(); - Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 5 : 0)); + Mekanism.packetPipeline.sendToServer(new PacketDigitalMinerGui(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), isNew ? 5 : 0, 0, 0)); } if(xAxis >= 131 && xAxis <= 143 && yAxis >= 47 && yAxis <= 59) diff --git a/src/main/java/mekanism/client/gui/GuiRobitRepair.java b/src/main/java/mekanism/client/gui/GuiRobitRepair.java index e7b563905..140d56610 100644 --- a/src/main/java/mekanism/client/gui/GuiRobitRepair.java +++ b/src/main/java/mekanism/client/gui/GuiRobitRepair.java @@ -148,25 +148,25 @@ public class GuiRobitRepair extends GuiMekanism implements ICrafting if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28) { playClickSound(); - Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 0, entityId)); + Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 0, entityId, null)); mc.thePlayer.openGui(Mekanism.instance, 21, mc.theWorld, entityId, 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 30 && yAxis <= 48) { playClickSound(); - Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 1, entityId)); + Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 1, entityId, null)); mc.thePlayer.openGui(Mekanism.instance, 22, mc.theWorld, entityId, 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 50 && yAxis <= 68) { playClickSound(); - Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 2, entityId)); + Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 2, entityId, null)); mc.thePlayer.openGui(Mekanism.instance, 23, mc.theWorld, entityId, 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 70 && yAxis <= 88) { playClickSound(); - Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 3, entityId)); + Mekanism.packetPipeline.sendToServer(new PacketRobit(RobitPacketType.GUI, 3, entityId, null)); mc.thePlayer.openGui(Mekanism.instance, 24, mc.theWorld, entityId, 0, 0); } else if(xAxis >= 179 && xAxis <= 197 && yAxis >= 90 && yAxis <= 108) diff --git a/src/main/java/mekanism/client/render/RenderPartTransmitter.java b/src/main/java/mekanism/client/render/RenderPartTransmitter.java index 5962cef5f..14f0e83ae 100644 --- a/src/main/java/mekanism/client/render/RenderPartTransmitter.java +++ b/src/main/java/mekanism/client/render/RenderPartTransmitter.java @@ -23,7 +23,6 @@ import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.TransporterUtils; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.IIconRegister; @@ -44,17 +43,14 @@ import org.lwjgl.opengl.GL11; import codechicken.lib.colour.Colour; import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.lighting.LightMatrix; import codechicken.lib.lighting.LightModel; import codechicken.lib.lighting.LightModel.Light; import codechicken.lib.render.CCModel; import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.CCRenderState.IVertexOperation; import codechicken.lib.render.ColourMultiplier; import codechicken.lib.render.TextureUtils; import codechicken.lib.render.TextureUtils.IIconSelfRegister; import codechicken.lib.render.uv.IconTransformation; -import codechicken.lib.render.uv.UV; import codechicken.lib.vec.Translation; import codechicken.lib.vec.Vector3; import cpw.mods.fml.relauncher.Side; @@ -494,7 +490,7 @@ public class RenderPartTransmitter implements IIconSelfRegister GL11.glPopMatrix(); } - public void renderStatic(PartSidedPipe transmitter, LazyLightMatrix olm) + public void renderStatic(PartSidedPipe transmitter) { TextureUtils.bindAtlas(0); CCRenderState.reset(); @@ -503,11 +499,11 @@ public class RenderPartTransmitter implements IIconSelfRegister for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - renderSide(side, transmitter, olm); + renderSide(side, transmitter); } } - public void renderSide(ForgeDirection side, PartSidedPipe transmitter, LazyLightMatrix olm) + public void renderSide(ForgeDirection side, PartSidedPipe transmitter) { boolean connected = PartTransmitter.connectionMapContainsSide(transmitter.getAllCurrentConnections(), side); IIcon renderIcon = transmitter.getIconForSide(side); @@ -519,7 +515,7 @@ public class RenderPartTransmitter implements IIconSelfRegister c = new ColourRGBA(transmitter.getRenderColor().getColor(0), transmitter.getRenderColor().getColor(1), transmitter.getRenderColor().getColor(2), 1); } - renderPart(renderIcon, transmitter.getModelForSide(side, false), transmitter.x(), transmitter.y(), transmitter.z(), c, olm); + renderPart(renderIcon, transmitter.getModelForSide(side, false), transmitter.x(), transmitter.y(), transmitter.z(), c); } public void renderSide(ForgeDirection side, TransmitterType type) @@ -528,7 +524,7 @@ public class RenderPartTransmitter implements IIconSelfRegister IIcon renderIcon = out ? type.getSideIcon() : type.getCenterIcon(); - renderPart(renderIcon, getItemModel(side, type), 0, 0, 0, null, null); + renderPart(renderIcon, getItemModel(side, type), 0, 0, 0, null); } public void renderEnergySide(ForgeDirection side, PartUniversalCable cable) @@ -549,14 +545,14 @@ public class RenderPartTransmitter implements IIconSelfRegister renderTransparency(tube.getTransmitterNetwork().refGas.getIcon(), tube.getModelForSide(side, true), new ColourRGBA(1.0, 1.0, 1.0, tube.currentScale)); } - public void renderPart(IIcon icon, CCModel cc, double x, double y, double z, Colour color, LazyLightMatrix olm) + public void renderPart(IIcon icon, CCModel cc, double x, double y, double z, Colour color) { - cc.render(0, cc.verts.length, new Translation(x, y, z), new IconTransformation(icon), new TransmitterTransformation(color, null)); + cc.render(0, cc.verts.length, new Translation(x, y, z), new IconTransformation(icon), new ColourMultiplier(color.rgba())); } - public void renderTransparency(IIcon icon, CCModel cc, Colour colour) + public void renderTransparency(IIcon icon, CCModel cc, Colour color) { - cc.render(0, cc.verts.length, new Translation(0, 0, 0), new IconTransformation(icon), new ColourMultiplier(colour)); + cc.render(0, cc.verts.length, new Translation(0, 0, 0), new IconTransformation(icon), new ColourMultiplier(color.rgba())); } public CCModel getItemModel(ForgeDirection side, TransmitterType type) @@ -723,43 +719,4 @@ public class RenderPartTransmitter implements IIconSelfRegister return display; } - - public static class TransmitterTransformation implements IVertexOperation - { - public ColourMultiplier colour; - public LightMatrix lightMatrix; - - public TransmitterTransformation(Colour color, LightMatrix olm) - { - if(color != null) - { - colour = new ColourMultiplier(color); - } - - if(olm != null) - { - lightMatrix = olm; - } - } - - @Override - public void applyModifiers(CCModel m, Tessellator tess, Vector3 vec, UV uv, Vector3 normal, int i) - { - if(colour != null) - { - colour.applyModifiers(m, tess, vec, uv, normal, i); - } - - if(lightMatrix != null) - { - lightMatrix.applyModifiers(m, tess, vec, uv, normal, i); - } - } - - @Override - public boolean needsNormals() - { - return true; - } - } } diff --git a/src/main/java/mekanism/common/item/ItemBlockMachine.java b/src/main/java/mekanism/common/item/ItemBlockMachine.java index 52e19b911..613cda7bb 100644 --- a/src/main/java/mekanism/common/item/ItemBlockMachine.java +++ b/src/main/java/mekanism/common/item/ItemBlockMachine.java @@ -519,11 +519,11 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec { if(!getAuthenticated(itemstack)) { - Mekanism.packetPipeline.sendTo(new PacketElectricChest(ElectricChestPacketType.CLIENT_OPEN, 2, 0, false), entityplayer); + Mekanism.packetPipeline.sendTo(new PacketElectricChest(ElectricChestPacketType.CLIENT_OPEN, false, false, 2, 0, null, null), (EntityPlayerMP)entityplayer); } else if(getLocked(itemstack) && getEnergy(itemstack) > 0) { - Mekanism.packetPipeline.sendTo(new PacketElectricChest(ElectricChestPacketType.CLIENT_OPEN, 1, 0, false), entityplayer); + Mekanism.packetPipeline.sendTo(new PacketElectricChest(ElectricChestPacketType.CLIENT_OPEN, false, false, 1, 0, null, null), (EntityPlayerMP)entityplayer); } else { InventoryElectricChest inventory = new InventoryElectricChest(entityplayer); diff --git a/src/main/java/mekanism/common/multipart/PartGlowPanel.java b/src/main/java/mekanism/common/multipart/PartGlowPanel.java index 1e7e98844..7a51bd508 100644 --- a/src/main/java/mekanism/common/multipart/PartGlowPanel.java +++ b/src/main/java/mekanism/common/multipart/PartGlowPanel.java @@ -108,12 +108,14 @@ public class PartGlowPanel extends JCuboidPart implements JNormalOcclusion, JIco @Override @SideOnly(Side.CLIENT) - public void renderStatic(Vector3 pos, LazyLightMatrix olm, int pass) + public boolean renderStatic(Vector3 pos, int pass) { if(pass == 1) { - RenderGlowPanel.getInstance().renderStatic(this, olm); + RenderGlowPanel.getInstance().renderStatic(this); } + + return true; } @Override diff --git a/src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java b/src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java index f3648a38f..d8c2a0ae8 100644 --- a/src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java +++ b/src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java @@ -33,6 +33,7 @@ import net.minecraft.util.IIcon; import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.common.util.ForgeDirection; import buildcraft.api.transport.IPipeTile; +import buildcraft.api.transport.PipeWire; import codechicken.lib.vec.Vector3; import com.google.common.io.ByteArrayDataInput; @@ -324,7 +325,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti for(TransporterStack stack : remove) { - Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, true)), Coord4D.get(tile()), 50D); + Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, true)), Coord4D.get(tile()).getTargetPoint(50D)); transit.remove(stack); MekanismUtils.saveChunk(tile()); } @@ -333,7 +334,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti { if(transit.contains(stack)) { - Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()), 50D); + Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()).getTargetPoint(50D)); } } @@ -438,7 +439,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti { transit.add(stack); TransporterManager.add(stack); - Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()), 50D); + Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()).getTargetPoint(50D)); MekanismUtils.saveChunk(tile()); } @@ -474,7 +475,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti { transit.add(stack); TransporterManager.add(stack); - Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()), 50D); + Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()).getTargetPoint(50D)); MekanismUtils.saveChunk(tile()); } @@ -489,7 +490,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti { stack.progress = 0; transit.add(stack); - Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()), 50D); + Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getSyncPacket(stack, false)), Coord4D.get(tile()).getTargetPoint(50D)); MekanismUtils.saveChunk(tile()); } @@ -679,7 +680,7 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti TransporterUtils.incrementColor(this); refreshConnections(); tile().notifyPartChange(this); - Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getNetworkedData(new ArrayList())), Coord4D.get(tile()), 50D); + Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(tile()), getNetworkedData(new ArrayList())), Coord4D.get(tile()).getTargetPoint(50D)); player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.configurator.toggleColor") + ": " + (color != null ? color.getName() : EnumColor.BLACK + MekanismUtils.localize("gui.none")))); return true; @@ -758,4 +759,10 @@ public class PartLogisticalTransporter extends PartSidedPipe implements ILogisti { return 1; } + + @Override + public boolean isWireActive(PipeWire wire) + { + return false; + } } diff --git a/src/main/java/mekanism/common/network/PacketElectricChest.java b/src/main/java/mekanism/common/network/PacketElectricChest.java index 34d58e374..70fe4a508 100644 --- a/src/main/java/mekanism/common/network/PacketElectricChest.java +++ b/src/main/java/mekanism/common/network/PacketElectricChest.java @@ -36,50 +36,51 @@ public class PacketElectricChest extends MekanismPacket public Coord4D obj; - public PacketElectricChest(ElectricChestPacketType type)//TODO I'm bored now.) + //This is a really messy implementation... + public PacketElectricChest(ElectricChestPacketType type, boolean b1, boolean b2, int i1, int i2, String s1, Coord4D c1) { activeType = type; switch(activeType) { case LOCK: - locked = (Boolean)data[1]; - isBlock = (Boolean)data[2]; + locked = b1; + isBlock = b2; if(isBlock) { - obj = (Coord4D)data[3]; + obj = c1; } break; case PASSWORD: - password = (String)data[1]; - isBlock = (Boolean)data[2]; + password = s1; + isBlock = b1; if(isBlock) { - obj = (Coord4D)data[3]; + obj = c1; } break; case CLIENT_OPEN: - guiType = (Integer)data[1]; - windowId = (Integer)data[2]; - isBlock = (Boolean)data[3]; + guiType = i1; + windowId = i2; + isBlock = b1; if(isBlock) { - obj = (Coord4D)data[4]; + obj = c1; } break; case SERVER_OPEN: - useEnergy = (Boolean)data[1]; - isBlock = (Boolean)data[2]; + useEnergy = b1; + isBlock = b2; if(isBlock) { - obj = (Coord4D)data[3]; + obj = c1; } break; diff --git a/src/main/java/mekanism/common/network/PacketPipeline.java b/src/main/java/mekanism/common/network/PacketPipeline.java index 8726d2a95..f69a5a74b 100644 --- a/src/main/java/mekanism/common/network/PacketPipeline.java +++ b/src/main/java/mekanism/common/network/PacketPipeline.java @@ -43,8 +43,7 @@ public class PacketPipeline extends MessageToMessageCodec clazz = packets.get(discriminator); + if(clazz == null) { throw new NullPointerException("No packet registered for discriminator: " + discriminator); @@ -116,10 +116,9 @@ public class PacketPipeline extends MessageToMessageCodec 0.01) { - Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this), 50D); + Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D)); prevScale = (float)waterTank.getFluidAmount()/waterTank.getCapacity(); } } @@ -151,7 +151,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp if(structured != prev) { - Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this), 50D); + Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(50D)); } if(structured) diff --git a/src/main/java/mekanism/common/tile/TileEntityTeleporter.java b/src/main/java/mekanism/common/tile/TileEntityTeleporter.java index ace9dba46..9f537571c 100644 --- a/src/main/java/mekanism/common/tile/TileEntityTeleporter.java +++ b/src/main/java/mekanism/common/tile/TileEntityTeleporter.java @@ -131,7 +131,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IPe if(shouldRender != prevShouldRender) { - Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this), 40D); + Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(40D)); } prevShouldRender = shouldRender; @@ -279,7 +279,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IPe for(Coord4D coords : Mekanism.teleporters.get(code)) { - Mekanism.packetPipeline.sendToAllAround(new PacketPortalFX(coords), coords, 40D); + Mekanism.packetPipeline.sendToAllAround(new PacketPortalFX(coords), coords.getTargetPoint(40D)); } setEnergy(getEnergy() - calculateEnergyCost(entity, closestCoords)); diff --git a/src/main/java/mekanism/common/util/MekanismUtils.java b/src/main/java/mekanism/common/util/MekanismUtils.java index 85db4086f..a69fc8890 100644 --- a/src/main/java/mekanism/common/util/MekanismUtils.java +++ b/src/main/java/mekanism/common/util/MekanismUtils.java @@ -842,10 +842,10 @@ public final class MekanismUtils if(isBlock) { - Mekanism.packetPipeline.sendTo(new PacketElectricChest(ElectricChestPacketType.CLIENT_OPEN, 0, id, true, Coord4D.get(tileEntity)), player); + Mekanism.packetPipeline.sendTo(new PacketElectricChest(ElectricChestPacketType.CLIENT_OPEN, true, false, 0, id, null, Coord4D.get(tileEntity)), player); } else { - Mekanism.packetPipeline.sendTo(new PacketElectricChest(ElectricChestPacketType.CLIENT_OPEN, 0, id, false), player); + Mekanism.packetPipeline.sendTo(new PacketElectricChest(ElectricChestPacketType.CLIENT_OPEN, false, false, 0, id, null, null), player); } player.openContainer = new ContainerElectricChest(player.inventory, tileEntity, inventory, isBlock);