Work on networking update
This commit is contained in:
parent
da444327f8
commit
ec2040cccc
16 changed files with 86 additions and 108 deletions
|
@ -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.
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -43,8 +43,7 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Mekani
|
|||
* Register your packet with the pipeline. Discriminators are automatically
|
||||
* set.
|
||||
*
|
||||
* @param clazz
|
||||
* the class to register
|
||||
* @param clazz the class to register
|
||||
*
|
||||
* @return whether registration was successful. Failure may occur if 256
|
||||
* packets have been registered or if the registry already contains
|
||||
|
@ -100,6 +99,7 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Mekani
|
|||
ByteBuf payload = msg.payload();
|
||||
byte discriminator = payload.readByte();
|
||||
Class<? extends MekanismPacket> 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<FMLProxyPacket, Mekani
|
|||
player = getClientPlayer();
|
||||
pkt.handleClientSide(player);
|
||||
break;
|
||||
|
||||
case SERVER:
|
||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||
player =((NetHandlerPlayServer) netHandler).playerEntity;
|
||||
player = ((NetHandlerPlayServer)netHandler).playerEntity;
|
||||
pkt.handleServerSide(player);
|
||||
break;
|
||||
}
|
||||
|
@ -162,7 +161,6 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Mekani
|
|||
registerPacket(PacketScubaTankData.class);
|
||||
registerPacket(PacketConfigSync.class);
|
||||
registerPacket(PacketBoxBlacklist.class);
|
||||
|
||||
}
|
||||
|
||||
// Method to call from FMLPostInitializationEvent
|
||||
|
|
|
@ -34,6 +34,7 @@ import mekanism.common.util.MinerUtils;
|
|||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -260,7 +261,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
{
|
||||
for(EntityPlayer player : playersUsing)
|
||||
{
|
||||
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getSmallPacket(new ArrayList())), player);
|
||||
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getSmallPacket(new ArrayList())), (EntityPlayerMP)player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -511,7 +512,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
{
|
||||
for(EntityPlayer player : playersUsing)
|
||||
{
|
||||
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), player);
|
||||
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getNetworkedData(new ArrayList())), (EntityPlayerMP)player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -655,7 +656,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
|
||||
for(EntityPlayer player : playersUsing)
|
||||
{
|
||||
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getGenericPacket(new ArrayList())), player);
|
||||
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getGenericPacket(new ArrayList())), (EntityPlayerMP)player);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -1277,7 +1278,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
|
||||
for(EntityPlayer player : playersUsing)
|
||||
{
|
||||
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getGenericPacket(new ArrayList())), player);
|
||||
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getGenericPacket(new ArrayList())), (EntityPlayerMP)player);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -153,7 +153,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
|
||||
if(worldObj.rand.nextInt(3) == 2)
|
||||
{
|
||||
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getParticlePacket(0, new ArrayList())), Coord4D.get(this), 40D);
|
||||
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getParticlePacket(0, new ArrayList())), Coord4D.get(this).getTargetPoint(40D));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
|
||||
if(worldObj.rand.nextInt(3) == 2)
|
||||
{
|
||||
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getParticlePacket(1, new ArrayList())), Coord4D.get(this), 40D);
|
||||
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getParticlePacket(1, new ArrayList())), Coord4D.get(this).getTargetPoint(40D));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import mekanism.common.util.InventoryUtils;
|
|||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -147,7 +148,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
|
|||
{
|
||||
for(EntityPlayer player : playersUsing)
|
||||
{
|
||||
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getGenericPacket(new ArrayList())), player);
|
||||
Mekanism.packetPipeline.sendTo(new PacketTileEntity(Coord4D.get(this), getGenericPacket(new ArrayList())), (EntityPlayerMP)player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -492,7 +493,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
|
|||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getFilterPacket(new ArrayList())), Coord4D.get(this), 50D);
|
||||
Mekanism.packetPipeline.sendToAllAround(new PacketTileEntity(Coord4D.get(this), getFilterPacket(new ArrayList())), Coord4D.get(this).getTargetPoint(50D));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
|
|||
{
|
||||
if(Math.abs((float)waterTank.getFluidAmount()/waterTank.getCapacity()-prevScale) > 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)
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue