mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-14 01:04:12 +00:00
Fix #433 Stairs have wrong pick-block and Waila name
This commit is contained in:
1 parent
e5979367ee
commit
080e026285
2 files changed
+28
-9
No files matched your search
@@ -12,6 +12,7 @@ package forestry.arboriculture.gadgets;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -28,6 +29,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -104,6 +106,25 @@ public class BlockArbStairs extends BlockStairs {
|
||||
return new TileStairs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
ItemStack itemStack = super.getPickBlock(target, world, x, y, z);
|
||||
NBTTagCompound stairsNBT = getTagCompoundForStairs(world, x, y, z);
|
||||
itemStack.setTagCompound(stairsNBT);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
private static NBTTagCompound getTagCompoundForStairs(IBlockAccess world, int x, int y, int z) {
|
||||
TileStairs stairs = getStairTile(world, x, y, z);
|
||||
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
if (stairs == null || stairs.getType() == null)
|
||||
return nbttagcompound;
|
||||
|
||||
stairs.getType().saveToCompound(nbttagcompound);
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
/* ICONS */
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
|
||||
@@ -10,20 +10,19 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.items;
|
||||
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.arboriculture.gadgets.BlockArbStairs;
|
||||
import forestry.arboriculture.gadgets.TileStairs;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.items.ItemForestryBlock;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.arboriculture.gadgets.TileStairs;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.items.ItemForestryBlock;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class ItemStairs extends ItemForestryBlock {
|
||||
|
||||
public ItemStairs(Block block) {
|
||||
@@ -65,7 +64,6 @@ public class ItemStairs extends ItemForestryBlock {
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemStack) {
|
||||
BlockArbStairs block = (BlockArbStairs) getBlock();
|
||||
WoodType woodType = WoodType.getFromCompound(itemStack.getTagCompound());
|
||||
if (woodType == null)
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user