use of am2.network.AMDataReader in project ArsMagica2 by Mithion.
the class AMPacketProcessorServer method handleMBenchLockRecipe.
private void handleMBenchLockRecipe(byte[] data, EntityPlayerMP player) {
AMDataReader rdr = new AMDataReader(data, false);
int x = rdr.getInt();
int y = rdr.getInt();
int z = rdr.getInt();
TileEntity te = player.worldObj.getTileEntity(x, y, z);
if (te != null && te instanceof TileEntityMagiciansWorkbench) {
((TileEntityMagiciansWorkbench) te).setRecipeLocked(rdr.getInt(), rdr.getBoolean());
te.getWorldObj().markBlockForUpdate(te.xCoord, te.yCoord, te.zCoord);
}
}
use of am2.network.AMDataReader in project ArsMagica2 by Mithion.
the class AMPacketProcessorServer method handleSpellBookChangeActiveSlot.
private void handleSpellBookChangeActiveSlot(byte[] data, EntityPlayerMP player) {
AMDataReader rdr = new AMDataReader(data, false);
byte subID = rdr.getByte();
int entityID = rdr.getInt();
int inventorySlot = rdr.getInt();
ItemStack stack = player.inventory.getStackInSlot(inventorySlot);
if (stack == null || !(stack.getItem() instanceof ItemSpellBook))
return;
int newIndex = 0;
if (subID == ItemSpellBook.ID_NEXT_SPELL)
newIndex = ItemsCommonProxy.spellBook.SetNextSlot(stack);
else if (subID == ItemSpellBook.ID_PREV_SPELL)
newIndex = ItemsCommonProxy.spellBook.SetPrevSlot(stack);
else
return;
}
use of am2.network.AMDataReader in project ArsMagica2 by Mithion.
the class AMPacketProcessorClient method handleEntityActionUpdate.
private void handleEntityActionUpdate(byte[] data, EntityPlayer player) {
AMDataReader rdr = new AMDataReader(data, false);
int entityID = rdr.getInt();
int actionOrdinal = rdr.getInt();
Entity ent = player.worldObj.getEntityByID(entityID);
if (ent == null || ent.isDead || !(ent instanceof IArsMagicaBoss))
return;
((IArsMagicaBoss) ent).setCurrentAction(BossActions.values()[actionOrdinal]);
}
use of am2.network.AMDataReader in project ArsMagica2 by Mithion.
the class AMPacketProcessorClient method handleLecternData.
private void handleLecternData(byte[] data) {
AMDataReader rdr = new AMDataReader(data, false);
TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(rdr.getInt(), rdr.getInt(), rdr.getInt());
if (te == null || !(te instanceof TileEntityLectern))
return;
if (rdr.getBoolean())
((TileEntityLectern) te).setStack(rdr.getItemStack());
else
((TileEntityLectern) te).setStack(null);
}
use of am2.network.AMDataReader in project ArsMagica2 by Mithion.
the class AMPacketProcessorClient method handleObeliskData.
private void handleObeliskData(byte[] remaining) {
AMDataReader rdr = new AMDataReader(remaining, false);
TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(rdr.getInt(), rdr.getInt(), rdr.getInt());
if (te == null || !(te instanceof TileEntityObelisk))
return;
((TileEntityObelisk) te).handlePacket(rdr.getRemainingBytes());
}
Aggregations