diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java index ee2834c40..fb1e0f949 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java @@ -100,7 +100,7 @@ public enum ConfigIntValues{ DRILL_THREE_BY_THREE_EXTRA_USE("3x3 Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 10, 0, 10000, "How much extra Energy the 3x3 Upgrade uses"), DRILL_FIVE_BY_FIVE_EXTRA_USE("5x5 Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 30, 0, 10000, "How much extra Energy the 5x5 Upgrade uses"), - TELE_STAFF_REACH("TeleStaff: Reach", ConfigCategories.MACHINE_VALUES, 150, 5, 500, "How far the TeleStaff can teleport you"), + TELE_STAFF_REACH("TeleStaff: Range", ConfigCategories.MACHINE_VALUES, 100, 5, 150, "How far the TeleStaff can teleport you"), TELE_STAFF_ENERGY_USE("TeleStaff: Energy Use per Block", ConfigCategories.MACHINE_VALUES, 200, 1, 5000, "How much energy the TeleStaff uses per Block you teleport"); public final String name; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemTeleStaff.java b/src/main/java/ellpeck/actuallyadditions/items/ItemTeleStaff.java index 4b8b153b9..a0945f6c1 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemTeleStaff.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemTeleStaff.java @@ -18,7 +18,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class ItemTeleStaff extends ItemEnergy implements INameableItem{ - private static final double reach = ConfigIntValues.TELE_STAFF_REACH.getValue(); + private static final int reach = ConfigIntValues.TELE_STAFF_REACH.getValue(); private static final int energyUsedPerBlock = ConfigIntValues.TELE_STAFF_ENERGY_USE.getValue(); public ItemTeleStaff(){ @@ -48,7 +48,7 @@ public class ItemTeleStaff extends ItemEnergy implements INameableItem{ @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ - MovingObjectPosition pos = WorldUtil.getMovingObjectPosWithReachDistance(world, player, reach); + MovingObjectPosition pos = WorldUtil.getMovingObjectPosWithReachDistance(world, player, (double)reach); if(pos != null){ int side = pos.sideHit; if(side != -1){ diff --git a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java index 439291151..c46fddf32 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java @@ -214,10 +214,20 @@ public class WorldUtil{ } public static MovingObjectPosition getMovingObjectPosWithReachDistance(World world, EntityPlayer player, double distance){ - float f1 = player.prevRotationPitch+(player.rotationPitch-player.prevRotationPitch)*1.0F; - float f2 = player.prevRotationYaw+(player.rotationYaw-player.prevRotationYaw)*1.0F; - Vec3 vec = Vec3.createVectorHelper(player.prevPosX+(player.posX-player.prevPosX)*(double)1.0F, player.prevPosY+(player.posY-player.prevPosY)*(double)1.0F+(double)(world.isRemote ? player.getEyeHeight()-player.getDefaultEyeHeight() : player.getEyeHeight()), player.prevPosZ+(player.posZ-player.prevPosZ)*(double)1.0F); - Vec3 vec1 = vec.addVector((double)MathHelper.sin(-f2*0.017453292F-(float)Math.PI)*-MathHelper.cos(-f1*0.017453292F)*distance, (double)MathHelper.sin(-f1*0.017453292F)*distance, (double)MathHelper.cos(-f2*0.017453292F-(float)Math.PI)*-MathHelper.cos(-f1*0.017453292F)*distance); - return world.func_147447_a(vec, vec1, false, true, false); + float f = 1.0F; + float f1 = player.prevRotationPitch+(player.rotationPitch-player.prevRotationPitch)*f; + float f2 = player.prevRotationYaw+(player.rotationYaw-player.prevRotationYaw)*f; + double d0 = player.prevPosX+(player.posX-player.prevPosX)*(double)f; + double d1 = player.prevPosY+(player.posY-player.prevPosY)*(double)f+(double)player.getEyeHeight(); + double d2 = player.prevPosZ+(player.posZ-player.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; + Vec3 vec31 = vec3.addVector((double)f7*distance, (double)f6*distance, (double)f8*distance); + return world.func_147447_a(vec3, vec31, false, true, false); } }