Search in sources :

Example 36 with AMDataWriter

use of am2.network.AMDataWriter in project ArsMagica2 by Mithion.

the class ParticleManagerServer method spawn.

public Object spawn(World world, String name, double x, double y, double z, double targetX, double targetY, double targetZ) {
    if (!world.isRemote) {
        AMDataWriter writer = new AMDataWriter();
        writer.add(PKT_ARC_PT_PT);
        writer.add(name);
        writer.add(x);
        writer.add(y);
        writer.add(z);
        writer.add(targetX);
        writer.add(targetY);
        writer.add(targetZ);
        AMNetHandler.INSTANCE.sendPacketToAllClientsNear(world.provider.dimensionId, x, y, z, 32, AMPacketIDs.PARTICLE_SPAWN_SPECIAL, writer.generate());
    }
    return null;
}
Also used : AMDataWriter(am2.network.AMDataWriter)

Example 37 with AMDataWriter

use of am2.network.AMDataWriter in project ArsMagica2 by Mithion.

the class ParticleManagerServer method BeamFromPointToPoint.

public Object BeamFromPointToPoint(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, int color) {
    if (!world.isRemote) {
        //send a packet to all clients telling them to spawn this beam!
        AMDataWriter writer = new AMDataWriter();
        //what kind of beam are we doing?
        writer.add(PKT_BEAM_PT_PT);
        writer.add(startX);
        writer.add(startY);
        writer.add(startZ);
        writer.add(endX);
        writer.add(endY);
        writer.add(endZ);
        writer.add(color);
        AMNetHandler.INSTANCE.sendPacketToAllClientsNear(world.provider.dimensionId, startX, startY, startZ, 32, AMPacketIDs.PARTICLE_SPAWN_SPECIAL, writer.generate());
    }
    return null;
}
Also used : AMDataWriter(am2.network.AMDataWriter)

Example 38 with AMDataWriter

use of am2.network.AMDataWriter in project ArsMagica2 by Mithion.

the class ExtendedProperties method getUpdateData.

public byte[] getUpdateData() {
    AMDataWriter writer = new AMDataWriter();
    writer.add(this.entity.getEntityId());
    writer.add(this.updateFlags);
    if ((this.updateFlags & UPD_BITFLAG) == UPD_BITFLAG) {
        writer.add(this.bitFlag);
    }
    if ((this.updateFlags & UPD_CURRENT_MANA_FATIGUE) == UPD_CURRENT_MANA_FATIGUE) {
        writer.add(this.currentMana);
        writer.add(this.currentFatigue);
    }
    if ((this.updateFlags & UPD_MAGIC_LEVEL) == UPD_MAGIC_LEVEL) {
        writer.add(this.magicLevel);
        writer.add(this.magicXP);
    }
    if ((this.updateFlags & UPD_MARK) == UPD_MARK) {
        writer.add(this.markX);
        writer.add(this.markY);
        writer.add(this.markZ);
        writer.add(this.markDimension);
        writer.add(this.getMarkSet());
    }
    if ((this.updateFlags & UPD_MAX_MANA_FATIGUE) == UPD_MAX_MANA_FATIGUE) {
        writer.add(this.maxMana);
        writer.add(this.maxFatigue);
    }
    if ((this.updateFlags & UPD_NUM_SUMMONS) == UPD_NUM_SUMMONS) {
        writer.add(this.numSummons);
    }
    if ((this.updateFlags & UPD_BETA_PARTICLES) == UPD_BETA_PARTICLES && entity instanceof EntityPlayer && AMCore.proxy.playerTracker.hasAA((EntityPlayer) entity)) {
        writer.add(this.getAuraIndex());
        writer.add(this.getAuraBehaviour());
        writer.add(this.getAuraScale());
        writer.add(this.getAuraAlpha());
        writer.add(this.getAuraColorRandomize());
        writer.add(this.getAuraColorDefault());
        writer.add(this.getAuraColor());
        writer.add(this.getAuraDelay());
        writer.add(this.getAuraQuantity());
        writer.add(this.getAuraSpeed());
    }
    if ((this.updateFlags & UPD_CONTINGENCY) == UPD_CONTINGENCY) {
        writer.add(this.contingencyType.ordinal());
        if (this.contingencyType != ContingencyTypes.NONE) {
            writer.add(this.contingencyStack);
        }
    }
    if ((this.updateFlags & UPD_MANALINK) == UPD_MANALINK) {
        writer.add(this.manaLinks.size());
        for (ManaLinkEntry entry : this.manaLinks) writer.add(entry.entityID);
    }
    if ((this.updateFlags & UPD_DISABLE_GRAVITY) == UPD_DISABLE_GRAVITY) {
        writer.add(this.disableGravity);
    }
    this.updateFlags = 0;
    this.forcingSync = false;
    return writer.generate();
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) AMDataWriter(am2.network.AMDataWriter)

