Full multiplayer compatibility! Probably buggy, but hey it works!

main
Astoria 2 years ago
parent 327afae1d2
commit 22c1cc2915

@ -29,8 +29,8 @@ public class WireMod implements ModInitializer {
AccessorPacket.callAddIdClassMapping(111, true, true, WiremodWiringGuiPacket.class);
AccessorPacket.callAddIdClassMapping(112, true, true, WiremodPacketSyncIO.class);
AccessorPacket.callAddIdClassMapping(113, true, true, WiremodWiringPacket.class);
AccessorPacket.callAddIdClassMapping(114, true, true, WiremodSettingsGuiPacket.class);
AccessorPacket.callAddIdClassMapping(500, true, true, WiremodWireGuiPacket.class);
AccessorPacket.callAddIdClassMapping(114, true, true, WiremodWireGuiPacket.class);
AccessorPacket.callAddIdClassMapping(115, true, true, WiremodSettingsPacket.class);
}
public static final String MOD_ID = "afloydwiremod";

@ -48,7 +48,7 @@ public class GuiProgrammer extends GuiScrollable {
this.controlList.add(new GuiButtonExtended(i++, this.width + GuiButtonExtended.width * 2, "<=>"));
}
public GuiProgrammer(EntityPlayer player, AbstractWireTileEntity wireEntity) {
public GuiProgrammer(EntityPlayer player, ChipTileEntity wireEntity) {
super.initGui();
this.player = player;
this.wireEntity = wireEntity;
@ -56,7 +56,6 @@ public class GuiProgrammer extends GuiScrollable {
@Override
protected void actionPerformed(GuiButton guibutton) {
System.out.println("One");
switch(guibutton.displayString){
case "Constant":
this.setMode("constant");
@ -112,15 +111,11 @@ public class GuiProgrammer extends GuiScrollable {
}
public void setMode(String string){
System.out.println("Two");
if(this.player instanceof EntityClientPlayerMP){
System.out.println("Three");
NetClientHandler netclienthandler = ((EntityClientPlayerMP)this.mc.thePlayer).sendQueue;
netclienthandler.addToSendQueue(new WiremodProgrammerPacket(string, wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord));
System.out.println("e");
return;
}
System.out.println("Four");
((ChipTileEntity)Minecraft.getMinecraft().theWorld.getBlockTileEntity(wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord)).setMode(string);
}

@ -3,12 +3,13 @@ package net.brokenmoon.afloydwiremod.gui;
import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity;
import net.brokenmoon.afloydwiremod.api.WireConnection;
import net.brokenmoon.afloydwiremod.item.ToolWiring;
import net.brokenmoon.afloydwiremod.packet.WiremodSettingsPacket;
import net.brokenmoon.afloydwiremod.packet.WiremodWiringPacket;
import net.brokenmoon.afloydwiremod.tileentity.ChipTileEntity;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.GuiButton;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.*;
public class GuiSettings extends GuiScreen {
private EntityPlayer player;
private AbstractWireTileEntity wireEntity;
@Override
public void initGui() {
@ -42,6 +43,7 @@ public class GuiSettings extends GuiScreen {
public GuiSettings(EntityPlayer player, AbstractWireTileEntity wireEntity) {
super.initGui();
this.player = player;
this.wireEntity = wireEntity;
}
@ -66,6 +68,10 @@ public class GuiSettings extends GuiScreen {
if(guiButton.id == 2){
((ChipTileEntity)wireEntity).tickAmount--;
}
if(this.player instanceof EntityClientPlayerMP){
NetClientHandler netclienthandler = ((EntityClientPlayerMP)this.mc.thePlayer).sendQueue;
netclienthandler.addToSendQueue(new WiremodSettingsPacket(1, ((ChipTileEntity)wireEntity).tickAmount, wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord));
}
this.controlList.get(1).displayString = ((ChipTileEntity)wireEntity).tickAmount + "";
}
@ -77,6 +83,10 @@ public class GuiSettings extends GuiScreen {
wireEntity.outputs[0].floatvalue--;
}
this.controlList.get(1).displayString = wireEntity.outputs[0].floatvalue + "";
if(this.player instanceof EntityClientPlayerMP){
NetClientHandler netclienthandler = ((EntityClientPlayerMP)this.mc.thePlayer).sendQueue;
netclienthandler.addToSendQueue(new WiremodSettingsPacket(0, wireEntity.outputs[0].floatvalue, wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord));
}
wireEntity.updateIO();
}
}

@ -48,7 +48,6 @@ public class GuiWiring extends GuiScrollable {
this.z = z;
this.wireEntity = wireEntity;
otherEntity = (AbstractWireTileEntity)Minecraft.getMinecraft().theWorld.getBlockTileEntity(tool.x, tool.y, tool.z);
System.out.println(player instanceof EntityClientPlayerMP);
}
@Override
@ -84,7 +83,6 @@ public class GuiWiring extends GuiScrollable {
NetClientHandler netclienthandler = ((EntityClientPlayerMP)this.mc.thePlayer).sendQueue;
netclienthandler.addToSendQueue(new WiremodWiringPacket(wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord, this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, false, tool.red, tool.green, tool.blue, tool.alpha, tool.width));
netclienthandler.addToSendQueue(new WiremodWiringPacket(this.tool.x, this.tool.y, this.tool.z, this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot));
System.out.println("Okay");
} else{
wireEntity.outputs[guibutton.slot].wire = new WireConnection(this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, false, tool.red, tool.green, tool.blue, tool.alpha, tool.width);
otherEntity.inputs[tool.slot].wire = new WireConnection(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot);
@ -104,7 +102,6 @@ public class GuiWiring extends GuiScrollable {
NetClientHandler netclienthandler = ((EntityClientPlayerMP)this.mc.thePlayer).sendQueue;
netclienthandler.addToSendQueue(new WiremodWiringPacket(wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord, this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, true, tool.red, tool.green, tool.blue, tool.alpha, tool.width));
netclienthandler.addToSendQueue(new WiremodWiringPacket(this.tool.x, this.tool.y, this.tool.z, this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot));
System.out.println("Okay");
} else{
otherEntity.outputs[tool.slot].wire = new WireConnection(this.wireEntity.xCoord, this.wireEntity.yCoord, this.wireEntity.zCoord, tool.slot, guibutton.slot, tool.xadd, tool.yadd, tool.zadd, tool.sideadd, true, tool.red, tool.green, tool.blue, tool.alpha, tool.width);
wireEntity.inputs[guibutton.slot].wire = new WireConnection(this.tool.x, this.tool.y, this.tool.z, guibutton.slot, tool.slot);

@ -1,6 +1,7 @@
package net.brokenmoon.afloydwiremod.item;
import net.brokenmoon.afloydwiremod.WireMod;
import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity;
import net.brokenmoon.afloydwiremod.mixinInterfaces.IEntityPlayer;
import net.minecraft.src.*;
@ -37,6 +38,7 @@ public class ToolWiring extends Item {
return true;
}
} else {
if(!(world.getBlockTileEntity(i, j, k) instanceof AbstractWireTileEntity))
xadd.add(i);
yadd.add(j);
zadd.add(k);

@ -4,7 +4,6 @@ import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity;
import net.brokenmoon.afloydwiremod.item.ToolWiring;
import net.brokenmoon.afloydwiremod.mixinInterfaces.IEntityPlayer;
import net.brokenmoon.afloydwiremod.packet.WiremodProgrammerGuiPacket;
import net.brokenmoon.afloydwiremod.packet.WiremodSettingsGuiPacket;
import net.brokenmoon.afloydwiremod.packet.WiremodWireGuiPacket;
import net.brokenmoon.afloydwiremod.packet.WiremodWiringGuiPacket;
import net.minecraft.src.*;
@ -17,19 +16,18 @@ public class MixinEntityPlayerMP implements IEntityPlayer {
@Override
public void displayGuiProgrammer(AbstractWireTileEntity chip) {
this.playerNetServerHandler.sendPacket(new WiremodProgrammerGuiPacket(chip.xCoord, chip.yCoord, chip.zCoord));
this.playerNetServerHandler.sendPacket(new WiremodProgrammerGuiPacket(0, chip.xCoord, chip.yCoord, chip.zCoord));
}
@Override
public void displayGuiWiring(ToolWiring tool, AbstractWireTileEntity chip, int x, int y, int z) {
System.out.println("E");
this.playerNetServerHandler.sendPacket(new WiremodWiringGuiPacket(chip.xCoord, chip.yCoord, chip.zCoord, x, y, z));
}
@Override
public void displayGuiSettings(AbstractWireTileEntity chip) {
this.playerNetServerHandler.sendPacket(new WiremodSettingsGuiPacket(chip.xCoord, chip.yCoord, chip.zCoord));
this.playerNetServerHandler.sendPacket(new WiremodProgrammerGuiPacket(1, chip.xCoord, chip.yCoord, chip.zCoord));
}
@Override

@ -20,7 +20,7 @@ public class MixinEntityPlayerSP implements IEntityPlayer {
@Override
public void displayGuiProgrammer(AbstractWireTileEntity chip) {
this.mc.displayGuiScreen(new GuiProgrammer(((EntityPlayerSP)(Object)this), chip));
this.mc.displayGuiScreen(new GuiProgrammer(((EntityPlayerSP)(Object)this), (ChipTileEntity) chip));
}
@Override

@ -20,7 +20,10 @@ public class MixinNetClientHandler implements INetHandler {
Minecraft mc;
@Override
public void wiremodHandleOpenProgrammerGUI(WiremodProgrammerGuiPacket packet) {
((IEntityPlayer)this.mc.thePlayer).displayGuiProgrammer((ChipTileEntity)this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z));
if(packet.mode == 0)
((IEntityPlayer)this.mc.thePlayer).displayGuiProgrammer((ChipTileEntity)this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z));
if(packet.mode == 1)
((IEntityPlayer)this.mc.thePlayer).displayGuiSettings((AbstractWireTileEntity)this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z));
}
@Override
@ -36,14 +39,16 @@ public class MixinNetClientHandler implements INetHandler {
@Override
public void wiremodHandleIODisc(WiremodPacketSyncIO packet) {
boolean test = this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z) instanceof ChipTileEntity;
System.out.println("Sync Try! " + " " + packet.x + " " + packet.y + " " + packet.z + " " + test);
TileEntity tileentity;
if (this.mc.theWorld.blockExists(packet.x, packet.y, packet.z) && (tileentity = this.mc.theWorld.getBlockTileEntity(packet.x, packet.y, packet.z)) instanceof AbstractWireTileEntity) {
AbstractWireTileEntity wireEntity = (AbstractWireTileEntity)tileentity;
wireEntity.inputs = packet.io;
wireEntity.outputs = packet.oi;
System.out.println("Synced!");
wireEntity.onInventoryChanged();
if(wireEntity instanceof ChipTileEntity){
((ChipTileEntity) wireEntity).mode = packet.mode;
((ChipTileEntity) wireEntity).tickAmount = packet.tickAmount;
}
}
}
@ -53,12 +58,12 @@ public class MixinNetClientHandler implements INetHandler {
}
@Override
public void wiremodHandleWireToolGui(WiremodSettingsGuiPacket wiremodSettingsGuiPacket) {
public void wiremodHandleWireToolSettingsGui(WiremodWireGuiPacket wiremodWireGuiPacket) {
((IEntityPlayer)this.mc.thePlayer).displayGuiWireSettings();
}
@Override
public void wiremodHandleWireToolSettingsGui(WiremodWireGuiPacket wiremodWireGuiPacket) {
((IEntityPlayer)this.mc.thePlayer).displayGuiWireSettings();
public void wiremodHandleSettings(WiremodSettingsPacket wiremodSettingsPacket) {
}
}

@ -47,10 +47,10 @@ public class MixinNetServerHandler implements INetHandler {
AbstractWireTileEntity wireEntity;
if(!packet.backwired) {
wireEntity = (AbstractWireTileEntity) this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x1, packet.y1, packet.z1);
wireEntity.outputs[packet.slot1].wire = new WireConnection(packet.x2, packet.y2, packet.z2, packet.slot1, packet.slot2, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), packet.backwired, packet.red, packet.green, packet.blue, packet.alpha, packet.width);
wireEntity.outputs[packet.slot1].wire = new WireConnection(packet.x2, packet.y2, packet.z2, packet.slot1, packet.slot2, packet.xadd, packet.yadd, packet.zadd, packet.sideadd, packet.backwired, packet.red, packet.green, packet.blue, packet.alpha, packet.width);
} else{
wireEntity = (AbstractWireTileEntity) this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x2, packet.y2, packet.z2);
wireEntity.outputs[packet.slot2].wire = new WireConnection(packet.x1, packet.y1, packet.z1, packet.slot1, packet.slot2, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), packet.backwired, packet.red, packet.green, packet.blue, packet.alpha, packet.width);
wireEntity.outputs[packet.slot2].wire = new WireConnection(packet.x1, packet.y1, packet.z1, packet.slot1, packet.slot2, packet.xadd, packet.yadd, packet.zadd, packet.sideadd, packet.backwired, packet.red, packet.green, packet.blue, packet.alpha, packet.width);
}
wireEntity.update();
wireEntity.updateIO();
@ -73,12 +73,20 @@ public class MixinNetServerHandler implements INetHandler {
}
@Override
public void wiremodHandleWireToolGui(WiremodSettingsGuiPacket wiremodSettingsGuiPacket) {
public void wiremodHandleWireToolSettingsGui(WiremodWireGuiPacket wiremodWireGuiPacket) {
}
@Override
public void wiremodHandleWireToolSettingsGui(WiremodWireGuiPacket wiremodWireGuiPacket) {
public void wiremodHandleSettings(WiremodSettingsPacket packet) {
AbstractWireTileEntity wireEntity = (AbstractWireTileEntity) this.mcServer.getWorldManager(this.playerEntity.dimension).getBlockTileEntity(packet.x, packet.y, packet.z);
switch(packet.mode){
case 0:
wireEntity.outputs[0].floatvalue = packet.value;
break;
case 1:
((ChipTileEntity)wireEntity).tickAmount = (int)packet.value;
break;
}
}
}

@ -13,7 +13,7 @@ public interface INetHandler {
void wiremodHandleWireChips(WiremodWiringPacket wiremodWiringPacket);
void wiremodHandleWireToolGui(WiremodSettingsGuiPacket wiremodSettingsGuiPacket);
void wiremodHandleWireToolSettingsGui(WiremodWireGuiPacket wiremodWireGuiPacket);
void wiremodHandleSettings(WiremodSettingsPacket wiremodSettingsPacket);
}

@ -17,6 +17,8 @@ public class WiremodPacketSyncIO extends Packet {
private int size;
public WiringButton[] io;
public WiringButton[] oi;
public String mode;
public int tickAmount;
public WiremodPacketSyncIO(){
this.isChunkDataPacket = true;
}
@ -29,6 +31,17 @@ public class WiremodPacketSyncIO extends Packet {
this.oi = outputs;
}
public WiremodPacketSyncIO(int xCoord, int yCoord, int zCoord, WiringButton[] inputs, WiringButton[] outputs, String mode, int tickamount) {
this.isChunkDataPacket = true;
this.x = xCoord;
this.y = yCoord;
this.z = zCoord;
this.io = inputs;
this.oi = outputs;
this.mode = mode;
this.tickAmount = tickamount;
}
@Override
public void readPacketData(DataInputStream dataInputStream) throws IOException {
this.x = dataInputStream.readInt();
@ -107,6 +120,12 @@ public class WiremodPacketSyncIO extends Packet {
}
}
}
if(dataInputStream.readBoolean()){
this.mode = dataInputStream.readUTF();
}
if(dataInputStream.readBoolean()){
this.tickAmount = dataInputStream.readInt();
}
}
@Override
@ -259,6 +278,14 @@ public class WiremodPacketSyncIO extends Packet {
dataOutputStream.writeBoolean(false);
size++;
}
dataOutputStream.writeBoolean(this.mode != null);
if(this.mode != null){
dataOutputStream.writeUTF(mode);
}
dataOutputStream.writeBoolean(this.tickAmount != 0);
if(this.tickAmount != 0){
dataOutputStream.writeInt(tickAmount);
}
}
@Override

@ -9,6 +9,7 @@ import java.io.DataOutputStream;
import java.io.IOException;
public class WiremodProgrammerGuiPacket extends Packet {
public int mode;
public int x;
public int y;
public int z;
@ -16,7 +17,8 @@ public class WiremodProgrammerGuiPacket extends Packet {
}
public WiremodProgrammerGuiPacket(int x, int y, int z){
public WiremodProgrammerGuiPacket(int i, int x, int y, int z){
this.mode = i;
this.x = x;
this.y = y;
this.z = z;
@ -24,6 +26,7 @@ public class WiremodProgrammerGuiPacket extends Packet {
@Override
public void readPacketData(DataInputStream dataInputStream) throws IOException {
this.mode = dataInputStream.readInt();
this.x = dataInputStream.readInt();
this.y = dataInputStream.readInt();
this.z = dataInputStream.readInt();
@ -32,6 +35,7 @@ public class WiremodProgrammerGuiPacket extends Packet {
@Override
public void writePacketData(DataOutputStream dataOutputStream) throws IOException {
dataOutputStream.writeInt(this.mode);
dataOutputStream.writeInt(this.x);
dataOutputStream.writeInt(this.y);
dataOutputStream.writeInt(this.z);
@ -44,6 +48,6 @@ public class WiremodProgrammerGuiPacket extends Packet {
@Override
public int getPacketSize() {
return 3 * 4;
return 4 * 4;
}
}

@ -41,7 +41,6 @@ public class WiremodProgrammerPacket extends Packet {
@Override
public void processPacket(NetHandler netHandler) {
System.out.println("AE");
((INetHandler)netHandler).wiremodHandleProgramTile(this);
}

@ -1,34 +0,0 @@
package net.brokenmoon.afloydwiremod.packet;
import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler;
import net.minecraft.src.NetHandler;
import net.minecraft.src.Packet;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class WiremodSettingsGuiPacket extends Packet {
public WiremodSettingsGuiPacket(int xCoord, int yCoord, int zCoord) {
}
@Override
public void readPacketData(DataInputStream dataInputStream) throws IOException {
}
@Override
public void writePacketData(DataOutputStream dataOutputStream) throws IOException {
}
@Override
public void processPacket(NetHandler netHandler) {
}
@Override
public int getPacketSize() {
return 0;
}
}

@ -0,0 +1,63 @@
package net.brokenmoon.afloydwiremod.packet;
import net.brokenmoon.afloydwiremod.mixinInterfaces.INetHandler;
import net.minecraft.src.NetHandler;
import net.minecraft.src.Packet;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class WiremodSettingsPacket extends Packet {
public int mode;
public float value;
public int size;
public int x;
public int y;
public int z;
public WiremodSettingsPacket(){
}
//Settings which changes one variable
public WiremodSettingsPacket(int mode, float amount, int x, int y, int z) {
this.mode = mode;
this.value = amount;
this.x = x;
this.y = y;
this.z = z;
}
@Override
public void readPacketData(DataInputStream dataInputStream) throws IOException {
this.mode = dataInputStream.readInt();
this.x = dataInputStream.readInt();
this.y = dataInputStream.readInt();
this.z = dataInputStream.readInt();
if(mode == 0 || mode == 1){
this.value = dataInputStream.readFloat();
}
}
@Override
public void writePacketData(DataOutputStream dataOutputStream) throws IOException {
dataOutputStream.writeInt(mode);
dataOutputStream.writeInt(x);
dataOutputStream.writeInt(y);
dataOutputStream.writeInt(z);
if(mode == 0 || mode == 1){
dataOutputStream.writeFloat(value);
size += 4;
}
}
@Override
public void processPacket(NetHandler netHandler) {
((INetHandler)netHandler).wiremodHandleSettings(this);
}
@Override
public int getPacketSize() {
return 16 + size;
}
}

@ -31,7 +31,6 @@ public class WiremodWiringPacket extends Packet {
public float width = 0.5f;
private int size = 0;
public WiremodWiringPacket(){
System.out.println("Z");
}
public WiremodWiringPacket(int x1, int y1, int z1, int x2, int y2, int z2, int slot1, int slot2, ArrayList<Integer> xadd, ArrayList<Integer> yadd, ArrayList<Integer> zadd, ArrayList<Integer> sideadd, boolean b, float red, float green, float blue, float alpha, float width) {
this.type = 0;
@ -53,7 +52,6 @@ public class WiremodWiringPacket extends Packet {
this.green = green;
this.alpha = alpha;
this.width = width;
System.out.println("X");
}
public WiremodWiringPacket(int x1, int y1, int z1, int x2, int y2, int z2, int slot1, int slot2) {
@ -86,7 +84,19 @@ public class WiremodWiringPacket extends Packet {
alpha = dataInputStream.readFloat();
width = dataInputStream.readFloat();
boolean isxadd = dataInputStream.readBoolean();
System.out.println("C");
xadd = new ArrayList<>();
yadd = new ArrayList<>();
zadd = new ArrayList<>();
sideadd = new ArrayList<>();
if(isxadd){
int length = dataInputStream.readInt();
for(int i = 0; i < length; i++) {
xadd.add(dataInputStream.readInt());
yadd.add(dataInputStream.readInt());
zadd.add(dataInputStream.readInt());
sideadd.add(dataInputStream.readInt());
}
}
}
@Override
@ -107,6 +117,20 @@ public class WiremodWiringPacket extends Packet {
dataOutputStream.writeFloat(alpha);
dataOutputStream.writeFloat(width);
dataOutputStream.writeBoolean(xadd != null);
if(xadd != null){
dataOutputStream.writeInt(xadd.size());
size = 4;
for(int i = 0; i < xadd.size(); i++){
dataOutputStream.writeInt(xadd.get(i));
size += 4;
dataOutputStream.writeInt(yadd.get(i));
size += 4;
dataOutputStream.writeInt(zadd.get(i));
size += 4;
dataOutputStream.writeInt(sideadd.get(i));
size += 4;
}
}
}
@Override
@ -116,6 +140,6 @@ public class WiremodWiringPacket extends Packet {
@Override
public int getPacketSize() {
return 14 * 4 + 2;
return 14 * 4 + 2 + size;
}
}

@ -18,7 +18,7 @@ public class TERWire extends TileEntitySpecialRenderer {
public void renderWireAt(AbstractWireTileEntity wireEntity, double x, double y, double z, float weird) {
if(wireEntity.outputs != null){
for(int it = 0; it < wireEntity.outputs.length; it++){
if(wireEntity.outputs[it] != null && wireEntity.outputs[it].wire != null && wireEntity.outputs[it].wire.isMade){
if(wireEntity.outputs[it] != null && wireEntity.outputs[it].wire != null && wireEntity.outputs[it].wire.isMade && Minecraft.getMinecraft().theWorld.getBlockTileEntity(wireEntity.outputs[it].wire.x, wireEntity.outputs[it].wire.y, wireEntity.outputs[it].wire.z) instanceof AbstractWireTileEntity){
this.renderLineBetweenTwoPoints(
wireEntity.xCoord, wireEntity.yCoord, wireEntity.zCoord,
wireEntity.outputs[it].wire.x, wireEntity.outputs[it].wire.y, wireEntity.outputs[it].wire.z,

@ -2,7 +2,9 @@ package net.brokenmoon.afloydwiremod.tileentity;
import net.brokenmoon.afloydwiremod.api.AbstractWireTileEntity;
import net.brokenmoon.afloydwiremod.gui.WiringButton;
import net.brokenmoon.afloydwiremod.packet.WiremodPacketSyncIO;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.Packet;
public class ChipTileEntity extends AbstractWireTileEntity {
public String mode = "none";
@ -199,7 +201,6 @@ public class ChipTileEntity extends AbstractWireTileEntity {
}
private void doAND() {
System.out.println("ae");
outputs[0].floatvalue = inputs[0].floatvalue != 0 && inputs[1].floatvalue != 0 ? 1.0f : 0.0f;
}
@ -377,4 +378,9 @@ public class ChipTileEntity extends AbstractWireTileEntity {
update();
}
}
@Override
public Packet getDescriptionPacket() {
return new WiremodPacketSyncIO(this.xCoord, this.yCoord, this.zCoord, inputs, outputs, mode, tickAmount);
}
}

Loading…
Cancel
Save