Fixed Pick Block Results
We previously returned the Vanilla counterparts to our doors as the items to be used by the pick block button - used in Creative mode for replicating nearby blocks. This was incorrect because we would want to return the actual door item needed to place the particular door in question. More importantly, this might solve our issues with WAILA reporting the wrong information when players look at our doors. I read the code for the most recent version of WAILA and it uses various functions to choose how to identify a block. The result of Block.idPicked() is probably used as the main source for the identities of our blocks.
This commit is contained in:
parent
52bae00dc6
commit
7d840ff895
9 changed files with 64 additions and 5 deletions
|
@ -340,9 +340,9 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
|||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int idPicked(World par1World, int par2, int par3, int par4)
|
||||
public int idPicked(World world, int x, int y, int z)
|
||||
{
|
||||
return this.getDrops();
|
||||
return this.getDoorItem();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.client.renderer.IconFlipped;
|
|||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -35,6 +36,13 @@ public class BlockDoorGold extends BlockDoor
|
|||
upperTextures[1] = new IconFlipped(upperTextures[0], true, false);
|
||||
lowerTextures[1] = new IconFlipped(lowerTextures[0], true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int idPicked(World world, int x, int y, int z)
|
||||
{
|
||||
return mod_pocketDim.itemGoldenDoor.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
|
|
|
@ -34,6 +34,12 @@ public class BlockGoldDimDoor extends BaseDimDoor
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
{
|
||||
return mod_pocketDim.itemGoldenDimensionalDoor.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.blocks;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||
|
@ -30,6 +31,12 @@ public class DimensionalDoor extends BaseDimDoor
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
{
|
||||
return mod_pocketDim.itemDimensionalDoor.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
{
|
||||
|
|
|
@ -12,5 +12,7 @@ public interface IDimDoor
|
|||
|
||||
public int getDrops();
|
||||
|
||||
public int getDoorItem();
|
||||
|
||||
public TileEntity initDoorTE(World world, int x, int y, int z);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@ package StevenDimDoors.mod_pocketDim.blocks;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockTrapDoor;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
|
@ -99,18 +102,30 @@ public class TransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntit
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int idPicked(World world, int x, int y, int z)
|
||||
{
|
||||
return this.getDoorItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idDropped(int metadata, Random random, int fortuneLevel)
|
||||
{
|
||||
return getDrops();
|
||||
return this.getDrops();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
{
|
||||
return mod_pocketDim.transTrapdoor.blockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
{
|
||||
return Block.trapdoor.blockID;
|
||||
return Block.trapdoor.blockID;
|
||||
}
|
||||
|
||||
public static boolean isTrapdoorSetLow(int metadata)
|
||||
|
|
|
@ -72,6 +72,12 @@ public class TransientDoor extends BaseDimDoor
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
|
|
|
@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.blocks;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
|
@ -24,6 +25,13 @@ public class UnstableDoor extends BaseDimDoor
|
|||
dimension.createLink(x, y, z, LinkTypes.RANDOM,world.getBlockMetadata(x, y - 1, z));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
{
|
||||
return mod_pocketDim.itemUnstableDoor.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.blocks;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||
import StevenDimDoors.mod_pocketDim.core.LinkTypes;
|
||||
|
@ -30,6 +31,12 @@ public class WarpDoor extends BaseDimDoor
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDoorItem()
|
||||
{
|
||||
return mod_pocketDim.itemWarpDoor.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrops()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue