Finish autochisel animation

This commit is contained in:
tterrag1098 committed 2015-01-11 18:23:07 -05:00
1 parent 89a10a5ca6
commit ea98671cea
5 files changed
+72 -29

No files matched your search

@@ -1,6 +1,7 @@
package com.cricketcraft.chisel.network;
import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.network.message.MessageAutoChisel;
import com.cricketcraft.chisel.network.message.MessageChiselSound;
import com.cricketcraft.chisel.network.message.MessageSlotUpdate;
@@ -13,8 +14,9 @@ public class PacketHandler {
public static void init() {
int id = 0;
INSTANCE.registerMessage(MessageChiselSound.Handler.class, MessageChiselSound.class, id++, Side.CLIENT);
INSTANCE.registerMessage(MessageSlotUpdate.Handler.class, MessageSlotUpdate.class, id++, Side.CLIENT);
INSTANCE.registerMessage(MessageAutoChisel.Handler.class, MessageAutoChisel.class, id++, Side.CLIENT);
}
}
@@ -6,42 +6,37 @@ import net.minecraft.block.Block;
import com.cricketcraft.chisel.carving.CarvingVariation;
import com.cricketcraft.chisel.client.GeneralChiselClient;
import com.cricketcraft.chisel.item.chisel.ItemChisel;
import com.cricketcraft.chisel.network.message.base.MessageCoords;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class MessageChiselSound implements IMessage {
public class MessageChiselSound extends MessageCoords {
public MessageChiselSound() {
super();
}
private int x, y, z;
private int block;
private byte meta;
public MessageChiselSound(int x, int y, int z, CarvingVariation v) {
this.x = x;
this.y = y;
this.z = z;
super(x, y, z);
this.block = Block.getIdFromBlock(v.block);
this.meta = (byte) v.meta;
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
super.toBytes(buf);
buf.writeInt(block);
buf.writeByte(meta);
}
@Override
public void fromBytes(ByteBuf buf) {
x = buf.readInt();
y = buf.readInt();
z = buf.readInt();
super.fromBytes(buf);
block = buf.readInt();
meta = buf.readByte();
}
@@ -1,47 +1,42 @@
package com.cricketcraft.chisel.network.message;
import com.cricketcraft.chisel.Chisel;
import io.netty.buffer.ByteBuf;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import com.cricketcraft.chisel.Chisel;
import com.cricketcraft.chisel.network.message.base.MessageCoords;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class MessageSlotUpdate implements IMessage {
public class MessageSlotUpdate extends MessageCoords {
public MessageSlotUpdate() {
}
private int x, y, z;
private int slot;
private ItemStack stack;
public MessageSlotUpdate(TileEntity te, int slot, ItemStack stack) {
this.x = te.xCoord;
this.y = te.yCoord;
this.z = te.zCoord;
super(te);
this.slot = slot;
this.stack = stack;
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
super.toBytes(buf);
buf.writeInt(slot);
ByteBufUtils.writeItemStack(buf, stack);
}
@Override
public void fromBytes(ByteBuf buf) {
this.x = buf.readInt();
this.y = buf.readInt();
this.z = buf.readInt();
super.fromBytes(buf);
this.slot = buf.readInt();
this.stack = ByteBufUtils.readItemStack(buf);
}