mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-24 22:14:44 +00:00
Add et wood doors
This commit is contained in:
1 parent
6ec7808b25
commit
81f632168b
10 files changed
+276
-433
No files matched your search
@@ -57,7 +57,7 @@ import binnie.core.triggers.ModuleTrigger;
|
||||
name = "Binnie Core",
|
||||
useMetadata = true,
|
||||
dependencies = "required-after:forge@[13.20.0.2279,);" +
|
||||
"required-after:forestry@[5.3.3.89,);" +
|
||||
"required-after:forestry@[5.3.4.102,);" +
|
||||
"after:jei@[4.3.1,);"
|
||||
)
|
||||
public final class BinnieCore extends AbstractMod {
|
||||
|
||||
@@ -1,287 +0,0 @@
|
||||
package binnie.extratrees.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
|
||||
public class BlockETDoor extends BlockDoor implements IBlockMetadata, ITileEntityProvider {
|
||||
/*private IIcon getFlippedIcon(final boolean upper, final boolean flip, final int tileMeta) {
|
||||
final DoorType type = getDoorType(tileMeta);
|
||||
return upper ? (flip ? type.iconDoorUpperFlip : type.iconDoorUpper) : (flip ? type.iconDoorLowerFlip : type.iconDoorLower);
|
||||
}*/
|
||||
|
||||
protected BlockETDoor() {
|
||||
super(Material.WOOD);
|
||||
this.setHardness(3.0f);
|
||||
setSoundType(SoundType.WOOD);
|
||||
this.setCreativeTab(Tabs.tabArboriculture);
|
||||
this.setRegistryName("door");
|
||||
}
|
||||
|
||||
public static DoorType getDoorType(final int tileMeta) {
|
||||
final int type = (tileMeta & 0xF00) >> 8;
|
||||
if (type >= 0 && type < DoorType.values().length) {
|
||||
return DoorType.values()[type];
|
||||
}
|
||||
return DoorType.Standard;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public IIcon getIcon(final int side, final int meta) {
|
||||
return DoorType.Standard.iconDoorLower;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4, final int par5) {
|
||||
if (par5 != 1 && par5 != 0) {
|
||||
final int i1 = this.getFullMetadata(par1IBlockAccess, par2, par3, par4);
|
||||
final int j1 = i1 & 0x3;
|
||||
final boolean flag = (i1 & 0x4) != 0x0;
|
||||
boolean flag2 = false;
|
||||
final boolean flag3 = (i1 & 0x8) != 0x0;
|
||||
if (flag) {
|
||||
if (j1 == 0 && par5 == 2) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
else if (j1 == 1 && par5 == 5) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
else if (j1 == 2 && par5 == 3) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
else if (j1 == 3 && par5 == 4) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (j1 == 0 && par5 == 5) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
else if (j1 == 1 && par5 == 3) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
else if (j1 == 2 && par5 == 4) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
else if (j1 == 3 && par5 == 2) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
if ((i1 & 0x10) != 0x0) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
}
|
||||
int tileMeta = 0;
|
||||
if (flag3) {
|
||||
tileMeta = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3 - 1, par4);
|
||||
}
|
||||
else {
|
||||
tileMeta = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3, par4);
|
||||
}
|
||||
return this.getFlippedIcon(flag3, flag2, tileMeta);
|
||||
}
|
||||
return DoorType.Standard.iconDoorLower;
|
||||
}*/
|
||||
|
||||
/*@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister register) {
|
||||
for (final 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
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) {
|
||||
final int par5 = 2;
|
||||
final int i1 = this.getFullMetadata(par1IBlockAccess, par2, par3, par4);
|
||||
final int j1 = i1 & 0x3;
|
||||
final boolean flag = (i1 & 0x4) != 0x0;
|
||||
boolean flag2 = false;
|
||||
final boolean flag3 = (i1 & 0x8) != 0x0;
|
||||
if (flag) {
|
||||
if (j1 == 0 && par5 == 2) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
else if (j1 == 1 && par5 == 5) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
else if (j1 == 2 && par5 == 3) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
else if (j1 == 3 && par5 == 4) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (j1 == 0 && par5 == 5) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
else if (j1 == 1 && par5 == 3) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
else if (j1 == 2 && par5 == 4) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
else if (j1 == 3 && par5 == 2) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
if ((i1 & 0x10) != 0x0) {
|
||||
flag2 = !flag2;
|
||||
}
|
||||
}
|
||||
if (flag3) {
|
||||
final int meta = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3 - 1, par4);
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColour();
|
||||
}
|
||||
final int meta = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3, par4);
|
||||
return WoodManager.getPlankType(meta & 0xFF).getColour();
|
||||
}*/
|
||||
|
||||
/*public int getFullMetadata(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) {
|
||||
final int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
|
||||
final boolean flag = (l & 0x8) != 0x0;
|
||||
int i1;
|
||||
int j1;
|
||||
if (flag) {
|
||||
i1 = par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4);
|
||||
j1 = l;
|
||||
}
|
||||
else {
|
||||
i1 = l;
|
||||
j1 = par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4);
|
||||
}
|
||||
final boolean flag2 = (j1 & 0x1) != 0x0;
|
||||
return (i1 & 0x7) | (flag ? 8 : 0) | (flag2 ? 16 : 0);
|
||||
}*/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
int meta = getMetaFromState(state);
|
||||
if (player.capabilities.isCreativeMode && (meta & 0x8) != 0x0 && world.getBlockState(pos.down()).getBlock() == this) {
|
||||
world.setBlockToAir(pos.down());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return BlockMetadata.getBlockDroppedAsList(this, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int k) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World world, BlockPos pos, int id, int param) {
|
||||
TileEntity tileentity = world.getTileEntity(pos);
|
||||
return tileentity != null && tileentity.receiveClientEvent(id, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, final BlockPos pos, final EnumFacing clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(IBlockState state, int tileMetadata) {
|
||||
return tileMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName(ItemStack itemStack) {
|
||||
final int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
final String typeName = getDoorType(meta).getName();
|
||||
final String woodName = WoodManager.getPlankType(meta & 0xFF).getDesignMaterialName();
|
||||
if (typeName.equals("")) {
|
||||
return Binnie.LANGUAGE.localise(ExtraTrees.instance, "block.door.name", woodName);
|
||||
}
|
||||
return Binnie.LANGUAGE.localise(ExtraTrees.instance, "block.door.name.adv", woodName, typeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(final Item itemIn, final CreativeTabs tab, final NonNullList<ItemStack> itemList) {
|
||||
for (final IPlankType type : PlankType.ExtraTreePlanks.values()) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.Standard));
|
||||
}
|
||||
for (final IPlankType type : PlankType.ForestryPlanks.values()) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.Standard));
|
||||
}
|
||||
//TODO: extrabiomes 1.10.2
|
||||
/*for (final IPlankType type : PlankType.ExtraBiomesPlank.values()) {
|
||||
if (type.getStack() != null) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.Standard));
|
||||
}
|
||||
}*/
|
||||
for (final IPlankType type : PlankType.VanillaPlanks.values()) {
|
||||
itemList.add(WoodManager.getDoor(type, DoorType.Standard));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, pos);
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package binnie.extratrees.block;
|
||||
|
||||
public class DoorBlockRenderer //implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
/*@Override
|
||||
public void renderInventoryBlock(final Block block, final int metadata, final int modelID, final RenderBlocks renderer) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(final IBlockAccess world, final int par2, final int par3, final int par4, final Block par1Block, final int modelId, final RenderBlocks renderer) {
|
||||
final int c = par1Block.colorMultiplier(renderer.blockAccess, par2, par3, par4);
|
||||
final float c2 = (c >> 16 & 0xFF) / 255.0f;
|
||||
final float c3 = (c >> 8 & 0xFF) / 255.0f;
|
||||
final float c4 = (c & 0xFF) / 255.0f;
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final int l = renderer.blockAccess.getBlockMetadata(par2, par3, par4);
|
||||
if ((l & 0x8) != 0x0) {
|
||||
if (renderer.blockAccess.getBlock(par2, par3 - 1, par4) != par1Block) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (renderer.blockAccess.getBlock(par2, par3 + 1, par4) != par1Block) {
|
||||
return false;
|
||||
}
|
||||
boolean flag = false;
|
||||
final float f = 0.5f;
|
||||
final float f2 = 1.0f;
|
||||
final float f3 = 0.8f;
|
||||
final float f4 = 0.6f;
|
||||
final int i1 = par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4);
|
||||
tessellator.setBrightness((renderer.renderMinY > 0.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3 - 1, par4));
|
||||
tessellator.setColorOpaque_F(f * c2, f * c3, f * c4);
|
||||
renderer.renderFaceYNeg(par1Block, par2, par3, par4, renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 0));
|
||||
flag = true;
|
||||
tessellator.setBrightness((renderer.renderMaxY < 1.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3 + 1, par4));
|
||||
tessellator.setColorOpaque_F(f2 * c2, f2 * c3, f2 * c4);
|
||||
renderer.renderFaceYPos(par1Block, par2, par3, par4, renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 1));
|
||||
flag = true;
|
||||
tessellator.setBrightness((renderer.renderMinZ > 0.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4 - 1));
|
||||
tessellator.setColorOpaque_F(f3 * c2, f3 * c3, f3 * c4);
|
||||
IIcon icon = renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 2);
|
||||
renderer.renderFaceZNeg(par1Block, par2, par3, par4, icon);
|
||||
flag = true;
|
||||
renderer.flipTexture = false;
|
||||
tessellator.setBrightness((renderer.renderMaxZ < 1.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4 + 1));
|
||||
tessellator.setColorOpaque_F(f3 * c2, f3 * c3, f3 * c4);
|
||||
icon = renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 3);
|
||||
renderer.renderFaceZPos(par1Block, par2, par3, par4, icon);
|
||||
flag = true;
|
||||
renderer.flipTexture = false;
|
||||
tessellator.setBrightness((renderer.renderMinX > 0.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2 - 1, par3, par4));
|
||||
tessellator.setColorOpaque_F(f4 * c2, f4 * c3, f4 * c4);
|
||||
icon = renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 4);
|
||||
renderer.renderFaceXNeg(par1Block, par2, par3, par4, icon);
|
||||
flag = true;
|
||||
renderer.flipTexture = false;
|
||||
tessellator.setBrightness((renderer.renderMaxX < 1.0) ? i1 : par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2 + 1, par3, par4));
|
||||
tessellator.setColorOpaque_F(f4 * c2, f4 * c3, f4 * c4);
|
||||
icon = renderer.getBlockIcon(par1Block, renderer.blockAccess, par2, par3, par4, 5);
|
||||
renderer.renderFaceXPos(par1Block, par2, par3, par4, icon);
|
||||
flag = true;
|
||||
renderer.flipTexture = false;
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(final int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return ExtraTrees.doorRenderId;
|
||||
}*/
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package binnie.extratrees.block;
|
||||
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
|
||||
public enum DoorType {
|
||||
Standard("standard"),
|
||||
Solid("solid"),
|
||||
Double("double"),
|
||||
Full("full");
|
||||
|
||||
String id;
|
||||
//IIcon iconDoorLower;
|
||||
//IIcon iconDoorUpper;
|
||||
//IIcon iconDoorLowerFlip;
|
||||
//IIcon iconDoorUpperFlip;
|
||||
//IIcon iconItem;
|
||||
|
||||
DoorType(final String iconName) {
|
||||
this.id = iconName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return ExtraTrees.proxy.localise("block.door.type." + this.id);
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.PluginArboriculture;
|
||||
import forestry.arboriculture.WoodAccess;
|
||||
import forestry.arboriculture.blocks.BlockForestryFenceGate;
|
||||
@@ -44,24 +45,23 @@ import binnie.core.liquid.ILiquidType;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.block.decor.BlockHedge;
|
||||
import binnie.extratrees.block.decor.BlockMultiFence;
|
||||
import binnie.extratrees.block.decor.FenceType;
|
||||
import binnie.extratrees.block.decor.MultiFenceRecipeEmbedded;
|
||||
import binnie.extratrees.block.decor.MultiFenceRecipeSize;
|
||||
import binnie.extratrees.block.decor.MultiFenceRecipeSolid;
|
||||
import binnie.extratrees.block.property.PropertyETType;
|
||||
import binnie.extratrees.block.wood.BlockETDoor;
|
||||
import binnie.extratrees.block.wood.BlockETFence;
|
||||
import binnie.extratrees.block.wood.BlockETLog;
|
||||
import binnie.extratrees.block.wood.BlockETPlank;
|
||||
import binnie.extratrees.block.wood.BlockETSlab;
|
||||
import binnie.extratrees.block.wood.BlockShrubLog;
|
||||
import binnie.extratrees.block.wood.ItemBlockETWood;
|
||||
import binnie.extratrees.block.wood.ItemBlockETWoodDoor;
|
||||
import binnie.extratrees.block.wood.ItemETSlab;
|
||||
import binnie.extratrees.genetics.ETTreeDefinition;
|
||||
import binnie.extratrees.item.ExtraTreeLiquid;
|
||||
|
||||
public class ModuleBlocks implements IInitializable {
|
||||
//public static int hedgeRenderID;
|
||||
|
||||
public List<BlockETLog> logs;
|
||||
public List<BlockETLog> logsFireproof;
|
||||
public List<BlockETPlank> planks;
|
||||
@@ -76,6 +76,7 @@ public class ModuleBlocks implements IInitializable {
|
||||
public List<BlockETFence> fencesFireproof;
|
||||
public List<BlockForestryFenceGate<EnumETLog>> fenceGates;
|
||||
public List<BlockForestryFenceGate<EnumETLog>> fenceGatesFireproof;
|
||||
public List<BlockETDoor> doors;
|
||||
public List<BlockETDecorativeLeaves> leavesDecorative;
|
||||
public Map<String, ItemStack> speciesToLeavesDecorative;
|
||||
public List<BlockETDefaultLeaves> leavesDefault;
|
||||
@@ -207,7 +208,7 @@ public class ModuleBlocks implements IInitializable {
|
||||
registerOreDictWildcard(OreDictUtil.FENCE_WOOD, block);
|
||||
FMLInterModComms.sendMessage("forestry", "add-fence-block", block.getRegistryName().toString());
|
||||
}
|
||||
|
||||
|
||||
woodAccess.registerFences(fences);
|
||||
woodAccess.registerFences(fencesFireproof);
|
||||
|
||||
@@ -237,20 +238,19 @@ public class ModuleBlocks implements IInitializable {
|
||||
//Forestry's API doesn't allow typed lists to be registered, but making a new one allows us to get away with it
|
||||
woodAccess.registerFenceGates(new ArrayList<>(fenceGates));
|
||||
woodAccess.registerFenceGates(new ArrayList<>(fenceGatesFireproof));
|
||||
|
||||
doors = new ArrayList<>();
|
||||
for (EnumETLog woodType : EnumETLog.VALUES) {
|
||||
BlockETDoor door = new BlockETDoor(woodType);
|
||||
ExtraTrees.proxy.registerBlock(door, new ItemBlockETWoodDoor(door));
|
||||
registerOreDictWildcard(OreDictUtil.DOOR_WOOD, door);
|
||||
doors.add(door);
|
||||
}
|
||||
|
||||
registerDoors(woodAccess, doors);
|
||||
|
||||
blockMultiFence = new BlockMultiFence();
|
||||
ExtraTrees.proxy.registerBlock(blockMultiFence, new ItemMetadata(blockMultiFence));
|
||||
|
||||
blockDoor = new BlockETDoor();
|
||||
GameRegistry.register(blockDoor);
|
||||
GameRegistry.register(new ItemETDoor(blockDoor).setRegistryName(blockDoor.getRegistryName()));
|
||||
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockStairs), new StairItemRenderer());
|
||||
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockGate), new GateItemRenderer());
|
||||
for (BlockETLog log : logs) {
|
||||
ItemStack logInput = new ItemStack(log, 1, OreDictionary.WILDCARD_VALUE);
|
||||
ItemStack coalOutput = new ItemStack(Items.COAL, 1, 1);
|
||||
RecipeUtil.addSmelting(logInput, coalOutput, 0.15F);
|
||||
}
|
||||
|
||||
leavesDefault = BlockETDefaultLeaves.create();
|
||||
Map speciesToLeavesDefault = PluginArboriculture.getBlocks().speciesToLeavesDefault;
|
||||
@@ -267,7 +267,6 @@ public class ModuleBlocks implements IInitializable {
|
||||
}
|
||||
}
|
||||
|
||||
//ModuleBlocks.hedgeRenderID = BinnieCore.proxy.getUniqueRenderID();
|
||||
leavesDecorative = BlockETDecorativeLeaves.create();
|
||||
speciesToLeavesDecorative = new HashMap<>();
|
||||
for (BlockETDecorativeLeaves leaves : leavesDecorative) {
|
||||
@@ -287,12 +286,26 @@ public class ModuleBlocks implements IInitializable {
|
||||
woodAccess.register(EnumShrubLog.INSTANCE, WoodBlockKind.LOG, false, shrubLog.getStateFromMeta(0), new ItemStack(shrubLog, 1, 0));
|
||||
woodAccess.register(EnumShrubLog.INSTANCE, WoodBlockKind.LOG, true, shrubLog.getStateFromMeta(1), new ItemStack(shrubLog, 1, 1));
|
||||
}
|
||||
|
||||
|
||||
public void registerDoors(WoodAccess woodAccess, List<BlockETDoor> blocks) {
|
||||
for (BlockETDoor block : blocks) {
|
||||
registerWithoutVariants(woodAccess, block, WoodBlockKind.DOOR);
|
||||
}
|
||||
}
|
||||
|
||||
private <T extends Block & IWoodTyped> void registerWithoutVariants(WoodAccess woodAccess, T woodTyped, WoodBlockKind woodBlockKind) {
|
||||
boolean fireproof = woodTyped.isFireproof();
|
||||
IBlockState blockState = woodTyped.getDefaultState();
|
||||
IWoodType woodType = woodTyped.getWoodType(0);
|
||||
ItemStack itemStack = new ItemStack(woodTyped);
|
||||
if (!(woodType instanceof EnumVanillaWoodType)) {
|
||||
PluginArboriculture.proxy.registerWoodModel(woodTyped, false);
|
||||
}
|
||||
woodAccess.register(woodType, woodBlockKind, fireproof, blockState, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
// ExtraTrees.doorRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
// RenderingRegistry.registerBlockHandler(new DoorBlockRenderer());
|
||||
// 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, "");
|
||||
@@ -300,6 +313,12 @@ public class ModuleBlocks implements IInitializable {
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
for (BlockETLog log : logs) {
|
||||
ItemStack logInput = new ItemStack(log, 1, OreDictionary.WILDCARD_VALUE);
|
||||
ItemStack coalOutput = new ItemStack(Items.COAL, 1, 1);
|
||||
RecipeUtil.addSmelting(logInput, coalOutput, 0.15F);
|
||||
}
|
||||
|
||||
IWoodAccess woodAccess = TreeManager.woodAccess;
|
||||
for (PlankType.ExtraTreePlanks plankType : PlankType.ExtraTreePlanks.VALUES) {
|
||||
for (boolean fireproof : new boolean[]{false, true}) {
|
||||
@@ -317,30 +336,21 @@ public class ModuleBlocks implements IInitializable {
|
||||
|
||||
slabs.setCount(6);
|
||||
RecipeUtil.addPriorityRecipe(slabs.copy(), "###", '#', planks.copy());
|
||||
if(!fireproof){
|
||||
ItemStack doors = woodAccess.getStack(plankType.getWoodType(), WoodBlockKind.DOOR, false);
|
||||
doors.setCount(3);
|
||||
planks.setCount(1);
|
||||
RecipeUtil.addPriorityRecipe(doors.copy(),
|
||||
"## ",
|
||||
"## ",
|
||||
"## ",
|
||||
'#', planks.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
GameRegistry.addRecipe(new MultiFenceRecipeSize());
|
||||
GameRegistry.addRecipe(new MultiFenceRecipeEmbedded());
|
||||
GameRegistry.addRecipe(new MultiFenceRecipeSolid());
|
||||
for (final IPlankType plank2 : WoodManager.getAllPlankTypes()) {
|
||||
final ItemStack planks2 = plank2.getStack();
|
||||
final ItemStack fenceNormal = WoodManager.getFence(plank2, new FenceType(0), 1);
|
||||
final ItemStack gate = WoodManager.getGate(plank2);
|
||||
final ItemStack doorStandard = WoodManager.getDoor(plank2, DoorType.Standard);
|
||||
final ItemStack doorSolid = WoodManager.getDoor(plank2, DoorType.Solid);
|
||||
final ItemStack doorSplit = WoodManager.getDoor(plank2, DoorType.Double);
|
||||
final ItemStack doorFull = WoodManager.getDoor(plank2, DoorType.Full);
|
||||
if (!planks2.isEmpty() && !gate.isEmpty()) {
|
||||
gate.setCount(1);
|
||||
GameRegistry.addRecipe(gate.copy(), "fpf", 'f', fenceNormal.copy(), 'p', planks2.copy());
|
||||
fenceNormal.setCount(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());
|
||||
}
|
||||
}
|
||||
this.addSqueezer(EnumVanillaWoodType.SPRUCE, ExtraTreeLiquid.Resin, 50);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -104,6 +105,23 @@ public class WoodManager {
|
||||
}
|
||||
return TreeManager.woodAccess.getStack(plank.getWoodType(), WoodBlockKind.FENCE_GATE, false);
|
||||
}
|
||||
|
||||
public static ItemStack getDoor(final IPlankType plank) {
|
||||
if (plank == PlankType.VanillaPlanks.OAK) {
|
||||
return new ItemStack(Items.OAK_DOOR);
|
||||
}else if (plank == PlankType.VanillaPlanks.BIRCH) {
|
||||
return new ItemStack(Items.BIRCH_DOOR);
|
||||
}else if (plank == PlankType.VanillaPlanks.SPRUCE) {
|
||||
return new ItemStack(Items.SPRUCE_DOOR);
|
||||
} else if (plank == PlankType.VanillaPlanks.BIG_OAK) {
|
||||
return new ItemStack(Items.DARK_OAK_DOOR);
|
||||
} else if (plank == PlankType.VanillaPlanks.JUNGLE) {
|
||||
return new ItemStack(Items.JUNGLE_DOOR);
|
||||
} else if (plank == PlankType.VanillaPlanks.ACACIA) {
|
||||
return new ItemStack(Items.ACACIA_DOOR);
|
||||
}
|
||||
return TreeManager.woodAccess.getStack(plank.getWoodType(), WoodBlockKind.DOOR, false);
|
||||
}
|
||||
|
||||
public static ItemStack getFence(final IPlankType plank, final FenceType type, final int amount) {
|
||||
return getFence(plank, plank, type, amount);
|
||||
@@ -124,10 +142,6 @@ public class WoodManager {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack getDoor(final IPlankType plank, final DoorType type) {
|
||||
return TileEntityMetadata.getItemStack(ExtraTrees.blocks().blockDoor, type.ordinal() * 256 + getPlankTypeIndex(plank));
|
||||
}
|
||||
|
||||
public static List<IPlankType> getAllPlankTypes() {
|
||||
List<IPlankType> list = new ArrayList<>();
|
||||
Collections.addAll(list, PlankType.ExtraTreePlanks.values());
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
package binnie.extratrees.block.wood;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.IWoodItemMeshDefinition;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.blocks.WoodTypeStateMapper;
|
||||
import forestry.arboriculture.proxy.ProxyArboricultureClient;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
|
||||
import binnie.Constants;
|
||||
import binnie.extratrees.block.EnumETLog;
|
||||
|
||||
public class BlockETDoor extends BlockDoor implements IWoodTyped, IItemModelRegister, IStateMapperRegister, IColoredBlock {
|
||||
private final EnumETLog woodType;
|
||||
|
||||
public BlockETDoor(EnumETLog woodType) {
|
||||
super(Material.WOOD);
|
||||
this.woodType = woodType;
|
||||
|
||||
setHarvestLevel("axe", 0);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
String name = "doors." + woodType;
|
||||
setUnlocalizedName(name);
|
||||
setRegistryName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
ModelBakery.registerItemVariants(item, new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "door"));
|
||||
ProxyArboricultureClient.registerWoodMeshDefinition(item, new WoodMeshDefinition());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static class WoodMeshDefinition implements IWoodItemMeshDefinition {
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
return new ModelResourceLocation(Constants.EXTRA_TREES_MOD_ID + ":door", "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getDefaultModelLocation(ItemStack stack) {
|
||||
return new ResourceLocation(Constants.EXTRA_TREES_MOD_ID + ":item/door");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerStateMapper() {
|
||||
ProxyArboricultureClient.registerWoodStateMapper(this,
|
||||
new WoodTypeStateMapper(this, null).addPropertyToRemove(POWERED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WoodBlockKind getBlockKind() {
|
||||
return WoodBlockKind.DOOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFireproof() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumETLog getWoodType(int meta) {
|
||||
return woodType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<EnumETLog> getWoodTypes() {
|
||||
return Collections.singleton(woodType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) {
|
||||
int meta = getMetaFromState(blockState);
|
||||
EnumETLog woodType = getWoodType(meta);
|
||||
return woodType.getHardness();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||
return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? Items.AIR : getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) {
|
||||
return new ItemStack(getItem());
|
||||
}
|
||||
|
||||
private Item getItem() {
|
||||
return TreeManager.woodAccess.getStack(woodType, getBlockKind(), false).getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
|
||||
return woodType.getPlank().getColour();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package binnie.extratrees.block.wood;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemDoor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.items.IColoredItem;
|
||||
|
||||
public class ItemBlockETWoodDoor extends ItemBlockETWood<BlockETDoor> implements IColoredItem {
|
||||
public ItemBlockETWoodDoor(BlockETDoor block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy of {@link ItemDoor#onItemUse}
|
||||
*/
|
||||
/**
|
||||
* Called when a Block is right-clicked with this Item
|
||||
*/
|
||||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
if (facing != EnumFacing.UP) {
|
||||
return EnumActionResult.FAIL;
|
||||
} else {
|
||||
IBlockState iblockstate = worldIn.getBlockState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (!block.isReplaceable(worldIn, pos)) {
|
||||
pos = pos.offset(facing);
|
||||
}
|
||||
|
||||
ItemStack itemstack = player.getHeldItem(hand);
|
||||
|
||||
if (player.canPlayerEdit(pos, facing, itemstack) && this.block.canPlaceBlockAt(worldIn, pos)) {
|
||||
EnumFacing enumfacing = EnumFacing.fromAngle(player.rotationYaw);
|
||||
int i = enumfacing.getFrontOffsetX();
|
||||
int j = enumfacing.getFrontOffsetZ();
|
||||
boolean flag = i < 0 && hitZ < 0.5F || i > 0 && hitZ > 0.5F || j < 0 && hitX > 0.5F || j > 0 && hitX < 0.5F;
|
||||
ItemDoor.placeDoor(worldIn, pos, enumfacing, this.block, flag);
|
||||
SoundType soundtype = worldIn.getBlockState(pos).getBlock().getSoundType(worldIn.getBlockState(pos), worldIn, pos, player);
|
||||
worldIn.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
|
||||
itemstack.shrink(1);
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||
return getBlock().getWoodType(0).getPlank().getColour();
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import binnie.core.craftgui.geometry.TextJustification;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.block.DoorType;
|
||||
import binnie.extratrees.block.IPlankType;
|
||||
import binnie.extratrees.block.WoodManager;
|
||||
import binnie.extratrees.block.decor.FenceType;
|
||||
@@ -40,7 +39,7 @@ public class PagePlanksOverview extends PageAbstract<ItemStack> {
|
||||
if (type != null) {
|
||||
final ItemStack fence = WoodManager.getFence(type, new FenceType(0), 1);
|
||||
final ItemStack gate = WoodManager.getGate(type);
|
||||
final ItemStack door = WoodManager.getDoor(type, DoorType.Standard);
|
||||
final ItemStack door = WoodManager.getDoor(type);
|
||||
if (!fence.isEmpty()) {
|
||||
new ControlItemDisplay(this, x, 48).setItemStack(fence);
|
||||
x += 22;
|
||||
|
||||
Reference in new issue
Block a user