Fix #967 trees growing with wrong wood

This commit is contained in:
mezz committed 2015-11-16 23:13:39 -08:00
1 parent d82db2f003
commit d7c2f11ace
7 files changed
+11 -69

No files matched your search

@@ -70,7 +70,8 @@ public class ItemBlockWood extends ItemBlockForestry {
}
public static void saveToItemStack(EnumWoodType woodType, ItemStack itemStack) {
itemStack.setItemDamage(woodType.ordinal());
int ordinal = woodType.ordinal();
itemStack.setItemDamage(ordinal);
}
public static EnumWoodType getWoodType(ItemStack stack) {
@@ -15,7 +15,6 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockTypeLog extends BlockTypeWood {
public BlockTypeLog(ItemStack itemStack) {
super(itemStack);
}
@@ -23,12 +22,11 @@ public class BlockTypeLog extends BlockTypeWood {
@Override
public void setDirection(ForgeDirection facing) {
if (facing.offsetX != 0) {
itemStack.setItemDamage(4);
blockMeta = 4;
} else if (facing.offsetZ != 0) {
itemStack.setItemDamage(8);
blockMeta = 8;
} else {
itemStack.setItemDamage(0);
blockMeta = 0;
}
}
}
@@ -10,7 +10,6 @@
******************************************************************************/
package forestry.arboriculture.worldgen;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@@ -23,6 +22,7 @@ import forestry.core.worldgen.IBlockType;
public class BlockTypeWood implements IBlockType, ITreeBlockType {
protected final ItemStack itemStack;
protected int blockMeta;
public BlockTypeWood(ItemStack itemStack) {
this.itemStack = itemStack;
@@ -35,26 +35,11 @@ public class BlockTypeWood implements IBlockType, ITreeBlockType {
@Override
public void setBlock(World world, int x, int y, int z) {
ItemBlockWood.placeWood(itemStack, null, world, x, y, z, itemStack.getItemDamage());
ItemBlockWood.placeWood(itemStack, null, world, x, y, z, blockMeta);
}
@Override
public void setDirection(ForgeDirection facing) {
}
@Override
public Block getBlock() {
return Block.getBlockFromItem(itemStack.getItem());
}
@Override
public int getMeta() {
return itemStack.getItemDamage();
}
@Override
public ItemStack getItemStack() {
return itemStack;
}
}
@@ -23,16 +23,16 @@ public class BlockTypeWoodStairs extends BlockTypeWood {
public void setDirection(ForgeDirection facing) {
switch (facing) {
case NORTH:
itemStack.setItemDamage(3);
blockMeta = 3;
break;
case SOUTH:
itemStack.setItemDamage(2);
blockMeta = 2;
break;
case WEST:
itemStack.setItemDamage(1);
blockMeta = 1;
break;
default:
itemStack.setItemDamage(0);
blockMeta = 0;
break;
}
}
@@ -11,7 +11,6 @@
package forestry.core.worldgen;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -19,7 +18,6 @@ import net.minecraftforge.common.util.ForgeDirection;
import forestry.core.config.Constants;
public class BlockType implements IBlockType {
private final Block block;
protected int meta;
@@ -37,19 +35,4 @@ public class BlockType implements IBlockType {
public void setBlock(World world, int x, int y, int z) {
world.setBlock(x, y, z, block, meta, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
}
@Override
public int getMeta() {
return this.meta;
}
@Override
public Block getBlock() {
return this.block;
}
@Override
public ItemStack getItemStack() {
return new ItemStack(block, 1, meta);
}
}
@@ -11,7 +11,6 @@
package forestry.core.worldgen;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -22,7 +21,6 @@ import forestry.core.config.ForestryBlock;
import forestry.core.tiles.TileForestry;
public class BlockTypeTileForestry implements IBlockType {
private final Block block;
private final int meta;
private ForgeDirection direction;
@@ -59,19 +57,4 @@ public class BlockTypeTileForestry implements IBlockType {
tileForestry.setOrientation(direction);
}
@Override
public int getMeta() {
return meta;
}
@Override
public Block getBlock() {
return block;
}
@Override
public ItemStack getItemStack() {
return new ItemStack(block, 1, meta);
}
}
@@ -10,8 +10,6 @@
******************************************************************************/
package forestry.core.worldgen;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -20,10 +18,4 @@ public interface IBlockType {
void setDirection(ForgeDirection facing);
void setBlock(World world, int x, int y, int z);
int getMeta();
Block getBlock();
ItemStack getItemStack();
}