From 4140ba7d7fb534156cc43ec7cc7a12c3ed14d7c6 Mon Sep 17 00:00:00 2001 From: Nedelosk Date: Fri, 27 Jan 2017 20:15:44 +0100 Subject: [PATCH] Fix block carpentry panel --- .../binnie/core/block/IMultipassBlock.java | 7 + .../binnie/core/models/ModelMutlipass.java | 43 +++- .../binnie/core/models/PanelModelBaker.java | 237 ++++++++++++++++++ .../carpentry/BlockCarpentryPanel.java | 198 +++++++-------- .../extratrees/carpentry/DesignBlock.java | 2 - .../extratrees/carpentry/ModuleCarpentry.java | 2 +- 6 files changed, 377 insertions(+), 112 deletions(-) create mode 100644 src/main/java/binnie/core/models/PanelModelBaker.java diff --git a/src/main/java/binnie/core/block/IMultipassBlock.java b/src/main/java/binnie/core/block/IMultipassBlock.java index f5a2ea32..0942190f 100644 --- a/src/main/java/binnie/core/block/IMultipassBlock.java +++ b/src/main/java/binnie/core/block/IMultipassBlock.java @@ -2,14 +2,21 @@ package binnie.core.block; import javax.annotation.Nullable; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public interface IMultipassBlock { + + default AxisAlignedBB getItemBoundingBox(){ + return Block.FULL_BLOCK_AABB; + } + @SideOnly(Side.CLIENT) int getRenderPasses(); diff --git a/src/main/java/binnie/core/models/ModelMutlipass.java b/src/main/java/binnie/core/models/ModelMutlipass.java index cb5904cf..163d65bc 100644 --- a/src/main/java/binnie/core/models/ModelMutlipass.java +++ b/src/main/java/binnie/core/models/ModelMutlipass.java @@ -1,7 +1,12 @@ package binnie.core.models; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import binnie.core.block.IMultipassBlock; import forestry.api.core.IModelBaker; +import forestry.core.blocks.propertys.UnlistedBlockAccess; +import forestry.core.blocks.propertys.UnlistedBlockPos; import forestry.core.models.ModelBlockCached; import forestry.core.models.baker.ModelBaker; import net.minecraft.block.Block; @@ -10,7 +15,11 @@ import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -30,6 +39,34 @@ public class ModelMutlipass, K> extends Mod protected K getWorldKey(IBlockState state) { return ((B) state.getBlock()).getWorldKey(state); } + + @Nullable + protected IBakedModel bakeModel(@Nonnull IBlockState state, @Nonnull K key) { + if (key == null) { + return null; + } + + IModelBaker baker = new PanelModelBaker(); + + Block block = state.getBlock(); + if (!blockClass.isInstance(block)) { + return null; + } + B bBlock = blockClass.cast(block); + + if (state instanceof IExtendedBlockState) { + IExtendedBlockState stateExtended = (IExtendedBlockState) state; + IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS); + BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS); + baker.setRenderBounds(state.getBoundingBox(world, pos)); + } + + bakeBlock(bBlock, key, baker, false); + + blockModel = baker.bakeModel(false); + onCreateModel(blockModel); + return blockModel; + } @Override protected void bakeBlock(B block, K key, IModelBaker baker, boolean inventory) { @@ -38,7 +75,7 @@ public class ModelMutlipass, K> extends Mod for(EnumFacing facing : EnumFacing.VALUES){ sprites[facing.ordinal()] = block.getSprite(key, facing, pass); } - baker.addBlockModel(block, Block.FULL_BLOCK_AABB, null, sprites, pass); + baker.addBlockModel(block, null, null, sprites, pass); } // Set the particle sprite @@ -52,14 +89,14 @@ public class ModelMutlipass, K> extends Mod return null; } - IModelBaker baker = new ModelBaker(); + IModelBaker baker = new PanelModelBaker(); Block block = Block.getBlockFromItem(stack.getItem()); if (!blockClass.isInstance(block)) { return null; } B bBlock = blockClass.cast(block); - baker.setRenderBounds(Block.FULL_BLOCK_AABB); + baker.setRenderBounds(bBlock.getItemBoundingBox()); bakeBlock(bBlock, key, baker, true); return itemModel = baker.bakeModel(true); diff --git a/src/main/java/binnie/core/models/PanelModelBaker.java b/src/main/java/binnie/core/models/PanelModelBaker.java new file mode 100644 index 00000000..c52593a6 --- /dev/null +++ b/src/main/java/binnie/core/models/PanelModelBaker.java @@ -0,0 +1,237 @@ +package binnie.core.models; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import org.apache.commons.lang3.tuple.Pair; +import org.lwjgl.util.vector.Vector3f; + +import forestry.api.core.IModelBaker; +import forestry.api.core.IModelBakerModel; +import forestry.core.models.ModelManager; +import forestry.core.models.baker.ModelBaker; +import forestry.core.models.baker.ModelBakerFace; +import forestry.core.models.baker.ModelBakerModel; +import forestry.core.proxy.Proxies; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.BlockFaceUV; +import net.minecraft.client.renderer.block.model.BlockPartFace; +import net.minecraft.client.renderer.block.model.FaceBakery; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelRotation; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.common.model.IModelState; + +public class PanelModelBaker implements IModelBaker { + + private final float[] quadsUV; + private final List faces = new ArrayList<>(); + private final List> bakedModels = new ArrayList<>(); + @Nonnull + protected AxisAlignedBB renderBounds = Block.FULL_BLOCK_AABB; + + protected ModelBakerModel currentModel = new ModelBakerModel(ModelManager.getInstance().DEFAULT_BLOCK); + + protected final FaceBakery faceBakery = new FaceBakery(); + + protected final float[] defUVs; + + public PanelModelBaker() { + quadsUV = new float[]{0, 0, 1, 1, 0, 0, 1, 1}; + defUVs = new float[] { 0, 0, 1, 1 }; + } + + @Override + public void setRenderBounds(@Nonnull AxisAlignedBB renderBounds) { + if (renderBounds == null) { + return; + } + + this.renderBounds = renderBounds; + } + + @Override + public void setRenderBounds(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { + renderBounds = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ); + } + + protected int colorIndex = -1; + + @Override + public void setColorIndex(int colorIndex) { + this.colorIndex = colorIndex; + } + + @Override + public void addModel(@Nonnull AxisAlignedBB renderBounds, @Nonnull TextureAtlasSprite[] textures, int colorIndex) { + + setColorIndex(colorIndex); + + for (EnumFacing facing : EnumFacing.VALUES) { + addFace(facing, textures[facing.ordinal()]); + } + } + + @Override + public void addModel(@Nonnull AxisAlignedBB renderBounds, @Nonnull TextureAtlasSprite texture, int colorIndex) { + addModel(renderBounds, new TextureAtlasSprite[]{ texture, texture, texture, texture, texture, texture }, colorIndex); + } + + @Override + public void addBlockModel(@Nonnull Block block, @Nonnull AxisAlignedBB renderBounds, @Nullable BlockPos pos, @Nonnull TextureAtlasSprite[] textures, int colorIndex) { + setColorIndex(colorIndex); + + if(pos != null){ + World world = Proxies.common.getRenderWorld(); + IBlockState blockState = world.getBlockState(pos); + for (EnumFacing facing : EnumFacing.VALUES) { + if (block.shouldSideBeRendered(blockState, world, pos, facing)) { + addFace(facing, textures[facing.ordinal()]); + } + } + }else { + for (EnumFacing facing : EnumFacing.VALUES) { + addFace(facing, textures[facing.ordinal()]); + } + } + + } + + @Override + public void addBlockModel(@Nonnull Block block, @Nonnull AxisAlignedBB renderBounds, @Nullable BlockPos pos, @Nonnull TextureAtlasSprite texture, int colorIndex) { + addBlockModel(block, renderBounds, pos, new TextureAtlasSprite[]{ texture, texture, texture, texture, texture, texture }, colorIndex); + } + + @Override + public void addBakedModel(@Nullable IBlockState state, @Nonnull IBakedModel model) { + if(model != null){ + this.bakedModels.add(Pair.of(state, model)); + } + } + + protected float[] getFaceUvs(final EnumFacing face, final Vector3f to_16, final Vector3f from_16) { + float from_a = 0; + float from_b = 0; + float to_a = 0; + float to_b = 0; + + switch (face) { + case UP: + from_a = from_16.x / 16.0f; + from_b = from_16.z / 16.0f; + to_a = to_16.x / 16.0f; + to_b = to_16.z / 16.0f; + break; + case DOWN: + from_a = from_16.x / 16.0f; + from_b = from_16.z / 16.0f; + to_a = to_16.x / 16.0f; + to_b = to_16.z / 16.0f; + break; + case SOUTH: + from_a = from_16.y / 16.0f; + from_b = from_16.x / 16.0f; + to_a = to_16.y / 16.0f; + to_b = to_16.x / 16.0f; + break; + case NORTH: + from_a = from_16.y / 16.0f; + from_b = from_16.x / 16.0f; + to_a = to_16.y / 16.0f; + to_b = to_16.x / 16.0f; + break; + case EAST: + from_a = from_16.y / 16.0f; + from_b = from_16.z / 16.0f; + to_a = to_16.y / 16.0f; + to_b = to_16.z / 16.0f; + break; + case WEST: + from_a = from_16.y / 16.0f; + from_b = from_16.z / 16.0f; + to_a = to_16.y / 16.0f; + to_b = to_16.z / 16.0f; + break; + default: + } + + from_a = 1.0f - from_a; + from_b = 1.0f - from_b; + to_a = 1.0f - to_a; + to_b = 1.0f - to_b; + + return new float[]{ // :P + 16.0f * (quadsUV[0] + quadsUV[2] * from_a + quadsUV[4] * from_b), // 0 + 16.0f * (quadsUV[1] + quadsUV[3] * from_a + quadsUV[5] * from_b), // 1 + + 16.0f * (quadsUV[0] + quadsUV[2] * to_a + quadsUV[4] * from_b), // 2 + 16.0f * (quadsUV[1] + quadsUV[3] * to_a + quadsUV[5] * from_b), // 3 + + 16.0f * (quadsUV[0] + quadsUV[2] * to_a + quadsUV[4] * to_b), // 2 + 16.0f * (quadsUV[1] + quadsUV[3] * to_a + quadsUV[5] * to_b), // 3 + + 16.0f * (quadsUV[0] + quadsUV[2] * from_a + quadsUV[4] * to_b), // 0 + 16.0f * (quadsUV[1] + quadsUV[3] * from_a + quadsUV[5] * to_b), // 1 + }; + } + + @Override + public void addFace(@Nonnull EnumFacing facing, @Nonnull TextureAtlasSprite sprite) { + if (sprite == null) { + return; + } + + Vector3f to = new Vector3f((float) renderBounds.minX * 16.0f, (float) renderBounds.minY * 16.0f, (float) renderBounds.minZ * 16.0f); + Vector3f from = new Vector3f((float) renderBounds.maxX * 16.0f, (float) renderBounds.maxY * 16.0f, (float) renderBounds.maxZ * 16.0f); + + faces.add(new ModelBakerFace(facing, colorIndex, to, from, defUVs, sprite)); + } + + @Override + public IModelBakerModel bakeModel(boolean flip) { + ModelRotation mr = ModelRotation.X0_Y0; + + if (flip) { + mr = ModelRotation.X0_Y180; + } + + //Add baked models to the current model. + for(Pair bakedModel : bakedModels){ + currentModel.addModelQuads(bakedModel); + } + + for (ModelBakerFace face : faces) { + final EnumFacing myFace = face.face; + final float[] uvs = getFaceUvs(myFace, face.from, face.to); + + final BlockFaceUV uv = new BlockFaceUV(uvs, 0); + final BlockPartFace bpf = new BlockPartFace(myFace, face.colorIndex, "", uv); + + BakedQuad bf = faceBakery.makeBakedQuad(face.to, face.from, bpf, face.spite, myFace, mr, null, true, true); + + currentModel.addQuad(myFace, bf); + } + + return currentModel; + } + + @Override + public void setModelState(IModelState modelState){ + currentModel.setModelState(modelState); + } + + @Override + public void setParticleSprite(TextureAtlasSprite particleSprite) { + currentModel.setParticleSprite(particleSprite); + } + +} diff --git a/src/main/java/binnie/extratrees/carpentry/BlockCarpentryPanel.java b/src/main/java/binnie/extratrees/carpentry/BlockCarpentryPanel.java index 33e1d3af..55b01520 100644 --- a/src/main/java/binnie/extratrees/carpentry/BlockCarpentryPanel.java +++ b/src/main/java/binnie/extratrees/carpentry/BlockCarpentryPanel.java @@ -1,14 +1,18 @@ package binnie.extratrees.carpentry; import binnie.Binnie; +import binnie.core.block.BlockMetadata; import binnie.core.block.TileEntityMetadata; import binnie.extratrees.ExtraTrees; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import java.util.List; @@ -17,130 +21,112 @@ public class BlockCarpentryPanel extends BlockCarpentry { public BlockCarpentryPanel() { super("carpentryPanel"); this.useNeighborBrightness = true; - //this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.0625f, 1.0f); this.setLightOpacity(0); } @Override public void getSubBlocks(final Item itemIn, final CreativeTabs par2CreativeTabs, final List itemList) { } + + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + final DesignBlock block = this.getCarpentryBlock(source, pos); + switch (block.getFacing()) { + case DOWN: { + return new AxisAlignedBB(0.0f, 0.0f, 0.0f, 1.0f, 0.0625f, 1.0f); + } + case EAST: { + return new AxisAlignedBB(0.9375f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f); + } + case NORTH: { + return new AxisAlignedBB(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0625f); + } + case SOUTH: { + return new AxisAlignedBB(0.0f, 0.0f, 0.9375f, 1.0f, 1.0f, 1.0f); + } + case UP: { + return new AxisAlignedBB(0.0f, 0.9375f, 0.0f, 1.0f, 1.0f, 1.0f); + } + case WEST: { + return new AxisAlignedBB(0.0f, 0.0f, 0.0f, 0.0625f, 1.0f, 1.0f); + } + } + return FULL_BLOCK_AABB; + } -// @Override -// public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) -// { -// this.setBlockBoundsBasedOnState(world, x, y, z); -// return super.getCollisionBoundingBoxFromPool(world, x, y, z); -// } -// -// @Override -// public void setBlockBoundsBasedOnState(final IBlockAccess world, final int x, final int y, final int z) { -// final DesignBlock block = this.getCarpentryBlock(world, x, y, z); -// switch (block.getFacing()) { -// case DOWN: { -// this.setBlockBounds(0.0f, 0.9375f, 0.0f, 1.0f, 1.0f, 1.0f); -// break; -// } -// case EAST: { -// this.setBlockBounds(0.0f, 0.0f, 0.0f, 0.0625f, 1.0f, 1.0f); -// break; -// } -// case NORTH: { -// this.setBlockBounds(0.0f, 0.0f, 0.9375f, 1.0f, 1.0f, 1.0f); -// break; -// } -// case SOUTH: { -// this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0625f); -// break; -// } -// case UP: { -// this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.0625f, 1.0f); -// break; -// } -// case WEST: { -// this.setBlockBounds(0.9375f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f); -// break; -// } -// } -// } - -// @Override -// public void setBlockBoundsForItemRender() { -// this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.0625f, 1.0f); -// } + @Override + public AxisAlignedBB getItemBoundingBox() { + return new AxisAlignedBB(0.0f, 0.0f, 0.0f, 1.0f, 0.0625f, 1.0f); + } @Override public String getDisplayName(final ItemStack stack) { final DesignBlock block = ModuleCarpentry.getDesignBlock(this.getDesignSystem(), TileEntityMetadata.getItemDamage(stack)); return Binnie.LANGUAGE.localise(ExtraTrees.instance, "block.woodenpanel.name", block.getDesign().getName()); } + + @Override + public boolean isOpaqueCube(IBlockState state) { + return false; + } + + @Override + public boolean isFullCube(IBlockState state) { + return false; + } -// @Override -// public AxisAlignedBB getCollisionBoundingBoxFromPool(final World par1World, final int par2, final int par3, final int par4) { -// this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); -// return AxisAlignedBB.getBoundingBox(par2 + this.minX, par3 + this.minY, par4 + this.minZ, par2 + this.maxX, par3 + this.maxY, par4 + this.maxZ); -// } -// -// @Override -// public boolean isOpaqueCube() { -// return false; -// } -// -// @Override -// public boolean renderAsNormalBlock() { -// return false; -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public boolean shouldSideBeRendered(final IBlockAccess world, final int x, final int y, final int z, final int side) { -// return super.shouldSideBeRendered(world, x, y, z, side); -// } -// -// @Override -// public DesignBlock getCarpentryBlock(final IBlockAccess world, final int x, final int y, final int z) { -// return ModuleCarpentry.getCarpentryPanel(this.getDesignSystem(), TileEntityMetadata.getTileMetadata(world, x, y, z)); -// } + @Override + public DesignBlock getCarpentryBlock(IBlockAccess world, BlockPos pos) { + return ModuleCarpentry.getCarpentryPanel(this.getDesignSystem(), TileEntityMetadata.getTileMetadata(world, pos)); + } - public static boolean isValidPanelPlacement(World world, BlockPos pos, EnumFacing facing) { + public static boolean isValidPanelPlacement(IBlockAccess world, BlockPos pos, EnumFacing facing) { if (facing == null) { return false; } - pos = pos.offset(facing, -1); + pos = pos.offset(facing); IBlockState state = world.getBlockState(pos); - return state != null && state.isSideSolid(world, pos, facing); + return state != null && state.isSideSolid(world, pos, facing.getOpposite()); } -// -// @Override -// public int getPlacedMeta(final ItemStack item, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) { -// final DesignBlock block = ModuleCarpentry.getCarpentryPanel(this.getDesignSystem(), TileEntityMetadata.getItemDamage(item)); -// ForgeDirection facing = clickedBlock; -// boolean valid = true; -// if (!isValidPanelPlacement(world, x, y, z, facing)) { -// valid = false; -// for (final ForgeDirection direction : ForgeDirection.values()) { -// if (isValidPanelPlacement(world, x, y, z, direction)) { -// facing = direction; -// valid = true; -// break; -// } -// } -// } -// if (!valid) { -// return -1; -// } -// block.setFacing(facing); -// return block.getBlockMetadata(this.getDesignSystem()); -// } -// -// @Override -// public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block par5) { -// super.onNeighborBlockChange(world, x, y, z, par5); -// final DesignBlock block = this.getCarpentryBlock(world, x, y, z); -// if (!isValidPanelPlacement(world, x, y, z, block.getFacing())) { -// for (final ItemStack stack : BlockMetadata.getBlockDropped(this, world, x, y, z, 0)) { -// this.dropBlockAsItem(world, x, y, z, stack); -// } -// world.setBlockToAir(x, y, z); -// } -// } + + @Override + public int getPlacedMeta(ItemStack item, World world, BlockPos pos, EnumFacing clickedBlock) { + final DesignBlock block = ModuleCarpentry.getCarpentryPanel(this.getDesignSystem(), TileEntityMetadata.getItemDamage(item)); + EnumFacing facing = clickedBlock; + boolean valid = true; + if (!isValidPanelPlacement(world, pos, facing)) { + valid = false; + for (EnumFacing direction : EnumFacing.VALUES) { + if (isValidPanelPlacement(world, pos, direction)) { + facing = direction; + valid = true; + break; + } + } + } + if (!valid) { + return -1; + } + block.setFacing(facing); + return block.getBlockMetadata(this.getDesignSystem()); + } + + @Override + public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) { + return false; + } + + @Override + public void onNeighborChange(IBlockAccess blockAccess, BlockPos pos, BlockPos neighbor) { + super.onNeighborChange(blockAccess, pos, neighbor); + World world = (World) blockAccess; + final DesignBlock block = this.getCarpentryBlock(blockAccess, pos); + if (!isValidPanelPlacement(blockAccess, pos, block.getFacing())) { + for (ItemStack stack : BlockMetadata.getBlockDroppedAsList(this, blockAccess, pos)) { + spawnAsEntity(world, pos, stack); + } + world.setBlockToAir(pos); + } + } + } diff --git a/src/main/java/binnie/extratrees/carpentry/DesignBlock.java b/src/main/java/binnie/extratrees/carpentry/DesignBlock.java index 1bdc0ff2..480f4fd6 100644 --- a/src/main/java/binnie/extratrees/carpentry/DesignBlock.java +++ b/src/main/java/binnie/extratrees/carpentry/DesignBlock.java @@ -40,8 +40,6 @@ public class DesignBlock { } DesignBlock(final IDesignSystem system, final IDesignMaterial primaryWood, final IDesignMaterial secondaryWood, final IDesign design, final int rotation, final EnumFacing dir) { - this.rotation = 0; - this.facing = EnumFacing.UP; this.panel = false; this.design = design; this.primaryMaterial = primaryWood; diff --git a/src/main/java/binnie/extratrees/carpentry/ModuleCarpentry.java b/src/main/java/binnie/extratrees/carpentry/ModuleCarpentry.java index 8ce1bef0..8a19dfd6 100644 --- a/src/main/java/binnie/extratrees/carpentry/ModuleCarpentry.java +++ b/src/main/java/binnie/extratrees/carpentry/ModuleCarpentry.java @@ -68,7 +68,7 @@ public class ModuleCarpentry implements IInitializable { final IDesignMaterial type1 = system.getMaterial(plankID1); final IDesignMaterial type2 = system.getMaterial(plankID2); final IDesign type3 = CarpentryManager.carpentryInterface.getDesign(tile); - return new DesignBlock(system, type1, type2, type3, rotation, /*EnumFacing.getOrientation(axis)*/ EnumFacing.UP); + return new DesignBlock(system, type1, type2, type3, rotation, EnumFacing.VALUES[axis]); } public static DesignBlock getCarpentryPanel(final IDesignSystem system, final int meta) {