mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-25 14:34:33 +00:00
Update buildscript & spotlessApply
This commit is contained in:
1 parent
e4329e2b8f
commit
8683a345c3
818 files changed
+51123
-49403
No files matched your search
@@ -8,6 +8,8 @@ import binnie.extratrees.ExtraTrees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -24,251 +26,249 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockETDoor extends BlockDoor implements IBlockMetadata {
|
||||
protected BlockETDoor() {
|
||||
super(Material.wood);
|
||||
setHardness(3.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("door");
|
||||
}
|
||||
protected BlockETDoor() {
|
||||
super(Material.wood);
|
||||
setHardness(3.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("door");
|
||||
}
|
||||
|
||||
public static DoorType getDoorType(int tileMeta) {
|
||||
int type = (tileMeta & 0xF00) >> 8;
|
||||
if (type >= 0 && type < DoorType.values().length) {
|
||||
return DoorType.values()[type];
|
||||
}
|
||||
return DoorType.STANDARD;
|
||||
}
|
||||
public static DoorType getDoorType(int tileMeta) {
|
||||
int type = (tileMeta & 0xF00) >> 8;
|
||||
if (type >= 0 && type < DoorType.values().length) {
|
||||
return DoorType.values()[type];
|
||||
}
|
||||
return DoorType.STANDARD;
|
||||
}
|
||||
|
||||
private IIcon getFlippedIcon(boolean upper, boolean flip, int tileMeta) {
|
||||
DoorType type = getDoorType(tileMeta);
|
||||
if (upper) {
|
||||
return flip ? type.iconDoorUpperFlip : type.iconDoorUpper;
|
||||
}
|
||||
return flip ? type.iconDoorLowerFlip : type.iconDoorLower;
|
||||
}
|
||||
private IIcon getFlippedIcon(boolean upper, boolean flip, int tileMeta) {
|
||||
DoorType type = getDoorType(tileMeta);
|
||||
if (upper) {
|
||||
return flip ? type.iconDoorUpperFlip : type.iconDoorUpper;
|
||||
}
|
||||
return flip ? type.iconDoorLowerFlip : type.iconDoorLower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return DoorType.STANDARD.iconDoorLower;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return DoorType.STANDARD.iconDoorLower;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int meta) {
|
||||
if (meta != 1 && meta != 0) {
|
||||
int i1 = getFullMetadata(blockAccess, x, y, z);
|
||||
int j1 = i1 & 0x3;
|
||||
boolean flag = (i1 & 0x4) != 0;
|
||||
boolean flag2;
|
||||
boolean flag3 = (i1 & 0x8) != 0;
|
||||
if (flag) {
|
||||
flag2 = (j1 == 0 && meta == 2)
|
||||
|| (j1 == 1 && meta == 5)
|
||||
|| (j1 == 2 && meta == 3)
|
||||
|| (j1 == 3 && meta == 4);
|
||||
} else {
|
||||
flag2 = (j1 == 0 && meta == 5)
|
||||
|| (j1 == 1 && meta == 3)
|
||||
|| (j1 == 2 && meta == 4)
|
||||
|| (j1 == 3 && meta == 2);
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int meta) {
|
||||
if (meta != 1 && meta != 0) {
|
||||
int i1 = getFullMetadata(blockAccess, x, y, z);
|
||||
int j1 = i1 & 0x3;
|
||||
boolean flag = (i1 & 0x4) != 0;
|
||||
boolean flag2;
|
||||
boolean flag3 = (i1 & 0x8) != 0;
|
||||
if (flag) {
|
||||
flag2 = (j1 == 0 && meta == 2)
|
||||
|| (j1 == 1 && meta == 5)
|
||||
|| (j1 == 2 && meta == 3)
|
||||
|| (j1 == 3 && meta == 4);
|
||||
} else {
|
||||
flag2 = (j1 == 0 && meta == 5)
|
||||
|| (j1 == 1 && meta == 3)
|
||||
|| (j1 == 2 && meta == 4)
|
||||
|| (j1 == 3 && meta == 2);
|
||||
|
||||
if ((i1 & 0x10) != 0) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
}
|
||||
if ((i1 & 0x10) != 0) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
}
|
||||
|
||||
int tileMeta;
|
||||
if (flag3) {
|
||||
tileMeta = TileEntityMetadata.getTileMetadata(blockAccess, x, y - 1, z);
|
||||
} else {
|
||||
tileMeta = TileEntityMetadata.getTileMetadata(blockAccess, x, y, z);
|
||||
}
|
||||
return getFlippedIcon(flag3, flag2, tileMeta);
|
||||
}
|
||||
return DoorType.STANDARD.iconDoorLower;
|
||||
}
|
||||
int tileMeta;
|
||||
if (flag3) {
|
||||
tileMeta = TileEntityMetadata.getTileMetadata(blockAccess, x, y - 1, z);
|
||||
} else {
|
||||
tileMeta = TileEntityMetadata.getTileMetadata(blockAccess, x, y, z);
|
||||
}
|
||||
return getFlippedIcon(flag3, flag2, tileMeta);
|
||||
}
|
||||
return DoorType.STANDARD.iconDoorLower;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (DoorType type : DoorType.values()) {
|
||||
type.iconDoorLower = ExtraTrees.proxy.getIcon(register, "door." + type.id + ".lower");
|
||||
type.iconDoorUpper = ExtraTrees.proxy.getIcon(register, "door." + type.id + ".upper");
|
||||
type.iconDoorLowerFlip = new IconFlipped(type.iconDoorLower, true, false);
|
||||
type.iconDoorUpperFlip = new IconFlipped(type.iconDoorUpper, true, false);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (DoorType type : DoorType.values()) {
|
||||
type.iconDoorLower = ExtraTrees.proxy.getIcon(register, "door." + type.id + ".lower");
|
||||
type.iconDoorUpper = ExtraTrees.proxy.getIcon(register, "door." + type.id + ".upper");
|
||||
type.iconDoorLowerFlip = new IconFlipped(type.iconDoorLower, true, false);
|
||||
type.iconDoorUpperFlip = new IconFlipped(type.iconDoorUpper, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ExtraTrees.doorRenderId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ExtraTrees.doorRenderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess blockAccess, int x, int y, int z) {
|
||||
int i1 = getFullMetadata(blockAccess, x, y, z);
|
||||
if ((i1 & 0x8) != 0) {
|
||||
int meta = TileEntityMetadata.getTileMetadata(blockAccess, x, y - 1, z);
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColor();
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess blockAccess, int x, int y, int z) {
|
||||
int i1 = getFullMetadata(blockAccess, x, y, z);
|
||||
if ((i1 & 0x8) != 0) {
|
||||
int meta = TileEntityMetadata.getTileMetadata(blockAccess, x, y - 1, z);
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColor();
|
||||
}
|
||||
|
||||
int meta = TileEntityMetadata.getTileMetadata(blockAccess, x, y, z);
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColor();
|
||||
}
|
||||
int meta = TileEntityMetadata.getTileMetadata(blockAccess, x, y, z);
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColor();
|
||||
}
|
||||
|
||||
public int getFullMetadata(IBlockAccess blockAccess, int x, int y, int z) {
|
||||
int l = blockAccess.getBlockMetadata(x, y, z);
|
||||
boolean flag = (l & 0x8) != 0x0;
|
||||
int i1;
|
||||
int j1;
|
||||
if (flag) {
|
||||
i1 = blockAccess.getBlockMetadata(x, y - 1, z);
|
||||
j1 = l;
|
||||
} else {
|
||||
i1 = l;
|
||||
j1 = blockAccess.getBlockMetadata(x, y + 1, z);
|
||||
}
|
||||
public int getFullMetadata(IBlockAccess blockAccess, int x, int y, int z) {
|
||||
int l = blockAccess.getBlockMetadata(x, y, z);
|
||||
boolean flag = (l & 0x8) != 0x0;
|
||||
int i1;
|
||||
int j1;
|
||||
if (flag) {
|
||||
i1 = blockAccess.getBlockMetadata(x, y - 1, z);
|
||||
j1 = l;
|
||||
} else {
|
||||
i1 = l;
|
||||
j1 = blockAccess.getBlockMetadata(x, y + 1, z);
|
||||
}
|
||||
|
||||
boolean flag2 = (j1 & 0x1) != 0x0;
|
||||
return (i1 & 0x7) | (flag ? 8 : 0) | (flag2 ? 16 : 0);
|
||||
}
|
||||
boolean flag2 = (j1 & 0x1) != 0x0;
|
||||
return (i1 & 0x7) | (flag ? 8 : 0) | (flag2 ? 16 : 0);
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if ((meta & 8) == 0) {
|
||||
boolean flag = false;
|
||||
if (world.getBlock(x, y + 1, z) != this) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
flag = true;
|
||||
}
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if ((meta & 8) == 0) {
|
||||
boolean flag = false;
|
||||
if (world.getBlock(x, y + 1, z) != this) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
if (!world.isRemote) {
|
||||
dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
}
|
||||
} else {
|
||||
boolean flag1 = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z);
|
||||
if ((flag1 || block.canProvidePower()) && block != this) {
|
||||
func_150014_a(world, x, y, z, flag1);
|
||||
}
|
||||
}
|
||||
if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z)) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
if (world.getBlock(x, y + 1, z) == this) {
|
||||
world.setBlockToAir(x, y + 1, z);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (world.getBlock(x, y - 1, z) != this) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
if (flag) {
|
||||
if (!world.isRemote) {
|
||||
dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
}
|
||||
} else {
|
||||
boolean flag1 = world.isBlockIndirectlyGettingPowered(x, y, z)
|
||||
|| world.isBlockIndirectlyGettingPowered(x, y + 1, z);
|
||||
if ((flag1 || block.canProvidePower()) && block != this) {
|
||||
func_150014_a(world, x, y, z, flag1);
|
||||
}
|
||||
}
|
||||
|
||||
if (block != this) {
|
||||
onNeighborBlockChange(world, x, y - 1, z, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z)) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
if (world.getBlock(x, y + 1, z) == this) {
|
||||
world.setBlockToAir(x, y + 1, z);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (world.getBlock(x, y - 1, z) != this) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) {
|
||||
if ((meta & 0x08) != 0) {
|
||||
y -= 1;
|
||||
}
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, meta);
|
||||
}
|
||||
if (block != this) {
|
||||
onNeighborBlockChange(world, x, y - 1, z, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) {
|
||||
if ((meta & 0x08) != 0) {
|
||||
y -= 1;
|
||||
}
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int k) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int k) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack stack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack stack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack stack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(stack);
|
||||
String typeName = getDoorType(meta).getName();
|
||||
String woodName = WoodManager.getPlankType(meta & 0xFF).getName();
|
||||
if (typeName.isEmpty()) {
|
||||
return I18N.localise("extratrees.block.door.name", woodName);
|
||||
}
|
||||
return I18N.localise("extratrees.block.door.name.adv", woodName, typeName);
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(ItemStack stack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(stack);
|
||||
String typeName = getDoorType(meta).getName();
|
||||
String woodName = WoodManager.getPlankType(meta & 0xFF).getName();
|
||||
if (typeName.isEmpty()) {
|
||||
return I18N.localise("extratrees.block.door.name", woodName);
|
||||
}
|
||||
return I18N.localise("extratrees.block.door.name.adv", woodName, typeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack stack) {
|
||||
dropBlockAsItem(world, x, y, z, stack);
|
||||
}
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
|
||||
for (IPlankType type : PlankType.ExtraTreePlanks.values()) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.STANDARD));
|
||||
}
|
||||
for (IPlankType type : PlankType.ForestryPlanks.values()) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.STANDARD));
|
||||
}
|
||||
for (IPlankType type : PlankType.ExtraBiomesPlank.values()) {
|
||||
if (type.getStack() != null) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.STANDARD));
|
||||
}
|
||||
}
|
||||
for (IPlankType type : PlankType.VanillaPlanks.values()) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.STANDARD));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack stack) {
|
||||
dropBlockAsItem(world, x, y, z, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
|
||||
for (IPlankType type : PlankType.ExtraTreePlanks.values()) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.STANDARD));
|
||||
}
|
||||
for (IPlankType type : PlankType.ForestryPlanks.values()) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.STANDARD));
|
||||
}
|
||||
for (IPlankType type : PlankType.ExtraBiomesPlank.values()) {
|
||||
if (type.getStack() != null) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.STANDARD));
|
||||
}
|
||||
}
|
||||
for (IPlankType type : PlankType.VanillaPlanks.values()) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.STANDARD));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import binnie.core.util.I18N;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -21,185 +23,182 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockETLog extends BlockLog implements IBlockMetadata {
|
||||
public BlockETLog() {
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("log");
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
public BlockETLog() {
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("log");
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < ILogType.ExtraTreeLog.values().length; ++i) {
|
||||
list.add(TileEntityMetadata.getItemStack(this, i));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < ILogType.ExtraTreeLog.values().length; ++i) {
|
||||
list.add(TileEntityMetadata.getItemStack(this, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata(), world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata(), world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
public IIcon getIcon(int side, int tileMeta, int blockMeta) {
|
||||
int oriented = blockMeta & 0xC;
|
||||
ILogType.ExtraTreeLog log = ILogType.ExtraTreeLog.values()[tileMeta];
|
||||
switch (oriented) {
|
||||
case 4:
|
||||
if (side > 3) {
|
||||
return log.getTrunk();
|
||||
}
|
||||
return log.getBark();
|
||||
public IIcon getIcon(int side, int tileMeta, int blockMeta) {
|
||||
int oriented = blockMeta & 0xC;
|
||||
ILogType.ExtraTreeLog log = ILogType.ExtraTreeLog.values()[tileMeta];
|
||||
switch (oriented) {
|
||||
case 4:
|
||||
if (side > 3) {
|
||||
return log.getTrunk();
|
||||
}
|
||||
return log.getBark();
|
||||
|
||||
case 8:
|
||||
if (side == 2 || side == 3) {
|
||||
return log.getTrunk();
|
||||
}
|
||||
return log.getBark();
|
||||
}
|
||||
if (side < 2) {
|
||||
return log.getTrunk();
|
||||
}
|
||||
return log.getBark();
|
||||
}
|
||||
case 8:
|
||||
if (side == 2 || side == 3) {
|
||||
return log.getTrunk();
|
||||
}
|
||||
return log.getBark();
|
||||
}
|
||||
if (side < 2) {
|
||||
return log.getTrunk();
|
||||
}
|
||||
return log.getBark();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int tileMeta) {
|
||||
return getIcon(side, tileMeta, 0);
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int tileMeta) {
|
||||
return getIcon(side, tileMeta, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
ILogType.ExtraTreeLog.registerIcons(register);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
ILogType.ExtraTreeLog.registerIcons(register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 31;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
ILogType.ExtraTreeLog[] logs= ILogType.ExtraTreeLog.values();
|
||||
if(meta < 0 || meta >= logs.length) {
|
||||
meta = 0;
|
||||
}
|
||||
return I18N.localise("extratrees.block.log.name", logs[meta].getName());
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
ILogType.ExtraTreeLog[] logs = ILogType.ExtraTreeLog.values();
|
||||
if (meta < 0 || meta >= logs.length) {
|
||||
meta = 0;
|
||||
}
|
||||
return I18N.localise("extratrees.block.log.name", logs[meta].getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float par6, float par7, float par8, int meta) {
|
||||
byte b0 = 0;
|
||||
switch (side) {
|
||||
case 0:
|
||||
case 1:
|
||||
b0 = 0;
|
||||
break;
|
||||
@Override
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float par6, float par7, float par8, int meta) {
|
||||
byte b0 = 0;
|
||||
switch (side) {
|
||||
case 0:
|
||||
case 1:
|
||||
b0 = 0;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
b0 = 8;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
b0 = 8;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case 5:
|
||||
b0 = 4;
|
||||
break;
|
||||
}
|
||||
return b0;
|
||||
}
|
||||
case 4:
|
||||
case 5:
|
||||
b0 = 4;
|
||||
break;
|
||||
}
|
||||
return b0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import binnie.core.util.I18N;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockWood;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -21,129 +23,126 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockETPlanks extends BlockWood implements IBlockMetadata {
|
||||
public BlockETPlanks() {
|
||||
setBlockName("planks");
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
public BlockETPlanks() {
|
||||
setBlockName("planks");
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return I18N.localise("extratrees.block.plank.name", PlankType.ExtraTreePlanks.values()[meta].getName());
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return I18N.localise("extratrees.block.plank.name", PlankType.ExtraTreePlanks.values()[meta].getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < PlankType.ExtraTreePlanks.values().length; ++i) {
|
||||
list.add(TileEntityMetadata.getItemStack(this, i));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < PlankType.ExtraTreePlanks.values().length; ++i) {
|
||||
list.add(TileEntityMetadata.getItemStack(this, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return PlankType.ExtraTreePlanks.values()[meta].getIcon();
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return PlankType.ExtraTreePlanks.values()[meta].getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (PlankType.ExtraTreePlanks plank : PlankType.ExtraTreePlanks.values()) {
|
||||
plank.loadIcon(register);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (PlankType.ExtraTreePlanks plank : PlankType.ExtraTreePlanks.values()) {
|
||||
plank.loadIcon(register);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import binnie.extratrees.ExtraTrees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockWoodSlab;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -21,141 +23,139 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockETSlab extends BlockWoodSlab implements IBlockMetadata {
|
||||
public BlockETSlab(boolean isDouble) {
|
||||
super(isDouble);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setHardness(2.0f);
|
||||
setResistance(5.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
public BlockETSlab(boolean isDouble) {
|
||||
super(isDouble);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setHardness(2.0f);
|
||||
setResistance(5.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
|
||||
if (!field_150004_a) {
|
||||
useNeighborBrightness = true;
|
||||
}
|
||||
if (!field_150004_a) {
|
||||
useNeighborBrightness = true;
|
||||
}
|
||||
|
||||
setLightOpacity(0);
|
||||
setBlockName("slabs");
|
||||
}
|
||||
setLightOpacity(0);
|
||||
setBlockName("slabs");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
ArrayList<ItemStack> drops = new ArrayList<>();
|
||||
drops.addAll(BlockMetadata.getBlockDropped((IBlockMetadata) ExtraTrees.blockSlab, world, x, y, z, blockMeta));
|
||||
if (field_150004_a) {
|
||||
drops.addAll(BlockMetadata.getBlockDropped((IBlockMetadata) ExtraTrees.blockSlab, world, x, y, z, blockMeta));
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
ArrayList<ItemStack> drops = new ArrayList<>();
|
||||
drops.addAll(BlockMetadata.getBlockDropped((IBlockMetadata) ExtraTrees.blockSlab, world, x, y, z, blockMeta));
|
||||
if (field_150004_a) {
|
||||
drops.addAll(
|
||||
BlockMetadata.getBlockDropped((IBlockMetadata) ExtraTrees.blockSlab, world, x, y, z, blockMeta));
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return I18N.localise("extratrees.block.woodslab.name", PlankType.ExtraTreePlanks.values()[meta].getName());
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return I18N.localise("extratrees.block.woodslab.name", PlankType.ExtraTreePlanks.values()[meta].getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
if (field_150004_a) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < PlankType.ExtraTreePlanks.values().length; ++i) {
|
||||
list.add(TileEntityMetadata.getItemStack(this, i));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
if (field_150004_a) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < PlankType.ExtraTreePlanks.values().length; ++i) {
|
||||
list.add(TileEntityMetadata.getItemStack(this, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return PlankType.ExtraTreePlanks.values()[meta].getIcon();
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return PlankType.ExtraTreePlanks.values()[meta].getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import binnie.extratrees.ExtraTrees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -20,123 +22,122 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockETStairs extends BlockStairs implements IBlockMetadata {
|
||||
public BlockETStairs(Block par2Block) {
|
||||
super(par2Block, 0);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("stairs");
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
useNeighborBrightness = true;
|
||||
}
|
||||
public BlockETStairs(Block par2Block) {
|
||||
super(par2Block, 0);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("stairs");
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
useNeighborBrightness = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ExtraTrees.stairsID;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ExtraTrees.stairsID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
for (int i = 0; i < PlankType.ExtraTreePlanks.values().length; ++i) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||
for (int i = 0; i < PlankType.ExtraTreePlanks.values().length; ++i) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return WoodManager.getPlankType(meta + 32).getIcon();
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return WoodManager.getPlankType(meta + 32).getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return I18N.localise("extratrees.block.woodstairs.name", WoodManager.getPlankType(meta + 32).getName());
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return I18N.localise(
|
||||
"extratrees.block.woodstairs.name",
|
||||
WoodManager.getPlankType(meta + 32).getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,12 @@ import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockShrubLeaves extends BlockForestryLeaves {
|
||||
public BlockShrubLeaves() {
|
||||
super();
|
||||
}
|
||||
public BlockShrubLeaves() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginLeavesDecay(World world, int x, int y, int z) {
|
||||
// ignored, no able decay
|
||||
}
|
||||
@Override
|
||||
public void beginLeavesDecay(World world, int x, int y, int z) {
|
||||
// ignored, no able decay
|
||||
}
|
||||
}
|
||||
@@ -7,24 +7,25 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BranchBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int i) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ExtraTrees.branchRenderId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ExtraTrees.branchRenderId;
|
||||
}
|
||||
}
|
||||
@@ -9,74 +9,81 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class DoorBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
int c = block.colorMultiplier(renderer.blockAccess, x, y, z);
|
||||
float c2 = (c >> 16 & 0xFF) / 255.0f;
|
||||
float c3 = (c >> 8 & 0xFF) / 255.0f;
|
||||
float c4 = (c & 0xFF) / 255.0f;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int l = renderer.blockAccess.getBlockMetadata(x, y, z);
|
||||
if ((l & 0x8) != 0x0) {
|
||||
if (renderer.blockAccess.getBlock(x, y - 1, z) != block) {
|
||||
return false;
|
||||
}
|
||||
} else if (renderer.blockAccess.getBlock(x, y + 1, z) != block) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
int c = block.colorMultiplier(renderer.blockAccess, x, y, z);
|
||||
float c2 = (c >> 16 & 0xFF) / 255.0f;
|
||||
float c3 = (c >> 8 & 0xFF) / 255.0f;
|
||||
float c4 = (c & 0xFF) / 255.0f;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int l = renderer.blockAccess.getBlockMetadata(x, y, z);
|
||||
if ((l & 0x8) != 0x0) {
|
||||
if (renderer.blockAccess.getBlock(x, y - 1, z) != block) {
|
||||
return false;
|
||||
}
|
||||
} else if (renderer.blockAccess.getBlock(x, y + 1, z) != block) {
|
||||
return false;
|
||||
}
|
||||
|
||||
float f = 0.5f;
|
||||
float f2 = 1.0f;
|
||||
float f3 = 0.8f;
|
||||
float f4 = 0.6f;
|
||||
float f = 0.5f;
|
||||
float f2 = 1.0f;
|
||||
float f3 = 0.8f;
|
||||
float f4 = 0.6f;
|
||||
|
||||
int i1 = block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z);
|
||||
tessellator.setBrightness((renderer.renderMinY > 0.0) ? i1 : block.getMixedBrightnessForBlock(renderer.blockAccess, x, y - 1, z));
|
||||
tessellator.setColorOpaque_F(f * c2, f * c3, f * c4);
|
||||
renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 0));
|
||||
int i1 = block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z);
|
||||
tessellator.setBrightness(
|
||||
(renderer.renderMinY > 0.0) ? i1 : block.getMixedBrightnessForBlock(renderer.blockAccess, x, y - 1, z));
|
||||
tessellator.setColorOpaque_F(f * c2, f * c3, f * c4);
|
||||
renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 0));
|
||||
|
||||
tessellator.setBrightness((renderer.renderMaxY < 1.0) ? i1 : block.getMixedBrightnessForBlock(renderer.blockAccess, x, y + 1, z));
|
||||
tessellator.setColorOpaque_F(f2 * c2, f2 * c3, f2 * c4);
|
||||
renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 1));
|
||||
tessellator.setBrightness(
|
||||
(renderer.renderMaxY < 1.0) ? i1 : block.getMixedBrightnessForBlock(renderer.blockAccess, x, y + 1, z));
|
||||
tessellator.setColorOpaque_F(f2 * c2, f2 * c3, f2 * c4);
|
||||
renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 1));
|
||||
|
||||
tessellator.setBrightness((renderer.renderMinZ > 0.0) ? i1 : block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z - 1));
|
||||
tessellator.setColorOpaque_F(f3 * c2, f3 * c3, f3 * c4);
|
||||
IIcon icon = renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 2);
|
||||
renderer.renderFaceZNeg(block, x, y, z, icon);
|
||||
tessellator.setBrightness(
|
||||
(renderer.renderMinZ > 0.0) ? i1 : block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z - 1));
|
||||
tessellator.setColorOpaque_F(f3 * c2, f3 * c3, f3 * c4);
|
||||
IIcon icon = renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 2);
|
||||
renderer.renderFaceZNeg(block, x, y, z, icon);
|
||||
|
||||
renderer.flipTexture = false;
|
||||
tessellator.setBrightness((renderer.renderMaxZ < 1.0) ? i1 : block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z + 1));
|
||||
tessellator.setColorOpaque_F(f3 * c2, f3 * c3, f3 * c4);
|
||||
icon = renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 3);
|
||||
renderer.renderFaceZPos(block, x, y, z, icon);
|
||||
renderer.flipTexture = false;
|
||||
tessellator.setBrightness(
|
||||
(renderer.renderMaxZ < 1.0) ? i1 : block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z + 1));
|
||||
tessellator.setColorOpaque_F(f3 * c2, f3 * c3, f3 * c4);
|
||||
icon = renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 3);
|
||||
renderer.renderFaceZPos(block, x, y, z, icon);
|
||||
|
||||
renderer.flipTexture = false;
|
||||
tessellator.setBrightness((renderer.renderMinX > 0.0) ? i1 : block.getMixedBrightnessForBlock(renderer.blockAccess, x - 1, y, z));
|
||||
tessellator.setColorOpaque_F(f4 * c2, f4 * c3, f4 * c4);
|
||||
icon = renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 4);
|
||||
renderer.renderFaceXNeg(block, x, y, z, icon);
|
||||
renderer.flipTexture = false;
|
||||
tessellator.setBrightness(
|
||||
(renderer.renderMinX > 0.0) ? i1 : block.getMixedBrightnessForBlock(renderer.blockAccess, x - 1, y, z));
|
||||
tessellator.setColorOpaque_F(f4 * c2, f4 * c3, f4 * c4);
|
||||
icon = renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 4);
|
||||
renderer.renderFaceXNeg(block, x, y, z, icon);
|
||||
|
||||
renderer.flipTexture = false;
|
||||
tessellator.setBrightness((renderer.renderMaxX < 1.0) ? i1 : block.getMixedBrightnessForBlock(renderer.blockAccess, x + 1, y, z));
|
||||
tessellator.setColorOpaque_F(f4 * c2, f4 * c3, f4 * c4);
|
||||
icon = renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 5);
|
||||
renderer.renderFaceXPos(block, x, y, z, icon);
|
||||
renderer.flipTexture = false;
|
||||
return true;
|
||||
}
|
||||
renderer.flipTexture = false;
|
||||
tessellator.setBrightness(
|
||||
(renderer.renderMaxX < 1.0) ? i1 : block.getMixedBrightnessForBlock(renderer.blockAccess, x + 1, y, z));
|
||||
tessellator.setColorOpaque_F(f4 * c2, f4 * c3, f4 * c4);
|
||||
icon = renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 5);
|
||||
renderer.renderFaceXPos(block, x, y, z, icon);
|
||||
renderer.flipTexture = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int i) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ExtraTrees.doorRenderId;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ExtraTrees.doorRenderId;
|
||||
}
|
||||
}
|
||||
@@ -4,23 +4,23 @@ import binnie.core.util.I18N;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public enum DoorType {
|
||||
STANDARD("standard"),
|
||||
SOLID("solid"),
|
||||
DOUBLE("double"),
|
||||
FULL("full");
|
||||
STANDARD("standard"),
|
||||
SOLID("solid"),
|
||||
DOUBLE("double"),
|
||||
FULL("full");
|
||||
|
||||
protected String id;
|
||||
protected IIcon iconDoorLower;
|
||||
protected IIcon iconDoorUpper;
|
||||
protected IIcon iconDoorLowerFlip;
|
||||
protected IIcon iconDoorUpperFlip;
|
||||
protected IIcon iconItem;
|
||||
protected String id;
|
||||
protected IIcon iconDoorLower;
|
||||
protected IIcon iconDoorUpper;
|
||||
protected IIcon iconDoorLowerFlip;
|
||||
protected IIcon iconDoorUpperFlip;
|
||||
protected IIcon iconItem;
|
||||
|
||||
DoorType(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
DoorType(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return I18N.localise("extratrees.block.door.type." + id);
|
||||
}
|
||||
public String getName() {
|
||||
return I18N.localise("extratrees.block.door.type." + id);
|
||||
}
|
||||
}
|
||||
@@ -9,44 +9,44 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public enum FruitPod implements IIconProvider {
|
||||
Cocoa,
|
||||
Banana,
|
||||
Coconut,
|
||||
Plantain,
|
||||
RedBanana,
|
||||
Papayimar;
|
||||
Cocoa,
|
||||
Banana,
|
||||
Coconut,
|
||||
Plantain,
|
||||
RedBanana,
|
||||
Papayimar;
|
||||
|
||||
protected short[] textures;
|
||||
protected IIcon[] icons;
|
||||
protected short[] textures;
|
||||
protected IIcon[] icons;
|
||||
|
||||
FruitPod() {
|
||||
textures = new short[]{
|
||||
BinnieCore.proxy.getUniqueTextureUID(),
|
||||
BinnieCore.proxy.getUniqueTextureUID(),
|
||||
BinnieCore.proxy.getUniqueTextureUID(),
|
||||
};
|
||||
icons = new IIcon[3];
|
||||
}
|
||||
FruitPod() {
|
||||
textures = new short[] {
|
||||
BinnieCore.proxy.getUniqueTextureUID(),
|
||||
BinnieCore.proxy.getUniqueTextureUID(),
|
||||
BinnieCore.proxy.getUniqueTextureUID(),
|
||||
};
|
||||
icons = new IIcon[3];
|
||||
}
|
||||
|
||||
public short[] getTextures() {
|
||||
return textures;
|
||||
}
|
||||
public short[] getTextures() {
|
||||
return textures;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(short texUID) {
|
||||
int index = textures[0] - texUID;
|
||||
if (index >= 0 && index < 3) {
|
||||
return icons[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(short texUID) {
|
||||
int index = textures[0] - texUID;
|
||||
if (index >= 0 && index < 3) {
|
||||
return icons[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icons[0] = ExtraTrees.proxy.getIcon(register, "pods/" + toString().toLowerCase() + ".0");
|
||||
icons[1] = ExtraTrees.proxy.getIcon(register, "pods/" + toString().toLowerCase() + ".1");
|
||||
icons[2] = ExtraTrees.proxy.getIcon(register, "pods/" + toString().toLowerCase() + ".2");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icons[0] = ExtraTrees.proxy.getIcon(register, "pods/" + toString().toLowerCase() + ".0");
|
||||
icons[1] = ExtraTrees.proxy.getIcon(register, "pods/" + toString().toLowerCase() + ".1");
|
||||
icons[2] = ExtraTrees.proxy.getIcon(register, "pods/" + toString().toLowerCase() + ".2");
|
||||
}
|
||||
}
|
||||
@@ -9,81 +9,87 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GateItemRenderer implements IItemRenderer {
|
||||
private void renderStairBlock(RenderBlocks renderBlocks, ItemStack item, float f, float g, float h) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Block block = ((ItemBlock) item.getItem()).field_150939_a;
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
float f2 = 0.0625f;
|
||||
if (k == 0) {
|
||||
renderBlocks.setRenderBounds(0.5f - f2, 0.30000001192092896, 0.0, 0.5f + f2, 1.0, f2 * 2.0f);
|
||||
}
|
||||
if (k == 1) {
|
||||
renderBlocks.setRenderBounds(0.5f - f2, 0.30000001192092896, 1.0f - f2 * 2.0f, 0.5f + f2, 1.0, 1.0);
|
||||
}
|
||||
f2 = 0.0625f;
|
||||
if (k == 2) {
|
||||
renderBlocks.setRenderBounds(0.5f - f2, 0.5, 0.0, 0.5f + f2, 1.0f - f2, 1.0);
|
||||
}
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderBlocks.renderFaceYNeg(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 0, item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderBlocks.renderFaceYPos(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 1, item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderBlocks.renderFaceZNeg(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 2, item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderBlocks.renderFaceZPos(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 3, item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderBlocks.renderFaceXNeg(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 4, item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderBlocks.renderFaceXPos(block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 5, item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
private void renderStairBlock(RenderBlocks renderBlocks, ItemStack item, float f, float g, float h) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Block block = ((ItemBlock) item.getItem()).field_150939_a;
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
float f2 = 0.0625f;
|
||||
if (k == 0) {
|
||||
renderBlocks.setRenderBounds(0.5f - f2, 0.30000001192092896, 0.0, 0.5f + f2, 1.0, f2 * 2.0f);
|
||||
}
|
||||
if (k == 1) {
|
||||
renderBlocks.setRenderBounds(0.5f - f2, 0.30000001192092896, 1.0f - f2 * 2.0f, 0.5f + f2, 1.0, 1.0);
|
||||
}
|
||||
f2 = 0.0625f;
|
||||
if (k == 2) {
|
||||
renderBlocks.setRenderBounds(0.5f - f2, 0.5, 0.0, 0.5f + f2, 1.0f - f2, 1.0);
|
||||
}
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderBlocks.renderFaceYNeg(
|
||||
block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 0, item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderBlocks.renderFaceYPos(
|
||||
block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 1, item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderBlocks.renderFaceZNeg(
|
||||
block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 2, item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderBlocks.renderFaceZPos(
|
||||
block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 3, item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderBlocks.renderFaceXNeg(
|
||||
block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 4, item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderBlocks.renderFaceXPos(
|
||||
block, 0.0, 0.0, 0.0, renderBlocks.getBlockIconFromSideAndMetadata(block, 5, item.getItemDamage()));
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
case EQUIPPED:
|
||||
case INVENTORY:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
case EQUIPPED:
|
||||
case INVENTORY:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(
|
||||
IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderStairBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
@Override
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderStairBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
|
||||
case EQUIPPED:
|
||||
renderStairBlock((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderStairBlock((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
|
||||
case INVENTORY:
|
||||
renderStairBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
case INVENTORY:
|
||||
renderStairBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,5 +3,5 @@ package binnie.extratrees.block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IFenceProvider {
|
||||
ItemStack getFence();
|
||||
ItemStack getFence();
|
||||
}
|
||||
@@ -1,219 +1,219 @@
|
||||
package binnie.extratrees.block;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.arboriculture.worldgen.BlockTypeLog;
|
||||
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.arboriculture.worldgen.BlockTypeLog;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface ILogType {
|
||||
void placeBlock(World p0, int p1, int p2, int p3);
|
||||
void placeBlock(World p0, int p1, int p2, int p3);
|
||||
|
||||
ItemStack getItemStack();
|
||||
ItemStack getItemStack();
|
||||
|
||||
int getColour();
|
||||
int getColour();
|
||||
|
||||
enum ExtraTreeLog implements ILogType {
|
||||
Apple("apple", 0x7b7a7b, PlankType.ExtraTreePlanks.Apple),
|
||||
Fig("fig", 0x807357, PlankType.ExtraTreePlanks.Fig),
|
||||
Butternut("butternut", 0xb7ada0, PlankType.ExtraTreePlanks.Butternut),
|
||||
Cherry("cherry", 0x716850, PlankType.ForestryPlanks.CHERRY),
|
||||
Whitebeam("whitebeam", 0x786a6d, PlankType.ExtraTreePlanks.Whitebeam),
|
||||
Rowan("rowan", 0xb6b09b, PlankType.ExtraTreePlanks.Rowan),
|
||||
Hemlock("hemlock", 0xada39b, PlankType.ExtraTreePlanks.Hemlock),
|
||||
Ash("ash", 0x898982, PlankType.ExtraTreePlanks.Ash),
|
||||
Alder("alder", 0xc6c0b8, PlankType.ExtraTreePlanks.Alder),
|
||||
Beech("beech", 0xb2917e, PlankType.ExtraTreePlanks.Beech),
|
||||
Hawthorn("hawthorn", 0x5f5745, PlankType.ExtraTreePlanks.Hawthorn),
|
||||
Banana("banana", 0x85924f),
|
||||
Yew("yew", 0xd1bbc1, PlankType.ExtraTreePlanks.Yew),
|
||||
Cypress("cypress", 0x9a8483, PlankType.ExtraTreePlanks.Cypress),
|
||||
Fir("fir", 0x828382, PlankType.ExtraTreePlanks.Fir),
|
||||
Hazel("hazel", 0xaa986f, PlankType.ExtraTreePlanks.Hazel),
|
||||
Hickory("hickory", 0x3e3530, PlankType.ExtraTreePlanks.Hickory),
|
||||
Elm("elm", 0x848386, PlankType.ExtraTreePlanks.Elm),
|
||||
Elder("elder", 0xd8b874, PlankType.ExtraTreePlanks.Elder),
|
||||
Holly("holly", 0xb5aa85, PlankType.ExtraTreePlanks.Holly),
|
||||
Hornbeam("hornbeam", 0xa39276, PlankType.ExtraTreePlanks.Hornbeam),
|
||||
Cedar("cedar", 0xad764f, PlankType.ExtraTreePlanks.Cedar),
|
||||
Olive("olive", 0x7b706a, PlankType.ExtraTreePlanks.Olive),
|
||||
Sweetgum("sweetgum", 0xa1a19c, PlankType.ExtraTreePlanks.Sweetgum),
|
||||
Locust("locust", 0xadacbc, PlankType.ExtraTreePlanks.Locust),
|
||||
Pear("pear", 0xa89779, PlankType.ExtraTreePlanks.Pear),
|
||||
Maclura("maclura", 0x8b5734, PlankType.ExtraTreePlanks.Maclura),
|
||||
Brazilwood("brazilwood", 0x9e8068, PlankType.ExtraTreePlanks.Brazilwood),
|
||||
Logwood("logwood", 0xf9e2d2, PlankType.ExtraTreePlanks.Logwood),
|
||||
Rosewood("rosewood", 0x998666, PlankType.ExtraTreePlanks.Rosewood),
|
||||
Purpleheart("purpleheart", 0x9392a2, PlankType.ExtraTreePlanks.Purpleheart),
|
||||
Iroko("iroko", 0x605c5b, PlankType.ExtraTreePlanks.Iroko),
|
||||
Gingko("gingko", 0xadae9c, PlankType.ExtraTreePlanks.Gingko),
|
||||
Eucalyptus("eucalyptus", 0xeadeda, PlankType.ExtraTreePlanks.Eucalyptus),
|
||||
Eucalyptus2("eucalyptus", 0x867e65, PlankType.ExtraTreePlanks.Eucalyptus),
|
||||
Box("box", 0xab6f57, PlankType.ExtraTreePlanks.Box),
|
||||
Syzgium("syzgium", 0xab6f57, PlankType.ExtraTreePlanks.Syzgium),
|
||||
Eucalyptus3("eucalyptus", 0x6cb03f, PlankType.ExtraTreePlanks.Eucalyptus),
|
||||
Cinnamon("cinnamon", 0x86583c, PlankType.VanillaPlanks.JUNGLE),
|
||||
PinkIvory("pinkivory", 0x7f6554, PlankType.ExtraTreePlanks.PinkIvory);
|
||||
enum ExtraTreeLog implements ILogType {
|
||||
Apple("apple", 0x7b7a7b, PlankType.ExtraTreePlanks.Apple),
|
||||
Fig("fig", 0x807357, PlankType.ExtraTreePlanks.Fig),
|
||||
Butternut("butternut", 0xb7ada0, PlankType.ExtraTreePlanks.Butternut),
|
||||
Cherry("cherry", 0x716850, PlankType.ForestryPlanks.CHERRY),
|
||||
Whitebeam("whitebeam", 0x786a6d, PlankType.ExtraTreePlanks.Whitebeam),
|
||||
Rowan("rowan", 0xb6b09b, PlankType.ExtraTreePlanks.Rowan),
|
||||
Hemlock("hemlock", 0xada39b, PlankType.ExtraTreePlanks.Hemlock),
|
||||
Ash("ash", 0x898982, PlankType.ExtraTreePlanks.Ash),
|
||||
Alder("alder", 0xc6c0b8, PlankType.ExtraTreePlanks.Alder),
|
||||
Beech("beech", 0xb2917e, PlankType.ExtraTreePlanks.Beech),
|
||||
Hawthorn("hawthorn", 0x5f5745, PlankType.ExtraTreePlanks.Hawthorn),
|
||||
Banana("banana", 0x85924f),
|
||||
Yew("yew", 0xd1bbc1, PlankType.ExtraTreePlanks.Yew),
|
||||
Cypress("cypress", 0x9a8483, PlankType.ExtraTreePlanks.Cypress),
|
||||
Fir("fir", 0x828382, PlankType.ExtraTreePlanks.Fir),
|
||||
Hazel("hazel", 0xaa986f, PlankType.ExtraTreePlanks.Hazel),
|
||||
Hickory("hickory", 0x3e3530, PlankType.ExtraTreePlanks.Hickory),
|
||||
Elm("elm", 0x848386, PlankType.ExtraTreePlanks.Elm),
|
||||
Elder("elder", 0xd8b874, PlankType.ExtraTreePlanks.Elder),
|
||||
Holly("holly", 0xb5aa85, PlankType.ExtraTreePlanks.Holly),
|
||||
Hornbeam("hornbeam", 0xa39276, PlankType.ExtraTreePlanks.Hornbeam),
|
||||
Cedar("cedar", 0xad764f, PlankType.ExtraTreePlanks.Cedar),
|
||||
Olive("olive", 0x7b706a, PlankType.ExtraTreePlanks.Olive),
|
||||
Sweetgum("sweetgum", 0xa1a19c, PlankType.ExtraTreePlanks.Sweetgum),
|
||||
Locust("locust", 0xadacbc, PlankType.ExtraTreePlanks.Locust),
|
||||
Pear("pear", 0xa89779, PlankType.ExtraTreePlanks.Pear),
|
||||
Maclura("maclura", 0x8b5734, PlankType.ExtraTreePlanks.Maclura),
|
||||
Brazilwood("brazilwood", 0x9e8068, PlankType.ExtraTreePlanks.Brazilwood),
|
||||
Logwood("logwood", 0xf9e2d2, PlankType.ExtraTreePlanks.Logwood),
|
||||
Rosewood("rosewood", 0x998666, PlankType.ExtraTreePlanks.Rosewood),
|
||||
Purpleheart("purpleheart", 0x9392a2, PlankType.ExtraTreePlanks.Purpleheart),
|
||||
Iroko("iroko", 0x605c5b, PlankType.ExtraTreePlanks.Iroko),
|
||||
Gingko("gingko", 0xadae9c, PlankType.ExtraTreePlanks.Gingko),
|
||||
Eucalyptus("eucalyptus", 0xeadeda, PlankType.ExtraTreePlanks.Eucalyptus),
|
||||
Eucalyptus2("eucalyptus", 0x867e65, PlankType.ExtraTreePlanks.Eucalyptus),
|
||||
Box("box", 0xab6f57, PlankType.ExtraTreePlanks.Box),
|
||||
Syzgium("syzgium", 0xab6f57, PlankType.ExtraTreePlanks.Syzgium),
|
||||
Eucalyptus3("eucalyptus", 0x6cb03f, PlankType.ExtraTreePlanks.Eucalyptus),
|
||||
Cinnamon("cinnamon", 0x86583c, PlankType.VanillaPlanks.JUNGLE),
|
||||
PinkIvory("pinkivory", 0x7f6554, PlankType.ExtraTreePlanks.PinkIvory);
|
||||
|
||||
protected String name;
|
||||
protected int color;
|
||||
protected IDesignMaterial plank;
|
||||
protected IIcon trunk;
|
||||
protected IIcon bark;
|
||||
protected String name;
|
||||
protected int color;
|
||||
protected IDesignMaterial plank;
|
||||
protected IIcon trunk;
|
||||
protected IIcon bark;
|
||||
|
||||
ExtraTreeLog(String name, int color) {
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
plank = null;
|
||||
}
|
||||
ExtraTreeLog(String name, int color) {
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
plank = null;
|
||||
}
|
||||
|
||||
ExtraTreeLog(String name, int color, IDesignMaterial plank) {
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.plank = plank;
|
||||
}
|
||||
ExtraTreeLog(String name, int color, IDesignMaterial plank) {
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.plank = plank;
|
||||
}
|
||||
|
||||
public static void registerIcons(IIconRegister register) {
|
||||
for (ExtraTreeLog log : values()) {
|
||||
log.trunk = ExtraTrees.proxy.getIcon(register, "logs/" + log.toString().toLowerCase() + "Trunk");
|
||||
log.bark = ExtraTrees.proxy.getIcon(register, "logs/" + log.toString().toLowerCase() + "Bark");
|
||||
}
|
||||
}
|
||||
public static void registerIcons(IIconRegister register) {
|
||||
for (ExtraTreeLog log : values()) {
|
||||
log.trunk = ExtraTrees.proxy.getIcon(
|
||||
register, "logs/" + log.toString().toLowerCase() + "Trunk");
|
||||
log.bark = ExtraTrees.proxy.getIcon(
|
||||
register, "logs/" + log.toString().toLowerCase() + "Bark");
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return I18N.localise("extratrees.block.planks." + name);
|
||||
}
|
||||
public String getName() {
|
||||
return I18N.localise("extratrees.block.planks." + name);
|
||||
}
|
||||
|
||||
public void addRecipe() {
|
||||
if (plank == null) {
|
||||
return;
|
||||
}
|
||||
public void addRecipe() {
|
||||
if (plank == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack log = getItemStack();
|
||||
ItemStack result = plank.getStack();
|
||||
result.stackSize = 4;
|
||||
GameRegistry.addShapelessRecipe(result, log);
|
||||
}
|
||||
ItemStack log = getItemStack();
|
||||
ItemStack result = plank.getStack();
|
||||
result.stackSize = 4;
|
||||
GameRegistry.addShapelessRecipe(result, log);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeBlock(World world, int x, int y, int z) {
|
||||
world.setBlock(x, y, z, ExtraTrees.blockLog, 0, 2);
|
||||
if (world.getTileEntity(x, y, z) != null) {
|
||||
((TileEntityMetadata) world.getTileEntity(x, y, z)).setTileMetadata(ordinal(), false);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void placeBlock(World world, int x, int y, int z) {
|
||||
world.setBlock(x, y, z, ExtraTrees.blockLog, 0, 2);
|
||||
if (world.getTileEntity(x, y, z) != null) {
|
||||
((TileEntityMetadata) world.getTileEntity(x, y, z)).setTileMetadata(ordinal(), false);
|
||||
}
|
||||
}
|
||||
|
||||
public IIcon getTrunk() {
|
||||
return trunk;
|
||||
}
|
||||
public IIcon getTrunk() {
|
||||
return trunk;
|
||||
}
|
||||
|
||||
public IIcon getBark() {
|
||||
return bark;
|
||||
}
|
||||
public IIcon getBark() {
|
||||
return bark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blockLog, ordinal()).copy();
|
||||
}
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blockLog, ordinal())
|
||||
.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getColour() {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
enum ForestryLog implements ILogType {
|
||||
LARCH(1, 0, 6376529),
|
||||
TEAK(1, 1, 3486249),
|
||||
ACACIA(1, 2, 7565906),
|
||||
LIME(1, 3, 7431512),
|
||||
CHESTNUT(2, 0, 6183484),
|
||||
WENGE(2, 1, 6444875),
|
||||
BAOBAB(2, 2, 14326376),
|
||||
SEQUOIA(2, 3, 11563861),
|
||||
KAPOK(3, 0, 5396559),
|
||||
EBONY(3, 1, 10453073),
|
||||
MAHOGANY(3, 2, 9403501),
|
||||
BALSA(3, 3, 8551285),
|
||||
WILLOW(4, 0, 10590869),
|
||||
WALNUT(4, 1, 9474682),
|
||||
GREENHEART(4, 2, 7956050),
|
||||
CHERRY(4, 3, 6296064),
|
||||
MAHOE(5, 0, 6382152),
|
||||
POPLAR(5, 1, 9217671),
|
||||
PALM(5, 2, 8941379),
|
||||
PAPAYA(5, 3, 9069862),
|
||||
PINE(6, 0, 7558729),
|
||||
PLUM(6, 1, 11961953),
|
||||
MAPLE(6, 2, 9078657),
|
||||
CITRUS(6, 3, 5983033);
|
||||
enum ForestryLog implements ILogType {
|
||||
LARCH(1, 0, 6376529),
|
||||
TEAK(1, 1, 3486249),
|
||||
ACACIA(1, 2, 7565906),
|
||||
LIME(1, 3, 7431512),
|
||||
CHESTNUT(2, 0, 6183484),
|
||||
WENGE(2, 1, 6444875),
|
||||
BAOBAB(2, 2, 14326376),
|
||||
SEQUOIA(2, 3, 11563861),
|
||||
KAPOK(3, 0, 5396559),
|
||||
EBONY(3, 1, 10453073),
|
||||
MAHOGANY(3, 2, 9403501),
|
||||
BALSA(3, 3, 8551285),
|
||||
WILLOW(4, 0, 10590869),
|
||||
WALNUT(4, 1, 9474682),
|
||||
GREENHEART(4, 2, 7956050),
|
||||
CHERRY(4, 3, 6296064),
|
||||
MAHOE(5, 0, 6382152),
|
||||
POPLAR(5, 1, 9217671),
|
||||
PALM(5, 2, 8941379),
|
||||
PAPAYA(5, 3, 9069862),
|
||||
PINE(6, 0, 7558729),
|
||||
PLUM(6, 1, 11961953),
|
||||
MAPLE(6, 2, 9078657),
|
||||
CITRUS(6, 3, 5983033);
|
||||
|
||||
protected int block;
|
||||
protected int metadata;
|
||||
protected int colour;
|
||||
protected int block;
|
||||
protected int metadata;
|
||||
protected int colour;
|
||||
|
||||
ForestryLog(int blockOffset, int meta, int colour) {
|
||||
block = blockOffset;
|
||||
metadata = meta;
|
||||
this.colour = colour;
|
||||
}
|
||||
ForestryLog(int blockOffset, int meta, int colour) {
|
||||
block = blockOffset;
|
||||
metadata = meta;
|
||||
this.colour = colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeBlock(World world, int x, int y, int z) {
|
||||
BlockTypeLog logBlock = new BlockTypeLog(TreeManager.woodItemAccess.getLog(EnumWoodType.valueOf(name().toUpperCase()), false));
|
||||
logBlock.setDirection(ForgeDirection.UP);
|
||||
logBlock.setBlock(world, x, y, z);
|
||||
@Override
|
||||
public void placeBlock(World world, int x, int y, int z) {
|
||||
BlockTypeLog logBlock = new BlockTypeLog(
|
||||
TreeManager.woodItemAccess.getLog(EnumWoodType.valueOf(name().toUpperCase()), false));
|
||||
logBlock.setDirection(ForgeDirection.UP);
|
||||
logBlock.setBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return TreeManager.woodItemAccess.getLog(EnumWoodType.valueOf(name().toUpperCase()), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return TreeManager.woodItemAccess.getLog(EnumWoodType.valueOf(name().toUpperCase()), false);
|
||||
}
|
||||
@Override
|
||||
public int getColour() {
|
||||
return colour;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return colour;
|
||||
}
|
||||
}
|
||||
enum VanillaLog implements ILogType {
|
||||
Oak(6376752),
|
||||
Spruce(2759179),
|
||||
Birch(6376752),
|
||||
Jungle(5456154);
|
||||
|
||||
enum VanillaLog implements ILogType {
|
||||
Oak(6376752),
|
||||
Spruce(2759179),
|
||||
Birch(6376752),
|
||||
Jungle(5456154);
|
||||
protected int colour;
|
||||
|
||||
protected int colour;
|
||||
VanillaLog(int colour) {
|
||||
this.colour = colour;
|
||||
}
|
||||
|
||||
VanillaLog(int colour) {
|
||||
this.colour = colour;
|
||||
}
|
||||
@Override
|
||||
public void placeBlock(World world, int x, int y, int z) {
|
||||
world.setBlock(x, y, z, Blocks.log, ordinal(), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeBlock(World world, int x, int y, int z) {
|
||||
world.setBlock(x, y, z, Blocks.log, ordinal(), 2);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return new ItemStack(Blocks.log, 1, ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return new ItemStack(Blocks.log, 1, ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return colour;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getColour() {
|
||||
return colour;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import binnie.extratrees.api.IDesignMaterial;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface IPlankType extends IDesignMaterial {
|
||||
IIcon getIcon();
|
||||
IIcon getIcon();
|
||||
|
||||
String getDescription();
|
||||
String getDescription();
|
||||
}
|
||||
@@ -15,97 +15,111 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemETDoor extends ItemMetadata {
|
||||
public ItemETDoor(Block block) {
|
||||
super(block);
|
||||
maxStackSize = 8;
|
||||
setCreativeTab(CreativeTabs.tabRedstone);
|
||||
}
|
||||
public ItemETDoor(Block block) {
|
||||
super(block);
|
||||
maxStackSize = 8;
|
||||
setCreativeTab(CreativeTabs.tabRedstone);
|
||||
}
|
||||
|
||||
public static void placeDoorBlock(World world, int x, int y, int z, int meta, Block block, ItemStack item, EntityPlayer player) {
|
||||
byte b0 = 0;
|
||||
byte b2 = 0;
|
||||
if (meta == 0) {
|
||||
b2 = 1;
|
||||
}
|
||||
if (meta == 1) {
|
||||
b0 = -1;
|
||||
}
|
||||
if (meta == 2) {
|
||||
b2 = -1;
|
||||
}
|
||||
if (meta == 3) {
|
||||
b0 = 1;
|
||||
}
|
||||
public static void placeDoorBlock(
|
||||
World world, int x, int y, int z, int meta, Block block, ItemStack item, EntityPlayer player) {
|
||||
byte b0 = 0;
|
||||
byte b2 = 0;
|
||||
if (meta == 0) {
|
||||
b2 = 1;
|
||||
}
|
||||
if (meta == 1) {
|
||||
b0 = -1;
|
||||
}
|
||||
if (meta == 2) {
|
||||
b2 = -1;
|
||||
}
|
||||
if (meta == 3) {
|
||||
b0 = 1;
|
||||
}
|
||||
|
||||
int i1 = (world.isBlockNormalCubeDefault(x - b0, y, z - b2, false) ? 1 : 0) + (world.isBlockNormalCubeDefault(x - b0, y + 1, z - b2, false) ? 1 : 0);
|
||||
int j1 = (world.isBlockNormalCubeDefault(x + b0, y, z + b2, false) ? 1 : 0) + (world.isBlockNormalCubeDefault(x + b0, y + 1, z + b2, false) ? 1 : 0);
|
||||
boolean flag = world.getBlock(x - b0, y, z - b2) == block || world.getBlock(x - b0, y + 1, z - b2) == block;
|
||||
boolean flag2 = world.getBlock(x + b0, y, z + b2) == block || world.getBlock(x + b0, y + 1, z + b2) == block;
|
||||
boolean flag3 = false;
|
||||
if (flag && !flag2 || j1 > i1) {
|
||||
flag3 = true;
|
||||
}
|
||||
int i1 = (world.isBlockNormalCubeDefault(x - b0, y, z - b2, false) ? 1 : 0)
|
||||
+ (world.isBlockNormalCubeDefault(x - b0, y + 1, z - b2, false) ? 1 : 0);
|
||||
int j1 = (world.isBlockNormalCubeDefault(x + b0, y, z + b2, false) ? 1 : 0)
|
||||
+ (world.isBlockNormalCubeDefault(x + b0, y + 1, z + b2, false) ? 1 : 0);
|
||||
boolean flag = world.getBlock(x - b0, y, z - b2) == block || world.getBlock(x - b0, y + 1, z - b2) == block;
|
||||
boolean flag2 = world.getBlock(x + b0, y, z + b2) == block || world.getBlock(x + b0, y + 1, z + b2) == block;
|
||||
boolean flag3 = false;
|
||||
if (flag && !flag2 || j1 > i1) {
|
||||
flag3 = true;
|
||||
}
|
||||
|
||||
world.setBlock(x, y, z, block, meta, 2);
|
||||
world.setBlock(x, y + 1, z, block, 0x8 | (flag3 ? 1 : 0), 2);
|
||||
if (world.getBlock(x, y, z) == block) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.setTileMetadata(TileEntityMetadata.getItemDamage(item), false);
|
||||
}
|
||||
block.onBlockPlacedBy(world, x, y, z, player, item);
|
||||
block.onPostBlockPlaced(world, x, y, z, meta);
|
||||
}
|
||||
world.setBlock(x, y, z, block, meta, 2);
|
||||
world.setBlock(x, y + 1, z, block, 0x8 | (flag3 ? 1 : 0), 2);
|
||||
if (world.getBlock(x, y, z) == block) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.setTileMetadata(TileEntityMetadata.getItemDamage(item), false);
|
||||
}
|
||||
block.onBlockPlacedBy(world, x, y, z, player, item);
|
||||
block.onPostBlockPlaced(world, x, y, z, meta);
|
||||
}
|
||||
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, block);
|
||||
world.notifyBlocksOfNeighborChange(x, y + 1, z, block);
|
||||
}
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, block);
|
||||
world.notifyBlocksOfNeighborChange(x, y + 1, z, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (DoorType type : DoorType.values()) {
|
||||
type.iconItem = ExtraTrees.proxy.getIcon(register, "door." + type.id);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (DoorType type : DoorType.values()) {
|
||||
type.iconItem = ExtraTrees.proxy.getIcon(register, "door." + type.id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int meta, float hitX, float hitY, float hitZ) {
|
||||
if (meta != 1) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean onItemUse(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int meta,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ) {
|
||||
if (meta != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
y++;
|
||||
Block block = ExtraTrees.blockDoor;
|
||||
if (!player.canPlayerEdit(x, y, z, meta, stack) || !player.canPlayerEdit(x, y + 1, z, meta, stack)) {
|
||||
return false;
|
||||
}
|
||||
if (!block.canPlaceBlockAt(world, x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
y++;
|
||||
Block block = ExtraTrees.blockDoor;
|
||||
if (!player.canPlayerEdit(x, y, z, meta, stack) || !player.canPlayerEdit(x, y + 1, z, meta, stack)) {
|
||||
return false;
|
||||
}
|
||||
if (!block.canPlaceBlockAt(world, x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int newMeta = MathHelper.floor_double((player.rotationYaw + 180.0f) * 4.0f / 360.0f - 0.5) & 0x3;
|
||||
placeDoorBlock(world, x, y, z, newMeta, block, stack, player);
|
||||
stack.stackSize--;
|
||||
return true;
|
||||
}
|
||||
int newMeta = MathHelper.floor_double((player.rotationYaw + 180.0f) * 4.0f / 360.0f - 0.5) & 0x3;
|
||||
placeDoorBlock(world, x, y, z, newMeta, block, stack, player);
|
||||
stack.stackSize--;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
DoorType type = BlockETDoor.getDoorType(damage);
|
||||
return type.iconItem;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
DoorType type = BlockETDoor.getDoorType(damage);
|
||||
return type.iconItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int meta) {
|
||||
return WoodManager.getPlankType((stack == null) ? 0 : (stack.getItemDamage() & 0xFF)).getColor();
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int meta) {
|
||||
return WoodManager.getPlankType((stack == null) ? 0 : (stack.getItemDamage() & 0xFF))
|
||||
.getColor();
|
||||
}
|
||||
}
|
||||
@@ -11,80 +11,92 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemETSlab extends ItemMetadata {
|
||||
private boolean isFullBlock;
|
||||
private BlockETSlab theHalfSlab;
|
||||
private BlockETSlab doubleSlab;
|
||||
private boolean isFullBlock;
|
||||
private BlockETSlab theHalfSlab;
|
||||
private BlockETSlab doubleSlab;
|
||||
|
||||
public ItemETSlab(Block block) {
|
||||
super(block);
|
||||
theHalfSlab = (BlockETSlab) ExtraTrees.blockSlab;
|
||||
doubleSlab = (BlockETSlab) ExtraTrees.blockDoubleSlab;
|
||||
isFullBlock = (block != theHalfSlab);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
public ItemETSlab(Block block) {
|
||||
super(block);
|
||||
theHalfSlab = (BlockETSlab) ExtraTrees.blockSlab;
|
||||
doubleSlab = (BlockETSlab) ExtraTrees.blockDoubleSlab;
|
||||
isFullBlock = (block != theHalfSlab);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int meta, float hitX, float hitY, float hitZ) {
|
||||
if (isFullBlock) {
|
||||
return super.onItemUse(stack, player, world, x, y, z, meta, hitX, hitY, hitZ);
|
||||
}
|
||||
if (stack.stackSize == 0 || !player.canPlayerEdit(x, y, z, meta, stack)) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean onItemUse(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int meta,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ) {
|
||||
if (isFullBlock) {
|
||||
return super.onItemUse(stack, player, world, x, y, z, meta, hitX, hitY, hitZ);
|
||||
}
|
||||
if (stack.stackSize == 0 || !player.canPlayerEdit(x, y, z, meta, stack)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Block i1 = world.getBlock(x, y, z);
|
||||
int j1 = world.getBlockMetadata(x, y, z);
|
||||
int tileMeta = TileEntityMetadata.getTileMetadata(world, x, y, z);
|
||||
int k1 = j1 & 0x7;
|
||||
boolean flag = (j1 & 0x8) != 0x0;
|
||||
Block i1 = world.getBlock(x, y, z);
|
||||
int j1 = world.getBlockMetadata(x, y, z);
|
||||
int tileMeta = TileEntityMetadata.getTileMetadata(world, x, y, z);
|
||||
int k1 = j1 & 0x7;
|
||||
boolean flag = (j1 & 0x8) != 0x0;
|
||||
|
||||
if (((meta == 1 && !flag) || (meta == 0 && flag)) && i1 == theHalfSlab && tileMeta == stack.getItemDamage()) {
|
||||
if (world.checkNoEntityCollision(doubleSlab.getCollisionBoundingBoxFromPool(world, x, y, z)) && world.setBlock(x, y, z, doubleSlab, k1, 3)) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.setTileMetadata(tileMeta, true);
|
||||
}
|
||||
stack.stackSize--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return func_77888_a(stack, player, world, x, y, z, meta)
|
||||
|| super.onItemUse(stack, player, world, x, y, z, meta, hitX, hitY, hitZ);
|
||||
}
|
||||
if (((meta == 1 && !flag) || (meta == 0 && flag)) && i1 == theHalfSlab && tileMeta == stack.getItemDamage()) {
|
||||
if (world.checkNoEntityCollision(doubleSlab.getCollisionBoundingBoxFromPool(world, x, y, z))
|
||||
&& world.setBlock(x, y, z, doubleSlab, k1, 3)) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.setTileMetadata(tileMeta, true);
|
||||
}
|
||||
stack.stackSize--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return func_77888_a(stack, player, world, x, y, z, meta)
|
||||
|| super.onItemUse(stack, player, world, x, y, z, meta, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
private boolean func_77888_a(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side) {
|
||||
if (side == 0) {
|
||||
y--;
|
||||
} else if (side == 1) {
|
||||
y++;
|
||||
} else if (side == 2) {
|
||||
z--;
|
||||
} else if (side == 3) {
|
||||
z++;
|
||||
} else if (side == 4) {
|
||||
x--;
|
||||
} else if (side == 5) {
|
||||
x++;
|
||||
}
|
||||
private boolean func_77888_a(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side) {
|
||||
if (side == 0) {
|
||||
y--;
|
||||
} else if (side == 1) {
|
||||
y++;
|
||||
} else if (side == 2) {
|
||||
z--;
|
||||
} else if (side == 3) {
|
||||
z++;
|
||||
} else if (side == 4) {
|
||||
x--;
|
||||
} else if (side == 5) {
|
||||
x++;
|
||||
}
|
||||
|
||||
Block i1 = world.getBlock(x, y, z);
|
||||
int j1 = world.getBlockMetadata(x, y, z);
|
||||
int k1 = j1 & 0x7;
|
||||
int tileMeta = TileEntityMetadata.getTileMetadata(world, x, y, z);
|
||||
Block i1 = world.getBlock(x, y, z);
|
||||
int j1 = world.getBlockMetadata(x, y, z);
|
||||
int k1 = j1 & 0x7;
|
||||
int tileMeta = TileEntityMetadata.getTileMetadata(world, x, y, z);
|
||||
|
||||
if (i1 == theHalfSlab && tileMeta == stack.getItemDamage()) {
|
||||
if (world.checkNoEntityCollision(doubleSlab.getCollisionBoundingBoxFromPool(world, x, y, z)) && world.setBlock(x, y, z, doubleSlab, k1, 3)) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.setTileMetadata(tileMeta, false);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
stack.stackSize--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (i1 == theHalfSlab && tileMeta == stack.getItemDamage()) {
|
||||
if (world.checkNoEntityCollision(doubleSlab.getCollisionBoundingBoxFromPool(world, x, y, z))
|
||||
&& world.setBlock(x, y, z, doubleSlab, k1, 3)) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.setTileMetadata(tileMeta, false);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
stack.stackSize--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -13,31 +13,42 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemETStairs extends ItemBlock {
|
||||
public ItemETStairs(Block block) {
|
||||
super(block);
|
||||
setCreativeTab(CreativeTabs.tabBlock);
|
||||
setUnlocalizedName("stairs");
|
||||
}
|
||||
public ItemETStairs(Block block) {
|
||||
super(block);
|
||||
setCreativeTab(CreativeTabs.tabBlock);
|
||||
setUnlocalizedName("stairs");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int par1) {
|
||||
return PlankType.ExtraTreePlanks.values()[par1].getIcon();
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int par1) {
|
||||
return PlankType.ExtraTreePlanks.values()[par1].getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
boolean done = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
|
||||
TileEntityMetadata tile = (TileEntityMetadata) world.getTileEntity(x, y, z);
|
||||
if (tile != null) {
|
||||
tile.setTileMetadata(stack.getItemDamage(), false);
|
||||
}
|
||||
return done;
|
||||
}
|
||||
@Override
|
||||
public boolean placeBlockAt(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ,
|
||||
int metadata) {
|
||||
boolean done = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
|
||||
TileEntityMetadata tile = (TileEntityMetadata) world.getTileEntity(x, y, z);
|
||||
if (tile != null) {
|
||||
tile.setTileMetadata(stack.getItemDamage(), false);
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getItemStackDisplayName(ItemStack par1ItemStack) {
|
||||
return ((IBlockMetadata) field_150939_a).getBlockName(par1ItemStack);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getItemStackDisplayName(ItemStack par1ItemStack) {
|
||||
return ((IBlockMetadata) field_150939_a).getBlockName(par1ItemStack);
|
||||
}
|
||||
}
|
||||
@@ -32,113 +32,121 @@ import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class ModuleBlocks implements IInitializable {
|
||||
public static int hedgeRenderID;
|
||||
public static int hedgeRenderID;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
PlankType.setup();
|
||||
ExtraTrees.blockPlanks = new BlockETPlanks();
|
||||
ExtraTrees.blockFence = new BlockFence();
|
||||
ExtraTrees.blockLog = new BlockETLog();
|
||||
ExtraTrees.blockShrubLeaves = new BlockShrubLeaves();
|
||||
ExtraTrees.blockGate = new BlockGate();
|
||||
ExtraTrees.blockDoor = new BlockETDoor();
|
||||
ExtraTrees.blockMultiFence = new BlockMultiFence();
|
||||
ExtraTrees.blockSlab = new BlockETSlab(false);
|
||||
ExtraTrees.blockDoubleSlab = new BlockETSlab(true);
|
||||
ExtraTrees.blockStairs = new BlockETStairs(ExtraTrees.blockPlanks);
|
||||
@Override
|
||||
public void preInit() {
|
||||
PlankType.setup();
|
||||
ExtraTrees.blockPlanks = new BlockETPlanks();
|
||||
ExtraTrees.blockFence = new BlockFence();
|
||||
ExtraTrees.blockLog = new BlockETLog();
|
||||
ExtraTrees.blockShrubLeaves = new BlockShrubLeaves();
|
||||
ExtraTrees.blockGate = new BlockGate();
|
||||
ExtraTrees.blockDoor = new BlockETDoor();
|
||||
ExtraTrees.blockMultiFence = new BlockMultiFence();
|
||||
ExtraTrees.blockSlab = new BlockETSlab(false);
|
||||
ExtraTrees.blockDoubleSlab = new BlockETSlab(true);
|
||||
ExtraTrees.blockStairs = new BlockETStairs(ExtraTrees.blockPlanks);
|
||||
|
||||
GameRegistry.registerBlock(ExtraTrees.blockPlanks, ItemMetadata.class, "planks");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockFence, ItemMetadata.class, "fence");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockMultiFence, ItemMetadata.class, "multifence");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockMultiFence), new ItemMetadataRenderer());
|
||||
GameRegistry.registerBlock(ExtraTrees.blockLog, ItemMetadata.class, "log");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockGate, ItemMetadata.class, "gate");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockSlab, ItemETSlab.class, "slab");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockDoubleSlab, ItemETSlab.class, "doubleSlab");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockDoor, ItemETDoor.class, "door");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockStairs, ItemETStairs.class, "stairs");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockPlanks, ItemMetadata.class, "planks");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockFence, ItemMetadata.class, "fence");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockMultiFence, ItemMetadata.class, "multifence");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(
|
||||
Item.getItemFromBlock(ExtraTrees.blockMultiFence), new ItemMetadataRenderer());
|
||||
GameRegistry.registerBlock(ExtraTrees.blockLog, ItemMetadata.class, "log");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockGate, ItemMetadata.class, "gate");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockSlab, ItemETSlab.class, "slab");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockDoubleSlab, ItemETSlab.class, "doubleSlab");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockDoor, ItemETDoor.class, "door");
|
||||
GameRegistry.registerBlock(ExtraTrees.blockStairs, ItemETStairs.class, "stairs");
|
||||
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockStairs), new StairItemRenderer());
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockGate), new GateItemRenderer());
|
||||
for (ILogType plank : ILogType.ExtraTreeLog.values()) {
|
||||
OreDictionary.registerOre("logWood", plank.getItemStack());
|
||||
}
|
||||
BinnieCore.proxy.registerCustomItemRenderer(
|
||||
Item.getItemFromBlock(ExtraTrees.blockStairs), new StairItemRenderer());
|
||||
BinnieCore.proxy.registerCustomItemRenderer(
|
||||
Item.getItemFromBlock(ExtraTrees.blockGate), new GateItemRenderer());
|
||||
for (ILogType plank : ILogType.ExtraTreeLog.values()) {
|
||||
OreDictionary.registerOre("logWood", plank.getItemStack());
|
||||
}
|
||||
|
||||
GameRegistry.addSmelting(ExtraTrees.blockLog, new ItemStack(Items.coal, 1, 1), 0.15f);
|
||||
for (IPlankType plank2 : PlankType.ExtraTreePlanks.values()) {
|
||||
OreDictionary.registerOre("plankWood", plank2.getStack());
|
||||
}
|
||||
GameRegistry.addSmelting(ExtraTrees.blockLog, new ItemStack(Items.coal, 1, 1), 0.15f);
|
||||
for (IPlankType plank2 : PlankType.ExtraTreePlanks.values()) {
|
||||
OreDictionary.registerOre("plankWood", plank2.getStack());
|
||||
}
|
||||
|
||||
FMLInterModComms.sendMessage("Forestry", "add-fence-block", "ExtraTrees:fence");
|
||||
FMLInterModComms.sendMessage("Forestry", "add-fence-block", "ExtraTrees:gate");
|
||||
// FMLInterModComms.sendMessage("Forestry", "add-alveary-slab", "ExtraTrees:slab");
|
||||
FMLInterModComms.sendMessage("Forestry", "add-fence-block", "ExtraTrees:multifence");
|
||||
ModuleBlocks.hedgeRenderID = BinnieCore.proxy.getUniqueRenderID();
|
||||
}
|
||||
FMLInterModComms.sendMessage("Forestry", "add-fence-block", "ExtraTrees:fence");
|
||||
FMLInterModComms.sendMessage("Forestry", "add-fence-block", "ExtraTrees:gate");
|
||||
// FMLInterModComms.sendMessage("Forestry", "add-alveary-slab", "ExtraTrees:slab");
|
||||
FMLInterModComms.sendMessage("Forestry", "add-fence-block", "ExtraTrees:multifence");
|
||||
ModuleBlocks.hedgeRenderID = BinnieCore.proxy.getUniqueRenderID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
ExtraTrees.fenceID = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new FenceRenderer());
|
||||
ExtraTrees.stairsID = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new StairsRenderer());
|
||||
ExtraTrees.doorRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new DoorBlockRenderer());
|
||||
ExtraTrees.branchRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new BranchBlockRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new HedgeRenderer());
|
||||
RecipeSorter.register("extratrees:multifence", MultiFenceRecipeSize.class, RecipeSorter.Category.SHAPED, "");
|
||||
RecipeSorter.register("extratrees:multifence2", MultiFenceRecipeEmbedded.class, RecipeSorter.Category.SHAPED, "");
|
||||
RecipeSorter.register("extratrees:multifence3", MultiFenceRecipeSolid.class, RecipeSorter.Category.SHAPED, "");
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
ExtraTrees.fenceID = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new FenceRenderer());
|
||||
ExtraTrees.stairsID = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new StairsRenderer());
|
||||
ExtraTrees.doorRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new DoorBlockRenderer());
|
||||
ExtraTrees.branchRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new BranchBlockRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new HedgeRenderer());
|
||||
RecipeSorter.register("extratrees:multifence", MultiFenceRecipeSize.class, RecipeSorter.Category.SHAPED, "");
|
||||
RecipeSorter.register(
|
||||
"extratrees:multifence2", MultiFenceRecipeEmbedded.class, RecipeSorter.Category.SHAPED, "");
|
||||
RecipeSorter.register("extratrees:multifence3", MultiFenceRecipeSolid.class, RecipeSorter.Category.SHAPED, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
for (PlankType.ExtraTreePlanks plank : PlankType.ExtraTreePlanks.values()) {
|
||||
ItemStack planks = plank.getStack();
|
||||
ItemStack slabs = TileEntityMetadata.getItemStack(ExtraTrees.blockSlab, plank.ordinal());
|
||||
ItemStack stairs = TileEntityMetadata.getItemStack(ExtraTrees.blockStairs, plank.ordinal());
|
||||
stairs.stackSize = 4;
|
||||
GameRegistry.addRecipe(stairs.copy(), "# ", "## ", "###", '#', planks.copy());
|
||||
slabs.stackSize = 6;
|
||||
CraftingManager.getInstance().getRecipeList().add(0, new ShapedOreRecipe(slabs.copy(), "###", '#', planks.copy()));
|
||||
}
|
||||
@Override
|
||||
public void postInit() {
|
||||
for (PlankType.ExtraTreePlanks plank : PlankType.ExtraTreePlanks.values()) {
|
||||
ItemStack planks = plank.getStack();
|
||||
ItemStack slabs = TileEntityMetadata.getItemStack(ExtraTrees.blockSlab, plank.ordinal());
|
||||
ItemStack stairs = TileEntityMetadata.getItemStack(ExtraTrees.blockStairs, plank.ordinal());
|
||||
stairs.stackSize = 4;
|
||||
GameRegistry.addRecipe(stairs.copy(), "# ", "## ", "###", '#', planks.copy());
|
||||
slabs.stackSize = 6;
|
||||
CraftingManager.getInstance()
|
||||
.getRecipeList()
|
||||
.add(0, new ShapedOreRecipe(slabs.copy(), "###", '#', planks.copy()));
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(new MultiFenceRecipeSize());
|
||||
GameRegistry.addRecipe(new MultiFenceRecipeEmbedded());
|
||||
GameRegistry.addRecipe(new MultiFenceRecipeSolid());
|
||||
for (IPlankType plank2 : WoodManager.getAllPlankTypes()) {
|
||||
ItemStack planks2 = plank2.getStack();
|
||||
ItemStack fenceNormal = WoodManager.getFence(plank2, new FenceType(0), 1);
|
||||
ItemStack gate = WoodManager.getGate(plank2);
|
||||
ItemStack doorStandard = WoodManager.getDoor(plank2, DoorType.STANDARD);
|
||||
ItemStack doorSolid = WoodManager.getDoor(plank2, DoorType.SOLID);
|
||||
ItemStack doorSplit = WoodManager.getDoor(plank2, DoorType.DOUBLE);
|
||||
ItemStack doorFull = WoodManager.getDoor(plank2, DoorType.FULL);
|
||||
if (planks2 != null) {
|
||||
if (gate == null) {
|
||||
continue;
|
||||
}
|
||||
gate.stackSize = 1;
|
||||
GameRegistry.addRecipe(gate.copy(), "fpf", 'f', fenceNormal.copy(), 'p', planks2.copy());
|
||||
fenceNormal.stackSize = 4;
|
||||
GameRegistry.addRecipe(fenceNormal.copy(), "###", "# #", '#', planks2.copy());
|
||||
GameRegistry.addRecipe(doorSolid.copy(), "###", "###", "###", '#', planks2.copy());
|
||||
GameRegistry.addRecipe(doorStandard.copy(), "# #", "###", "###", '#', planks2.copy());
|
||||
GameRegistry.addRecipe(doorSplit.copy(), "# #", "###", "# #", '#', planks2.copy());
|
||||
GameRegistry.addRecipe(doorFull.copy(), "# #", "# #", "# #", '#', planks2.copy());
|
||||
}
|
||||
}
|
||||
addSqueezer(ILogType.VanillaLog.Spruce, ExtraTreeLiquid.Resin, 50);
|
||||
}
|
||||
GameRegistry.addRecipe(new MultiFenceRecipeSize());
|
||||
GameRegistry.addRecipe(new MultiFenceRecipeEmbedded());
|
||||
GameRegistry.addRecipe(new MultiFenceRecipeSolid());
|
||||
for (IPlankType plank2 : WoodManager.getAllPlankTypes()) {
|
||||
ItemStack planks2 = plank2.getStack();
|
||||
ItemStack fenceNormal = WoodManager.getFence(plank2, new FenceType(0), 1);
|
||||
ItemStack gate = WoodManager.getGate(plank2);
|
||||
ItemStack doorStandard = WoodManager.getDoor(plank2, DoorType.STANDARD);
|
||||
ItemStack doorSolid = WoodManager.getDoor(plank2, DoorType.SOLID);
|
||||
ItemStack doorSplit = WoodManager.getDoor(plank2, DoorType.DOUBLE);
|
||||
ItemStack doorFull = WoodManager.getDoor(plank2, DoorType.FULL);
|
||||
if (planks2 != null) {
|
||||
if (gate == null) {
|
||||
continue;
|
||||
}
|
||||
gate.stackSize = 1;
|
||||
GameRegistry.addRecipe(gate.copy(), "fpf", 'f', fenceNormal.copy(), 'p', planks2.copy());
|
||||
fenceNormal.stackSize = 4;
|
||||
GameRegistry.addRecipe(fenceNormal.copy(), "###", "# #", '#', planks2.copy());
|
||||
GameRegistry.addRecipe(doorSolid.copy(), "###", "###", "###", '#', planks2.copy());
|
||||
GameRegistry.addRecipe(doorStandard.copy(), "# #", "###", "###", '#', planks2.copy());
|
||||
GameRegistry.addRecipe(doorSplit.copy(), "# #", "###", "# #", '#', planks2.copy());
|
||||
GameRegistry.addRecipe(doorFull.copy(), "# #", "# #", "# #", '#', planks2.copy());
|
||||
}
|
||||
}
|
||||
addSqueezer(ILogType.VanillaLog.Spruce, ExtraTreeLiquid.Resin, 50);
|
||||
}
|
||||
|
||||
public void addSqueezer(ILogType log, ILiquidType liquid, int amount, float pulpChance) {
|
||||
FluidStack liquidStack = liquid.get(amount);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{log.getItemStack()}, liquidStack, Mods.forestry.stack("woodPulp"), (int) (100.0f * pulpChance));
|
||||
}
|
||||
public void addSqueezer(ILogType log, ILiquidType liquid, int amount, float pulpChance) {
|
||||
FluidStack liquidStack = liquid.get(amount);
|
||||
RecipeManagers.squeezerManager.addRecipe(
|
||||
10, new ItemStack[] {log.getItemStack()}, liquidStack, Mods.forestry.stack("woodPulp"), (int)
|
||||
(100.0f * pulpChance));
|
||||
}
|
||||
|
||||
public void addSqueezer(ILogType log, ILiquidType liquid, int amount) {
|
||||
addSqueezer(log, liquid, amount, 0.5f);
|
||||
}
|
||||
public void addSqueezer(ILogType log, ILiquidType liquid, int amount) {
|
||||
addSqueezer(log, liquid, amount, 0.5f);
|
||||
}
|
||||
}
|
||||
@@ -15,268 +15,270 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class PlankType {
|
||||
public static void setup() {
|
||||
for (VanillaPlanks plank : VanillaPlanks.values()) {
|
||||
CarpentryManager.carpentryInterface.registerCarpentryWood(plank.ordinal(), plank);
|
||||
}
|
||||
for (ExtraTreePlanks plank2 : ExtraTreePlanks.values()) {
|
||||
CarpentryManager.carpentryInterface.registerCarpentryWood(plank2.ordinal() + 32, plank2);
|
||||
}
|
||||
for (ForestryPlanks plank3 : ForestryPlanks.values()) {
|
||||
CarpentryManager.carpentryInterface.registerCarpentryWood(plank3.ordinal() + 128, plank3);
|
||||
}
|
||||
for (ExtraBiomesPlank plank4 : ExtraBiomesPlank.values()) {
|
||||
CarpentryManager.carpentryInterface.registerCarpentryWood(plank4.ordinal() + 192, plank4);
|
||||
}
|
||||
}
|
||||
public static void setup() {
|
||||
for (VanillaPlanks plank : VanillaPlanks.values()) {
|
||||
CarpentryManager.carpentryInterface.registerCarpentryWood(plank.ordinal(), plank);
|
||||
}
|
||||
for (ExtraTreePlanks plank2 : ExtraTreePlanks.values()) {
|
||||
CarpentryManager.carpentryInterface.registerCarpentryWood(plank2.ordinal() + 32, plank2);
|
||||
}
|
||||
for (ForestryPlanks plank3 : ForestryPlanks.values()) {
|
||||
CarpentryManager.carpentryInterface.registerCarpentryWood(plank3.ordinal() + 128, plank3);
|
||||
}
|
||||
for (ExtraBiomesPlank plank4 : ExtraBiomesPlank.values()) {
|
||||
CarpentryManager.carpentryInterface.registerCarpentryWood(plank4.ordinal() + 192, plank4);
|
||||
}
|
||||
}
|
||||
|
||||
public enum ExtraTreePlanks implements IPlankType, IFenceProvider {
|
||||
Fir(0xc38c54),
|
||||
Cedar(0xd86634),
|
||||
Hemlock(0xc7b56c),
|
||||
Cypress(0xf6b85c),
|
||||
Fig(0xc8882a),
|
||||
Beech(0xe19951),
|
||||
Alder(0xb88553),
|
||||
Hazel(0xcdb195),
|
||||
Hornbeam(0xc39860),
|
||||
Box(0xfbf1c6),
|
||||
Butternut(0xecaa7a),
|
||||
Hickory(0xdab48e),
|
||||
Whitebeam(0xc9c2b9),
|
||||
Elm(0xf0a964),
|
||||
Apple(0x603528),
|
||||
Yew(0xe0a57a),
|
||||
Pear(0xb8896d),
|
||||
Hawthorn(0xcc8362),
|
||||
Rowan(0xcfad9a),
|
||||
Elder(0xbe9279),
|
||||
Maclura(0xf3b22e),
|
||||
Syzgium(0xe6c3c1),
|
||||
Brazilwood(0x723e57),
|
||||
Logwood(0xa4372c),
|
||||
Iroko(0x753400),
|
||||
Locust(0xc39160),
|
||||
Eucalyptus(0xf6ab8b),
|
||||
Purpleheart(0x5b1c2f),
|
||||
Ash(0xf5c768),
|
||||
Holly(0xfbf6e7),
|
||||
Olive(0xb0ad88),
|
||||
Sweetgum(0xd59658),
|
||||
Rosewood(0x761500),
|
||||
Gingko(0xf4e7ba),
|
||||
PinkIvory(0xec8ca0);
|
||||
public enum ExtraTreePlanks implements IPlankType, IFenceProvider {
|
||||
Fir(0xc38c54),
|
||||
Cedar(0xd86634),
|
||||
Hemlock(0xc7b56c),
|
||||
Cypress(0xf6b85c),
|
||||
Fig(0xc8882a),
|
||||
Beech(0xe19951),
|
||||
Alder(0xb88553),
|
||||
Hazel(0xcdb195),
|
||||
Hornbeam(0xc39860),
|
||||
Box(0xfbf1c6),
|
||||
Butternut(0xecaa7a),
|
||||
Hickory(0xdab48e),
|
||||
Whitebeam(0xc9c2b9),
|
||||
Elm(0xf0a964),
|
||||
Apple(0x603528),
|
||||
Yew(0xe0a57a),
|
||||
Pear(0xb8896d),
|
||||
Hawthorn(0xcc8362),
|
||||
Rowan(0xcfad9a),
|
||||
Elder(0xbe9279),
|
||||
Maclura(0xf3b22e),
|
||||
Syzgium(0xe6c3c1),
|
||||
Brazilwood(0x723e57),
|
||||
Logwood(0xa4372c),
|
||||
Iroko(0x753400),
|
||||
Locust(0xc39160),
|
||||
Eucalyptus(0xf6ab8b),
|
||||
Purpleheart(0x5b1c2f),
|
||||
Ash(0xf5c768),
|
||||
Holly(0xfbf6e7),
|
||||
Olive(0xb0ad88),
|
||||
Sweetgum(0xd59658),
|
||||
Rosewood(0x761500),
|
||||
Gingko(0xf4e7ba),
|
||||
PinkIvory(0xec8ca0);
|
||||
|
||||
protected int color;
|
||||
protected IIcon icon;
|
||||
protected int color;
|
||||
protected IIcon icon;
|
||||
|
||||
ExtraTreePlanks(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
ExtraTreePlanks(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("extratrees.block.planks." + toString().toLowerCase());
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("extratrees.block.planks." + toString().toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return I18N.localise("extratrees.block.planks." + toString().toLowerCase() + ".desc");
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return I18N.localise("extratrees.block.planks." + toString().toLowerCase() + ".desc");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blockPlanks, ordinal());
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blockPlanks, ordinal());
|
||||
}
|
||||
|
||||
public IIcon loadIcon(IIconRegister register) {
|
||||
return icon = ExtraTrees.proxy.getIcon(register, "planks/" + toString());
|
||||
}
|
||||
public IIcon loadIcon(IIconRegister register) {
|
||||
return icon = ExtraTrees.proxy.getIcon(register, "planks/" + toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getFence() {
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blockFence, WoodManager.getPlankTypeIndex(this));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ItemStack getFence() {
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blockFence, WoodManager.getPlankTypeIndex(this));
|
||||
}
|
||||
}
|
||||
|
||||
public enum VanillaPlanks implements IPlankType, IFenceProvider {
|
||||
OAK(0xb4905a),
|
||||
SPRUCE(0x805e36),
|
||||
BIRCH(0xd7c185),
|
||||
JUNGLE(0xb1805c),
|
||||
ACACIA(0xba6337),
|
||||
DARKOAK(0x462d15);
|
||||
public enum VanillaPlanks implements IPlankType, IFenceProvider {
|
||||
OAK(0xb4905a),
|
||||
SPRUCE(0x805e36),
|
||||
BIRCH(0xd7c185),
|
||||
JUNGLE(0xb1805c),
|
||||
ACACIA(0xba6337),
|
||||
DARKOAK(0x462d15);
|
||||
|
||||
protected int color;
|
||||
protected int color;
|
||||
|
||||
VanillaPlanks(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
VanillaPlanks(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("extratrees.block.planks.vanilla." + toString().toLowerCase());
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("extratrees.block.planks.vanilla." + toString().toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return I18N.localise("extratrees.block.planks.vanilla." + toString().toLowerCase() + ".desc");
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return I18N.localise("extratrees.block.planks.vanilla." + toString().toLowerCase() + ".desc");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return new ItemStack(Blocks.planks, 1, ordinal());
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return new ItemStack(Blocks.planks, 1, ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
int meta = getStack().getItemDamage();
|
||||
Block block = Blocks.planks;
|
||||
return block.getIcon(2, meta);
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
int meta = getStack().getItemDamage();
|
||||
Block block = Blocks.planks;
|
||||
return block.getIcon(2, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getFence() {
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blockFence, WoodManager.getPlankTypeIndex(this));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ItemStack getFence() {
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blockFence, WoodManager.getPlankTypeIndex(this));
|
||||
}
|
||||
}
|
||||
|
||||
public enum ForestryPlanks implements IPlankType, IFenceProvider {
|
||||
LARCH(0xd79f8d),
|
||||
TEAK(0x7d7963),
|
||||
ACACIA(0x94b387),
|
||||
LIME(0xceaa70),
|
||||
CHESTNUT(0xbbaa5d),
|
||||
WENGE(0x5e564a),
|
||||
BAOBAB(0x929c62),
|
||||
SEQUOIA(0x995a57),
|
||||
KAPOK(0x7c7434),
|
||||
EBONY(0x3c3730),
|
||||
MAHOGANY(0x763f38),
|
||||
BALSA(0xa9a299),
|
||||
WILLOW(0xb2b162),
|
||||
WALNUT(0x685242),
|
||||
GREENHEART(0x4e7e5c),
|
||||
CHERRY(0xb58234),
|
||||
MAHOE(0x7f98aa),
|
||||
POPLAR(0xcfcf82),
|
||||
PALM(0xca804b),
|
||||
PAPAYA(0xdccb75),
|
||||
PINE(0xc49e51),
|
||||
PLUM(0xad687f),
|
||||
MAPLE(0xae6d2b),
|
||||
CITRUS(0x9ca81d),
|
||||
GIGANTEUM(0x4f241e),
|
||||
IPE(0x4d2d1e),
|
||||
PADAUK(0xb36335),
|
||||
COCOBOLO(0x731302),
|
||||
ZEBRAWOOD(0xa6824e);
|
||||
public enum ForestryPlanks implements IPlankType, IFenceProvider {
|
||||
LARCH(0xd79f8d),
|
||||
TEAK(0x7d7963),
|
||||
ACACIA(0x94b387),
|
||||
LIME(0xceaa70),
|
||||
CHESTNUT(0xbbaa5d),
|
||||
WENGE(0x5e564a),
|
||||
BAOBAB(0x929c62),
|
||||
SEQUOIA(0x995a57),
|
||||
KAPOK(0x7c7434),
|
||||
EBONY(0x3c3730),
|
||||
MAHOGANY(0x763f38),
|
||||
BALSA(0xa9a299),
|
||||
WILLOW(0xb2b162),
|
||||
WALNUT(0x685242),
|
||||
GREENHEART(0x4e7e5c),
|
||||
CHERRY(0xb58234),
|
||||
MAHOE(0x7f98aa),
|
||||
POPLAR(0xcfcf82),
|
||||
PALM(0xca804b),
|
||||
PAPAYA(0xdccb75),
|
||||
PINE(0xc49e51),
|
||||
PLUM(0xad687f),
|
||||
MAPLE(0xae6d2b),
|
||||
CITRUS(0x9ca81d),
|
||||
GIGANTEUM(0x4f241e),
|
||||
IPE(0x4d2d1e),
|
||||
PADAUK(0xb36335),
|
||||
COCOBOLO(0x731302),
|
||||
ZEBRAWOOD(0xa6824e);
|
||||
|
||||
protected int color;
|
||||
protected int color;
|
||||
|
||||
ForestryPlanks(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
ForestryPlanks(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("extratrees.block.planks.forestry." + toString().toLowerCase());
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise(
|
||||
"extratrees.block.planks.forestry." + toString().toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return I18N.localise("extratrees.block.planks.forestry." + toString().toLowerCase() + ".desc");
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return I18N.localise(
|
||||
"extratrees.block.planks.forestry." + toString().toLowerCase() + ".desc");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
Item stack = Mods.forestry.item("planks");
|
||||
return new ItemStack(stack, 1, ordinal());
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
Item stack = Mods.forestry.item("planks");
|
||||
return new ItemStack(stack, 1, ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
if (getStack() != null) {
|
||||
int meta = getStack().getItemDamage();
|
||||
Block block = ((ItemBlock) getStack().getItem()).field_150939_a;
|
||||
return block.getIcon(2, meta);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
if (getStack() != null) {
|
||||
int meta = getStack().getItemDamage();
|
||||
Block block = ((ItemBlock) getStack().getItem()).field_150939_a;
|
||||
return block.getIcon(2, meta);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getFence() {
|
||||
ItemStack fence = Mods.forestry.stack("fences");
|
||||
fence.setItemDamage(ordinal());
|
||||
return fence;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ItemStack getFence() {
|
||||
ItemStack fence = Mods.forestry.stack("fences");
|
||||
fence.setItemDamage(ordinal());
|
||||
return fence;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ExtraBiomesPlank implements IPlankType {
|
||||
Redwood(0x9b6b42),
|
||||
Fir(0x7e774a),
|
||||
Acacia(0xbfaa7e);
|
||||
public enum ExtraBiomesPlank implements IPlankType {
|
||||
Redwood(0x9b6b42),
|
||||
Fir(0x7e774a),
|
||||
Acacia(0xbfaa7e);
|
||||
|
||||
protected int color;
|
||||
protected int color;
|
||||
|
||||
ExtraBiomesPlank(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
ExtraBiomesPlank(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("extratrees.block.planks.ebxl." + toString().toLowerCase());
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("extratrees.block.planks.ebxl." + toString().toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return I18N.localise("extratrees.block.planks.ebxl." + toString().toLowerCase() + ".desc");
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return I18N.localise("extratrees.block.planks.ebxl." + toString().toLowerCase() + ".desc");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
try {
|
||||
Class clss = Class.forName("extrabiomes.api.Stuff");
|
||||
Block block = (Block) ((Optional) clss.getField("planks").get(null)).get();
|
||||
return new ItemStack(block, 1, ordinal());
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
try {
|
||||
Class clss = Class.forName("extrabiomes.api.Stuff");
|
||||
Block block = (Block) ((Optional) clss.getField("planks").get(null)).get();
|
||||
return new ItemStack(block, 1, ordinal());
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
if (getStack() != null) {
|
||||
int meta = getStack().getItemDamage();
|
||||
Block block = ((ItemBlock) getStack().getItem()).field_150939_a;
|
||||
return block.getIcon(2, meta);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
if (getStack() != null) {
|
||||
int meta = getStack().getItemDamage();
|
||||
Block block = ((ItemBlock) getStack().getItem()).field_150939_a;
|
||||
return block.getIcon(2, meta);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,78 +10,79 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class StairItemRenderer implements IItemRenderer {
|
||||
private void renderStairBlock(RenderBlocks renderBlocks, ItemStack item, float f, float g, float h) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Block block = ((ItemBlock) item.getItem()).field_150939_a;
|
||||
IIcon textureIndex = PlankType.ExtraTreePlanks.values()[item.getItemDamage()].getIcon();
|
||||
private void renderStairBlock(RenderBlocks renderBlocks, ItemStack item, float f, float g, float h) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Block block = ((ItemBlock) item.getItem()).field_150939_a;
|
||||
IIcon textureIndex = PlankType.ExtraTreePlanks.values()[item.getItemDamage()].getIcon();
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (i == 0) {
|
||||
renderBlocks.setRenderBounds(0.0, 0.0, 0.0, 1.0, 1.0, 0.5);
|
||||
}
|
||||
if (i == 1) {
|
||||
renderBlocks.setRenderBounds(0.0, 0.0, 0.5, 1.0, 0.5, 1.0);
|
||||
}
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (i == 0) {
|
||||
renderBlocks.setRenderBounds(0.0, 0.0, 0.0, 1.0, 1.0, 0.5);
|
||||
}
|
||||
if (i == 1) {
|
||||
renderBlocks.setRenderBounds(0.0, 0.0, 0.5, 1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderBlocks.renderFaceYNeg(block, 0.0, 0.0, 0.0, textureIndex);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderBlocks.renderFaceYPos(block, 0.0, 0.0, 0.0, textureIndex);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderBlocks.renderFaceXNeg(block, 0.0, 0.0, 0.0, textureIndex);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderBlocks.renderFaceXPos(block, 0.0, 0.0, 0.0, textureIndex);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderBlocks.renderFaceZNeg(block, 0.0, 0.0, 0.0, textureIndex);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderBlocks.renderFaceZPos(block, 0.0, 0.0, 0.0, textureIndex);
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderBlocks.renderFaceYNeg(block, 0.0, 0.0, 0.0, textureIndex);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderBlocks.renderFaceYPos(block, 0.0, 0.0, 0.0, textureIndex);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderBlocks.renderFaceXNeg(block, 0.0, 0.0, 0.0, textureIndex);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderBlocks.renderFaceXPos(block, 0.0, 0.0, 0.0, textureIndex);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderBlocks.renderFaceZNeg(block, 0.0, 0.0, 0.0, textureIndex);
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderBlocks.renderFaceZPos(block, 0.0, 0.0, 0.0, textureIndex);
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
case EQUIPPED:
|
||||
case INVENTORY:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
case EQUIPPED:
|
||||
case INVENTORY:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(
|
||||
IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderStairBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
@Override
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderStairBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
|
||||
case EQUIPPED:
|
||||
renderStairBlock((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderStairBlock((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
|
||||
case INVENTORY:
|
||||
renderStairBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case INVENTORY:
|
||||
renderStairBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,69 +9,70 @@ import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class StairsRenderer implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public void renderInventoryBlock(Block par1Block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
Tessellator var4 = Tessellator.instance;
|
||||
for (int var5 = 0; var5 < 2; ++var5) {
|
||||
if (var5 == 0) {
|
||||
renderer.setRenderBounds(0.0, 0.0, 0.0, 1.0, 1.0, 0.5);
|
||||
}
|
||||
if (var5 == 1) {
|
||||
renderer.setRenderBounds(0.0, 0.0, 0.5, 1.0, 0.5, 1.0);
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block par1Block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
Tessellator var4 = Tessellator.instance;
|
||||
for (int var5 = 0; var5 < 2; ++var5) {
|
||||
if (var5 == 0) {
|
||||
renderer.setRenderBounds(0.0, 0.0, 0.0, 1.0, 1.0, 0.5);
|
||||
}
|
||||
if (var5 == 1) {
|
||||
renderer.setRenderBounds(0.0, 0.0, 0.5, 1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
var4.startDrawingQuads();
|
||||
var4.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderer.renderFaceYNeg(par1Block, 0.0, 0.0, 0.0, par1Block.getIcon(0, metadata));
|
||||
var4.draw();
|
||||
var4.startDrawingQuads();
|
||||
var4.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderer.renderFaceYPos(par1Block, 0.0, 0.0, 0.0, par1Block.getIcon(1, metadata));
|
||||
var4.draw();
|
||||
var4.startDrawingQuads();
|
||||
var4.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderer.renderFaceXPos(par1Block, 0.0, 0.0, 0.0, par1Block.getIcon(2, metadata));
|
||||
var4.draw();
|
||||
var4.startDrawingQuads();
|
||||
var4.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderer.renderFaceXNeg(par1Block, 0.0, 0.0, 0.0, par1Block.getIcon(3, metadata));
|
||||
var4.draw();
|
||||
var4.startDrawingQuads();
|
||||
var4.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceZNeg(par1Block, 0.0, 0.0, 0.0, par1Block.getIcon(4, metadata));
|
||||
var4.draw();
|
||||
var4.startDrawingQuads();
|
||||
var4.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceZPos(par1Block, 0.0, 0.0, 0.0, par1Block.getIcon(5, metadata));
|
||||
var4.draw();
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
var4.startDrawingQuads();
|
||||
var4.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderer.renderFaceYNeg(par1Block, 0.0, 0.0, 0.0, par1Block.getIcon(0, metadata));
|
||||
var4.draw();
|
||||
var4.startDrawingQuads();
|
||||
var4.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderer.renderFaceYPos(par1Block, 0.0, 0.0, 0.0, par1Block.getIcon(1, metadata));
|
||||
var4.draw();
|
||||
var4.startDrawingQuads();
|
||||
var4.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderer.renderFaceXPos(par1Block, 0.0, 0.0, 0.0, par1Block.getIcon(2, metadata));
|
||||
var4.draw();
|
||||
var4.startDrawingQuads();
|
||||
var4.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderer.renderFaceXNeg(par1Block, 0.0, 0.0, 0.0, par1Block.getIcon(3, metadata));
|
||||
var4.draw();
|
||||
var4.startDrawingQuads();
|
||||
var4.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceZNeg(par1Block, 0.0, 0.0, 0.0, par1Block.getIcon(4, metadata));
|
||||
var4.draw();
|
||||
var4.startDrawingQuads();
|
||||
var4.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceZPos(par1Block, 0.0, 0.0, 0.0, par1Block.getIcon(5, metadata));
|
||||
var4.draw();
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
BlockETStairs blockStairs = (BlockETStairs) block;
|
||||
blockStairs.func_150147_e(renderer.blockAccess, x, y, z);
|
||||
renderer.setRenderBoundsFromBlock(blockStairs);
|
||||
renderer.renderStandardBlock(blockStairs, x, y, z);
|
||||
boolean var5 = blockStairs.func_150145_f(renderer.blockAccess, x, y, z);
|
||||
renderer.setRenderBoundsFromBlock(blockStairs);
|
||||
renderer.renderStandardBlock(blockStairs, x, y, z);
|
||||
if (var5 && blockStairs.func_150144_g(renderer.blockAccess, x, y, z)) {
|
||||
renderer.setRenderBoundsFromBlock(blockStairs);
|
||||
renderer.renderStandardBlock(blockStairs, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
BlockETStairs blockStairs = (BlockETStairs) block;
|
||||
blockStairs.func_150147_e(renderer.blockAccess, x, y, z);
|
||||
renderer.setRenderBoundsFromBlock(blockStairs);
|
||||
renderer.renderStandardBlock(blockStairs, x, y, z);
|
||||
boolean var5 = blockStairs.func_150145_f(renderer.blockAccess, x, y, z);
|
||||
renderer.setRenderBoundsFromBlock(blockStairs);
|
||||
renderer.renderStandardBlock(blockStairs, x, y, z);
|
||||
if (var5 && blockStairs.func_150144_g(renderer.blockAccess, x, y, z)) {
|
||||
renderer.setRenderBoundsFromBlock(blockStairs);
|
||||
renderer.renderStandardBlock(blockStairs, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int i) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ExtraTrees.stairsID;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ExtraTrees.stairsID;
|
||||
}
|
||||
}
|
||||
@@ -6,113 +6,113 @@ import binnie.extratrees.api.CarpentryManager;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.block.decor.FenceDescription;
|
||||
import binnie.extratrees.block.decor.FenceType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class WoodManager {
|
||||
public static IPlankType getPlankType(int index) {
|
||||
IDesignMaterial wood = CarpentryManager.carpentryInterface.getWoodMaterial(index);
|
||||
if (wood instanceof IPlankType) {
|
||||
return (IPlankType) wood;
|
||||
}
|
||||
return PlankType.ExtraTreePlanks.Fir;
|
||||
}
|
||||
public static IPlankType getPlankType(int index) {
|
||||
IDesignMaterial wood = CarpentryManager.carpentryInterface.getWoodMaterial(index);
|
||||
if (wood instanceof IPlankType) {
|
||||
return (IPlankType) wood;
|
||||
}
|
||||
return PlankType.ExtraTreePlanks.Fir;
|
||||
}
|
||||
|
||||
public static int getPlankTypeIndex(IPlankType type) {
|
||||
int index = CarpentryManager.carpentryInterface.getCarpentryWoodIndex(type);
|
||||
return (index < 0) ? 0 : index;
|
||||
}
|
||||
public static int getPlankTypeIndex(IPlankType type) {
|
||||
int index = CarpentryManager.carpentryInterface.getCarpentryWoodIndex(type);
|
||||
return (index < 0) ? 0 : index;
|
||||
}
|
||||
|
||||
public static FenceType getFenceType(ItemStack stack) {
|
||||
FenceDescription desc = getFenceDescription(stack);
|
||||
return (desc == null) ? null : desc.getFenceType();
|
||||
}
|
||||
public static FenceType getFenceType(ItemStack stack) {
|
||||
FenceDescription desc = getFenceDescription(stack);
|
||||
return (desc == null) ? null : desc.getFenceType();
|
||||
}
|
||||
|
||||
public static FenceDescription getFenceDescription(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
public static FenceDescription getFenceDescription(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (stack.getItem() == Item.getItemFromBlock(ExtraTrees.blockMultiFence)) {
|
||||
int damage = TileEntityMetadata.getItemDamage(stack);
|
||||
return getFenceDescription(damage);
|
||||
}
|
||||
if (stack.getItem() == Item.getItemFromBlock(ExtraTrees.blockMultiFence)) {
|
||||
int damage = TileEntityMetadata.getItemDamage(stack);
|
||||
return getFenceDescription(damage);
|
||||
}
|
||||
|
||||
for (IPlankType type : getAllPlankTypes()) {
|
||||
if (type instanceof IFenceProvider) {
|
||||
ItemStack f = ((IFenceProvider) type).getFence();
|
||||
if (f != null && ItemStack.areItemStacksEqual(stack, f)) {
|
||||
return new FenceDescription(new FenceType(0), type, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
for (IPlankType type : getAllPlankTypes()) {
|
||||
if (type instanceof IFenceProvider) {
|
||||
ItemStack f = ((IFenceProvider) type).getFence();
|
||||
if (f != null && ItemStack.areItemStacksEqual(stack, f)) {
|
||||
return new FenceDescription(new FenceType(0), type, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FenceDescription getFenceDescription(int meta) {
|
||||
return new FenceDescription(meta);
|
||||
}
|
||||
public static FenceDescription getFenceDescription(int meta) {
|
||||
return new FenceDescription(meta);
|
||||
}
|
||||
|
||||
public static FenceType getFenceType(int meta) {
|
||||
return getFenceDescription(meta).getFenceType();
|
||||
}
|
||||
public static FenceType getFenceType(int meta) {
|
||||
return getFenceDescription(meta).getFenceType();
|
||||
}
|
||||
|
||||
public static ItemStack getGate(IPlankType plank) {
|
||||
if (plank == PlankType.VanillaPlanks.OAK) {
|
||||
return new ItemStack(Blocks.fence_gate);
|
||||
}
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blockGate, getPlankTypeIndex(plank));
|
||||
}
|
||||
public static ItemStack getGate(IPlankType plank) {
|
||||
if (plank == PlankType.VanillaPlanks.OAK) {
|
||||
return new ItemStack(Blocks.fence_gate);
|
||||
}
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blockGate, getPlankTypeIndex(plank));
|
||||
}
|
||||
|
||||
public static ItemStack getFence(IPlankType plank, FenceType type, int amount) {
|
||||
return getFence(plank, plank, type, amount);
|
||||
}
|
||||
public static ItemStack getFence(IPlankType plank, FenceType type, int amount) {
|
||||
return getFence(plank, plank, type, amount);
|
||||
}
|
||||
|
||||
public static ItemStack getFence(IPlankType plank, IPlankType plank2, FenceType type, int amount) {
|
||||
if (plank instanceof IFenceProvider && plank == plank2 && type.isPlain()) {
|
||||
ItemStack original = ((IFenceProvider) plank).getFence();
|
||||
if (original != null) {
|
||||
original.stackSize = amount;
|
||||
return original;
|
||||
}
|
||||
}
|
||||
public static ItemStack getFence(IPlankType plank, IPlankType plank2, FenceType type, int amount) {
|
||||
if (plank instanceof IFenceProvider && plank == plank2 && type.isPlain()) {
|
||||
ItemStack original = ((IFenceProvider) plank).getFence();
|
||||
if (original != null) {
|
||||
original.stackSize = amount;
|
||||
return original;
|
||||
}
|
||||
}
|
||||
|
||||
int ord = type.ordinal();
|
||||
int i = getPlankTypeIndex(plank) + 256 * ord;
|
||||
ItemStack stack = TileEntityMetadata.getItemStack(ExtraTrees.blockMultiFence, i + 65536 * getPlankTypeIndex(plank2));
|
||||
stack.stackSize = amount;
|
||||
return stack;
|
||||
}
|
||||
int ord = type.ordinal();
|
||||
int i = getPlankTypeIndex(plank) + 256 * ord;
|
||||
ItemStack stack =
|
||||
TileEntityMetadata.getItemStack(ExtraTrees.blockMultiFence, i + 65536 * getPlankTypeIndex(plank2));
|
||||
stack.stackSize = amount;
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack getDoor(IPlankType plank, DoorType type) {
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blockDoor, type.ordinal() * 256 + getPlankTypeIndex(plank));
|
||||
}
|
||||
public static ItemStack getDoor(IPlankType plank, DoorType type) {
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blockDoor, type.ordinal() * 256 + getPlankTypeIndex(plank));
|
||||
}
|
||||
|
||||
public static List<IPlankType> getAllPlankTypes() {
|
||||
List<IPlankType> list = new ArrayList<>();
|
||||
Collections.addAll(list, PlankType.ExtraTreePlanks.values());
|
||||
Collections.addAll(list, PlankType.ForestryPlanks.values());
|
||||
for (IPlankType type : PlankType.ExtraBiomesPlank.values()) {
|
||||
if (type.getStack() != null) {
|
||||
list.add(type);
|
||||
}
|
||||
}
|
||||
public static List<IPlankType> getAllPlankTypes() {
|
||||
List<IPlankType> list = new ArrayList<>();
|
||||
Collections.addAll(list, PlankType.ExtraTreePlanks.values());
|
||||
Collections.addAll(list, PlankType.ForestryPlanks.values());
|
||||
for (IPlankType type : PlankType.ExtraBiomesPlank.values()) {
|
||||
if (type.getStack() != null) {
|
||||
list.add(type);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.addAll(list, PlankType.VanillaPlanks.values());
|
||||
return list;
|
||||
}
|
||||
Collections.addAll(list, PlankType.VanillaPlanks.values());
|
||||
return list;
|
||||
}
|
||||
|
||||
public static IPlankType get(ItemStack species) {
|
||||
for (IPlankType type : getAllPlankTypes()) {
|
||||
if (type.getStack() != null && type.getStack().isItemEqual(species)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static IPlankType get(ItemStack species) {
|
||||
for (IPlankType type : getAllPlankTypes()) {
|
||||
if (type.getStack() != null && type.getStack().isItemEqual(species)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -11,12 +11,13 @@ import binnie.extratrees.block.WoodManager;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -26,162 +27,160 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockFence extends net.minecraft.block.BlockFence implements IBlockMetadata, IBlockFence {
|
||||
public BlockFence() {
|
||||
super("", Material.wood);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("fence");
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
public BlockFence() {
|
||||
super("", Material.wood);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("fence");
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (IFenceProvider type : PlankType.ExtraTreePlanks.values()) {
|
||||
list.add(type.getFence());
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (IFenceProvider type : PlankType.ExtraTreePlanks.values()) {
|
||||
list.add(type.getFence());
|
||||
}
|
||||
|
||||
for (IFenceProvider type : PlankType.VanillaPlanks.values()) {
|
||||
if (type != PlankType.VanillaPlanks.OAK) {
|
||||
list.add(type.getFence());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (IFenceProvider type : PlankType.VanillaPlanks.values()) {
|
||||
if (type != PlankType.VanillaPlanks.OAK) {
|
||||
list.add(type.getFence());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
public FenceDescription getDescription(int meta) {
|
||||
return WoodManager.getFenceDescription(meta);
|
||||
}
|
||||
public FenceDescription getDescription(int meta) {
|
||||
return WoodManager.getFenceDescription(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return getDescription(meta).getPlankType().getIcon();
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return getDescription(meta).getPlankType().getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ExtraTrees.fenceID;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ExtraTrees.fenceID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return I18N.localise("extratrees.block.woodfence.name", getDescription(meta).getPlankType().getName());
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return I18N.localise(
|
||||
"extratrees.block.woodfence.name",
|
||||
getDescription(meta).getPlankType().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
}
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceTorchOnTop(World world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canPlaceTorchOnTop(World world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectFenceTo(IBlockAccess world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
Material material = block.getMaterial();
|
||||
return IBlockFence.isFence(block) && material == this.blockMaterial
|
||||
|| material.isOpaque() && block.renderAsNormalBlock() && material != Material.gourd;
|
||||
}
|
||||
@Override
|
||||
public boolean canConnectFenceTo(IBlockAccess world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
Material material = block.getMaterial();
|
||||
return IBlockFence.isFence(block) && material == this.blockMaterial
|
||||
|| material.isOpaque() && block.renderAsNormalBlock() && material != Material.gourd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
//@SideOnly(Side.CLIENT)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
//@SideOnly(Side.CLIENT)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import binnie.extratrees.block.WoodManager;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFenceGate;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -22,134 +24,131 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockGate extends BlockFenceGate implements IBlockMetadata {
|
||||
public BlockGate() {
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
public BlockGate() {
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
for (IPlankType type : WoodManager.getAllPlankTypes()) {
|
||||
ItemStack gate = WoodManager.getGate(type);
|
||||
if (gate != null) {
|
||||
itemList.add(gate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
for (IPlankType type : WoodManager.getAllPlankTypes()) {
|
||||
ItemStack gate = WoodManager.getGate(type);
|
||||
if (gate != null) {
|
||||
itemList.add(gate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return WoodManager.getPlankType(meta).getIcon();
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return WoodManager.getPlankType(meta).getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return I18N.localise("extratrees.block.woodgate.name", WoodManager.getPlankType(meta).getName());
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
return I18N.localise(
|
||||
"extratrees.block.woodgate.name", WoodManager.getPlankType(meta).getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
}
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
//@SideOnly(Side.CLIENT)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
//@SideOnly(Side.CLIENT)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,12 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@@ -20,161 +20,162 @@ import net.minecraft.world.ColorizerFoliage;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockHedge extends Block implements IBlockFence {
|
||||
public BlockHedge() {
|
||||
super(Material.leaves);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("hedge");
|
||||
}
|
||||
public BlockHedge() {
|
||||
super(Material.leaves);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("hedge");
|
||||
}
|
||||
|
||||
public static int getColor(int meta) {
|
||||
LeafType type = LeafType.values()[meta % 6];
|
||||
if (type == LeafType.CONIFER) {
|
||||
return ColorizerFoliage.getFoliageColorPine();
|
||||
}
|
||||
double d0 = 0.5;
|
||||
double d2 = 1.0;
|
||||
return ColorizerFoliage.getFoliageColor(d0, d2);
|
||||
}
|
||||
public static int getColor(int meta) {
|
||||
LeafType type = LeafType.values()[meta % 6];
|
||||
if (type == LeafType.CONIFER) {
|
||||
return ColorizerFoliage.getFoliageColorPine();
|
||||
}
|
||||
double d0 = 0.5;
|
||||
double d2 = 1.0;
|
||||
return ColorizerFoliage.getFoliageColor(d0, d2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) {
|
||||
boolean connectNegZ = canConnectFenceTo(world, x, y, z - 1);
|
||||
boolean connectPosZ = canConnectFenceTo(world, x, y, z + 1);
|
||||
boolean connectNegX = canConnectFenceTo(world, x - 1, y, z);
|
||||
boolean connectPosX = canConnectFenceTo(world, x + 1, y, z);
|
||||
float f = 0.25f;
|
||||
float f2 = 0.75f;
|
||||
float f3 = 0.25f;
|
||||
float f4 = 0.75f;
|
||||
if (connectNegZ) {
|
||||
f3 = 0.0f;
|
||||
}
|
||||
if (connectPosZ) {
|
||||
f4 = 1.0f;
|
||||
}
|
||||
if (connectNegZ || connectPosZ) {
|
||||
setBlockBounds(f, 0.0f, f3, f2, 1.5f, f4);
|
||||
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
|
||||
}
|
||||
@Override
|
||||
public void addCollisionBoxesToList(
|
||||
World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) {
|
||||
boolean connectNegZ = canConnectFenceTo(world, x, y, z - 1);
|
||||
boolean connectPosZ = canConnectFenceTo(world, x, y, z + 1);
|
||||
boolean connectNegX = canConnectFenceTo(world, x - 1, y, z);
|
||||
boolean connectPosX = canConnectFenceTo(world, x + 1, y, z);
|
||||
float f = 0.25f;
|
||||
float f2 = 0.75f;
|
||||
float f3 = 0.25f;
|
||||
float f4 = 0.75f;
|
||||
if (connectNegZ) {
|
||||
f3 = 0.0f;
|
||||
}
|
||||
if (connectPosZ) {
|
||||
f4 = 1.0f;
|
||||
}
|
||||
if (connectNegZ || connectPosZ) {
|
||||
setBlockBounds(f, 0.0f, f3, f2, 1.5f, f4);
|
||||
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
|
||||
}
|
||||
|
||||
f3 = 0.25f;
|
||||
f4 = 0.75f;
|
||||
if (connectNegX) {
|
||||
f = 0.0f;
|
||||
}
|
||||
if (connectPosX) {
|
||||
f2 = 1.0f;
|
||||
}
|
||||
if (connectNegX || connectPosX || (!connectNegZ && !connectPosZ)) {
|
||||
setBlockBounds(f, 0.0f, f3, f2, 1.5f, f4);
|
||||
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
|
||||
}
|
||||
if (connectNegZ) {
|
||||
f3 = 0.0f;
|
||||
}
|
||||
if (connectPosZ) {
|
||||
f4 = 1.0f;
|
||||
}
|
||||
setBlockBounds(f, 0.0f, f3, f2, 1.0f, f4);
|
||||
}
|
||||
f3 = 0.25f;
|
||||
f4 = 0.75f;
|
||||
if (connectNegX) {
|
||||
f = 0.0f;
|
||||
}
|
||||
if (connectPosX) {
|
||||
f2 = 1.0f;
|
||||
}
|
||||
if (connectNegX || connectPosX || (!connectNegZ && !connectPosZ)) {
|
||||
setBlockBounds(f, 0.0f, f3, f2, 1.5f, f4);
|
||||
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
|
||||
}
|
||||
if (connectNegZ) {
|
||||
f3 = 0.0f;
|
||||
}
|
||||
if (connectPosZ) {
|
||||
f4 = 1.0f;
|
||||
}
|
||||
setBlockBounds(f, 0.0f, f3, f2, 1.0f, f4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
boolean connectNegZ = canConnectFenceTo(world, x, y, z - 1);
|
||||
boolean connectPosZ = canConnectFenceTo(world, x, y, z + 1);
|
||||
boolean connectNegX = canConnectFenceTo(world, x - 1, y, z);
|
||||
boolean connectPosX = canConnectFenceTo(world, x + 1, y, z);
|
||||
float f = 0.25f;
|
||||
float f2 = 0.75f;
|
||||
float f3 = 0.25f;
|
||||
float f4 = 0.75f;
|
||||
if (connectNegZ) {
|
||||
f3 = 0.0f;
|
||||
}
|
||||
if (connectPosZ) {
|
||||
f4 = 1.0f;
|
||||
}
|
||||
if (connectNegX) {
|
||||
f = 0.0f;
|
||||
}
|
||||
if (connectPosX) {
|
||||
f2 = 1.0f;
|
||||
}
|
||||
setBlockBounds(f, 0.0f, f3, f2, 1.0f, f4);
|
||||
}
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
boolean connectNegZ = canConnectFenceTo(world, x, y, z - 1);
|
||||
boolean connectPosZ = canConnectFenceTo(world, x, y, z + 1);
|
||||
boolean connectNegX = canConnectFenceTo(world, x - 1, y, z);
|
||||
boolean connectPosX = canConnectFenceTo(world, x + 1, y, z);
|
||||
float f = 0.25f;
|
||||
float f2 = 0.75f;
|
||||
float f3 = 0.25f;
|
||||
float f4 = 0.75f;
|
||||
if (connectNegZ) {
|
||||
f3 = 0.0f;
|
||||
}
|
||||
if (connectPosZ) {
|
||||
f4 = 1.0f;
|
||||
}
|
||||
if (connectNegX) {
|
||||
f = 0.0f;
|
||||
}
|
||||
if (connectPosX) {
|
||||
f2 = 1.0f;
|
||||
}
|
||||
setBlockBounds(f, 0.0f, f3, f2, 1.0f, f4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ModuleBlocks.hedgeRenderID;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ModuleBlocks.hedgeRenderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectFenceTo(IBlockAccess world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
return block == this
|
||||
|| IBlockFence.isFence(block)
|
||||
|| block.isLeaves(world, x, y, z)
|
||||
|| (block.getMaterial().isOpaque() && block.renderAsNormalBlock() && block.getMaterial() != Material.gourd);
|
||||
}
|
||||
@Override
|
||||
public boolean canConnectFenceTo(IBlockAccess world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
return block == this
|
||||
|| IBlockFence.isFence(block)
|
||||
|| block.isLeaves(world, x, y, z)
|
||||
|| (block.getMaterial().isOpaque()
|
||||
&& block.renderAsNormalBlock()
|
||||
&& block.getMaterial() != Material.gourd);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
private LeafType getType(int meta) {
|
||||
return LeafType.values()[meta % 8];
|
||||
}
|
||||
private LeafType getType(int meta) {
|
||||
return LeafType.values()[meta % 8];
|
||||
}
|
||||
|
||||
private boolean isFull(int meta) {
|
||||
return meta / 8 > 0;
|
||||
}
|
||||
private boolean isFull(int meta) {
|
||||
return meta / 8 > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
LeafType type = getType(meta);
|
||||
return ForestryAPI.textureManager.getIcon(isFull(meta) ? type.plainUID : type.fancyUID);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
LeafType type = getType(meta);
|
||||
return ForestryAPI.textureManager.getIcon(isFull(meta) ? type.plainUID : type.fancyUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
for (int f = 0; f < 2; ++f) {
|
||||
list.add(new ItemStack(item, 1, i + f * 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
for (int f = 0; f < 2; ++f) {
|
||||
list.add(new ItemStack(item, 1, i + f * 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
return getColor(world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
return getColor(world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
}
|
||||
@@ -6,39 +6,42 @@ import binnie.core.util.I18N;
|
||||
import binnie.extratrees.block.IPlankType;
|
||||
import binnie.extratrees.block.PlankType;
|
||||
import binnie.extratrees.block.WoodManager;
|
||||
import java.util.List;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockMultiFence extends BlockFence implements IBlockMetadata {
|
||||
public BlockMultiFence() {
|
||||
setBlockName("multifence");
|
||||
}
|
||||
public BlockMultiFence() {
|
||||
setBlockName("multifence");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (FenceType type : FenceType.values()) {
|
||||
list.add(WoodManager.getFence(PlankType.VanillaPlanks.SPRUCE, PlankType.VanillaPlanks.BIRCH, type, 1));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (FenceType type : FenceType.values()) {
|
||||
list.add(WoodManager.getFence(PlankType.VanillaPlanks.SPRUCE, PlankType.VanillaPlanks.BIRCH, type, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return (FenceRenderer.layer == 0)
|
||||
? getDescription(meta).getPlankType().getIcon()
|
||||
: getDescription(meta).getSecondaryPlankType().getIcon();
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return (FenceRenderer.layer == 0)
|
||||
? getDescription(meta).getPlankType().getIcon()
|
||||
: getDescription(meta).getSecondaryPlankType().getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
IPlankType type1 = getDescription(meta).getPlankType();
|
||||
IPlankType type2 = getDescription(meta).getSecondaryPlankType();
|
||||
FenceType type3 = getDescription(meta).getFenceType();
|
||||
boolean twoTypes = type1 != type2;
|
||||
return I18N.localise("extratrees.block.woodslab.name" + (twoTypes ? "2" : ""), type3.getPrefix(), type1.getName(), type2.getName());
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
IPlankType type1 = getDescription(meta).getPlankType();
|
||||
IPlankType type2 = getDescription(meta).getSecondaryPlankType();
|
||||
FenceType type3 = getDescription(meta).getFenceType();
|
||||
boolean twoTypes = type1 != type2;
|
||||
return I18N.localise(
|
||||
"extratrees.block.woodslab.name" + (twoTypes ? "2" : ""),
|
||||
type3.getPrefix(),
|
||||
type1.getName(),
|
||||
type2.getName());
|
||||
}
|
||||
}
|
||||
@@ -4,31 +4,31 @@ import binnie.extratrees.block.IPlankType;
|
||||
import binnie.extratrees.block.WoodManager;
|
||||
|
||||
public class FenceDescription {
|
||||
protected FenceType fenceType;
|
||||
protected IPlankType plankType;
|
||||
protected IPlankType secondaryPlankType;
|
||||
protected FenceType fenceType;
|
||||
protected IPlankType plankType;
|
||||
protected IPlankType secondaryPlankType;
|
||||
|
||||
public FenceDescription(FenceType fenceType, IPlankType plankType, IPlankType secondaryPlankType) {
|
||||
this.fenceType = fenceType;
|
||||
this.plankType = plankType;
|
||||
this.secondaryPlankType = secondaryPlankType;
|
||||
}
|
||||
public FenceDescription(FenceType fenceType, IPlankType plankType, IPlankType secondaryPlankType) {
|
||||
this.fenceType = fenceType;
|
||||
this.plankType = plankType;
|
||||
this.secondaryPlankType = secondaryPlankType;
|
||||
}
|
||||
|
||||
public FenceDescription(int meta) {
|
||||
fenceType = new FenceType(meta >> 8 & 0xFF);
|
||||
plankType = WoodManager.getPlankType(meta & 0xFF);
|
||||
secondaryPlankType = WoodManager.getPlankType(meta >> 16 & 0xFF);
|
||||
}
|
||||
public FenceDescription(int meta) {
|
||||
fenceType = new FenceType(meta >> 8 & 0xFF);
|
||||
plankType = WoodManager.getPlankType(meta & 0xFF);
|
||||
secondaryPlankType = WoodManager.getPlankType(meta >> 16 & 0xFF);
|
||||
}
|
||||
|
||||
public FenceType getFenceType() {
|
||||
return fenceType;
|
||||
}
|
||||
public FenceType getFenceType() {
|
||||
return fenceType;
|
||||
}
|
||||
|
||||
public IPlankType getPlankType() {
|
||||
return plankType;
|
||||
}
|
||||
public IPlankType getPlankType() {
|
||||
return plankType;
|
||||
}
|
||||
|
||||
public IPlankType getSecondaryPlankType() {
|
||||
return secondaryPlankType;
|
||||
}
|
||||
public IPlankType getSecondaryPlankType() {
|
||||
return secondaryPlankType;
|
||||
}
|
||||
}
|
||||
@@ -12,272 +12,276 @@ import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class FenceRenderer implements ISimpleBlockRenderingHandler {
|
||||
public static int layer;
|
||||
public static int layer;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
float thickness = 0.125f;
|
||||
FenceRenderer.layer = 0;
|
||||
if (i == 0) {
|
||||
block.setBlockBounds(0.5f - thickness, 0.0f, 0.0f, 0.5f + thickness, 1.0f, thickness * 2.0f);
|
||||
}
|
||||
if (i == 1) {
|
||||
block.setBlockBounds(0.5f - thickness, 0.0f, 1.0f - thickness * 2.0f, 0.5f + thickness, 1.0f, 1.0f);
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
float thickness = 0.125f;
|
||||
FenceRenderer.layer = 0;
|
||||
if (i == 0) {
|
||||
block.setBlockBounds(0.5f - thickness, 0.0f, 0.0f, 0.5f + thickness, 1.0f, thickness * 2.0f);
|
||||
}
|
||||
if (i == 1) {
|
||||
block.setBlockBounds(0.5f - thickness, 0.0f, 1.0f - thickness * 2.0f, 0.5f + thickness, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
float s = 0.0625f;
|
||||
FenceType fenceType = (block == ExtraTrees.blockMultiFence) ? WoodManager.getFenceType(metadata) : new FenceType(0);
|
||||
boolean bottomBar = !fenceType.solid;
|
||||
float topBarMaxY = 1.0f - s;
|
||||
float topBarMinY = 1.0f - s * 3.0f;
|
||||
float bottomBarMaxY = 0.5f - s;
|
||||
float bottomBarMinY = 0.5f - s * 3.0f;
|
||||
if (fenceType.size == 2) {
|
||||
bottomBarMinY -= 4.0f * s;
|
||||
bottomBarMaxY -= 4.0f * s;
|
||||
topBarMinY -= 4.0f * s;
|
||||
topBarMaxY -= 4.0f * s;
|
||||
}
|
||||
float s = 0.0625f;
|
||||
FenceType fenceType =
|
||||
(block == ExtraTrees.blockMultiFence) ? WoodManager.getFenceType(metadata) : new FenceType(0);
|
||||
boolean bottomBar = !fenceType.solid;
|
||||
float topBarMaxY = 1.0f - s;
|
||||
float topBarMinY = 1.0f - s * 3.0f;
|
||||
float bottomBarMaxY = 0.5f - s;
|
||||
float bottomBarMinY = 0.5f - s * 3.0f;
|
||||
if (fenceType.size == 2) {
|
||||
bottomBarMinY -= 4.0f * s;
|
||||
bottomBarMaxY -= 4.0f * s;
|
||||
topBarMinY -= 4.0f * s;
|
||||
topBarMaxY -= 4.0f * s;
|
||||
}
|
||||
|
||||
if (fenceType.size == 1) {
|
||||
bottomBarMinY -= 4.0f * s;
|
||||
bottomBarMaxY -= 4.0f * s;
|
||||
}
|
||||
if (fenceType.size == 1) {
|
||||
bottomBarMinY -= 4.0f * s;
|
||||
bottomBarMaxY -= 4.0f * s;
|
||||
}
|
||||
|
||||
if (fenceType.solid) {
|
||||
topBarMinY = bottomBarMinY;
|
||||
}
|
||||
if (fenceType.solid) {
|
||||
topBarMinY = bottomBarMinY;
|
||||
}
|
||||
|
||||
float minX = 0.5f - s;
|
||||
float maxX = 0.5f + s;
|
||||
float minZ = -s * 2.0f;
|
||||
float maxZ = 1.0f + s * 2.0f;
|
||||
if (i == 2) {
|
||||
block.setBlockBounds(minX, topBarMinY, minZ, maxX, topBarMaxY, maxZ);
|
||||
FenceRenderer.layer = 1;
|
||||
} else if (i == 3) {
|
||||
if (!bottomBar) {
|
||||
continue;
|
||||
}
|
||||
block.setBlockBounds(minX, bottomBarMinY, minZ, maxX, bottomBarMaxY, maxZ);
|
||||
FenceRenderer.layer = 1;
|
||||
} else if (i == 4) {
|
||||
if (fenceType.embossed) {
|
||||
minX -= s * 0.9f;
|
||||
maxX += s * 0.9f;
|
||||
minZ -= s;
|
||||
maxZ += s;
|
||||
float minY;
|
||||
float maxY;
|
||||
float minX = 0.5f - s;
|
||||
float maxX = 0.5f + s;
|
||||
float minZ = -s * 2.0f;
|
||||
float maxZ = 1.0f + s * 2.0f;
|
||||
if (i == 2) {
|
||||
block.setBlockBounds(minX, topBarMinY, minZ, maxX, topBarMaxY, maxZ);
|
||||
FenceRenderer.layer = 1;
|
||||
} else if (i == 3) {
|
||||
if (!bottomBar) {
|
||||
continue;
|
||||
}
|
||||
block.setBlockBounds(minX, bottomBarMinY, minZ, maxX, bottomBarMaxY, maxZ);
|
||||
FenceRenderer.layer = 1;
|
||||
} else if (i == 4) {
|
||||
if (fenceType.embossed) {
|
||||
minX -= s * 0.9f;
|
||||
maxX += s * 0.9f;
|
||||
minZ -= s;
|
||||
maxZ += s;
|
||||
float minY;
|
||||
float maxY;
|
||||
|
||||
if (fenceType.size != 1 && !fenceType.solid) {
|
||||
minY = bottomBarMinY + 2.0f * s;
|
||||
maxY = topBarMaxY - 2.0f * s;
|
||||
} else if (fenceType.size == 1 && fenceType.solid) {
|
||||
minY = bottomBarMinY + 2.0f * s;
|
||||
maxY = topBarMaxY - 2.0f * s;
|
||||
} else {
|
||||
minY = 0.5f - 2.0f * s;
|
||||
maxY = 0.5f + 2.0f * s;
|
||||
}
|
||||
if (fenceType.solid && fenceType.size == 0) {
|
||||
minY -= s;
|
||||
maxY -= s;
|
||||
}
|
||||
if (fenceType.solid && fenceType.size == 2) {
|
||||
minY += s;
|
||||
maxY += s;
|
||||
}
|
||||
block.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
FenceRenderer.layer = 0;
|
||||
} else {
|
||||
if (fenceType.size != 1 || fenceType.solid) {
|
||||
continue;
|
||||
}
|
||||
block.setBlockBounds(minX, 0.5f - s, minZ, maxX, 0.5f + s, maxZ);
|
||||
FenceRenderer.layer = 1;
|
||||
}
|
||||
}
|
||||
if (fenceType.size != 1 && !fenceType.solid) {
|
||||
minY = bottomBarMinY + 2.0f * s;
|
||||
maxY = topBarMaxY - 2.0f * s;
|
||||
} else if (fenceType.size == 1 && fenceType.solid) {
|
||||
minY = bottomBarMinY + 2.0f * s;
|
||||
maxY = topBarMaxY - 2.0f * s;
|
||||
} else {
|
||||
minY = 0.5f - 2.0f * s;
|
||||
maxY = 0.5f + 2.0f * s;
|
||||
}
|
||||
if (fenceType.solid && fenceType.size == 0) {
|
||||
minY -= s;
|
||||
maxY -= s;
|
||||
}
|
||||
if (fenceType.solid && fenceType.size == 2) {
|
||||
minY += s;
|
||||
maxY += s;
|
||||
}
|
||||
block.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
FenceRenderer.layer = 0;
|
||||
} else {
|
||||
if (fenceType.size != 1 || fenceType.solid) {
|
||||
continue;
|
||||
}
|
||||
block.setBlockBounds(minX, 0.5f - s, minZ, maxX, 0.5f + s, maxZ);
|
||||
FenceRenderer.layer = 1;
|
||||
}
|
||||
}
|
||||
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderer.renderFaceYNeg(block, 0.0, 0.0, 0.0, block.getIcon(0, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderer.renderFaceYPos(block, 0.0, 0.0, 0.0, block.getIcon(1, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderer.renderFaceXPos(block, 0.0, 0.0, 0.0, block.getIcon(2, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderer.renderFaceXNeg(block, 0.0, 0.0, 0.0, block.getIcon(3, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceZNeg(block, 0.0, 0.0, 0.0, block.getIcon(4, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceZPos(block, 0.0, 0.0, 0.0, block.getIcon(5, metadata));
|
||||
tess.draw();
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
}
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderer.renderFaceYNeg(block, 0.0, 0.0, 0.0, block.getIcon(0, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderer.renderFaceYPos(block, 0.0, 0.0, 0.0, block.getIcon(1, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderer.renderFaceXPos(block, 0.0, 0.0, 0.0, block.getIcon(2, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderer.renderFaceXNeg(block, 0.0, 0.0, 0.0, block.getIcon(3, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceZNeg(block, 0.0, 0.0, 0.0, block.getIcon(4, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceZPos(block, 0.0, 0.0, 0.0, block.getIcon(5, metadata));
|
||||
tess.draw();
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
FenceRenderer.layer = 0;
|
||||
BlockFence blockFence = (BlockFence) block;
|
||||
float i = 0.0625f;
|
||||
FenceType fenceType = new FenceType(0);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile != null && tile instanceof TileEntityMetadata && block instanceof BlockMultiFence) {
|
||||
fenceType = WoodManager.getFenceType(((TileEntityMetadata) tile).getTileMetadata());
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
FenceRenderer.layer = 0;
|
||||
BlockFence blockFence = (BlockFence) block;
|
||||
float i = 0.0625f;
|
||||
FenceType fenceType = new FenceType(0);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile != null && tile instanceof TileEntityMetadata && block instanceof BlockMultiFence) {
|
||||
fenceType = WoodManager.getFenceType(((TileEntityMetadata) tile).getTileMetadata());
|
||||
}
|
||||
|
||||
boolean rendered;
|
||||
float postWidth = 0.25f;
|
||||
float postHeight = 1.0f;
|
||||
float minPostPos = 0.5f - postWidth / 2.0f;
|
||||
float maxPostPos = 0.5f + postWidth / 2.0f;
|
||||
renderer.setRenderBounds(minPostPos, 0.0, minPostPos, maxPostPos, postHeight, maxPostPos);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
rendered = true;
|
||||
boolean connectAnyX = false;
|
||||
boolean connectAnyZ = false;
|
||||
if (blockFence.canConnectFenceTo(renderer.blockAccess, x - 1, y, z) || blockFence.canConnectFenceTo(renderer.blockAccess, x + 1, y, z)) {
|
||||
connectAnyX = true;
|
||||
}
|
||||
if (blockFence.canConnectFenceTo(renderer.blockAccess, x, y, z - 1) || blockFence.canConnectFenceTo(renderer.blockAccess, x, y, z + 1)) {
|
||||
connectAnyZ = true;
|
||||
}
|
||||
boolean rendered;
|
||||
float postWidth = 0.25f;
|
||||
float postHeight = 1.0f;
|
||||
float minPostPos = 0.5f - postWidth / 2.0f;
|
||||
float maxPostPos = 0.5f + postWidth / 2.0f;
|
||||
renderer.setRenderBounds(minPostPos, 0.0, minPostPos, maxPostPos, postHeight, maxPostPos);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
rendered = true;
|
||||
boolean connectAnyX = false;
|
||||
boolean connectAnyZ = false;
|
||||
if (blockFence.canConnectFenceTo(renderer.blockAccess, x - 1, y, z)
|
||||
|| blockFence.canConnectFenceTo(renderer.blockAccess, x + 1, y, z)) {
|
||||
connectAnyX = true;
|
||||
}
|
||||
if (blockFence.canConnectFenceTo(renderer.blockAccess, x, y, z - 1)
|
||||
|| blockFence.canConnectFenceTo(renderer.blockAccess, x, y, z + 1)) {
|
||||
connectAnyZ = true;
|
||||
}
|
||||
|
||||
boolean connectNegX = blockFence.canConnectFenceTo(renderer.blockAccess, x - 1, y, z);
|
||||
boolean connectPosX = blockFence.canConnectFenceTo(renderer.blockAccess, x + 1, y, z);
|
||||
boolean connectNegZ = blockFence.canConnectFenceTo(renderer.blockAccess, x, y, z - 1);
|
||||
boolean connectPosZ = blockFence.canConnectFenceTo(renderer.blockAccess, x, y, z + 1);
|
||||
if (!connectAnyX && !connectAnyZ) {
|
||||
connectAnyX = true;
|
||||
}
|
||||
boolean connectNegX = blockFence.canConnectFenceTo(renderer.blockAccess, x - 1, y, z);
|
||||
boolean connectPosX = blockFence.canConnectFenceTo(renderer.blockAccess, x + 1, y, z);
|
||||
boolean connectNegZ = blockFence.canConnectFenceTo(renderer.blockAccess, x, y, z - 1);
|
||||
boolean connectPosZ = blockFence.canConnectFenceTo(renderer.blockAccess, x, y, z + 1);
|
||||
if (!connectAnyX && !connectAnyZ) {
|
||||
connectAnyX = true;
|
||||
}
|
||||
|
||||
minPostPos = 7.0f * i;
|
||||
maxPostPos = 9.0f * i;
|
||||
float barMinY = 12.0f * i;
|
||||
float barMaxY = 15.0f * i;
|
||||
float minX = connectNegX ? 0.0f : minPostPos;
|
||||
float maxX = connectPosX ? 1.0f : maxPostPos;
|
||||
float minZ = connectNegZ ? 0.0f : minPostPos;
|
||||
float maxZ = connectPosZ ? 1.0f : maxPostPos;
|
||||
boolean renderBottom = true;
|
||||
if (fenceType.size == 2) {
|
||||
barMaxY -= 5.0f * i;
|
||||
barMinY -= 5.0f * i;
|
||||
}
|
||||
if (fenceType.solid) {
|
||||
renderBottom = false;
|
||||
if (fenceType.size == 0) {
|
||||
barMinY = 6.0f * i;
|
||||
} else {
|
||||
barMinY = i;
|
||||
}
|
||||
}
|
||||
minPostPos = 7.0f * i;
|
||||
maxPostPos = 9.0f * i;
|
||||
float barMinY = 12.0f * i;
|
||||
float barMaxY = 15.0f * i;
|
||||
float minX = connectNegX ? 0.0f : minPostPos;
|
||||
float maxX = connectPosX ? 1.0f : maxPostPos;
|
||||
float minZ = connectNegZ ? 0.0f : minPostPos;
|
||||
float maxZ = connectPosZ ? 1.0f : maxPostPos;
|
||||
boolean renderBottom = true;
|
||||
if (fenceType.size == 2) {
|
||||
barMaxY -= 5.0f * i;
|
||||
barMinY -= 5.0f * i;
|
||||
}
|
||||
if (fenceType.solid) {
|
||||
renderBottom = false;
|
||||
if (fenceType.size == 0) {
|
||||
barMinY = 6.0f * i;
|
||||
} else {
|
||||
barMinY = i;
|
||||
}
|
||||
}
|
||||
|
||||
float totalMaxY = barMaxY;
|
||||
FenceRenderer.layer = 1;
|
||||
if (connectAnyX) {
|
||||
renderer.setRenderBounds(minX, barMinY, minPostPos, maxX, barMaxY, maxPostPos);
|
||||
renderer.renderStandardBlock(blockFence, x, y, z);
|
||||
rendered = true;
|
||||
}
|
||||
float totalMaxY = barMaxY;
|
||||
FenceRenderer.layer = 1;
|
||||
if (connectAnyX) {
|
||||
renderer.setRenderBounds(minX, barMinY, minPostPos, maxX, barMaxY, maxPostPos);
|
||||
renderer.renderStandardBlock(blockFence, x, y, z);
|
||||
rendered = true;
|
||||
}
|
||||
|
||||
if (connectAnyZ) {
|
||||
renderer.setRenderBounds(minPostPos, barMinY, minZ, maxPostPos, barMaxY, maxZ);
|
||||
renderer.renderStandardBlock(blockFence, x, y, z);
|
||||
rendered = true;
|
||||
}
|
||||
if (connectAnyZ) {
|
||||
renderer.setRenderBounds(minPostPos, barMinY, minZ, maxPostPos, barMaxY, maxZ);
|
||||
renderer.renderStandardBlock(blockFence, x, y, z);
|
||||
rendered = true;
|
||||
}
|
||||
|
||||
if (renderBottom) {
|
||||
barMinY -= 6.0f * i;
|
||||
barMaxY -= 6.0f * i;
|
||||
if (fenceType.size == 1) {
|
||||
barMinY += i;
|
||||
}
|
||||
if (connectAnyX) {
|
||||
renderer.setRenderBounds(minX, barMinY, minPostPos, maxX, barMaxY, maxPostPos);
|
||||
renderer.renderStandardBlock(blockFence, x, y, z);
|
||||
rendered = true;
|
||||
}
|
||||
if (connectAnyZ) {
|
||||
renderer.setRenderBounds(minPostPos, barMinY, minZ, maxPostPos, barMaxY, maxZ);
|
||||
renderer.renderStandardBlock(blockFence, x, y, z);
|
||||
rendered = true;
|
||||
}
|
||||
}
|
||||
if (renderBottom) {
|
||||
barMinY -= 6.0f * i;
|
||||
barMaxY -= 6.0f * i;
|
||||
if (fenceType.size == 1) {
|
||||
barMinY += i;
|
||||
}
|
||||
if (connectAnyX) {
|
||||
renderer.setRenderBounds(minX, barMinY, minPostPos, maxX, barMaxY, maxPostPos);
|
||||
renderer.renderStandardBlock(blockFence, x, y, z);
|
||||
rendered = true;
|
||||
}
|
||||
if (connectAnyZ) {
|
||||
renderer.setRenderBounds(minPostPos, barMinY, minZ, maxPostPos, barMaxY, maxZ);
|
||||
renderer.renderStandardBlock(blockFence, x, y, z);
|
||||
rendered = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (renderBottom && fenceType.size == 1) {
|
||||
barMinY -= 6.0f * i;
|
||||
barMaxY -= 6.0f * i;
|
||||
barMaxY += i;
|
||||
if (connectAnyX) {
|
||||
renderer.setRenderBounds(minX, barMinY, minPostPos, maxX, barMaxY, maxPostPos);
|
||||
renderer.renderStandardBlock(blockFence, x, y, z);
|
||||
rendered = true;
|
||||
}
|
||||
if (connectAnyZ) {
|
||||
renderer.setRenderBounds(minPostPos, barMinY, minZ, maxPostPos, barMaxY, maxZ);
|
||||
renderer.renderStandardBlock(blockFence, x, y, z);
|
||||
rendered = true;
|
||||
}
|
||||
}
|
||||
if (renderBottom && fenceType.size == 1) {
|
||||
barMinY -= 6.0f * i;
|
||||
barMaxY -= 6.0f * i;
|
||||
barMaxY += i;
|
||||
if (connectAnyX) {
|
||||
renderer.setRenderBounds(minX, barMinY, minPostPos, maxX, barMaxY, maxPostPos);
|
||||
renderer.renderStandardBlock(blockFence, x, y, z);
|
||||
rendered = true;
|
||||
}
|
||||
if (connectAnyZ) {
|
||||
renderer.setRenderBounds(minPostPos, barMinY, minZ, maxPostPos, barMaxY, maxZ);
|
||||
renderer.renderStandardBlock(blockFence, x, y, z);
|
||||
rendered = true;
|
||||
}
|
||||
}
|
||||
|
||||
float totalMinY = barMinY;
|
||||
FenceRenderer.layer = 0;
|
||||
if (fenceType.embossed) {
|
||||
minPostPos -= (float) (i - 0.25 * i);
|
||||
maxPostPos += (float) (i - 0.25 * i);
|
||||
float minY = totalMinY + 2.0f * i;
|
||||
float maxY = totalMaxY - 2.0f * i;
|
||||
if (fenceType.size == 1 && !fenceType.solid) {
|
||||
minY = 6.0f * i;
|
||||
maxY = 10.0f * i;
|
||||
} else if (fenceType.size == 0 && fenceType.solid) {
|
||||
minY -= 4.0f * i;
|
||||
maxY -= 4.0f * i;
|
||||
} else if (fenceType.size == 2 && fenceType.solid) {
|
||||
minY += 4.0f * i;
|
||||
maxY += 4.0f * i;
|
||||
}
|
||||
float totalMinY = barMinY;
|
||||
FenceRenderer.layer = 0;
|
||||
if (fenceType.embossed) {
|
||||
minPostPos -= (float) (i - 0.25 * i);
|
||||
maxPostPos += (float) (i - 0.25 * i);
|
||||
float minY = totalMinY + 2.0f * i;
|
||||
float maxY = totalMaxY - 2.0f * i;
|
||||
if (fenceType.size == 1 && !fenceType.solid) {
|
||||
minY = 6.0f * i;
|
||||
maxY = 10.0f * i;
|
||||
} else if (fenceType.size == 0 && fenceType.solid) {
|
||||
minY -= 4.0f * i;
|
||||
maxY -= 4.0f * i;
|
||||
} else if (fenceType.size == 2 && fenceType.solid) {
|
||||
minY += 4.0f * i;
|
||||
maxY += 4.0f * i;
|
||||
}
|
||||
|
||||
if (connectAnyX) {
|
||||
renderer.setRenderBounds(minX, minY, minPostPos, maxX, maxY, maxPostPos);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (connectAnyX) {
|
||||
renderer.setRenderBounds(minX, minY, minPostPos, maxX, maxY, maxPostPos);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (connectAnyZ) {
|
||||
renderer.setRenderBounds(minPostPos, minY, minZ, maxPostPos, maxY, maxZ);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
blockFence.setBlockBoundsBasedOnState(renderer.blockAccess, x, y, z);
|
||||
return rendered;
|
||||
}
|
||||
if (connectAnyZ) {
|
||||
renderer.setRenderBounds(minPostPos, minY, minZ, maxPostPos, maxY, maxZ);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
blockFence.setBlockBoundsBasedOnState(renderer.blockAccess, x, y, z);
|
||||
return rendered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int i) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ExtraTrees.fenceID;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ExtraTrees.fenceID;
|
||||
}
|
||||
}
|
||||
@@ -5,56 +5,54 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class FenceType {
|
||||
public int size;
|
||||
public boolean solid;
|
||||
public boolean embossed;
|
||||
public int size;
|
||||
public boolean solid;
|
||||
public boolean embossed;
|
||||
|
||||
public FenceType(int size, boolean solid, boolean embedded) {
|
||||
this.size = size;
|
||||
this.solid = solid;
|
||||
embossed = embedded;
|
||||
}
|
||||
public FenceType(int size, boolean solid, boolean embedded) {
|
||||
this.size = size;
|
||||
this.solid = solid;
|
||||
embossed = embedded;
|
||||
}
|
||||
|
||||
public FenceType(int meta) {
|
||||
size = (meta & 0x3);
|
||||
solid = ((meta >> 2 & 0x1) > 0);
|
||||
embossed = ((meta >> 3 & 0x1) > 0);
|
||||
}
|
||||
public FenceType(int meta) {
|
||||
size = (meta & 0x3);
|
||||
solid = ((meta >> 2 & 0x1) > 0);
|
||||
embossed = ((meta >> 3 & 0x1) > 0);
|
||||
}
|
||||
|
||||
public static Collection<FenceType> values() {
|
||||
List<FenceType> list = new ArrayList<>();
|
||||
for (int size = 0; size < 3; ++size) {
|
||||
for (boolean solid : new boolean[]{false, true}) {
|
||||
for (boolean embedded : new boolean[]{false, true}) {
|
||||
list.add(new FenceType(size, solid, embedded));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public static Collection<FenceType> values() {
|
||||
List<FenceType> list = new ArrayList<>();
|
||||
for (int size = 0; size < 3; ++size) {
|
||||
for (boolean solid : new boolean[] {false, true}) {
|
||||
for (boolean embedded : new boolean[] {false, true}) {
|
||||
list.add(new FenceType(size, solid, embedded));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
return ((size == 0) ? "" : ((size == 1) ? "Full " : "Low "))
|
||||
+ (solid ? "Solid " : "")
|
||||
+ (embossed ? "Embedded " : "");
|
||||
}
|
||||
public String getPrefix() {
|
||||
return ((size == 0) ? "" : ((size == 1) ? "Full " : "Low "))
|
||||
+ (solid ? "Solid " : "")
|
||||
+ (embossed ? "Embedded " : "");
|
||||
}
|
||||
|
||||
public int ordinal() {
|
||||
return size + ((solid ? 1 : 0) << 2) + ((embossed ? 1 : 0) << 3);
|
||||
}
|
||||
public int ordinal() {
|
||||
return size + ((solid ? 1 : 0) << 2) + ((embossed ? 1 : 0) << 3);
|
||||
}
|
||||
|
||||
public boolean isPlain() {
|
||||
return size == 0 && !embossed && !solid;
|
||||
}
|
||||
public boolean isPlain() {
|
||||
return size == 0 && !embossed && !solid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof FenceType) {
|
||||
FenceType o = (FenceType) obj;
|
||||
return o.size == size
|
||||
&& o.embossed == embossed
|
||||
&& o.solid == solid;
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof FenceType) {
|
||||
FenceType o = (FenceType) obj;
|
||||
return o.size == size && o.embossed == embossed && o.solid == solid;
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
}
|
||||
@@ -11,111 +11,112 @@ import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class HedgeRenderer implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
int color = BlockHedge.getColor(metadata);
|
||||
int r = color >> 16 & 0xFF;
|
||||
int g = color >> 8 & 0xFF;
|
||||
int b = color & 0xFF;
|
||||
GL11.glColor3f(r / 255.0f, g / 255.0f, b / 255.0f);
|
||||
renderer.setRenderBounds(0.25, 0.0, 0.25, 0.75, 1.0, 0.75);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderer.renderFaceYNeg(block, 0.0, 0.0, 0.0, block.getIcon(0, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderer.renderFaceYPos(block, 0.0, 0.0, 0.0, block.getIcon(1, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderer.renderFaceXPos(block, 0.0, 0.0, 0.0, block.getIcon(2, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderer.renderFaceXNeg(block, 0.0, 0.0, 0.0, block.getIcon(3, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceZNeg(block, 0.0, 0.0, 0.0, block.getIcon(4, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceZPos(block, 0.0, 0.0, 0.0, block.getIcon(5, metadata));
|
||||
tess.draw();
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
int color = BlockHedge.getColor(metadata);
|
||||
int r = color >> 16 & 0xFF;
|
||||
int g = color >> 8 & 0xFF;
|
||||
int b = color & 0xFF;
|
||||
GL11.glColor3f(r / 255.0f, g / 255.0f, b / 255.0f);
|
||||
renderer.setRenderBounds(0.25, 0.0, 0.25, 0.75, 1.0, 0.75);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderer.renderFaceYNeg(block, 0.0, 0.0, 0.0, block.getIcon(0, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderer.renderFaceYPos(block, 0.0, 0.0, 0.0, block.getIcon(1, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderer.renderFaceXPos(block, 0.0, 0.0, 0.0, block.getIcon(2, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderer.renderFaceXNeg(block, 0.0, 0.0, 0.0, block.getIcon(3, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceZNeg(block, 0.0, 0.0, 0.0, block.getIcon(4, metadata));
|
||||
tess.draw();
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceZPos(block, 0.0, 0.0, 0.0, block.getIcon(5, metadata));
|
||||
tess.draw();
|
||||
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
IIcon icon = block.getIcon(0, world.getBlockMetadata(x, y, z));
|
||||
BlockHedge hedge = ExtraTrees.blockHedge;
|
||||
boolean connectNegX = hedge.canConnectFenceTo(world, x - 1, y, z);
|
||||
boolean connectPosX = hedge.canConnectFenceTo(world, x + 1, y, z);
|
||||
boolean connectNegZ = hedge.canConnectFenceTo(world, x, y, z - 1);
|
||||
boolean connectPosZ = hedge.canConnectFenceTo(world, x, y, z + 1);
|
||||
GL11.glPushMatrix();
|
||||
renderer.setRenderBounds(0.25, 0.0, 0.25, 0.75, 1.0, 0.75);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.renderFaceYPos(block, x, y, z, icon);
|
||||
renderer.renderFaceYNeg(block, x, y, z, icon);
|
||||
if (!connectNegX) {
|
||||
renderer.renderFaceXNeg(block, x, y, z, icon);
|
||||
}
|
||||
if (!connectPosX) {
|
||||
renderer.renderFaceXPos(block, x, y, z, icon);
|
||||
}
|
||||
if (!connectNegZ) {
|
||||
renderer.renderFaceZNeg(block, x, y, z, icon);
|
||||
}
|
||||
if (!connectPosZ) {
|
||||
renderer.renderFaceZPos(block, x, y, z, icon);
|
||||
}
|
||||
if (connectNegX) {
|
||||
renderer.setRenderBounds(0.0, 0.0, 0.25, 0.25, 1.0, 0.75);
|
||||
renderer.renderFaceYPos(block, x, y, z, icon);
|
||||
renderer.renderFaceYNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceXNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceZNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceZPos(block, x, y, z, icon);
|
||||
}
|
||||
if (connectPosX) {
|
||||
renderer.setRenderBounds(0.75, 0.0, 0.25, 1.0, 1.0, 0.75);
|
||||
renderer.renderFaceYPos(block, x, y, z, icon);
|
||||
renderer.renderFaceYNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceXPos(block, x, y, z, icon);
|
||||
renderer.renderFaceZNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceZPos(block, x, y, z, icon);
|
||||
}
|
||||
if (connectPosZ) {
|
||||
renderer.setRenderBounds(0.25, 0.0, 0.75, 0.75, 1.0, 1.0);
|
||||
renderer.renderFaceYPos(block, x, y, z, icon);
|
||||
renderer.renderFaceYNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceZPos(block, x, y, z, icon);
|
||||
renderer.renderFaceXNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceXPos(block, x, y, z, icon);
|
||||
}
|
||||
if (connectNegZ) {
|
||||
renderer.setRenderBounds(0.25, 0.0, 0.0, 0.75, 1.0, 0.25);
|
||||
renderer.renderFaceYPos(block, x, y, z, icon);
|
||||
renderer.renderFaceYNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceZNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceXNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceXPos(block, x, y, z, icon);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
IIcon icon = block.getIcon(0, world.getBlockMetadata(x, y, z));
|
||||
BlockHedge hedge = ExtraTrees.blockHedge;
|
||||
boolean connectNegX = hedge.canConnectFenceTo(world, x - 1, y, z);
|
||||
boolean connectPosX = hedge.canConnectFenceTo(world, x + 1, y, z);
|
||||
boolean connectNegZ = hedge.canConnectFenceTo(world, x, y, z - 1);
|
||||
boolean connectPosZ = hedge.canConnectFenceTo(world, x, y, z + 1);
|
||||
GL11.glPushMatrix();
|
||||
renderer.setRenderBounds(0.25, 0.0, 0.25, 0.75, 1.0, 0.75);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.renderFaceYPos(block, x, y, z, icon);
|
||||
renderer.renderFaceYNeg(block, x, y, z, icon);
|
||||
if (!connectNegX) {
|
||||
renderer.renderFaceXNeg(block, x, y, z, icon);
|
||||
}
|
||||
if (!connectPosX) {
|
||||
renderer.renderFaceXPos(block, x, y, z, icon);
|
||||
}
|
||||
if (!connectNegZ) {
|
||||
renderer.renderFaceZNeg(block, x, y, z, icon);
|
||||
}
|
||||
if (!connectPosZ) {
|
||||
renderer.renderFaceZPos(block, x, y, z, icon);
|
||||
}
|
||||
if (connectNegX) {
|
||||
renderer.setRenderBounds(0.0, 0.0, 0.25, 0.25, 1.0, 0.75);
|
||||
renderer.renderFaceYPos(block, x, y, z, icon);
|
||||
renderer.renderFaceYNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceXNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceZNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceZPos(block, x, y, z, icon);
|
||||
}
|
||||
if (connectPosX) {
|
||||
renderer.setRenderBounds(0.75, 0.0, 0.25, 1.0, 1.0, 0.75);
|
||||
renderer.renderFaceYPos(block, x, y, z, icon);
|
||||
renderer.renderFaceYNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceXPos(block, x, y, z, icon);
|
||||
renderer.renderFaceZNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceZPos(block, x, y, z, icon);
|
||||
}
|
||||
if (connectPosZ) {
|
||||
renderer.setRenderBounds(0.25, 0.0, 0.75, 0.75, 1.0, 1.0);
|
||||
renderer.renderFaceYPos(block, x, y, z, icon);
|
||||
renderer.renderFaceYNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceZPos(block, x, y, z, icon);
|
||||
renderer.renderFaceXNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceXPos(block, x, y, z, icon);
|
||||
}
|
||||
if (connectNegZ) {
|
||||
renderer.setRenderBounds(0.25, 0.0, 0.0, 0.75, 1.0, 0.25);
|
||||
renderer.renderFaceYPos(block, x, y, z, icon);
|
||||
renderer.renderFaceYNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceZNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceXNeg(block, x, y, z, icon);
|
||||
renderer.renderFaceXPos(block, x, y, z, icon);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ModuleBlocks.hedgeRenderID;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ModuleBlocks.hedgeRenderID;
|
||||
}
|
||||
}
|
||||
@@ -9,53 +9,52 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MultiFenceRecipeEmbedded implements IRecipe {
|
||||
protected ItemStack cached;
|
||||
protected ItemStack cached;
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world) {
|
||||
FenceType type;
|
||||
for (int row = 0; row < 3; ++row) {
|
||||
ItemStack a = inv.getStackInSlot(row * 3);
|
||||
ItemStack b = inv.getStackInSlot(row * 3 + 1);
|
||||
ItemStack c = inv.getStackInSlot(row * 3 + 2);
|
||||
if (a == null || b == null || c == null) {
|
||||
continue;
|
||||
}
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world) {
|
||||
FenceType type;
|
||||
for (int row = 0; row < 3; ++row) {
|
||||
ItemStack a = inv.getStackInSlot(row * 3);
|
||||
ItemStack b = inv.getStackInSlot(row * 3 + 1);
|
||||
ItemStack c = inv.getStackInSlot(row * 3 + 2);
|
||||
if (a == null || b == null || c == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
type = WoodManager.getFenceType(a);
|
||||
FenceType type2 = WoodManager.getFenceType(c);
|
||||
if (type == null || type2 == null || !type.equals(type2)) {
|
||||
continue;
|
||||
}
|
||||
type = WoodManager.getFenceType(a);
|
||||
FenceType type2 = WoodManager.getFenceType(c);
|
||||
if (type == null || type2 == null || !type.equals(type2)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IPlankType pType = WoodManager.get(b);
|
||||
if (WoodManager.getFenceDescription(a).getPlankType() != pType) {
|
||||
continue;
|
||||
}
|
||||
IPlankType pType = WoodManager.get(b);
|
||||
if (WoodManager.getFenceDescription(a).getPlankType() != pType) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cached = WoodManager.getFence(
|
||||
WoodManager.getFenceDescription(a).getPlankType(),
|
||||
WoodManager.getFenceDescription(a).getSecondaryPlankType(),
|
||||
new FenceType(type.size, type.solid, true),
|
||||
2
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
cached = WoodManager.getFence(
|
||||
WoodManager.getFenceDescription(a).getPlankType(),
|
||||
WoodManager.getFenceDescription(a).getSecondaryPlankType(),
|
||||
new FenceType(type.size, type.solid, true),
|
||||
2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
return getRecipeOutput();
|
||||
}
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
return getRecipeOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 3;
|
||||
}
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return (cached == null) ? new ItemStack(Blocks.fence) : cached;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return (cached == null) ? new ItemStack(Blocks.fence) : cached;
|
||||
}
|
||||
}
|
||||
@@ -2,77 +2,76 @@ package binnie.extratrees.block.decor;
|
||||
|
||||
import binnie.extratrees.block.IPlankType;
|
||||
import binnie.extratrees.block.WoodManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MultiFenceRecipeSize implements IRecipe {
|
||||
protected ItemStack cached;
|
||||
protected ItemStack cached;
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world) {
|
||||
StringBuilder pattern = new StringBuilder();
|
||||
List<IPlankType> types = new ArrayList<>();
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
IPlankType type = (stack == null) ? null : WoodManager.get(stack);
|
||||
if (stack != null && type == null) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world) {
|
||||
StringBuilder pattern = new StringBuilder();
|
||||
List<IPlankType> types = new ArrayList<>();
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
IPlankType type = (stack == null) ? null : WoodManager.get(stack);
|
||||
if (stack != null && type == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stack == null) {
|
||||
pattern.append(" ");
|
||||
} else {
|
||||
if (!types.contains(type)) {
|
||||
types.add(type);
|
||||
if (types.size() > 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
pattern.append(types.indexOf(type));
|
||||
}
|
||||
}
|
||||
if (stack == null) {
|
||||
pattern.append(" ");
|
||||
} else {
|
||||
if (!types.contains(type)) {
|
||||
types.add(type);
|
||||
if (types.size() > 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
pattern.append(types.indexOf(type));
|
||||
}
|
||||
}
|
||||
|
||||
if (types.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (types.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack fence = null;
|
||||
if (pattern.toString().contains("0100 0 ")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(1), new FenceType(0, false, false), 4);
|
||||
} else if (pattern.toString().contains("0000 0 ")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(0), new FenceType(0, false, false), 4);
|
||||
} else if (pattern.toString().contains("0100 0 1 ")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(1), new FenceType(1, false, false), 4);
|
||||
} else if (pattern.toString().contains("0000 0 0 ")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(0), new FenceType(1, false, false), 4);
|
||||
} else if (pattern.toString().contains(" 0 1 1101")) {
|
||||
fence = WoodManager.getFence(types.get(1), types.get(0), new FenceType(2, false, false), 4);
|
||||
} else if (pattern.toString().contains(" 0 0 0000")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(0), new FenceType(2, false, false), 4);
|
||||
}
|
||||
ItemStack fence = null;
|
||||
if (pattern.toString().contains("0100 0 ")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(1), new FenceType(0, false, false), 4);
|
||||
} else if (pattern.toString().contains("0000 0 ")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(0), new FenceType(0, false, false), 4);
|
||||
} else if (pattern.toString().contains("0100 0 1 ")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(1), new FenceType(1, false, false), 4);
|
||||
} else if (pattern.toString().contains("0000 0 0 ")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(0), new FenceType(1, false, false), 4);
|
||||
} else if (pattern.toString().contains(" 0 1 1101")) {
|
||||
fence = WoodManager.getFence(types.get(1), types.get(0), new FenceType(2, false, false), 4);
|
||||
} else if (pattern.toString().contains(" 0 0 0000")) {
|
||||
fence = WoodManager.getFence(types.get(0), types.get(0), new FenceType(2, false, false), 4);
|
||||
}
|
||||
|
||||
cached = fence;
|
||||
return fence != null;
|
||||
}
|
||||
cached = fence;
|
||||
return fence != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
return getRecipeOutput();
|
||||
}
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
return getRecipeOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 3;
|
||||
}
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return (cached == null) ? new ItemStack(Blocks.fence) : cached;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return (cached == null) ? new ItemStack(Blocks.fence) : cached;
|
||||
}
|
||||
}
|
||||
@@ -8,49 +8,48 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MultiFenceRecipeSolid implements IRecipe {
|
||||
ItemStack cached;
|
||||
ItemStack cached;
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world) {
|
||||
FenceType type;
|
||||
for (int row = 0; row < 3; ++row) {
|
||||
ItemStack a = inv.getStackInSlot(row * 3);
|
||||
ItemStack b = inv.getStackInSlot(row * 3 + 1);
|
||||
ItemStack c = inv.getStackInSlot(row * 3 + 2);
|
||||
if (a == null || b == null || c == null) {
|
||||
continue;
|
||||
}
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world) {
|
||||
FenceType type;
|
||||
for (int row = 0; row < 3; ++row) {
|
||||
ItemStack a = inv.getStackInSlot(row * 3);
|
||||
ItemStack b = inv.getStackInSlot(row * 3 + 1);
|
||||
ItemStack c = inv.getStackInSlot(row * 3 + 2);
|
||||
if (a == null || b == null || c == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
type = WoodManager.getFenceType(a);
|
||||
FenceType type2 = WoodManager.getFenceType(b);
|
||||
FenceType type3 = WoodManager.getFenceType(c);
|
||||
if (type == null || type2 == null || type3 == null || !type.equals(type2) || !type.equals(type3)) {
|
||||
continue;
|
||||
}
|
||||
type = WoodManager.getFenceType(a);
|
||||
FenceType type2 = WoodManager.getFenceType(b);
|
||||
FenceType type3 = WoodManager.getFenceType(c);
|
||||
if (type == null || type2 == null || type3 == null || !type.equals(type2) || !type.equals(type3)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cached = WoodManager.getFence(
|
||||
WoodManager.getFenceDescription(a).getPlankType(),
|
||||
WoodManager.getFenceDescription(a).getSecondaryPlankType(),
|
||||
new FenceType(type.size, true, type.solid),
|
||||
2
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
cached = WoodManager.getFence(
|
||||
WoodManager.getFenceDescription(a).getPlankType(),
|
||||
WoodManager.getFenceDescription(a).getSecondaryPlankType(),
|
||||
new FenceType(type.size, true, type.solid),
|
||||
2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
return getRecipeOutput();
|
||||
}
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
return getRecipeOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 3;
|
||||
}
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return (cached == null) ? new ItemStack(Blocks.fence) : cached;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return (cached == null) ? new ItemStack(Blocks.fence) : cached;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.extratrees.block.decor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -8,142 +9,141 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class NBTShapedRecipe implements IRecipe {
|
||||
public int recipeWidth;
|
||||
public int recipeHeight;
|
||||
public ItemStack[] recipeItems;
|
||||
private ItemStack recipeOutput;
|
||||
private boolean field_92101_f;
|
||||
public int recipeWidth;
|
||||
public int recipeHeight;
|
||||
public ItemStack[] recipeItems;
|
||||
private ItemStack recipeOutput;
|
||||
private boolean field_92101_f;
|
||||
|
||||
public NBTShapedRecipe(ItemStack stack, Object... p_92103_2_) {
|
||||
String s = "";
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
|
||||
public NBTShapedRecipe(ItemStack stack, Object... p_92103_2_) {
|
||||
String s = "";
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
if (p_92103_2_[i] instanceof String[]) {
|
||||
String[] astring = (String[]) p_92103_2_[i++];
|
||||
for (String s2 : astring) {
|
||||
k++;
|
||||
j = s2.length();
|
||||
s += s2;
|
||||
}
|
||||
} else {
|
||||
while (p_92103_2_[i] instanceof String) {
|
||||
String s3 = (String) p_92103_2_[i++];
|
||||
++k;
|
||||
j = s3.length();
|
||||
s += s3;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_92103_2_[i] instanceof String[]) {
|
||||
String[] astring = (String[]) p_92103_2_[i++];
|
||||
for (String s2 : astring) {
|
||||
k++;
|
||||
j = s2.length();
|
||||
s += s2;
|
||||
}
|
||||
} else {
|
||||
while (p_92103_2_[i] instanceof String) {
|
||||
String s3 = (String) p_92103_2_[i++];
|
||||
++k;
|
||||
j = s3.length();
|
||||
s += s3;
|
||||
}
|
||||
}
|
||||
HashMap hashmap = new HashMap();
|
||||
while (i < p_92103_2_.length) {
|
||||
Character character = (Character) p_92103_2_[i];
|
||||
ItemStack itemstack1 = null;
|
||||
if (p_92103_2_[i + 1] instanceof Item) {
|
||||
itemstack1 = new ItemStack((Item) p_92103_2_[i + 1]);
|
||||
} else if (p_92103_2_[i + 1] instanceof Block) {
|
||||
itemstack1 = new ItemStack((Block) p_92103_2_[i + 1], 1, 32767);
|
||||
} else if (p_92103_2_[i + 1] instanceof ItemStack) {
|
||||
itemstack1 = (ItemStack) p_92103_2_[i + 1];
|
||||
}
|
||||
|
||||
HashMap hashmap = new HashMap();
|
||||
while (i < p_92103_2_.length) {
|
||||
Character character = (Character) p_92103_2_[i];
|
||||
ItemStack itemstack1 = null;
|
||||
if (p_92103_2_[i + 1] instanceof Item) {
|
||||
itemstack1 = new ItemStack((Item) p_92103_2_[i + 1]);
|
||||
} else if (p_92103_2_[i + 1] instanceof Block) {
|
||||
itemstack1 = new ItemStack((Block) p_92103_2_[i + 1], 1, 32767);
|
||||
} else if (p_92103_2_[i + 1] instanceof ItemStack) {
|
||||
itemstack1 = (ItemStack) p_92103_2_[i + 1];
|
||||
}
|
||||
hashmap.put(character, itemstack1);
|
||||
i += 2;
|
||||
}
|
||||
|
||||
hashmap.put(character, itemstack1);
|
||||
i += 2;
|
||||
}
|
||||
ItemStack[] aitemstack = new ItemStack[j * k];
|
||||
for (int i2 = 0; i2 < j * k; ++i2) {
|
||||
char c0 = s.charAt(i2);
|
||||
if (hashmap.containsKey(c0)) {
|
||||
aitemstack[i2] = ((ItemStack) hashmap.get(c0)).copy();
|
||||
} else {
|
||||
aitemstack[i2] = null;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack[] aitemstack = new ItemStack[j * k];
|
||||
for (int i2 = 0; i2 < j * k; ++i2) {
|
||||
char c0 = s.charAt(i2);
|
||||
if (hashmap.containsKey(c0)) {
|
||||
aitemstack[i2] = ((ItemStack) hashmap.get(c0)).copy();
|
||||
} else {
|
||||
aitemstack[i2] = null;
|
||||
}
|
||||
}
|
||||
recipeWidth = j;
|
||||
recipeHeight = k;
|
||||
recipeItems = aitemstack;
|
||||
recipeOutput = stack;
|
||||
NBTShapedRecipes.addRecipe(this);
|
||||
}
|
||||
|
||||
recipeWidth = j;
|
||||
recipeHeight = k;
|
||||
recipeItems = aitemstack;
|
||||
recipeOutput = stack;
|
||||
NBTShapedRecipes.addRecipe(this);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return recipeOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return recipeOutput;
|
||||
}
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_) {
|
||||
for (int i = 0; i <= 3 - recipeWidth; ++i) {
|
||||
for (int j = 0; j <= 3 - recipeHeight; ++j) {
|
||||
if (checkMatch(p_77569_1_, i, j, true)) {
|
||||
return true;
|
||||
}
|
||||
if (checkMatch(p_77569_1_, i, j, false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_) {
|
||||
for (int i = 0; i <= 3 - recipeWidth; ++i) {
|
||||
for (int j = 0; j <= 3 - recipeHeight; ++j) {
|
||||
if (checkMatch(p_77569_1_, i, j, true)) {
|
||||
return true;
|
||||
}
|
||||
if (checkMatch(p_77569_1_, i, j, false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private boolean checkMatch(InventoryCrafting crafting, int p_77573_2_, int p_77573_3_, boolean p_77573_4_) {
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
for (int l = 0; l < 3; ++l) {
|
||||
int i1 = k - p_77573_2_;
|
||||
int j1 = l - p_77573_3_;
|
||||
ItemStack itemstack = null;
|
||||
if (i1 >= 0 && j1 >= 0 && i1 < recipeWidth && j1 < recipeHeight) {
|
||||
if (p_77573_4_) {
|
||||
itemstack = recipeItems[recipeWidth - i1 - 1 + j1 * recipeWidth];
|
||||
} else {
|
||||
itemstack = recipeItems[i1 + j1 * recipeWidth];
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkMatch(InventoryCrafting crafting, int p_77573_2_, int p_77573_3_, boolean p_77573_4_) {
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
for (int l = 0; l < 3; ++l) {
|
||||
int i1 = k - p_77573_2_;
|
||||
int j1 = l - p_77573_3_;
|
||||
ItemStack itemstack = null;
|
||||
if (i1 >= 0 && j1 >= 0 && i1 < recipeWidth && j1 < recipeHeight) {
|
||||
if (p_77573_4_) {
|
||||
itemstack = recipeItems[recipeWidth - i1 - 1 + j1 * recipeWidth];
|
||||
} else {
|
||||
itemstack = recipeItems[i1 + j1 * recipeWidth];
|
||||
}
|
||||
}
|
||||
ItemStack itemstack2 = crafting.getStackInRowAndColumn(k, l);
|
||||
if (itemstack2 != null || itemstack != null) {
|
||||
if (itemstack2 == null || itemstack == null) {
|
||||
return false;
|
||||
}
|
||||
if (itemstack.getItem() != itemstack2.getItem()) {
|
||||
return false;
|
||||
}
|
||||
if (itemstack.getItemDamage() != 32767 && itemstack.getItemDamage() != itemstack2.getItemDamage()) {
|
||||
return false;
|
||||
}
|
||||
if (itemstack.hasTagCompound()
|
||||
&& itemstack2.hasTagCompound()
|
||||
&& !ItemStack.areItemStackTagsEqual(itemstack, itemstack2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack itemstack2 = crafting.getStackInRowAndColumn(k, l);
|
||||
if (itemstack2 != null || itemstack != null) {
|
||||
if (itemstack2 == null || itemstack == null) {
|
||||
return false;
|
||||
}
|
||||
if (itemstack.getItem() != itemstack2.getItem()) {
|
||||
return false;
|
||||
}
|
||||
if (itemstack.getItemDamage() != 32767 && itemstack.getItemDamage() != itemstack2.getItemDamage()) {
|
||||
return false;
|
||||
}
|
||||
if (itemstack.hasTagCompound() && itemstack2.hasTagCompound() && !ItemStack.areItemStackTagsEqual(itemstack, itemstack2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting crafting) {
|
||||
ItemStack itemstack = getRecipeOutput().copy();
|
||||
// todo unused code?
|
||||
if (field_92101_f) {
|
||||
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
||||
ItemStack itemstack2 = crafting.getStackInSlot(i);
|
||||
if (itemstack2 != null && itemstack2.hasTagCompound()) {
|
||||
itemstack.setTagCompound((NBTTagCompound) itemstack2.stackTagCompound.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting crafting) {
|
||||
ItemStack itemstack = getRecipeOutput().copy();
|
||||
// todo unused code?
|
||||
if (field_92101_f) {
|
||||
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
||||
ItemStack itemstack2 = crafting.getStackInSlot(i);
|
||||
if (itemstack2 != null && itemstack2.hasTagCompound()) {
|
||||
itemstack.setTagCompound((NBTTagCompound) itemstack2.stackTagCompound.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return recipeWidth * recipeHeight;
|
||||
}
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return recipeWidth * recipeHeight;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +1,46 @@
|
||||
package binnie.extratrees.block.decor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NBTShapedRecipes implements IRecipe {
|
||||
static List<NBTShapedRecipe> recipes = new ArrayList<>();
|
||||
static List<NBTShapedRecipe> recipes = new ArrayList<>();
|
||||
|
||||
public static void addRecipe(NBTShapedRecipe nbtShapedRecipe) {
|
||||
NBTShapedRecipes.recipes.add(nbtShapedRecipe);
|
||||
}
|
||||
public static void addRecipe(NBTShapedRecipe nbtShapedRecipe) {
|
||||
NBTShapedRecipes.recipes.add(nbtShapedRecipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
for (NBTShapedRecipe recipe : NBTShapedRecipes.recipes) {
|
||||
if (recipe.matches(inventory, world)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inventory, World world) {
|
||||
for (NBTShapedRecipe recipe : NBTShapedRecipes.recipes) {
|
||||
if (recipe.matches(inventory, world)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
for (NBTShapedRecipe recipe : NBTShapedRecipes.recipes) {
|
||||
if (recipe.matches(inventory, null)) {
|
||||
return recipe.getCraftingResult(inventory);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventory) {
|
||||
for (NBTShapedRecipe recipe : NBTShapedRecipes.recipes) {
|
||||
if (recipe.matches(inventory, null)) {
|
||||
return recipe.getCraftingResult(inventory);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 9;
|
||||
}
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user