Example 39 with AMDataWriter

use of am2.network.AMDataWriter in project ArsMagica2 by Mithion.

the class BlockKeystoneChest method onBlockActivated.

@Override
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
    super.onBlockActivated(world, par2, par3, par4, entityplayer, par6, par7, par8, par9);
    if (!world.isRemote) {
        TileEntity myTE = world.getTileEntity(par2, par3, par4);
        if (!(myTE instanceof TileEntityKeystoneChest))
            return false;
        TileEntityKeystoneChest te = (TileEntityKeystoneChest) myTE;
        ItemStack currentItem = entityplayer.getCurrentEquippedItem();
        if (KeystoneUtilities.HandleKeystoneRecovery(entityplayer, te)) {
            return true;
        }
        if (!KeystoneUtilities.instance.canPlayerAccess(te, entityplayer, KeystoneAccessType.USE)) {
            return true;
        }
        /*PacketDispatcher.sendPacketToPlayer(AMCore.instance.proxy.packetSender.createArsMagicaClientPacket(AMPacketIDs.KEYSTONE_CHEST_GUI_OPEN,
					new AMDataWriter().add(par2).add(par3).add(par4).generate()), (Player)entityplayer);*/
        FMLNetworkHandler.openGui(entityplayer, AMCore.instance, ArsMagicaGuiIdList.GUI_KEYSTONE_CHEST, world, par2, par3, par4);
        return true;
    } else {
        return true;
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ItemStack(net.minecraft.item.ItemStack) TileEntityKeystoneChest(am2.blocks.tileentities.TileEntityKeystoneChest)

Example 40 with AMDataWriter

use of am2.network.AMDataWriter in project ArsMagica2 by Mithion.

the class AuraCustomizationMenu method onGuiClosed.

@Override
public void onGuiClosed() {
    AMDataWriter writer = new AMDataWriter();
    writer.add(AMCore.config.getAuraIndex());
    writer.add(AMCore.config.getAuraBehaviour());
    writer.add(AMCore.config.getAuraScale());
    writer.add(AMCore.config.getAuraAlpha());
    writer.add(AMCore.config.getAuraColorRandom());
    writer.add(AMCore.config.getAuraColorDefault());
    writer.add(AMCore.config.getAuraColor());
    writer.add(AMCore.config.getAuraDelay());
    writer.add(AMCore.config.getAuraQuantity());
    writer.add(AMCore.config.getAuraSpeed());
    byte[] data = writer.generate();
    AMNetHandler.INSTANCE.sendPacketToServer(AMPacketIDs.SYNC_BETA_PARTICLES, data);
    AMCore.config.save();
    super.onGuiClosed();
}
Also used : AMDataWriter(am2.network.AMDataWriter)

Aggregations

AMDataWriter (am2.network.AMDataWriter)38 ItemStack (net.minecraft.item.ItemStack)6 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 AMVector3 (am2.api.math.AMVector3)3 TileEntity (net.minecraft.tileentity.TileEntity)3 SkillLearnedEvent (am2.api.events.SkillLearnedEvent)2 ISpellShape (am2.api.spell.component.interfaces.ISpellShape)2 KeystoneCombination (am2.items.ItemKeystone.KeystoneCombination)2 AMDataReader (am2.network.AMDataReader)2 ExtendedProperties (am2.playerextensions.ExtendedProperties)2 KeyValuePair (am2.utility.KeyValuePair)2 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)2 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)2 SpellCastingEvent (am2.api.events.SpellCastingEvent)1 IPowerNode (am2.api.power.IPowerNode)1 ItemSpellBase (am2.api.spell.ItemSpellBase)1 ISpellComponent (am2.api.spell.component.interfaces.ISpellComponent)1 ISpellModifier (am2.api.spell.component.interfaces.ISpellModifier)1 SkillPointTypes (am2.api.spell.enums.SkillPointTypes)1 SpellCastResult (am2.api.spell.enums.SpellCastResult)1