Fixed Pick Block Results #170

Merged
SenseiKiwi merged 9 commits from master into master 2014-07-11 15:38:21 +00:00
6 changed files with 28 additions and 45 deletions
Showing only changes of commit dc55359aaf - Show all commits

View File

@@ -11,7 +11,6 @@ import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
@@ -22,7 +21,6 @@ import StevenDimDoors.mod_pocketDim.config.DDProperties;
import StevenDimDoors.mod_pocketDim.core.DDTeleporter; import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
import StevenDimDoors.mod_pocketDim.core.DimLink; import StevenDimDoors.mod_pocketDim.core.DimLink;
import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@@ -159,16 +157,13 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
reversed = !reversed; reversed = !reversed;
} }
} }
if (isUpperDoorBlock(fullMetadata)) if (isUpperDoorBlock(fullMetadata))
{
return this.upperTextures[reversed ? 1 : 0]; return this.upperTextures[reversed ? 1 : 0];
else }
return this.lowerTextures[reversed ? 1 : 0]; return this.lowerTextures[reversed ? 1 : 0];
}
else
{
return this.lowerTextures[0];
} }
return this.lowerTextures[0];
} }
//Called to update the render information on the tile entity. Could probably implement a data watcher, //Called to update the render information on the tile entity. Could probably implement a data watcher,
@@ -180,29 +175,23 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
{ {
int metadata = world.getBlockMetadata(x, y, z); int metadata = world.getBlockMetadata(x, y, z);
TileEntityDimDoor dimTile = (TileEntityDimDoor) tile; TileEntityDimDoor dimTile = (TileEntityDimDoor) tile;
dimTile.openOrClosed = this.isDoorOnRift(world, x, y, z)&&this.isUpperDoorBlock(metadata); dimTile.openOrClosed = isDoorOnRift(world, x, y, z) && isUpperDoorBlock(metadata);
dimTile.orientation = this.getFullMetadata(world, x, y, z) & 7; dimTile.orientation = this.getFullMetadata(world, x, y, z) & 7;
} }
return this; return this;
} }
public boolean isDoorOnRift(World world, int x, int y, int z) public static boolean isDoorOnRift(World world, int x, int y, int z)
{ {
if(this.isUpperDoorBlock( world.getBlockMetadata(x, y, z))) if (isUpperDoorBlock(world.getBlockMetadata(x, y, z)))
{ {
if(PocketManager.getLink(x, y, z, world.provider.dimensionId) != null||PocketManager.getLink(x, y-1, z, world.provider.dimensionId) != null) // Target block is the upper block
{ return (PocketManager.getLink(x, y, z, world.provider.dimensionId) != null ||
return true; PocketManager.getLink(x, y - 1, z, world.provider.dimensionId) != null);
}
} }
else // Target block is the lower block
{ return (PocketManager.getLink(x, y, z, world.provider.dimensionId) != null ||
if(PocketManager.getLink(x, y, z, world.provider.dimensionId) != null||PocketManager.getLink(x, y+1, z, world.provider.dimensionId) != null) PocketManager.getLink(x, y + 1, z, world.provider.dimensionId) != null);
{
return true;
}
}
return false;
} }
/** /**
@@ -359,7 +348,8 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
/** /**
* Returns the ID of the items to drop on destruction. * Returns the ID of the items to drop on destruction.
*/ */
public int idDropped(int metadata, Random random, int fortune) @Override
public int idDropped(int metadata, Random random, int fortune)
{ {
return isUpperDoorBlock(metadata) ? 0 : this.getDrops(); return isUpperDoorBlock(metadata) ? 0 : this.getDrops();
} }

View File

@@ -88,6 +88,7 @@ public class BlockDimWall extends Block
subItems.add(new ItemStack(this, 1, ix)); subItems.add(new ItemStack(this, 1, ix));
} }
} }
@Override @Override
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {} public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}

View File

@@ -2,17 +2,15 @@ package StevenDimDoors.mod_pocketDim.blocks;
import java.util.Random; import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.config.DDProperties;
import net.minecraft.block.BlockDoor; import net.minecraft.block.BlockDoor;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.IconFlipped; import net.minecraft.client.renderer.IconFlipped;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockDoorGold extends BlockDoor public class BlockDoorGold extends BlockDoor
{ {
@@ -110,15 +108,12 @@ public class BlockDoorGold extends BlockDoor
reversed = !reversed; reversed = !reversed;
} }
} }
if (BaseDimDoor.isUpperDoorBlock(fullMetadata)) if (BaseDimDoor.isUpperDoorBlock(fullMetadata))
{
return this.upperTextures[reversed ? 1 : 0]; return this.upperTextures[reversed ? 1 : 0];
else }
return this.lowerTextures[reversed ? 1 : 0]; return this.lowerTextures[reversed ? 1 : 0];
}
else
{
return this.lowerTextures[0];
} }
return this.lowerTextures[0];
} }
} }

View File

@@ -9,10 +9,8 @@ import StevenDimDoors.mod_pocketDim.core.LinkTypes;
import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.core.PocketManager;
@SuppressWarnings("deprecation")
public class DimensionalDoor extends BaseDimDoor public class DimensionalDoor extends BaseDimDoor
{ {
public DimensionalDoor(int blockID, Material material, DDProperties properties) public DimensionalDoor(int blockID, Material material, DDProperties properties)
{ {
super(blockID, material, properties); super(blockID, material, properties);
@@ -27,10 +25,11 @@ public class DimensionalDoor extends BaseDimDoor
DimLink link = dimension.getLink(x, y, z); DimLink link = dimension.getLink(x, y, z);
if (link == null) if (link == null)
{ {
dimension.createLink(x, y, z, LinkTypes.POCKET,world.getBlockMetadata(x, y - 1, z)); dimension.createLink(x, y, z, LinkTypes.POCKET, world.getBlockMetadata(x, y - 1, z));
} }
} }
} }
@Override @Override
public int getDrops() public int getDrops()
{ {

View File

@@ -18,7 +18,6 @@ import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor;
@SuppressWarnings("deprecation")
public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntityProvider public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntityProvider
{ {
@@ -61,7 +60,7 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
{ {
this.placeLink(world, x, y, z); this.placeLink(world, x, y, z);
world.setBlockTileEntity(x, y, z, this.createNewTileEntity(world)); world.setBlockTileEntity(x, y, z, this.createNewTileEntity(world));
this.updateAttachedTile(world, x, y, z); updateAttachedTile(world, x, y, z);
} }
@Override @Override
@@ -76,8 +75,8 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
{ {
return new TileEntityTransTrapdoor(); return new TileEntityTransTrapdoor();
} }
public void updateAttachedTile(World world, int x, int y, int z) public static void updateAttachedTile(World world, int x, int y, int z)
{ {
TileEntity tile = world.getBlockTileEntity(x, y, z); TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TileEntityTransTrapdoor) if (tile instanceof TileEntityTransTrapdoor)

View File

@@ -9,7 +9,6 @@ import StevenDimDoors.mod_pocketDim.core.LinkTypes;
import StevenDimDoors.mod_pocketDim.core.NewDimData; import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager; import StevenDimDoors.mod_pocketDim.core.PocketManager;
@SuppressWarnings("deprecation")
public class WarpDoor extends BaseDimDoor public class WarpDoor extends BaseDimDoor
{ {
public WarpDoor(int blockID, Material material, DDProperties properties) public WarpDoor(int blockID, Material material, DDProperties properties)