Cleaned Up Code
Changed calls to canPlayerEdit() to pass hit.sideHit data with the request. Also renamed several variables to make the code clearer. Removed a custom implementation of the ray tracing call in BaseItemDoor - we can use the built-in call from Minecraft there.
This commit is contained in:
@@ -224,20 +224,19 @@ public class ItemRiftBlade extends ItemSword
|
||||
{
|
||||
if (PocketManager.getLink(hit.blockX, hit.blockY, hit.blockZ, world) != null)
|
||||
{
|
||||
Block var11 = mod_pocketDim.transientDoor;
|
||||
int par4 = hit.blockX;
|
||||
int par5 = hit.blockY;
|
||||
int par6 = hit.blockZ;
|
||||
int par7 = 0;
|
||||
Block block = mod_pocketDim.transientDoor;
|
||||
int x = hit.blockX;
|
||||
int y = hit.blockY;
|
||||
int z = hit.blockZ;
|
||||
|
||||
if (player.canPlayerEdit(par4, par5, par6, par7, stack) && player.canPlayerEdit(par4, par5 + 1, par6, par7, stack)&&!world.isRemote)
|
||||
if (player.canPlayerEdit(x, y, z, hit.sideHit, stack) && player.canPlayerEdit(x, y + 1, z, hit.sideHit, stack) && !world.isRemote)
|
||||
{
|
||||
int var12 = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
|
||||
int orientation = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
|
||||
|
||||
if (BaseItemDoor.canPlace(world, par4, par5, par6) &&
|
||||
BaseItemDoor.canPlace(world, par4, par5 - 1, par6))
|
||||
if (BaseItemDoor.canPlace(world, x, y, z) &&
|
||||
BaseItemDoor.canPlace(world, x, y - 1, z))
|
||||
{
|
||||
ItemDimensionalDoor.placeDoorBlock(world, par4, par5 - 1, par6, var12, var11);
|
||||
ItemDimensionalDoor.placeDoorBlock(world, x, y - 1, z, orientation, block);
|
||||
player.worldObj.playSoundAtEntity(player,"mods.DimDoors.sfx.riftDoor", 0.6f, 1);
|
||||
stack.damageItem(10, player);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user