From dbf4232ca00dc4e944b42e09a84664ebeb301311 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Wed, 10 Dec 2014 21:33:04 -0500 Subject: [PATCH] Fixed demon paths so that Double-tall grass doesn't mess it up --- build.properties | 4 +- .../alchemicalWizardry/ModItems.java | 4 + .../common/AlchemicalWizardryEventHooks.java | 40 +-- .../common/demonVillage/DemonVillagePath.java | 35 ++- .../common/items/sigil/AirSigil.java | 54 +++- .../items/sigil/ItemSigilOfTheAssassin.java | 232 ++++++++++++++++++ .../spell/complex/effect/SpellHelper.java | 26 +- 7 files changed, 352 insertions(+), 43 deletions(-) create mode 100644 src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/ItemSigilOfTheAssassin.java diff --git a/build.properties b/build.properties index dfa1c4ce..ac8ac800 100644 --- a/build.properties +++ b/build.properties @@ -1,5 +1,5 @@ # -#Sat Dec 06 10:00:16 EST 2014 +#Wed Dec 10 11:02:48 EST 2014 mod_name=BloodMagic forge_version=10.13.2.1232 ccc_version=1.0.4.29 @@ -8,5 +8,5 @@ nei_version=1.0.3.64 package_group=com.wayoftime.bloodmagic mod_version=1.3.0Beta minetweaker_version=Dev-1.7.10-3.0.9B -build_number=3 mc_version=1.7.10 +build_number=4 diff --git a/src/main/java/WayofTime/alchemicalWizardry/ModItems.java b/src/main/java/WayofTime/alchemicalWizardry/ModItems.java index d4c5e80a..7c5052aa 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/ModItems.java +++ b/src/main/java/WayofTime/alchemicalWizardry/ModItems.java @@ -72,6 +72,7 @@ import WayofTime.alchemicalWizardry.common.items.sigil.ItemPackRatSigil; import WayofTime.alchemicalWizardry.common.items.sigil.ItemSeerSigil; import WayofTime.alchemicalWizardry.common.items.sigil.ItemSigilOfEnderSeverance; import WayofTime.alchemicalWizardry.common.items.sigil.ItemSigilOfSupression; +import WayofTime.alchemicalWizardry.common.items.sigil.ItemSigilOfTheAssassin; import WayofTime.alchemicalWizardry.common.items.sigil.LavaSigil; import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfElementalAffinity; import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfGrowth; @@ -204,6 +205,7 @@ public class ModItems public static Item itemBloodPack; public static Item transcendentBloodOrb; + public static Item itemAssassinSigil; public static void init() { @@ -306,6 +308,7 @@ public class ModItems itemBloodPack = new ItemBloodLetterPack().setUnlocalizedName("itemBloodPack"); itemHarvestSigil = new ItemHarvestSigil().setUnlocalizedName("itemHarvestSigil"); itemCompressionSigil = new ItemPackRatSigil().setUnlocalizedName("itemCompressionSigil"); + itemAssassinSigil = new ItemSigilOfTheAssassin().setUnlocalizedName("itemAssassinSigil"); } public static void registerItems() @@ -413,6 +416,7 @@ public class ModItems GameRegistry.registerItem(ModItems.itemBloodPack, "itemBloodPack"); GameRegistry.registerItem(ModItems.itemHarvestSigil, "itemHarvestSigil"); GameRegistry.registerItem(ModItems.itemCompressionSigil, "itemCompressionSigil"); + GameRegistry.registerItem(ModItems.itemAssassinSigil, "itemAssassinSigil"); //GameRegistry.registerItem(ModItems.itemBloodFrame, "itemBloodFrame"); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java b/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java index 1de891f7..9b43b75b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java @@ -1,21 +1,17 @@ package WayofTime.alchemicalWizardry.common; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.BloodMagicConfiguration; -import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; -import WayofTime.alchemicalWizardry.common.items.BoundArmour; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; -import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; -import cpw.mods.fml.client.event.ConfigChangedEvent; -import cpw.mods.fml.common.ObfuscationReflectionHelper; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.eventhandler.Event.Result; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; -import cpw.mods.fml.common.registry.GameRegistry; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; + import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IProjectile; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; @@ -35,8 +31,19 @@ import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn; import vazkii.botania.api.internal.IManaBurst; - -import java.util.*; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.BloodMagicConfiguration; +import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; +import WayofTime.alchemicalWizardry.common.items.BoundArmour; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; +import cpw.mods.fml.client.event.ConfigChangedEvent; +import cpw.mods.fml.common.ObfuscationReflectionHelper; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.eventhandler.Event.Result; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; +import cpw.mods.fml.common.registry.GameRegistry; public class AlchemicalWizardryEventHooks { @@ -175,6 +182,9 @@ public class AlchemicalWizardryEventHooks @SubscribeEvent public void onLivingJumpEvent(LivingJumpEvent event) { + event.entityLiving.getEntityAttribute(SharedMonsterAttributes.maxHealth).removeModifier(new AttributeModifier(new UUID(493295, 1), "HealthModifier", 2, 0)); + //event.entityLiving.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier(new UUID(493295, 1), "HealthModifier", 2, 0)); + if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionBoost)) { int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonVillagePath.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonVillagePath.java index 65322a70..b6a2dada 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonVillagePath.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/DemonVillagePath.java @@ -1,7 +1,9 @@ package WayofTime.alchemicalWizardry.common.demonVillage; import net.minecraft.block.Block; +import net.minecraft.block.BlockFlower; import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import WayofTime.alchemicalWizardry.ModBlocks; @@ -98,7 +100,7 @@ public class DemonVillagePath Block block1 = world.getBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset); Block highBlock1 = world.getBlock(xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset); - if (!block1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset)) + if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset))) { if(doConstruct) { @@ -113,7 +115,7 @@ public class DemonVillagePath Block block2 = world.getBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset); Block highBlock2 = world.getBlock(xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset); - if (!block2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset)) + if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block2)) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset))) { if(doConstruct) { @@ -133,7 +135,7 @@ public class DemonVillagePath { Block block1 = world.getBlock(xPos + xOffset, yPos, zPos + zOffset); - if (block1.isReplaceable(world, xPos + xOffset, yPos, zPos + zOffset) || !this.isBlockReplaceable(block1)) + if (block1.isReplaceable(world, xPos + xOffset, yPos, zPos + zOffset) || !this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1)) { returnAmount = false; @@ -150,7 +152,7 @@ public class DemonVillagePath { Block block1 = world.getBlock(xPos + xOffset, yPos, zPos + zOffset); - if (!block1.isReplaceable(world, xPos + xOffset, yPos, zPos + zOffset) || this.isBlockReplaceable(block1)) + if (!block1.isReplaceable(world, xPos + xOffset, yPos, zPos + zOffset) || this.isBlockReplaceable(block1) || !this.forceReplaceBlock(block1)) { returnAmount = false; @@ -195,7 +197,7 @@ public class DemonVillagePath Block block1 = world.getBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset); Block highBlock1 = world.getBlock(xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset); - if (!block1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset)) + if ((this.forceReplaceBlock(block1))||(!block1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) ) && (this.forceCanTunnelUnder(highBlock1) || highBlock1.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset))) { yPos += sign * yOffset; break; @@ -205,7 +207,7 @@ public class DemonVillagePath Block block2 = world.getBlock(xPos + xOffset, yPos + sign * yOffset, zPos + zOffset); Block highBlock2 = world.getBlock(xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset); - if (!block2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block1) && highBlock2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset)) + if ((this.forceReplaceBlock(block2))||(!block2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset, zPos + zOffset) && this.isBlockReplaceable(block2) ) && (this.forceCanTunnelUnder(highBlock2) || highBlock2.isReplaceable(world, xPos + xOffset, yPos + sign * yOffset + 1, zPos + zOffset))) { yPos += sign * yOffset; break; @@ -230,4 +232,25 @@ public class DemonVillagePath } return !block.equals(ModBlocks.blockDemonPortal); } + + public boolean forceReplaceBlock(Block block) + { + if(block.getMaterial().isLiquid()) + { + return true; + }else + { + return false; + } + } + + public boolean forceCanTunnelUnder(Block block) + { + if(block instanceof BlockFlower || block == Blocks.double_plant) + { + return true; + } + + return false; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/AirSigil.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/AirSigil.java index 2236bd84..9150937e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/AirSigil.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/AirSigil.java @@ -1,17 +1,18 @@ package WayofTime.alchemicalWizardry.common.items.sigil; +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; import WayofTime.alchemicalWizardry.common.items.EnergyItems; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; - -import java.util.List; public class AirSigil extends EnergyItems implements ArmourUpgrade { @@ -54,6 +55,11 @@ public class AirSigil extends EnergyItems implements ArmourUpgrade return par1ItemStack; } + if(par2World.isRemote && this.isItemUnusable(par1ItemStack)) + { + return par1ItemStack; + } + Vec3 vec = par3EntityPlayer.getLookVec(); double wantedVelocity = 1.7; @@ -73,6 +79,16 @@ public class AirSigil extends EnergyItems implements ArmourUpgrade { if (!EnergyItems.syphonBatteries(par1ItemStack, par3EntityPlayer, getEnergyUsed())) { + if(!par2World.isRemote) + { + this.setIsItemUnusable(par1ItemStack, true); + } + }else + { + if(!par2World.isRemote) + { + this.setIsItemUnusable(par1ItemStack, false); + } } } else { @@ -81,6 +97,30 @@ public class AirSigil extends EnergyItems implements ArmourUpgrade return par1ItemStack; } + + public boolean isItemUnusable(ItemStack stack) + { + NBTTagCompound tag = stack.getTagCompound(); + if(tag == null) + { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + return tag.getBoolean("unusable"); + } + + public void setIsItemUnusable(ItemStack stack, boolean bool) + { + NBTTagCompound tag = stack.getTagCompound(); + if(tag == null) + { + tag = new NBTTagCompound(); + stack.setTagCompound(tag); + } + + tag.setBoolean("unusable", bool); + } @Override public void onArmourUpdate(World world, EntityPlayer player, diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/ItemSigilOfTheAssassin.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/ItemSigilOfTheAssassin.java new file mode 100644 index 00000000..b27772fc --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/sigil/ItemSigilOfTheAssassin.java @@ -0,0 +1,232 @@ +package WayofTime.alchemicalWizardry.common.items.sigil; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.EnderTeleportEvent; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemSigilOfTheAssassin extends EnergyItems implements ArmourUpgrade +{ + public ItemSigilOfTheAssassin() + { + super(); + this.maxStackSize = 1; + setEnergyUsed(100); + setCreativeTab(AlchemicalWizardry.tabBloodMagic); + } + + @Override + public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (par1ItemStack.stackTagCompound == null) + { + par1ItemStack.setTagCompound(new NBTTagCompound()); + } + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) + { + this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:WaterSigil"); + } + + @Override + public ItemStack getContainerItem(ItemStack itemStack) + { + ItemStack copiedStack = itemStack.copy(); + copiedStack.setItemDamage(copiedStack.getItemDamage() + 1); + copiedStack.stackSize = 1; + return copiedStack; + } + + @Override + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) + { + par3List.add("Time to stay stealthy..."); + + if (!(par1ItemStack.stackTagCompound == null)) + { + par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); + } + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer); + + if (par3EntityPlayer.isSneaking()) + { + return par1ItemStack; + } + + + + float f = 10.0F; + + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false, f); + + if (movingobjectposition == null) + { + AlchemicalWizardry.logger.info("I saw nothing."); + return par1ItemStack; + } else + { + AlchemicalWizardry.logger.info("Got something!"); + + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) + { + Entity hitEntity = movingobjectposition.entityHit; + double x = hitEntity.posX; + double y = hitEntity.posY; + double z = hitEntity.posZ; + + if(hitEntity instanceof EntityLivingBase) + { + AlchemicalWizardry.logger.info("It's a living entity!"); + + + teleportTo(par3EntityPlayer, x, y, z, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ); + } + } + + return par1ItemStack; + } + } + + protected static boolean teleportTo(EntityLivingBase entityLiving, double par1, double par3, double par5, double lastX, double lastY, double lastZ) + { + EnderTeleportEvent event = new EnderTeleportEvent(entityLiving, par1, par3, par5, 0); + + if (MinecraftForge.EVENT_BUS.post(event)) + { + return false; + } + + double d3 = lastX; + double d4 = lastY; + double d5 = lastZ; + SpellTeleport.moveEntityViaTeleport(entityLiving, event.targetX, event.targetY, event.targetZ); + boolean flag = false; + int i = MathHelper.floor_double(entityLiving.posX); + int j = MathHelper.floor_double(entityLiving.posY); + int k = MathHelper.floor_double(entityLiving.posZ); + Block l; + + if (entityLiving.worldObj.blockExists(i, j, k)) + { + boolean flag1 = false; + + while (!flag1 && j > 0) + { + l = entityLiving.worldObj.getBlock(i, j - 1, k); + + if (l != null && l.getMaterial().blocksMovement()) + { + flag1 = true; + } else + { + --entityLiving.posY; + --j; + } + } + + if (flag1) + { + SpellTeleport.moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ); + + if (entityLiving.worldObj.getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox).isEmpty() && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox)) + { + flag = true; + } + } + } + + if (!flag) + { + SpellTeleport.moveEntityViaTeleport(entityLiving, d3, d4, d5); + return false; + } else + { + short short1 = 128; + + for (j = 0; j < short1; ++j) + { + double d6 = (double) j / ((double) short1 - 1.0D); + float f = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; + float f1 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; + float f2 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F; + double d7 = d3 + (entityLiving.posX - d3) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; + double d8 = d4 + (entityLiving.posY - d4) * d6 + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height; + double d9 = d5 + (entityLiving.posZ - d5) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D; + entityLiving.worldObj.spawnParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2); + } + return true; + } + } + + public MovingObjectPosition getMovingObjectPositionFromPlayer(World p_77621_1_, EntityPlayer p_77621_2_, boolean p_77621_3_, float reach) + { + float f = 1; + float f1 = p_77621_2_.prevRotationPitch + (p_77621_2_.rotationPitch - p_77621_2_.prevRotationPitch) * f; + float f2 = p_77621_2_.prevRotationYaw + (p_77621_2_.rotationYaw - p_77621_2_.prevRotationYaw) * f; + double d0 = p_77621_2_.prevPosX + (p_77621_2_.posX - p_77621_2_.prevPosX) * (double)f; + double d1 = p_77621_2_.prevPosY + (p_77621_2_.posY - p_77621_2_.prevPosY) * (double)f + (double)(p_77621_1_.isRemote ? p_77621_2_.getEyeHeight() - p_77621_2_.getDefaultEyeHeight() : p_77621_2_.getEyeHeight()); // isRemote check to revert changes to ray trace position due to adding the eye height clientside and player yOffset differences + double d2 = p_77621_2_.prevPosZ + (p_77621_2_.posZ - p_77621_2_.prevPosZ) * (double)f; + Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); + float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI); + float f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.017453292F); + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; + double d3 = 500.0D; + if (p_77621_2_ instanceof EntityPlayerMP) + { + d3 = ((EntityPlayerMP)p_77621_2_).theItemInWorldManager.getBlockReachDistance(); + } + Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); + return p_77621_1_.func_147447_a(vec3, vec31, p_77621_3_, !p_77621_3_, false); + } + + @Override + public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) + { + player.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 2, 9, true)); + } + + @Override + public boolean isUpgrade() + { + return true; + } + + @Override + public int getEnergyForTenSeconds() + { + return 50; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java index 6afa32bc..543736dc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java @@ -1,12 +1,10 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles; -import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; -import WayofTime.alchemicalWizardry.common.NewPacketHandler; -import cpw.mods.fml.common.FMLCommonHandler; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.entity.Entity; @@ -37,11 +35,13 @@ import net.minecraft.world.WorldServer; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.oredict.OreDictionary; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles; +import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; +import WayofTime.alchemicalWizardry.common.NewPacketHandler; +import cpw.mods.fml.common.FMLCommonHandler; public class SpellHelper { @@ -503,7 +503,7 @@ public class SpellHelper return false; } - public static Entity teleportEntitySameDim(int x, int y, int z, Entity entity) + public static Entity teleportEntitySameDim(double x, double y, double z, Entity entity) { if (entity != null) {