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.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
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.DimLink;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.schematic.BlockRotator;
import StevenDimDoors.mod_pocketDim.tileentities.TileEntityDimDoor;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -159,17 +157,14 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
reversed = !reversed;
}
}
if (isUpperDoorBlock(fullMetadata))
{
return this.upperTextures[reversed ? 1 : 0];
else
}
return this.lowerTextures[reversed ? 1 : 0];
}
else
{
return this.lowerTextures[0];
}
}
//Called to update the render information on the tile entity. Could probably implement a data watcher,
//but this works fine and is more versatile I think.
@@ -180,29 +175,23 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
{
int metadata = world.getBlockMetadata(x, y, z);
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;
}
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)
{
return true;
// Target block is the upper block
return (PocketManager.getLink(x, y, z, world.provider.dimensionId) != null ||
PocketManager.getLink(x, y - 1, z, world.provider.dimensionId) != null);
}
}
else
{
if(PocketManager.getLink(x, y, z, world.provider.dimensionId) != null||PocketManager.getLink(x, y+1, z, world.provider.dimensionId) != null)
{
return true;
}
}
return false;
// Target block is the lower block
return (PocketManager.getLink(x, y, z, world.provider.dimensionId) != null ||
PocketManager.getLink(x, y + 1, z, world.provider.dimensionId) != null);
}
/**
@@ -359,6 +348,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
/**
* Returns the ID of the items to drop on destruction.
*/
@Override
public int idDropped(int metadata, Random random, int fortune)
{
return isUpperDoorBlock(metadata) ? 0 : this.getDrops();

View File

@@ -88,6 +88,7 @@ public class BlockDimWall extends Block
subItems.add(new ItemStack(this, 1, ix));
}
}
@Override
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 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.material.Material;
import net.minecraft.client.renderer.IconFlipped;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.Icon;
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
{
@@ -110,15 +108,12 @@ public class BlockDoorGold extends BlockDoor
reversed = !reversed;
}
}
if (BaseDimDoor.isUpperDoorBlock(fullMetadata))
{
return this.upperTextures[reversed ? 1 : 0];
else
}
return this.lowerTextures[reversed ? 1 : 0];
}
else
{
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.PocketManager;
@SuppressWarnings("deprecation")
public class DimensionalDoor extends BaseDimDoor
{
public DimensionalDoor(int blockID, Material material, DDProperties properties)
{
super(blockID, material, properties);
@@ -27,10 +25,11 @@ public class DimensionalDoor extends BaseDimDoor
DimLink link = dimension.getLink(x, y, z);
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
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.tileentities.TileEntityTransTrapdoor;
@SuppressWarnings("deprecation")
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);
world.setBlockTileEntity(x, y, z, this.createNewTileEntity(world));
this.updateAttachedTile(world, x, y, z);
updateAttachedTile(world, x, y, z);
}
@Override
@@ -77,7 +76,7 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
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);
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.PocketManager;
@SuppressWarnings("deprecation")
public class WarpDoor extends BaseDimDoor
{
public WarpDoor(int blockID, Material material, DDProperties properties)