use of am2.blocks.tileentities.TileEntityAstralBarrier in project ArsMagica2 by Mithion.
the class Blink method applyEffectEntity.
@Override
public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target) {
if (!(target instanceof EntityLivingBase))
return false;
if (world.isRemote) {
ExtendedProperties.For((EntityLivingBase) target).astralBarrierBlocked = false;
}
double distance = GetTeleportDistance(stack, caster, target);
double motionX = -MathHelper.sin((target.rotationYaw / 180F) * 3.141593F) * MathHelper.cos((target.rotationPitch / 180F) * 3.141593F) * distance;
double motionZ = MathHelper.cos((target.rotationYaw / 180F) * 3.141593F) * MathHelper.cos((target.rotationPitch / 180F) * 3.141593F) * distance;
double motionY = -MathHelper.sin((target.rotationPitch / 180F) * 3.141593F) * distance;
double d = motionX, d1 = motionY, d2 = motionZ;
float f2 = MathHelper.sqrt_double(d * d + d1 * d1 + d2 * d2);
d /= f2;
d1 /= f2;
d2 /= f2;
d *= distance;
d1 *= distance;
d2 *= distance;
motionX = d;
motionY = d1;
motionZ = d2;
float f3 = MathHelper.sqrt_double(d * d + d2 * d2);
ArrayList<Long> keystoneKeys = KeystoneUtilities.instance.GetKeysInInvenory((EntityLivingBase) target);
double newX = target.posX + motionX;
double newZ = target.posZ + motionZ;
double newY = target.posY + motionY;
boolean coordsValid = false;
boolean astralBarrierBlocked = false;
TileEntityAstralBarrier finalBlocker = null;
while (!coordsValid && distance > 0) {
if (caster.isPotionActive(BuffList.astralDistortion.id)) {
coordsValid = true;
newX = caster.posX;
newY = caster.posY;
newZ = caster.posZ;
}
TileEntityAstralBarrier blocker = DimensionUtilities.GetBlockingAstralBarrier(world, (int) newX, (int) newY, (int) newZ, keystoneKeys);
while (blocker != null) {
finalBlocker = blocker;
astralBarrierBlocked = true;
int dx = (int) newX - blocker.xCoord;
int dy = (int) newY - blocker.yCoord;
int dz = (int) newZ - blocker.zCoord;
int sqDist = (dx * dx + dy * dy + dz * dz);
int delta = blocker.getRadius() - (int) Math.floor(Math.sqrt(sqDist));
distance -= delta;
if (distance < 0)
break;
motionX = -MathHelper.sin((target.rotationYaw / 180F) * 3.141593F) * MathHelper.cos((target.rotationPitch / 180F) * 3.141593F) * distance;
motionZ = MathHelper.cos((target.rotationYaw / 180F) * 3.141593F) * MathHelper.cos((target.rotationPitch / 180F) * 3.141593F) * distance;
motionY = -MathHelper.sin((target.rotationPitch / 180F) * 3.141593F) * distance;
d = motionX;
d1 = motionY;
d2 = motionZ;
f2 = MathHelper.sqrt_double(d * d + d1 * d1 + d2 * d2);
d /= f2;
d1 /= f2;
d2 /= f2;
d *= distance;
d1 *= distance;
d2 *= distance;
motionX = d;
motionY = d1;
motionZ = d2;
f3 = MathHelper.sqrt_double(d * d + d2 * d2);
newX = target.posX + motionX;
newZ = target.posZ + motionZ;
newY = target.posY + motionY;
blocker = DimensionUtilities.GetBlockingAstralBarrier(world, (int) newX, (int) newY, (int) newZ, keystoneKeys);
}
if (distance < 0) {
coordsValid = false;
break;
}
//rounding combinations, normal y
if (CheckCoords(world, (int) Math.floor(newX), (int) newY, (int) Math.floor(newZ))) {
newX = Math.floor(newX) + 0.5;
newZ = Math.floor(newZ) + 0.5;
coordsValid = true;
break;
} else if (CheckCoords(world, (int) Math.floor(newX), (int) newY, (int) Math.ceil(newZ))) {
newX = Math.floor(newX) + 0.5;
newZ = Math.ceil(newZ) + 0.5;
coordsValid = true;
break;
} else if (CheckCoords(world, (int) Math.ceil(newX), (int) newY, (int) Math.floor(newZ))) {
newX = Math.ceil(newX) + 0.5;
newZ = Math.floor(newZ) + 0.5;
coordsValid = true;
break;
} else if (CheckCoords(world, (int) Math.ceil(newX), (int) newY, (int) Math.ceil(newZ))) {
newX = Math.ceil(newX) + 0.5;
newZ = Math.ceil(newZ) + 0.5;
coordsValid = true;
break;
}
//rounding combinations, y-1
if (CheckCoords(world, (int) Math.floor(newX), (int) newY - 1, (int) Math.floor(newZ))) {
newX = Math.floor(newX) + 0.5;
newZ = Math.floor(newZ) + 0.5;
newY--;
coordsValid = true;
break;
} else if (CheckCoords(world, (int) Math.floor(newX), (int) newY - 1, (int) Math.ceil(newZ))) {
newX = Math.floor(newX) + 0.5;
newZ = Math.ceil(newZ) + 0.5;
newY--;
coordsValid = true;
break;
} else if (CheckCoords(world, (int) Math.ceil(newX), (int) newY - 1, (int) Math.floor(newZ))) {
newX = Math.ceil(newX) + 0.5;
newZ = Math.floor(newZ) + 0.5;
newY--;
coordsValid = true;
break;
} else if (CheckCoords(world, (int) Math.ceil(newX), (int) newY - 1, (int) Math.ceil(newZ))) {
newX = Math.ceil(newX) + 0.5;
newZ = Math.ceil(newZ) + 0.5;
newY--;
coordsValid = true;
break;
}
//rounding combinations, y+1
if (CheckCoords(world, (int) Math.floor(newX), (int) newY + 1, (int) Math.floor(newZ))) {
newX = Math.floor(newX) + 0.5;
newZ = Math.floor(newZ) + 0.5;
newY++;
coordsValid = true;
break;
} else if (CheckCoords(world, (int) Math.floor(newX), (int) newY + 1, (int) Math.ceil(newZ))) {
newX = Math.floor(newX) + 0.5;
newZ = Math.ceil(newZ) + 0.5;
newY++;
coordsValid = true;
break;
} else if (CheckCoords(world, (int) Math.ceil(newX), (int) newY + 1, (int) Math.floor(newZ))) {
newX = Math.ceil(newX) + 0.5;
newZ = Math.floor(newZ) + 0.5;
newY++;
coordsValid = true;
break;
} else if (CheckCoords(world, (int) Math.ceil(newX), (int) newY + 1, (int) Math.ceil(newZ))) {
newX = Math.ceil(newX) + 0.5;
newZ = Math.ceil(newZ) + 0.5;
newY++;
coordsValid = true;
break;
}
distance--;
motionX = -MathHelper.sin((target.rotationYaw / 180F) * 3.141593F) * MathHelper.cos((target.rotationPitch / 180F) * 3.141593F) * distance;
motionZ = MathHelper.cos((target.rotationYaw / 180F) * 3.141593F) * MathHelper.cos((target.rotationPitch / 180F) * 3.141593F) * distance;
motionY = -MathHelper.sin((target.rotationPitch / 180F) * 3.141593F) * distance;
d = motionX;
d1 = motionY;
d2 = motionZ;
f2 = MathHelper.sqrt_double(d * d + d1 * d1 + d2 * d2);
d /= f2;
d1 /= f2;
d2 /= f2;
d *= distance;
d1 *= distance;
d2 *= distance;
motionX = d;
motionY = d1;
motionZ = d2;
f3 = MathHelper.sqrt_double(d * d + d2 * d2);
newX = target.posX + motionX;
newZ = target.posZ + motionZ;
newY = target.posY + motionY;
}
if (world.isRemote && astralBarrierBlocked && coordsValid) {
ExtendedProperties.For((EntityLivingBase) target).astralBarrierBlocked = true;
if (finalBlocker != null) {
finalBlocker.onEntityBlocked((EntityLivingBase) target);
}
}
if (!world.isRemote) {
if (!coordsValid && target instanceof EntityPlayer) {
((EntityPlayer) target).addChatMessage(new ChatComponentText("Can't find a place to blink forward to."));
return false;
}
}
if (!world.isRemote) {
((EntityLivingBase) target).setPositionAndUpdate(newX, newY, newZ);
}
return true;
}
use of am2.blocks.tileentities.TileEntityAstralBarrier in project ArsMagica2 by Mithion.
the class DimensionUtilities method GetBlockingAstralBarrier.
public static TileEntityAstralBarrier GetBlockingAstralBarrier(World world, int x, int y, int z, ArrayList<Long> keys) {
//check for Astral Barrier
for (int i = -20; i <= 20; ++i) {
for (int j = -20; j <= 20; ++j) {
for (int k = -20; k <= 20; ++k) {
if (world.getBlock(x + i, y + j, z + k) == BlocksCommonProxy.astralBarrier) {
TileEntity te = world.getTileEntity(x + i, y + j, z + k);
if (te == null || !(te instanceof TileEntityAstralBarrier)) {
continue;
}
TileEntityAstralBarrier barrier = (TileEntityAstralBarrier) te;
long barrierKey = KeystoneUtilities.instance.getKeyFromRunes(barrier.getRunesInKey());
if ((barrierKey != 0 && keys.contains(barrierKey)) || !barrier.IsActive())
continue;
int dx = x - barrier.xCoord;
int dy = y - barrier.yCoord;
int dz = z - barrier.zCoord;
int sqDist = (dx * dx + dy * dy + dz * dz);
if (sqDist < (barrier.getRadius() * barrier.getRadius()))
return barrier;
}
}
}
}
return null;
}
use of am2.blocks.tileentities.TileEntityAstralBarrier in project ArsMagica2 by Mithion.
the class ClientGuiManager method getClientGuiElement.
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if (te == null && ID != ArsMagicaGuiIdList.GUI_SPELL_BOOK && ID != ArsMagicaGuiIdList.GUI_KEYSTONE && ID != ArsMagicaGuiIdList.GUI_ESSENCE_BAG && ID != ArsMagicaGuiIdList.GUI_RUNE_BAG && ID != ArsMagicaGuiIdList.GUI_RIFT && ID != ArsMagicaGuiIdList.GUI_SPELL_CUSTOMIZATION) {
return null;
}
switch(ID) {
case ArsMagicaGuiIdList.GUI_ESSENCE_REFINER:
if (!(te instanceof TileEntityEssenceRefiner)) {
return null;
}
return new GuiEssenceRefiner(player.inventory, (TileEntityEssenceRefiner) te);
case ArsMagicaGuiIdList.GUI_SPELL_BOOK:
ItemStack bookStack = player.getCurrentEquippedItem();
if (bookStack == null || bookStack.getItem() == null || !(bookStack.getItem() instanceof ItemSpellBook)) {
return null;
}
ItemSpellBook item = (ItemSpellBook) bookStack.getItem();
return new GuiSpellBook(player.inventory, player.getCurrentEquippedItem(), item.ConvertToInventory(bookStack));
case ArsMagicaGuiIdList.GUI_CALEFACTOR:
if (!(te instanceof TileEntityCalefactor)) {
return null;
}
return new GuiCalefactor(player, (TileEntityCalefactor) te);
case ArsMagicaGuiIdList.GUI_KEYSTONE_LOCKABLE:
if (!(te instanceof IKeystoneLockable)) {
return null;
}
return new GuiKeystoneLockable(player.inventory, (IKeystoneLockable) te);
case ArsMagicaGuiIdList.GUI_ASTRAL_BARRIER:
if (!(te instanceof TileEntityAstralBarrier)) {
return null;
}
return new GuiAstralBarrier(player.inventory, (TileEntityAstralBarrier) te);
case ArsMagicaGuiIdList.GUI_SEER_STONE:
if (!(te instanceof TileEntitySeerStone)) {
return null;
}
return new GuiSeerStone(player.inventory, (TileEntitySeerStone) te);
case ArsMagicaGuiIdList.GUI_KEYSTONE_CHEST:
if (!(te instanceof TileEntityKeystoneChest)) {
return null;
}
return new GuiKeystoneChest(player.inventory, (TileEntityKeystoneChest) te);
case ArsMagicaGuiIdList.GUI_KEYSTONE:
ItemStack keystoneStack = player.getCurrentEquippedItem();
if (keystoneStack == null || keystoneStack.getItem() == null || !(keystoneStack.getItem() instanceof ItemKeystone)) {
return null;
}
ItemKeystone keystone = (ItemKeystone) keystoneStack.getItem();
int runeBagSlot = InventoryUtilities.getInventorySlotIndexFor(player.inventory, ItemsCommonProxy.runeBag);
ItemStack runeBag = null;
if (runeBagSlot > -1)
runeBag = player.inventory.getStackInSlot(runeBagSlot);
return new GuiKeystone(player.inventory, player.getCurrentEquippedItem(), runeBag, keystone.ConvertToInventory(keystoneStack), runeBag == null ? null : ItemsCommonProxy.runeBag.ConvertToInventory(runeBag), runeBagSlot);
case ArsMagicaGuiIdList.GUI_ESSENCE_BAG:
ItemStack bagStack = player.getCurrentEquippedItem();
if (bagStack.getItem() == null || !(bagStack.getItem() instanceof ItemEssenceBag)) {
return null;
}
ItemEssenceBag bag = (ItemEssenceBag) bagStack.getItem();
return new GuiEssenceBag(player.inventory, player.getCurrentEquippedItem(), bag.ConvertToInventory(bagStack));
case ArsMagicaGuiIdList.GUI_RUNE_BAG:
bagStack = player.getCurrentEquippedItem();
if (bagStack.getItem() == null || !(bagStack.getItem() instanceof ItemRuneBag)) {
return null;
}
ItemRuneBag runebag = (ItemRuneBag) bagStack.getItem();
return new GuiRuneBag(player.inventory, player.getCurrentEquippedItem(), runebag.ConvertToInventory(bagStack));
case ArsMagicaGuiIdList.GUI_ARCANE_RECONSTRUCTOR:
if (!(te instanceof TileEntityArcaneReconstructor)) {
return null;
}
return new GuiArcaneReconstructor(player.inventory, (TileEntityArcaneReconstructor) te);
case ArsMagicaGuiIdList.GUI_SUMMONER:
if (!(te instanceof TileEntitySummoner)) {
return null;
}
return new GuiSummoner(player.inventory, (TileEntitySummoner) te);
case ArsMagicaGuiIdList.GUI_INSCRIPTION_TABLE:
if (!(te instanceof TileEntityInscriptionTable)) {
return null;
}
return new GuiInscriptionTable(player.inventory, (TileEntityInscriptionTable) te);
case ArsMagicaGuiIdList.GUI_MAGICIANS_WORKBENCH:
if (!(te instanceof TileEntityMagiciansWorkbench)) {
return null;
}
return new GuiMagiciansWorkbench(player.inventory, (TileEntityMagiciansWorkbench) te);
case ArsMagicaGuiIdList.GUI_RIFT:
return new GuiRiftStorage(player.inventory, RiftStorage.For(player));
case ArsMagicaGuiIdList.GUI_SPELL_CUSTOMIZATION:
return new GuiSpellCustomization(player);
case ArsMagicaGuiIdList.GUI_CRYSTAL_MARKER:
if (!(te instanceof TileEntityCrystalMarker)) {
return null;
}
return new GuiCrystalMarker(player, (TileEntityCrystalMarker) te);
case ArsMagicaGuiIdList.GUI_OBELISK:
if (!(te instanceof TileEntityObelisk)) {
return null;
}
return new GuiObelisk((TileEntityObelisk) te, player);
case ArsMagicaGuiIdList.GUI_FLICKER_HABITAT:
if (!(te instanceof TileEntityFlickerHabitat)) {
return null;
}
return new GuiFlickerHabitat(player, (TileEntityFlickerHabitat) te);
case ArsMagicaGuiIdList.GUI_ARMOR_INFUSION:
if (!(te instanceof TileEntityArmorImbuer)) {
return null;
}
return new GuiArmorImbuer(player, (TileEntityArmorImbuer) te);
case ArsMagicaGuiIdList.GUI_ARCANE_DECONSTRUCTOR:
if (!(te instanceof TileEntityArcaneDeconstructor)) {
return null;
}
return new GuiArcaneDeconstructor(player.inventory, (TileEntityArcaneDeconstructor) te);
case ArsMagicaGuiIdList.GUI_INERT_SPAWNER:
if (!(te instanceof TileEntityInertSpawner)) {
return null;
}
return new GuiInertSpawner(player, (TileEntityInertSpawner) te);
case ArsMagicaGuiIdList.GUI_SPELL_SEALED_DOOR:
if (!(te instanceof TileEntitySpellSealedDoor)) {
return null;
}
return new GuiSpellSealedDoor(player.inventory, (TileEntitySpellSealedDoor) te);
}
return null;
}
use of am2.blocks.tileentities.TileEntityAstralBarrier in project ArsMagica2 by Mithion.
the class ServerGuiManager method getServerGuiElement.
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if (te == null && ID != ArsMagicaGuiIdList.GUI_SPELL_BOOK && ID != ArsMagicaGuiIdList.GUI_KEYSTONE && ID != ArsMagicaGuiIdList.GUI_ESSENCE_BAG && ID != ArsMagicaGuiIdList.GUI_RUNE_BAG && ID != ArsMagicaGuiIdList.GUI_RIFT && ID != ArsMagicaGuiIdList.GUI_SPELL_CUSTOMIZATION) {
return null;
}
switch(ID) {
case ArsMagicaGuiIdList.GUI_ESSENCE_REFINER:
if (!(te instanceof TileEntityEssenceRefiner)) {
return null;
}
return new ContainerEssenceRefiner(player.inventory, (TileEntityEssenceRefiner) te);
case ArsMagicaGuiIdList.GUI_SPELL_BOOK:
ItemStack bookStack = player.getCurrentEquippedItem();
if (bookStack.getItem() == null || !(bookStack.getItem() instanceof ItemSpellBook)) {
return null;
}
ItemSpellBook item = (ItemSpellBook) bookStack.getItem();
return new ContainerSpellBook(player.inventory, player.getCurrentEquippedItem(), item.ConvertToInventory(bookStack));
case ArsMagicaGuiIdList.GUI_CALEFACTOR:
if (!(te instanceof TileEntityCalefactor)) {
return null;
}
return new ContainerCalefactor(player, (TileEntityCalefactor) te);
case ArsMagicaGuiIdList.GUI_KEYSTONE_LOCKABLE:
if (!(te instanceof IKeystoneLockable)) {
return null;
}
return new ContainerKeystoneLockable(player.inventory, (IKeystoneLockable) te);
case ArsMagicaGuiIdList.GUI_ASTRAL_BARRIER:
if (!(te instanceof TileEntityAstralBarrier)) {
return null;
}
return new ContainerAstralBarrier(player.inventory, (TileEntityAstralBarrier) te);
case ArsMagicaGuiIdList.GUI_SEER_STONE:
if (!(te instanceof TileEntitySeerStone)) {
return null;
}
return new ContainerSeerStone(player.inventory, (TileEntitySeerStone) te);
case ArsMagicaGuiIdList.GUI_KEYSTONE_CHEST:
if (!(te instanceof TileEntityKeystoneChest)) {
return null;
}
return new ContainerKeystoneChest(player.inventory, (TileEntityKeystoneChest) te);
case ArsMagicaGuiIdList.GUI_KEYSTONE:
ItemStack keystoneStack = player.getCurrentEquippedItem();
if (keystoneStack.getItem() == null || !(keystoneStack.getItem() instanceof ItemKeystone)) {
return null;
}
ItemKeystone keystone = (ItemKeystone) keystoneStack.getItem();
int runeBagSlot = InventoryUtilities.getInventorySlotIndexFor(player.inventory, ItemsCommonProxy.runeBag);
ItemStack runeBag = null;
if (runeBagSlot > -1)
runeBag = player.inventory.getStackInSlot(runeBagSlot);
return new ContainerKeystone(player.inventory, player.getCurrentEquippedItem(), runeBag, keystone.ConvertToInventory(keystoneStack), runeBag == null ? null : ItemsCommonProxy.runeBag.ConvertToInventory(runeBag), runeBagSlot);
case ArsMagicaGuiIdList.GUI_ESSENCE_BAG:
ItemStack bagStack = player.getCurrentEquippedItem();
if (bagStack.getItem() == null || !(bagStack.getItem() instanceof ItemEssenceBag)) {
return null;
}
ItemEssenceBag bag = (ItemEssenceBag) bagStack.getItem();
return new ContainerEssenceBag(player.inventory, player.getCurrentEquippedItem(), bag.ConvertToInventory(bagStack));
case ArsMagicaGuiIdList.GUI_RUNE_BAG:
bagStack = player.getCurrentEquippedItem();
if (bagStack.getItem() == null || !(bagStack.getItem() instanceof ItemRuneBag)) {
return null;
}
ItemRuneBag runebag = (ItemRuneBag) bagStack.getItem();
return new ContainerRuneBag(player.inventory, player.getCurrentEquippedItem(), runebag.ConvertToInventory(bagStack));
case ArsMagicaGuiIdList.GUI_ARCANE_RECONSTRUCTOR:
if (!(te instanceof TileEntityArcaneReconstructor)) {
return null;
}
return new ContainerArcaneReconstructor(player.inventory, (TileEntityArcaneReconstructor) te);
case ArsMagicaGuiIdList.GUI_INSCRIPTION_TABLE:
if (!(te instanceof TileEntityInscriptionTable)) {
return null;
}
return new ContainerInscriptionTable((TileEntityInscriptionTable) te, player.inventory);
case ArsMagicaGuiIdList.GUI_SUMMONER:
if (!(te instanceof TileEntitySummoner)) {
return null;
}
return new ContainerSummoner(player.inventory, (TileEntitySummoner) te);
case ArsMagicaGuiIdList.GUI_MAGICIANS_WORKBENCH:
if (!(te instanceof TileEntityMagiciansWorkbench)) {
return null;
}
return new ContainerMagiciansWorkbench(player.inventory, (TileEntityMagiciansWorkbench) te);
case ArsMagicaGuiIdList.GUI_RIFT:
return new ContainerRiftStorage(player.inventory, RiftStorage.For(player));
case ArsMagicaGuiIdList.GUI_SPELL_CUSTOMIZATION:
return new ContainerSpellCustomization(player);
case ArsMagicaGuiIdList.GUI_CRYSTAL_MARKER:
if (!(te instanceof TileEntityCrystalMarker)) {
return null;
}
return new ContainerCrystalMarker(player, (TileEntityCrystalMarker) te);
case ArsMagicaGuiIdList.GUI_OBELISK:
if (!(te instanceof TileEntityObelisk)) {
return null;
}
return new ContainerObelisk((TileEntityObelisk) te, player);
case ArsMagicaGuiIdList.GUI_FLICKER_HABITAT:
if (!(te instanceof TileEntityFlickerHabitat)) {
return null;
}
return new ContainerFlickerHabitat(player, (TileEntityFlickerHabitat) te);
case ArsMagicaGuiIdList.GUI_ARMOR_INFUSION:
if (!(te instanceof TileEntityArmorImbuer)) {
return null;
}
return new ContainerArmorInfuser(player, (TileEntityArmorImbuer) te);
case ArsMagicaGuiIdList.GUI_ARCANE_DECONSTRUCTOR:
if (!(te instanceof TileEntityArcaneDeconstructor)) {
return null;
}
return new ContainerArcaneDeconstructor(player.inventory, (TileEntityArcaneDeconstructor) te);
case ArsMagicaGuiIdList.GUI_INERT_SPAWNER:
if (!(te instanceof TileEntityInertSpawner)) {
return null;
}
return new ContainerInertSpawner(player, (TileEntityInertSpawner) te);
case ArsMagicaGuiIdList.GUI_SPELL_SEALED_DOOR:
if (!(te instanceof TileEntitySpellSealedDoor)) {
return null;
}
return new ContainerSpellSealedDoor(player.inventory, (TileEntitySpellSealedDoor) te);
}
return null;
}
use of am2.blocks.tileentities.TileEntityAstralBarrier in project ArsMagica2 by Mithion.
the class AMEventHandler method onEndermanTeleport.
@SubscribeEvent
public void onEndermanTeleport(EnderTeleportEvent event) {
EntityLivingBase ent = event.entityLiving;
ArrayList<Long> keystoneKeys = KeystoneUtilities.instance.GetKeysInInvenory(ent);
TileEntityAstralBarrier blockingBarrier = DimensionUtilities.GetBlockingAstralBarrier(event.entityLiving.worldObj, (int) event.targetX, (int) event.targetY, (int) event.targetZ, keystoneKeys);
if (ent.isPotionActive(BuffList.astralDistortion.id) || blockingBarrier != null) {
event.setCanceled(true);
if (blockingBarrier != null) {
blockingBarrier.onEntityBlocked(ent);
}
return;
}
if (!ent.worldObj.isRemote && ent instanceof EntityEnderman && ent.worldObj.rand.nextDouble() < 0.01f) {
EntityFlicker flicker = new EntityFlicker(ent.worldObj);
flicker.setPosition(ent.posX, ent.posY, ent.posZ);
flicker.setFlickerType(Affinity.ENDER);
ent.worldObj.spawnEntityInWorld(flicker);
}
}
Aggregations