Fixed raytrace bug

This commit is contained in:
Calclavia 2013-08-04 23:13:21 -04:00
parent 9e1feca3e8
commit d29252386a
3 changed files with 9 additions and 3 deletions

View file

@ -19,4 +19,4 @@ In order to compile the source code into binary form, you must have a working Mi
5. Install it into Minecraft just like any other Forge mod. 5. Install it into Minecraft just like any other Forge mod.
### License ### License
"Resonant Induction" is under the Calclavia Mod License (http://calclavia.com/license/cl). "Resonant Induction" is under the Educational Public License (http://calclavia.com/license/rpl).

View file

@ -248,7 +248,7 @@ public class Vector3
{ {
MovingObjectPosition pickedEntity = null; MovingObjectPosition pickedEntity = null;
Vec3 startingPosition = this.toVec3(); Vec3 startingPosition = this.toVec3();
Vec3 look = target.normalize().toVec3(); Vec3 look = target.clone().difference(this).normalize().toVec3();
double reachDistance = this.distance(target); double reachDistance = this.distance(target);
Vec3 reachPoint = Vec3.createVectorHelper(startingPosition.xCoord + look.xCoord * reachDistance, startingPosition.yCoord + look.yCoord * reachDistance, startingPosition.zCoord + look.zCoord * reachDistance); Vec3 reachPoint = Vec3.createVectorHelper(startingPosition.xCoord + look.xCoord * reachDistance, startingPosition.yCoord + look.yCoord * reachDistance, startingPosition.zCoord + look.zCoord * reachDistance);

View file

@ -53,16 +53,22 @@ public class BlockTesla extends BlockBase implements ITileEntityProvider
{ {
entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, 1); entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, 1);
} }
return true; return true;
} }
else if (entityPlayer.getCurrentEquippedItem().itemID == Item.redstone.itemID) else if (entityPlayer.getCurrentEquippedItem().itemID == Item.redstone.itemID)
{ {
tileEntity.toggleEntityAttack(); boolean status = tileEntity.toggleEntityAttack();
if (!entityPlayer.capabilities.isCreativeMode) if (!entityPlayer.capabilities.isCreativeMode)
{ {
entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, 1); entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, 1);
} }
if (!world.isRemote)
{
entityPlayer.addChatMessage("Toggled entity attack to: " + status);
}
return true; return true;
} }
else if (entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemCoordLink) else if (entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemCoordLink)