Search in sources :

Example 16 with AMDataReader

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

Example 17 with AMDataReader

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;
}
Also used : ItemStack(net.minecraft.item.ItemStack) ItemSpellBook(am2.items.ItemSpellBook)

Example 18 with AMDataReader

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]);
}
Also used : Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) IArsMagicaBoss(am2.bosses.IArsMagicaBoss)

Example 19 with AMDataReader

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

Example 20 with AMDataReader

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

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