mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-26 15:03:07 +00:00
Update buildscript & spotlessApply (#78)
* Update buildscript & spotlessApply * Add mapping version
This commit is contained in:
1 parent
f272840987
commit
cf41b89ae4
851 files changed
+95348
-92599
No files matched your search
@@ -1,62 +1,60 @@
|
||||
package crazypants.enderio.machine;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class PacketRedstoneMode implements IMessage, IMessageHandler<PacketRedstoneMode, IMessage> {
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private RedstoneControlMode mode;
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private RedstoneControlMode mode;
|
||||
|
||||
public PacketRedstoneMode() {
|
||||
}
|
||||
public PacketRedstoneMode() {}
|
||||
|
||||
public PacketRedstoneMode(IRedstoneModeControlable cont, int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
mode = cont.getRedstoneControlMode();
|
||||
}
|
||||
|
||||
public PacketRedstoneMode(AbstractMachineEntity ent) {
|
||||
x = ent.xCoord;
|
||||
y = ent.yCoord;
|
||||
z = ent.zCoord;
|
||||
mode = ent.getRedstoneControlMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(x);
|
||||
buf.writeInt(y);
|
||||
buf.writeInt(z);
|
||||
buf.writeShort((short) mode.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
x = buf.readInt();
|
||||
y = buf.readInt();
|
||||
z = buf.readInt();
|
||||
short ordinal = buf.readShort();
|
||||
mode = RedstoneControlMode.values()[ordinal];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketRedstoneMode message, MessageContext ctx) {
|
||||
EntityPlayer player = ctx.getServerHandler().playerEntity;
|
||||
TileEntity te = player.worldObj.getTileEntity(message.x, message.y, message.z);
|
||||
if(te instanceof IRedstoneModeControlable) {
|
||||
IRedstoneModeControlable me = (IRedstoneModeControlable) te;
|
||||
me.setRedstoneControlMode(message.mode);
|
||||
public PacketRedstoneMode(IRedstoneModeControlable cont, int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
mode = cont.getRedstoneControlMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PacketRedstoneMode(AbstractMachineEntity ent) {
|
||||
x = ent.xCoord;
|
||||
y = ent.yCoord;
|
||||
z = ent.zCoord;
|
||||
mode = ent.getRedstoneControlMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeInt(x);
|
||||
buf.writeInt(y);
|
||||
buf.writeInt(z);
|
||||
buf.writeShort((short) mode.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
x = buf.readInt();
|
||||
y = buf.readInt();
|
||||
z = buf.readInt();
|
||||
short ordinal = buf.readShort();
|
||||
mode = RedstoneControlMode.values()[ordinal];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketRedstoneMode message, MessageContext ctx) {
|
||||
EntityPlayer player = ctx.getServerHandler().playerEntity;
|
||||
TileEntity te = player.worldObj.getTileEntity(message.x, message.y, message.z);
|
||||
if (te instanceof IRedstoneModeControlable) {
|
||||
IRedstoneModeControlable me = (IRedstoneModeControlable) te;
|
||||
me.setRedstoneControlMode(message.mode);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user