use of net.minecraft.entity.EntityLivingBase 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 net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class AMPacketProcessorClient method handleSyncProps.
private void handleSyncProps(byte[] data) {
AMDataReader rdr = new AMDataReader(data, false);
int entityID = rdr.getInt();
EntityLivingBase ent = AMCore.proxy.getEntityByID(entityID);
if (ent == null)
return;
if (!ExtendedProperties.For(ent).handleDataPacket(data)) {
LogHelper.error("Critical Error Handling Sync Packet!");
}
}
use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class AMPacketProcessorClient method handleVelocityAdd.
private void handleVelocityAdd(byte[] data) {
AMDataReader rdr = new AMDataReader(data, false);
int entityID = rdr.getInt();
double velX = rdr.getDouble();
double velY = rdr.getDouble();
double velZ = rdr.getDouble();
Entity ent = AMCore.proxy.getEntityByID(entityID);
EntityLivingBase localPlayer = Minecraft.getMinecraft().thePlayer;
//this is only really required for the local player, as other entities seem to work across the network.
if (ent.getEntityId() != localPlayer.getEntityId()) {
return;
}
if (localPlayer.motionY > 0)
return;
localPlayer.addVelocity(velX, velY, velZ);
}
use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class AMPacketProcessorClient method handleRequestBetaParticles.
private void handleRequestBetaParticles(byte[] data) {
AMDataReader rdr = new AMDataReader(data, false);
int entityID = rdr.getInt();
byte[] expropData = rdr.getRemainingBytes();
EntityLivingBase ent = AMCore.proxy.getEntityByID(entityID);
if (ent == null)
return;
ExtendedProperties.For(ent).readAuraData(expropData);
}
use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class Appropriation method applyEffectEntity.
@Override
public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target) {
if (target instanceof EntityPlayer || target instanceof IBossDisplayData)
return false;
if (!(target instanceof EntityLivingBase))
return false;
for (Class clazz : AMCore.config.getAppropriationMobBlacklist()) if (target.getClass() == clazz)
return false;
if (!(caster instanceof EntityPlayer))
return false;
ItemStack originalSpellStack = getOriginalSpellStack((EntityPlayer) caster);
if (originalSpellStack == null)
return false;
if (!world.isRemote) {
if (originalSpellStack.stackTagCompound.hasKey(storageKey)) {
restore((EntityPlayer) caster, world, originalSpellStack, (int) target.posX, (int) target.posY, (int) target.posZ, target.posX, target.posY + target.getEyeHeight(), target.posZ);
} else {
NBTTagCompound data = new NBTTagCompound();
data.setString("class", target.getClass().getName());
data.setString(storageType, "ent");
NBTTagCompound targetData = new NBTTagCompound();
target.writeToNBT(targetData);
data.setTag("targetNBT", targetData);
originalSpellStack.stackTagCompound.setTag(storageKey, data);
setOriginalSpellStackData((EntityPlayer) caster, originalSpellStack);
target.setDead();
}
}
return true;
}
Aggregations