use of am2.network.AMDataReader in project ArsMagica2 by Mithion.
the class AMPacketProcessorServer method handleImbueArmor.
private void handleImbueArmor(byte[] data, EntityPlayerMP player) {
AMDataReader rdr = new AMDataReader(data, false);
TileEntity te = player.worldObj.getTileEntity(rdr.getInt(), rdr.getInt(), rdr.getInt());
if (te != null && te instanceof TileEntityArmorImbuer) {
((TileEntityArmorImbuer) te).imbueCurrentArmor(rdr.getString());
}
}
use of am2.network.AMDataReader in project ArsMagica2 by Mithion.
the class AMPacketProcessorClient method handleRcvPowerPaths.
private void handleRcvPowerPaths(byte[] data) {
AMDataReader rdr = new AMDataReader(data, false);
byte bite = rdr.getByte();
NBTTagCompound compound = rdr.getNBTTagCompound();
if (bite == 0) {
PowerNodeEntry pnd = PowerNodeRegistry.For(Minecraft.getMinecraft().theWorld).parseFromNBT(compound);
AMCore.proxy.receivePowerPathVisuals(pnd.getNodePaths());
} else if (bite == 1) {
int x = rdr.getInt();
int y = rdr.getInt();
int z = rdr.getInt();
AMCore.proxy.setTrackedPowerCompound((NBTTagCompound) compound.copy());
TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(x, y, z);
if (te != null && te instanceof IPowerNode)
PowerNodeRegistry.For(Minecraft.getMinecraft().theWorld).setDataCompoundForNode((IPowerNode) te, compound);
}
}
use of am2.network.AMDataReader in project ArsMagica2 by Mithion.
the class AMPacketProcessorServer method handleInscriptionTableUpdate.
private void handleInscriptionTableUpdate(byte[] data, EntityPlayerMP player) {
World world = player.worldObj;
AMDataReader rdr = new AMDataReader(data, false);
TileEntity te = world.getTileEntity(rdr.getInt(), rdr.getInt(), rdr.getInt());
if (te == null || !(te instanceof TileEntityInscriptionTable))
return;
((TileEntityInscriptionTable) te).HandleUpdatePacket(rdr.getRemainingBytes());
world.markBlockForUpdate(te.xCoord, te.yCoord, te.zCoord);
}
use of am2.network.AMDataReader in project ArsMagica2 by Mithion.
the class AMPacketProcessorServer method handleSpellCustomize.
private void handleSpellCustomize(byte[] data, EntityPlayerMP player) {
AMDataReader rdr = new AMDataReader(data, false);
int entityID = rdr.getInt();
EntityLivingBase ent = getEntityByID(entityID);
if (player == null) {
return;
}
int IIconIndex = rdr.getInt();
String name = rdr.getString();
if (player.openContainer instanceof ContainerSpellCustomization) {
((ContainerSpellCustomization) player.openContainer).setNameAndIndex(name, IIconIndex);
}
}
use of am2.network.AMDataReader in project ArsMagica2 by Mithion.
the class TileEntityCraftingAltar method HandleUpdatePacket.
public void HandleUpdatePacket(byte[] remainingBytes) {
AMDataReader rdr = new AMDataReader(remainingBytes, false);
byte subID = rdr.getByte();
switch(subID) {
case FULL_UPDATE:
this.isCrafting = rdr.getBoolean();
this.currentKey = rdr.getInt();
this.allAddedItems.clear();
this.currentAddedItems.clear();
int itemCount = rdr.getInt();
for (int i = 0; i < itemCount; ++i) this.allAddedItems.add(rdr.getItemStack());
break;
case CRAFTING_CHANGED:
this.setCrafting(rdr.getBoolean());
break;
case COMPONENT_ADDED:
this.allAddedItems.add(rdr.getItemStack());
break;
}
}
Aggregations