Search in sources :

Example 11 with AMDataReader

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());
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityArmorImbuer(am2.blocks.tileentities.TileEntityArmorImbuer)

Example 12 with AMDataReader

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);
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) PowerNodeEntry(am2.power.PowerNodeEntry) IPowerNode(am2.api.power.IPowerNode)

Example 13 with AMDataReader

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);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityInscriptionTable(am2.blocks.tileentities.TileEntityInscriptionTable) World(net.minecraft.world.World)

Example 14 with AMDataReader

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);
    }
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) ContainerSpellCustomization(am2.containers.ContainerSpellCustomization)

Example 15 with AMDataReader

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;
    }
}
Also used : AMDataReader(am2.network.AMDataReader)

Aggregations

TileEntity (net.minecraft.tileentity.TileEntity)14 AMDataReader (am2.network.AMDataReader)10 Entity (net.minecraft.entity.Entity)4 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 AMVector3 (am2.api.math.AMVector3)2 IPowerNode (am2.api.power.IPowerNode)2 AMDataWriter (am2.network.AMDataWriter)2 ItemStack (net.minecraft.item.ItemStack)2 World (net.minecraft.world.World)2 ISpellModifier (am2.api.spell.component.interfaces.ISpellModifier)1 TileEntityArmorImbuer (am2.blocks.tileentities.TileEntityArmorImbuer)1 TileEntityCalefactor (am2.blocks.tileentities.TileEntityCalefactor)1 TileEntityCraftingAltar (am2.blocks.tileentities.TileEntityCraftingAltar)1 TileEntityInscriptionTable (am2.blocks.tileentities.TileEntityInscriptionTable)1 TileEntityLectern (am2.blocks.tileentities.TileEntityLectern)1 TileEntityMagiciansWorkbench (am2.blocks.tileentities.TileEntityMagiciansWorkbench)1 TileEntityObelisk (am2.blocks.tileentities.TileEntityObelisk)1 TileEntityParticleEmitter (am2.blocks.tileentities.TileEntityParticleEmitter)1 IArsMagicaBoss (am2.bosses.IArsMagicaBoss)1