mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-27 23:46:05 +00:00
Improve code readability in binnie.extratrees package
This commit is contained in:
1 parent
adccdd181a
commit
96e4814ae3
225 files changed
+8968
-9306
No files matched your search
@@ -1,39 +1,31 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.Binnie;
|
||||
import binnie.extratrees.block.PlankType;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.block.PlankType;
|
||||
import forestry.api.core.Tabs;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BlockCarpentry extends BlockDesign
|
||||
{
|
||||
public class BlockCarpentry extends BlockDesign {
|
||||
public BlockCarpentry() {
|
||||
super(DesignSystem.Wood, Material.wood);
|
||||
this.setCreativeTab(Tabs.tabArboriculture);
|
||||
this.setBlockName("carpentry");
|
||||
this.setResistance(5.0f);
|
||||
this.setHardness(2.0f);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("carpentry");
|
||||
setResistance(5.0f);
|
||||
setHardness(2.0f);
|
||||
setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCreativeStack(final IDesign design) {
|
||||
public ItemStack getCreativeStack(IDesign design) {
|
||||
return ModuleCarpentry.getItemStack(this, PlankType.ExtraTreePlanks.Apple, PlankType.VanillaPlanks.BIRCH, design);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final DesignBlock design) {
|
||||
public String getBlockName(DesignBlock design) {
|
||||
return Binnie.Language.localise(ExtraTrees.instance, "block.woodentile.name", design.getDesign().getName());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,90 +1,97 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockCarpentryPanel extends BlockCarpentry
|
||||
{
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCarpentryPanel extends BlockCarpentry {
|
||||
public BlockCarpentryPanel() {
|
||||
this.useNeighborBrightness = true;
|
||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.0625f, 1.0f);
|
||||
this.setLightOpacity(0);
|
||||
useNeighborBrightness = true;
|
||||
setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.0625f, 1.0f);
|
||||
setLightOpacity(0);
|
||||
}
|
||||
|
||||
public static boolean isValidPanelPlacement(World world, int x, int y, int z, ForgeDirection facing) {
|
||||
if (facing == ForgeDirection.UNKNOWN) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int bx = x - facing.offsetX;
|
||||
int by = y - facing.offsetY;
|
||||
int bz = z - facing.offsetZ;
|
||||
Block block = world.getBlock(bx, by, bz);
|
||||
return block != null && block.isSideSolid(world, bx, by, bz, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
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);
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
DesignBlock block = 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;
|
||||
}
|
||||
case DOWN:
|
||||
setBlockBounds(0.0f, 0.9375f, 0.0f, 1.0f, 1.0f, 1.0f);
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
setBlockBounds(0.0f, 0.0f, 0.0f, 0.0625f, 1.0f, 1.0f);
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
setBlockBounds(0.0f, 0.0f, 0.9375f, 1.0f, 1.0f, 1.0f);
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0625f);
|
||||
break;
|
||||
|
||||
case UP:
|
||||
setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.0625f, 1.0f);
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
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);
|
||||
setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.0625f, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final ItemStack itemStack) {
|
||||
final DesignBlock block = ModuleCarpentry.getDesignBlock(this.getDesignSystem(), TileEntityMetadata.getItemDamage(itemStack));
|
||||
public String getBlockName(ItemStack stack) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
||||
return Binnie.Language.localise(ExtraTrees.instance, "block.woodenpanel.name", block.getDesign().getName());
|
||||
}
|
||||
|
||||
@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);
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
setBlockBoundsBasedOnState(par1World, par2, par3, par4);
|
||||
return AxisAlignedBB.getBoundingBox(par2 + minX, par3 + minY, par4 + minZ, par2 + maxX, par3 + maxY, par4 + maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,34 +106,23 @@ public class BlockCarpentryPanel extends BlockCarpentry
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, 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));
|
||||
}
|
||||
|
||||
public static boolean isValidPanelPlacement(final World world, final int x, final int y, final int z, final ForgeDirection facing) {
|
||||
if (facing == ForgeDirection.UNKNOWN) {
|
||||
return false;
|
||||
}
|
||||
final int bx = x - facing.offsetX;
|
||||
final int by = y - facing.offsetY;
|
||||
final int bz = z - facing.offsetZ;
|
||||
final Block block = world.getBlock(bx, by, bz);
|
||||
return block != null && block.isSideSolid(world, bx, by, bz, facing);
|
||||
public DesignBlock getCarpentryBlock(IBlockAccess world, int x, int y, int z) {
|
||||
return ModuleCarpentry.getCarpentryPanel(getDesignSystem(), TileEntityMetadata.getTileMetadata(world, x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack itemStack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
||||
final DesignBlock block = ModuleCarpentry.getCarpentryPanel(this.getDesignSystem(), TileEntityMetadata.getItemDamage(itemStack));
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection clickedBlock) {
|
||||
DesignBlock block = ModuleCarpentry.getCarpentryPanel(getDesignSystem(), TileEntityMetadata.getItemDamage(itemStack));
|
||||
ForgeDirection facing = clickedBlock;
|
||||
boolean valid = true;
|
||||
if (!isValidPanelPlacement(world, x, y, z, facing)) {
|
||||
valid = false;
|
||||
for (final ForgeDirection direction : ForgeDirection.values()) {
|
||||
for (ForgeDirection direction : ForgeDirection.values()) {
|
||||
if (isValidPanelPlacement(world, x, y, z, direction)) {
|
||||
facing = direction;
|
||||
valid = true;
|
||||
@@ -134,22 +130,25 @@ public class BlockCarpentryPanel extends BlockCarpentry
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
return -1;
|
||||
}
|
||||
block.setFacing(facing);
|
||||
return block.getBlockMetadata(this.getDesignSystem());
|
||||
return block.getBlockMetadata(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);
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
super.onNeighborBlockChange(world, x, y, z, block);
|
||||
DesignBlock carpentryBlock = getCarpentryBlock(world, x, y, z);
|
||||
if (isValidPanelPlacement(world, x, y, z, carpentryBlock.getFacing())) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ItemStack stack : BlockMetadata.getBlockDropped(this, world, x, y, z, 0)) {
|
||||
dropBlockAsItem(world, x, y, z, stack);
|
||||
}
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -1,87 +1,93 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import binnie.core.block.IMultipassBlock;
|
||||
import binnie.core.block.MultipassBlockRenderer;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.extratrees.api.CarpentryManager;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.IToolHammer;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.core.block.MultipassBlockRenderer;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.extratrees.api.CarpentryManager;
|
||||
import java.util.List;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import net.minecraft.block.material.Material;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import binnie.extratrees.api.IToolHammer;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.core.block.IMultipassBlock;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
public abstract class BlockDesign extends BlockMetadata implements IMultipassBlock
|
||||
{
|
||||
IDesignSystem designSystem;
|
||||
public static final ForgeDirection[] RENDER_DIRECTIONS;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BlockDesign extends BlockMetadata implements IMultipassBlock {
|
||||
public static ForgeDirection[] RENDER_DIRECTIONS = new ForgeDirection[]{
|
||||
ForgeDirection.DOWN,
|
||||
ForgeDirection.UP,
|
||||
ForgeDirection.EAST,
|
||||
ForgeDirection.WEST,
|
||||
ForgeDirection.NORTH,
|
||||
ForgeDirection.SOUTH
|
||||
};
|
||||
|
||||
protected IDesignSystem designSystem;
|
||||
|
||||
public BlockDesign(IDesignSystem system, Material material) {
|
||||
super(material);
|
||||
designSystem = system;
|
||||
}
|
||||
|
||||
public static int getMetadata(int plank1, int plank2, int design) {
|
||||
return plank1 + (plank2 << 9) + (design << 18);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClick(final PlayerInteractEvent event) {
|
||||
public void onClick(PlayerInteractEvent event) {
|
||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
final World world = event.entityPlayer.worldObj;
|
||||
final EntityPlayer player = event.entityPlayer;
|
||||
final int x = event.x;
|
||||
final int y = event.y;
|
||||
final int z = event.z;
|
||||
|
||||
World world = event.entityPlayer.worldObj;
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
int x = event.x;
|
||||
int y = event.y;
|
||||
int z = event.z;
|
||||
if (!(world.getBlock(x, y, z) instanceof BlockDesign)) {
|
||||
return;
|
||||
}
|
||||
final BlockDesign blockC = (BlockDesign) world.getBlock(x, y, z);
|
||||
final ItemStack item = player.getHeldItem();
|
||||
if (item == null) {
|
||||
|
||||
BlockDesign blockC = (BlockDesign) world.getBlock(x, y, z);
|
||||
ItemStack item = player.getHeldItem();
|
||||
if (item == null
|
||||
|| !(item.getItem() instanceof IToolHammer)
|
||||
|| !((IToolHammer) item.getItem()).isActive(item)) {
|
||||
return;
|
||||
}
|
||||
if (!(item.getItem() instanceof IToolHammer)) {
|
||||
return;
|
||||
}
|
||||
if (!((IToolHammer) item.getItem()).isActive(item)) {
|
||||
return;
|
||||
}
|
||||
final DesignBlock block = blockC.getCarpentryBlock(world, x, y, z);
|
||||
final TileEntityMetadata tile = (TileEntityMetadata) world.getTileEntity(x, y, z);
|
||||
|
||||
DesignBlock block = blockC.getCarpentryBlock(world, x, y, z);
|
||||
TileEntityMetadata tile = (TileEntityMetadata) world.getTileEntity(x, y, z);
|
||||
block.rotate(event.face, item, player, world, x, y, z);
|
||||
final int meta = block.getBlockMetadata(blockC.getDesignSystem());
|
||||
int meta = block.getBlockMetadata(blockC.getDesignSystem());
|
||||
tile.setTileMetadata(meta, true);
|
||||
}
|
||||
|
||||
public BlockDesign(final IDesignSystem system, final Material material) {
|
||||
super(material);
|
||||
this.designSystem = system;
|
||||
}
|
||||
|
||||
public abstract ItemStack getCreativeStack(final IDesign p0);
|
||||
public abstract ItemStack getCreativeStack(IDesign design);
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
for (final IDesign design : CarpentryManager.carpentryInterface.getSortedDesigns()) {
|
||||
itemList.add(this.getCreativeStack(design));
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (IDesign design : CarpentryManager.carpentryInterface.getSortedDesigns()) {
|
||||
list.add(getCreativeStack(design));
|
||||
}
|
||||
}
|
||||
|
||||
public IDesignSystem getDesignSystem() {
|
||||
return this.designSystem;
|
||||
return designSystem;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,86 +96,79 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final ItemStack itemStack) {
|
||||
final DesignBlock block = ModuleCarpentry.getDesignBlock(this.getDesignSystem(), TileEntityMetadata.getItemDamage(itemStack));
|
||||
return this.getBlockName(block);
|
||||
public String getBlockName(ItemStack stack) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
||||
return getBlockName(block);
|
||||
}
|
||||
|
||||
public abstract String getBlockName(final DesignBlock p0);
|
||||
public abstract String getBlockName(DesignBlock p0);
|
||||
|
||||
public DesignBlock getCarpentryBlock(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return ModuleCarpentry.getDesignBlock(this.getDesignSystem(), TileEntityMetadata.getTileMetadata(world, x, y, z));
|
||||
public DesignBlock getCarpentryBlock(IBlockAccess world, int x, int y, int z) {
|
||||
return ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getTileMetadata(world, x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final DesignBlock block = this.getCarpentryBlock(world, x, y, z);
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
DesignBlock block = getCarpentryBlock(world, x, y, z);
|
||||
return (MultipassBlockRenderer.getLayer() > 0) ? block.getSecondaryColour() : block.getPrimaryColour();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(final int meta) {
|
||||
final DesignBlock block = ModuleCarpentry.getDesignBlock(this.getDesignSystem(), meta);
|
||||
public int colorMultiplier(int meta) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), meta);
|
||||
return (MultipassBlockRenderer.getLayer() > 0) ? block.getSecondaryColour() : block.getPrimaryColour();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final int side, final int damage) {
|
||||
final DesignBlock block = ModuleCarpentry.getDesignBlock(this.getDesignSystem(), damage);
|
||||
final IIcon icon = (MultipassBlockRenderer.getLayer() > 0) ? block.getSecondaryIcon(this.getDesignSystem(), BlockDesign.RENDER_DIRECTIONS[side]) : block.getPrimaryIcon(this.getDesignSystem(), BlockDesign.RENDER_DIRECTIONS[side]);
|
||||
return icon;
|
||||
public IIcon getIcon(int side, int damage) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), damage);
|
||||
if (MultipassBlockRenderer.getLayer() > 0) {
|
||||
return block.getSecondaryIcon(getDesignSystem(), BlockDesign.RENDER_DIRECTIONS[side]);
|
||||
}
|
||||
return block.getPrimaryIcon(getDesignSystem(), BlockDesign.RENDER_DIRECTIONS[side]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack itemStack, final List tooltip) {
|
||||
final DesignBlock block = ModuleCarpentry.getDesignBlock(this.getDesignSystem(), TileEntityMetadata.getItemDamage(itemStack));
|
||||
public void getBlockTooltip(ItemStack stack, List tooltip) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
||||
if (block.getPrimaryMaterial() != block.getSecondaryMaterial()) {
|
||||
tooltip.add(block.getPrimaryMaterial().getName() + " and " + block.getSecondaryMaterial().getName());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
tooltip.add(block.getPrimaryMaterial().getName());
|
||||
}
|
||||
}
|
||||
|
||||
public int primaryColor(final int damage) {
|
||||
final DesignBlock block = ModuleCarpentry.getDesignBlock(this.getDesignSystem(), damage);
|
||||
public int primaryColor(int damage) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), damage);
|
||||
return block.getPrimaryColour();
|
||||
}
|
||||
|
||||
public int secondaryColor(final int damage) {
|
||||
final DesignBlock block = ModuleCarpentry.getDesignBlock(this.getDesignSystem(), damage);
|
||||
public int secondaryColor(int damage) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), damage);
|
||||
return block.getSecondaryColour();
|
||||
}
|
||||
|
||||
public ItemStack getItemStack(final int plank1, final int plank2, final int design) {
|
||||
public ItemStack getItemStack(int plank1, int plank2, int design) {
|
||||
return TileEntityMetadata.getItemStack(this, getMetadata(plank1, plank2, design));
|
||||
}
|
||||
|
||||
public static int getMetadata(final int plank1, final int plank2, final int design) {
|
||||
return plank1 + (plank2 << 9) + (design << 18);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister register) {
|
||||
for (final IDesignSystem system : DesignerManager.instance.getDesignSystems()) {
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (IDesignSystem system : DesignerManager.instance.getDesignSystems()) {
|
||||
system.registerIcons(register);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
||||
final DesignBlock block = ModuleCarpentry.getDesignBlock(this.getDesignSystem(), tileMeta);
|
||||
return block.getItemMetadata(this.getDesignSystem());
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), tileMeta);
|
||||
return block.getItemMetadata(getDesignSystem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfPasses() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
static {
|
||||
RENDER_DIRECTIONS = new ForgeDirection[] { ForgeDirection.DOWN, ForgeDirection.UP, ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.NORTH, ForgeDirection.SOUTH };
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,28 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.Binnie;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import net.minecraft.block.Block;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Random;
|
||||
import forestry.api.core.Tabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BlockStainedDesign extends BlockDesign
|
||||
{
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockStainedDesign extends BlockDesign {
|
||||
public BlockStainedDesign() {
|
||||
super(DesignSystem.Glass, Material.glass);
|
||||
this.setCreativeTab(Tabs.tabArboriculture);
|
||||
this.setBlockName("stainedGlass");
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setBlockName("stainedGlass");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(final Random p_149745_1_) {
|
||||
public int quantityDropped(Random p_149745_1_) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -49,19 +44,21 @@ public class BlockStainedDesign extends BlockDesign
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(final IBlockAccess p_149646_1_, final int p_149646_2_, final int p_149646_3_, final int p_149646_4_, final int p_149646_5_) {
|
||||
final Block block2 = p_149646_1_.getBlock(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]);
|
||||
final Block block3 = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
return block3 != this && block3 != Botany.stained && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
// Block block2 = world.getBlock(x - Facing.offsetsXForSide[side], y - Facing.offsetsYForSide[side], z - Facing.offsetsZForSide[side]);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
return block != this
|
||||
&& block != Botany.stained
|
||||
&& super.shouldSideBeRendered(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCreativeStack(final IDesign design) {
|
||||
public ItemStack getCreativeStack(IDesign design) {
|
||||
return ModuleCarpentry.getItemStack(this, GlassType.get(0), GlassType.get(1), design);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final DesignBlock design) {
|
||||
public String getBlockName(DesignBlock design) {
|
||||
return Binnie.Language.localise(ExtraTrees.instance, "block.stainedglass.name", design.getDesign().getName());
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,33 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import binnie.extratrees.api.ICarpentryInterface;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.api.IDesignCategory;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
import binnie.extratrees.api.IDesignCategory;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import java.util.Map;
|
||||
import binnie.extratrees.api.ICarpentryInterface;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CarpentryInterface implements ICarpentryInterface
|
||||
{
|
||||
static Map<Integer, IDesignMaterial> woodMap;
|
||||
static Map<Integer, IDesign> designMap;
|
||||
static Map<String, IDesignCategory> designCategories;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class CarpentryInterface implements ICarpentryInterface {
|
||||
protected static Map<Integer, IDesignMaterial> woodMap = new LinkedHashMap<>();
|
||||
protected static Map<Integer, IDesign> designMap = new LinkedHashMap<>();
|
||||
protected static Map<String, IDesignCategory> designCategories = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public boolean registerCarpentryWood(final int index, final IDesignMaterial wood) {
|
||||
public boolean registerCarpentryWood(int index, IDesignMaterial wood) {
|
||||
return wood != null && CarpentryInterface.woodMap.put(index, wood) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCarpentryWoodIndex(final IDesignMaterial wood) {
|
||||
for (final Integer integer : CarpentryInterface.woodMap.keySet()) {
|
||||
public int getCarpentryWoodIndex(IDesignMaterial wood) {
|
||||
for (Integer integer : CarpentryInterface.woodMap.keySet()) {
|
||||
if (CarpentryInterface.woodMap.get(integer).equals(wood)) {
|
||||
return integer;
|
||||
}
|
||||
@@ -40,18 +36,19 @@ public class CarpentryInterface implements ICarpentryInterface
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getWoodMaterial(final int index) {
|
||||
public IDesignMaterial getWoodMaterial(int index) {
|
||||
return CarpentryInterface.woodMap.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean registerDesign(final int index, final IDesign wood) {
|
||||
return wood != null && CarpentryInterface.designMap.put(index, wood) == null;
|
||||
public boolean registerDesign(int index, IDesign wood) {
|
||||
return wood != null
|
||||
&& CarpentryInterface.designMap.put(index, wood) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDesignIndex(final IDesign wood) {
|
||||
for (final Integer integer : CarpentryInterface.designMap.keySet()) {
|
||||
public int getDesignIndex(IDesign wood) {
|
||||
for (Integer integer : CarpentryInterface.designMap.keySet()) {
|
||||
if (CarpentryInterface.designMap.get(integer).equals(wood)) {
|
||||
return integer;
|
||||
}
|
||||
@@ -60,29 +57,31 @@ public class CarpentryInterface implements ICarpentryInterface
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesign getDesign(final int index) {
|
||||
public IDesign getDesign(int index) {
|
||||
return CarpentryInterface.designMap.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getLayout(final IPattern pattern, final boolean inverted) {
|
||||
public ILayout getLayout(IPattern pattern, boolean inverted) {
|
||||
return Layout.get(pattern, inverted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean registerDesignCategory(final IDesignCategory category) {
|
||||
return category != null && category.getId() != null && CarpentryInterface.designCategories.put(category.getId(), category) == null;
|
||||
public boolean registerDesignCategory(IDesignCategory category) {
|
||||
return category != null
|
||||
&& category.getId() != null
|
||||
&& CarpentryInterface.designCategories.put(category.getId(), category) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignCategory getDesignCategory(final String id) {
|
||||
public IDesignCategory getDesignCategory(String id) {
|
||||
return CarpentryInterface.designCategories.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IDesignCategory> getAllDesignCategories() {
|
||||
final List<IDesignCategory> categories = new ArrayList<IDesignCategory>();
|
||||
for (final IDesignCategory category : CarpentryInterface.designCategories.values()) {
|
||||
List<IDesignCategory> categories = new ArrayList<IDesignCategory>();
|
||||
for (IDesignCategory category : CarpentryInterface.designCategories.values()) {
|
||||
if (category.getDesigns().size() > 0) {
|
||||
categories.add(category);
|
||||
}
|
||||
@@ -92,20 +91,21 @@ public class CarpentryInterface implements ICarpentryInterface
|
||||
|
||||
@Override
|
||||
public List<IDesign> getSortedDesigns() {
|
||||
final List<IDesign> designs = new ArrayList<IDesign>();
|
||||
for (final IDesignCategory category : this.getAllDesignCategories()) {
|
||||
List<IDesign> designs = new ArrayList<IDesign>();
|
||||
for (IDesignCategory category : getAllDesignCategories()) {
|
||||
designs.addAll(category.getDesigns());
|
||||
}
|
||||
return designs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getWoodMaterial(final ItemStack stack) {
|
||||
public IDesignMaterial getWoodMaterial(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
for (final Map.Entry<Integer, IDesignMaterial> entry : CarpentryInterface.woodMap.entrySet()) {
|
||||
final ItemStack key = entry.getValue().getStack();
|
||||
|
||||
for (Map.Entry<Integer, IDesignMaterial> entry : CarpentryInterface.woodMap.entrySet()) {
|
||||
ItemStack key = entry.getValue().getStack();
|
||||
if (key == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -115,10 +115,4 @@ public class CarpentryInterface implements ICarpentryInterface
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static {
|
||||
CarpentryInterface.woodMap = new LinkedHashMap<Integer, IDesignMaterial>();
|
||||
CarpentryInterface.designMap = new LinkedHashMap<Integer, IDesign>();
|
||||
CarpentryInterface.designCategories = new HashMap<String, IDesignCategory>();
|
||||
}
|
||||
}
|
||||
@@ -1,455 +1,442 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IToolHammer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
|
||||
public class DesignBlock
|
||||
{
|
||||
IDesign design;
|
||||
IDesignMaterial primaryMaterial;
|
||||
IDesignMaterial secondaryMaterial;
|
||||
int rotation;
|
||||
ForgeDirection facing;
|
||||
boolean panel;
|
||||
public class DesignBlock {
|
||||
protected IDesign design;
|
||||
protected IDesignMaterial primaryMaterial;
|
||||
protected IDesignMaterial secondaryMaterial;
|
||||
protected int rotation;
|
||||
protected ForgeDirection facing;
|
||||
protected boolean panel;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " { design:" + this.design + " }, { primary:" + this.primaryMaterial + " }, { secondary:" + this.secondaryMaterial + " }, { rotation:" + this.rotation + " }, { facing:" + this.facing + " }";
|
||||
}
|
||||
|
||||
public IDesign getDesign() {
|
||||
return this.design;
|
||||
}
|
||||
|
||||
public IDesignMaterial getPrimaryMaterial() {
|
||||
return this.primaryMaterial;
|
||||
}
|
||||
|
||||
public IDesignMaterial getSecondaryMaterial() {
|
||||
return this.secondaryMaterial;
|
||||
}
|
||||
|
||||
DesignBlock(final IDesignSystem system, final IDesignMaterial primaryWood, final IDesignMaterial secondaryWood, final IDesign design, final int rotation, final ForgeDirection dir) {
|
||||
DesignBlock(IDesignSystem system, IDesignMaterial primaryWood, IDesignMaterial secondaryWood, IDesign design, int rotation, ForgeDirection dir) {
|
||||
this.rotation = 0;
|
||||
this.facing = ForgeDirection.UP;
|
||||
this.panel = false;
|
||||
this.design = design;
|
||||
this.primaryMaterial = primaryWood;
|
||||
this.secondaryMaterial = secondaryWood;
|
||||
this.rotation = rotation;
|
||||
this.facing = dir;
|
||||
facing = ForgeDirection.UP;
|
||||
panel = false;
|
||||
primaryMaterial = primaryWood;
|
||||
secondaryMaterial = secondaryWood;
|
||||
facing = dir;
|
||||
|
||||
if (design == null) {
|
||||
this.design = EnumDesign.Blank;
|
||||
}
|
||||
if (primaryWood == null) {
|
||||
this.primaryMaterial = system.getDefaultMaterial();
|
||||
primaryMaterial = system.getDefaultMaterial();
|
||||
}
|
||||
if (secondaryWood == null) {
|
||||
this.secondaryMaterial = system.getDefaultMaterial();
|
||||
secondaryMaterial = system.getDefaultMaterial();
|
||||
}
|
||||
if (this.rotation > 3 || this.rotation < 0) {
|
||||
if (rotation > 3 || rotation < 0) {
|
||||
this.rotation = 0;
|
||||
}
|
||||
if (this.facing == null || this.facing == ForgeDirection.UNKNOWN) {
|
||||
this.facing = ForgeDirection.UP;
|
||||
if (facing == null || facing == ForgeDirection.UNKNOWN) {
|
||||
facing = ForgeDirection.UP;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " { design:" + design + " }, { primary:" + primaryMaterial + " }, { secondary:" + secondaryMaterial + " }, { rotation:" + rotation + " }, { facing:" + facing + " }";
|
||||
}
|
||||
|
||||
public IDesign getDesign() {
|
||||
return design;
|
||||
}
|
||||
|
||||
public IDesignMaterial getPrimaryMaterial() {
|
||||
return primaryMaterial;
|
||||
}
|
||||
|
||||
public IDesignMaterial getSecondaryMaterial() {
|
||||
return secondaryMaterial;
|
||||
}
|
||||
|
||||
public int getPrimaryColour() {
|
||||
return this.getPrimaryMaterial().getColour();
|
||||
return getPrimaryMaterial().getColour();
|
||||
}
|
||||
|
||||
public int getSecondaryColour() {
|
||||
return this.getSecondaryMaterial().getColour();
|
||||
return getSecondaryMaterial().getColour();
|
||||
}
|
||||
|
||||
ForgeDirection getRotation(final ForgeDirection dir, final ModuleCarpentry.Axis axis) {
|
||||
// TODO unused method?
|
||||
ForgeDirection getRotation(ForgeDirection dir, ModuleCarpentry.Axis axis) {
|
||||
if (axis == ModuleCarpentry.Axis.Y) {
|
||||
switch (dir) {
|
||||
case EAST: {
|
||||
return ForgeDirection.NORTH;
|
||||
case EAST:
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
case NORTH:
|
||||
return ForgeDirection.WEST;
|
||||
|
||||
case SOUTH:
|
||||
return ForgeDirection.EAST;
|
||||
|
||||
case WEST:
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
case NORTH: {
|
||||
return ForgeDirection.WEST;
|
||||
}
|
||||
case SOUTH: {
|
||||
return ForgeDirection.EAST;
|
||||
}
|
||||
case WEST: {
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
default: {
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (axis == ModuleCarpentry.Axis.X) {
|
||||
return dir;
|
||||
} else if (axis == ModuleCarpentry.Axis.X) {
|
||||
switch (dir) {
|
||||
case EAST: {
|
||||
return ForgeDirection.UP;
|
||||
case EAST:
|
||||
return ForgeDirection.UP;
|
||||
|
||||
case UP:
|
||||
return ForgeDirection.WEST;
|
||||
|
||||
case WEST:
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
case DOWN:
|
||||
return ForgeDirection.EAST;
|
||||
}
|
||||
case UP: {
|
||||
return ForgeDirection.WEST;
|
||||
}
|
||||
case WEST: {
|
||||
return ForgeDirection.DOWN;
|
||||
}
|
||||
case DOWN: {
|
||||
return ForgeDirection.EAST;
|
||||
}
|
||||
default: {
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return dir;
|
||||
} else {
|
||||
switch (dir) {
|
||||
case SOUTH: {
|
||||
return ForgeDirection.UP;
|
||||
}
|
||||
case UP: {
|
||||
return ForgeDirection.NORTH;
|
||||
}
|
||||
case NORTH: {
|
||||
return ForgeDirection.DOWN;
|
||||
}
|
||||
case DOWN: {
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
default: {
|
||||
return dir;
|
||||
}
|
||||
case SOUTH:
|
||||
return ForgeDirection.UP;
|
||||
|
||||
case UP:
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
case NORTH:
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
case DOWN:
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
|
||||
public ILayout getLayout(ForgeDirection dir) {
|
||||
ForgeDirection adjustedDir;
|
||||
dir = (adjustedDir = dir.getRotation(ForgeDirection.DOWN));
|
||||
switch (this.getFacing()) {
|
||||
case DOWN: {
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
break;
|
||||
switch (getFacing()) {
|
||||
case DOWN:
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.NORTH);
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.SOUTH);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.SOUTH);
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.SOUTH);
|
||||
break;
|
||||
}
|
||||
case EAST: {
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.NORTH);
|
||||
break;
|
||||
}
|
||||
case NORTH: {
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.SOUTH);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.SOUTH);
|
||||
break;
|
||||
}
|
||||
case SOUTH: {
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.SOUTH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < this.rotation; ++i) {
|
||||
|
||||
for (int i = 0; i < rotation; ++i) {
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.DOWN);
|
||||
}
|
||||
ILayout layout = null;
|
||||
|
||||
ILayout layout;
|
||||
switch (adjustedDir) {
|
||||
case EAST: {
|
||||
layout = this.getDesign().getEastPattern();
|
||||
break;
|
||||
}
|
||||
case NORTH: {
|
||||
layout = this.getDesign().getNorthPattern();
|
||||
break;
|
||||
}
|
||||
case SOUTH: {
|
||||
layout = this.getDesign().getSouthPattern();
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
layout = this.getDesign().getWestPattern();
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = this.getDesign().getBottomPattern();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
layout = this.getDesign().getTopPattern();
|
||||
break;
|
||||
}
|
||||
}
|
||||
Label_1107: {
|
||||
switch (this.getFacing()) {
|
||||
case UP: {
|
||||
if (dir == ForgeDirection.DOWN || dir == ForgeDirection.UP) {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
layout = getDesign().getEastPattern();
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
switch (dir) {
|
||||
case UP:
|
||||
case DOWN: {
|
||||
layout = layout.flipVertical();
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
case WEST: {
|
||||
layout = layout.rotateRight().rotateRight();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dir == ForgeDirection.DOWN || dir == ForgeDirection.UP) {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NORTH:
|
||||
layout = getDesign().getNorthPattern();
|
||||
break;
|
||||
}
|
||||
case EAST: {
|
||||
switch (dir) {
|
||||
case SOUTH:
|
||||
|
||||
case SOUTH:
|
||||
layout = getDesign().getSouthPattern();
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
layout = getDesign().getWestPattern();
|
||||
break;
|
||||
|
||||
case DOWN:
|
||||
layout = getDesign().getBottomPattern();
|
||||
break;
|
||||
|
||||
default:
|
||||
layout = getDesign().getTopPattern();
|
||||
}
|
||||
|
||||
// TODO remove label
|
||||
Label_1107:
|
||||
{
|
||||
switch (getFacing()) {
|
||||
case UP: {
|
||||
layout = layout.rotateRight();
|
||||
break;
|
||||
}
|
||||
case NORTH: {
|
||||
layout = layout.rotateLeft();
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.rotateLeft().flipHorizontal();
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
layout = layout.flipHorizontal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dir == ForgeDirection.EAST) {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
}
|
||||
if (dir == ForgeDirection.WEST) {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
if (dir == ForgeDirection.DOWN || dir == ForgeDirection.UP) {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
switch (dir) {
|
||||
case NORTH: {
|
||||
layout = layout.rotateRight();
|
||||
break;
|
||||
}
|
||||
case SOUTH:
|
||||
case UP: {
|
||||
layout = layout.rotateLeft();
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.rotateLeft().flipVertical();
|
||||
switch (dir) {
|
||||
case UP:
|
||||
case DOWN: {
|
||||
layout = layout.flipVertical();
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
case WEST: {
|
||||
layout = layout.rotateRight().rotateRight();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dir == ForgeDirection.DOWN || dir == ForgeDirection.UP) {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EAST: {
|
||||
layout = layout.flipHorizontal();
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
switch (dir) {
|
||||
case SOUTH:
|
||||
case UP: {
|
||||
layout = layout.rotateRight();
|
||||
break;
|
||||
}
|
||||
case NORTH: {
|
||||
layout = layout.rotateLeft();
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.rotateLeft().flipHorizontal();
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
layout = layout.flipHorizontal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dir == ForgeDirection.EAST) {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
}
|
||||
if (dir == ForgeDirection.WEST) {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
switch (dir) {
|
||||
case NORTH: {
|
||||
layout = layout.rotateRight();
|
||||
break;
|
||||
}
|
||||
case SOUTH:
|
||||
case UP: {
|
||||
layout = layout.rotateLeft();
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.rotateLeft().flipVertical();
|
||||
break;
|
||||
}
|
||||
case EAST: {
|
||||
layout = layout.flipHorizontal();
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NORTH: {
|
||||
switch (dir) {
|
||||
case WEST: {
|
||||
layout = layout.rotateLeft();
|
||||
break Label_1107;
|
||||
}
|
||||
case EAST: {
|
||||
layout = layout.rotateRight();
|
||||
break Label_1107;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.flipHorizontal();
|
||||
break Label_1107;
|
||||
case NORTH: {
|
||||
switch (dir) {
|
||||
case WEST: {
|
||||
layout = layout.rotateLeft();
|
||||
break Label_1107;
|
||||
}
|
||||
case EAST: {
|
||||
layout = layout.rotateRight();
|
||||
break Label_1107;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.flipHorizontal();
|
||||
break Label_1107;
|
||||
}
|
||||
case SOUTH: {
|
||||
layout = layout.flipHorizontal();
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
case NORTH: {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
default: {
|
||||
break Label_1107;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
case SOUTH: {
|
||||
layout = layout.flipHorizontal();
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
switch (dir) {
|
||||
case EAST: {
|
||||
layout = layout.rotateLeft();
|
||||
break Label_1107;
|
||||
}
|
||||
case WEST: {
|
||||
layout = layout.rotateRight();
|
||||
break Label_1107;
|
||||
}
|
||||
case UP: {
|
||||
layout = layout.rotateRight().rotateRight();
|
||||
break Label_1107;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.flipVertical();
|
||||
break Label_1107;
|
||||
}
|
||||
case NORTH: {
|
||||
layout = layout.flipHorizontal();
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
case SOUTH: {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
default: {
|
||||
break Label_1107;
|
||||
}
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
case NORTH: {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
default: {
|
||||
break Label_1107;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
case SOUTH: {
|
||||
switch (dir) {
|
||||
case EAST: {
|
||||
layout = layout.rotateLeft();
|
||||
break Label_1107;
|
||||
}
|
||||
case WEST: {
|
||||
layout = layout.rotateRight();
|
||||
break Label_1107;
|
||||
}
|
||||
case UP: {
|
||||
layout = layout.rotateRight().rotateRight();
|
||||
break Label_1107;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.flipVertical();
|
||||
break Label_1107;
|
||||
}
|
||||
case NORTH: {
|
||||
layout = layout.flipHorizontal();
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
case SOUTH: {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
default: {
|
||||
break Label_1107;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return layout;
|
||||
}
|
||||
|
||||
public IIcon getPrimaryIcon(final IDesignSystem system, final ForgeDirection dir) {
|
||||
final ILayout l = this.getLayout(dir);
|
||||
return (l == null) ? null : l.getPrimaryIcon(system);
|
||||
public IIcon getPrimaryIcon(IDesignSystem system, ForgeDirection dir) {
|
||||
ILayout layout = getLayout(dir);
|
||||
return (layout == null) ? null : layout.getPrimaryIcon(system);
|
||||
}
|
||||
|
||||
public IIcon getSecondaryIcon(final IDesignSystem system, final ForgeDirection dir) {
|
||||
final ILayout l = this.getLayout(dir);
|
||||
return (l == null) ? null : l.getSecondaryIcon(system);
|
||||
public IIcon getSecondaryIcon(IDesignSystem system, ForgeDirection dir) {
|
||||
ILayout layout = getLayout(dir);
|
||||
return (layout == null) ? null : layout.getSecondaryIcon(system);
|
||||
}
|
||||
|
||||
public IIcon getIcon(final IDesignSystem system, final boolean secondary, final ForgeDirection dir) {
|
||||
return secondary ? this.getSecondaryIcon(system, dir) : this.getPrimaryIcon(system, dir);
|
||||
public IIcon getIcon(IDesignSystem system, boolean secondary, ForgeDirection dir) {
|
||||
return secondary ? getSecondaryIcon(system, dir) : getPrimaryIcon(system, dir);
|
||||
}
|
||||
|
||||
public ForgeDirection getFacing() {
|
||||
return this.facing;
|
||||
return facing;
|
||||
}
|
||||
|
||||
public void setFacing(ForgeDirection facing) {
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
public int getRotation() {
|
||||
return this.rotation;
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public void rotate(final int face, final ItemStack hammer, final EntityPlayer player, final World world, final int x, final int y, final int z) {
|
||||
final ForgeDirection dir = ForgeDirection.getOrientation(face);
|
||||
final IToolHammer hammerI = (IToolHammer) hammer.getItem();
|
||||
public void rotate(int face, ItemStack hammer, EntityPlayer player, World world, int x, int y, int z) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(face);
|
||||
IToolHammer hammerI = (IToolHammer) hammer.getItem();
|
||||
if (player.isSneaking()) {
|
||||
if (this.panel) {
|
||||
ForgeDirection newFacing = this.getFacing();
|
||||
if (panel) {
|
||||
ForgeDirection newFacing = getFacing();
|
||||
do {
|
||||
newFacing = ForgeDirection.getOrientation(newFacing.ordinal() + 1);
|
||||
if (newFacing == ForgeDirection.UNKNOWN) {
|
||||
newFacing = ForgeDirection.DOWN;
|
||||
}
|
||||
} while (newFacing != this.getFacing() && !BlockCarpentryPanel.isValidPanelPlacement(world, x, y, z, newFacing));
|
||||
if (newFacing != this.getFacing()) {
|
||||
} while (newFacing != getFacing() && !BlockCarpentryPanel.isValidPanelPlacement(world, x, y, z, newFacing));
|
||||
|
||||
if (newFacing != getFacing()) {
|
||||
hammerI.onHammerUsed(hammer, player);
|
||||
}
|
||||
this.setFacing(newFacing);
|
||||
}
|
||||
else {
|
||||
if (dir != this.getFacing()) {
|
||||
setFacing(newFacing);
|
||||
} else {
|
||||
if (dir != getFacing()) {
|
||||
hammerI.onHammerUsed(hammer, player);
|
||||
}
|
||||
this.setFacing(dir);
|
||||
setFacing(dir);
|
||||
}
|
||||
}
|
||||
else {
|
||||
++this.rotation;
|
||||
} else {
|
||||
rotation++;
|
||||
hammerI.onHammerUsed(hammer, player);
|
||||
}
|
||||
if (this.rotation > 3) {
|
||||
this.rotation = 0;
|
||||
|
||||
if (rotation > 3) {
|
||||
rotation = 0;
|
||||
}
|
||||
if (this.rotation < 0) {
|
||||
this.rotation = 3;
|
||||
if (rotation < 0) {
|
||||
rotation = 3;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFacing(final ForgeDirection facing) {
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
public int getBlockMetadata(final IDesignSystem system) {
|
||||
public int getBlockMetadata(IDesignSystem system) {
|
||||
return ModuleCarpentry.getBlockMetadata(system, this);
|
||||
}
|
||||
|
||||
public int getItemMetadata(final IDesignSystem system) {
|
||||
public int getItemMetadata(IDesignSystem system) {
|
||||
return ModuleCarpentry.getItemMetadata(system, this);
|
||||
}
|
||||
|
||||
public void setPanel() {
|
||||
this.panel = true;
|
||||
panel = true;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
String type = "";
|
||||
if (this.getPrimaryMaterial() != this.getSecondaryMaterial()) {
|
||||
type = this.getPrimaryMaterial().getName() + " and " + this.getSecondaryMaterial().getName();
|
||||
String type;
|
||||
if (getPrimaryMaterial() != getSecondaryMaterial()) {
|
||||
type = getPrimaryMaterial().getName() + " and " + getSecondaryMaterial().getName();
|
||||
} else {
|
||||
type = getPrimaryMaterial().getName();
|
||||
}
|
||||
else {
|
||||
type = this.getPrimaryMaterial().getName();
|
||||
}
|
||||
return super.toString() + " " + "{" + type + " " + this.getDesign().getName() + " " + (this.panel ? "Panel" : "Tile") + ", Facing:" + this.getFacing().toString() + ", Rotation:" + this.getRotation() + "}";
|
||||
return super.toString() + " " + "{" + type + " " + getDesign().getName() + " " + (panel ? "Panel" : "Tile") + ", Facing:" + getFacing().toString() + ", Rotation:" + getRotation() + "}";
|
||||
}
|
||||
}
|
||||
@@ -1,163 +1,144 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
import binnie.extratrees.item.ExtraTreeItems;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.api.CarpentryManager;
|
||||
import binnie.extratrees.block.PlankType;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import java.util.HashMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
import java.util.Map;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
import binnie.extratrees.block.PlankType;
|
||||
import binnie.extratrees.item.ExtraTreeItems;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public enum DesignSystem implements IDesignSystem
|
||||
{
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum DesignSystem implements IDesignSystem {
|
||||
Wood,
|
||||
Glass;
|
||||
|
||||
Map<Integer, IIcon> primary;
|
||||
Map<Integer, IIcon> secondary;
|
||||
protected Map<Integer, IIcon> primary;
|
||||
protected Map<Integer, IIcon> secondary;
|
||||
|
||||
private DesignSystem() {
|
||||
this.primary = new HashMap<Integer, IIcon>();
|
||||
this.secondary = new HashMap<Integer, IIcon>();
|
||||
DesignSystem() {
|
||||
primary = new HashMap<>();
|
||||
secondary = new HashMap<>();
|
||||
DesignerManager.instance.registerDesignSystem(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getDefaultMaterial() {
|
||||
switch (this) {
|
||||
case Glass: {
|
||||
return GlassType.get(0);
|
||||
}
|
||||
case Wood: {
|
||||
return PlankType.ExtraTreePlanks.Fir;
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
case Glass: {
|
||||
return GlassType.get(0);
|
||||
}
|
||||
case Wood: {
|
||||
return PlankType.ExtraTreePlanks.Fir;
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getDefaultMaterial2() {
|
||||
switch (this) {
|
||||
case Glass: {
|
||||
return GlassType.get(1);
|
||||
}
|
||||
case Wood: {
|
||||
return PlankType.ExtraTreePlanks.Whitebeam;
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
case Glass: {
|
||||
return GlassType.get(1);
|
||||
}
|
||||
case Wood: {
|
||||
return PlankType.ExtraTreePlanks.Whitebeam;
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getMaterial(final int id) {
|
||||
public IDesignMaterial getMaterial(int id) {
|
||||
switch (this) {
|
||||
case Glass: {
|
||||
return GlassType.get(id);
|
||||
}
|
||||
case Wood: {
|
||||
return CarpentryManager.carpentryInterface.getWoodMaterial(id);
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
case Glass:
|
||||
return GlassType.get(id);
|
||||
|
||||
case Wood:
|
||||
return CarpentryManager.carpentryInterface.getWoodMaterial(id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaterialIndex(final IDesignMaterial id) {
|
||||
public int getMaterialIndex(IDesignMaterial id) {
|
||||
switch (this) {
|
||||
case Glass: {
|
||||
return GlassType.getIndex(id);
|
||||
}
|
||||
case Wood: {
|
||||
return CarpentryManager.carpentryInterface.getCarpentryWoodIndex(id);
|
||||
}
|
||||
default: {
|
||||
return 0;
|
||||
}
|
||||
case Glass:
|
||||
return GlassType.getIndex(id);
|
||||
|
||||
case Wood:
|
||||
return CarpentryManager.carpentryInterface.getCarpentryWoodIndex(id);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getTexturePath() {
|
||||
switch (this) {
|
||||
case Glass: {
|
||||
return "glass";
|
||||
}
|
||||
case Wood: {
|
||||
return "patterns";
|
||||
}
|
||||
default: {
|
||||
return "";
|
||||
}
|
||||
case Glass:
|
||||
return "glass";
|
||||
|
||||
case Wood:
|
||||
return "patterns";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getMaterial(final ItemStack stack) {
|
||||
public IDesignMaterial getMaterial(ItemStack stack) {
|
||||
switch (this) {
|
||||
case Glass: {
|
||||
return GlassType.get(stack);
|
||||
}
|
||||
case Wood: {
|
||||
return CarpentryManager.carpentryInterface.getWoodMaterial(stack);
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
case Glass:
|
||||
return GlassType.get(stack);
|
||||
|
||||
case Wood:
|
||||
return CarpentryManager.carpentryInterface.getWoodMaterial(stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getAdhesive() {
|
||||
switch (this) {
|
||||
case Glass: {
|
||||
return ExtraTreeItems.GlassFitting.get(1);
|
||||
}
|
||||
case Wood: {
|
||||
return ExtraTreeItems.WoodWax.get(1);
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
case Glass:
|
||||
return ExtraTreeItems.GlassFitting.get(1);
|
||||
|
||||
@Override
|
||||
public IIcon getPrimaryIcon(final IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return this.primary.get(((EnumPattern) pattern).ordinal());
|
||||
case Wood:
|
||||
return ExtraTreeItems.WoodWax.get(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getSecondaryIcon(final IPattern pattern) {
|
||||
public IIcon getPrimaryIcon(IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return this.secondary.get(((EnumPattern) pattern).ordinal());
|
||||
return primary.get(((EnumPattern) pattern).ordinal());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
for (final EnumPattern pattern : EnumPattern.values()) {
|
||||
this.primary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
|
||||
this.secondary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
|
||||
public IIcon getSecondaryIcon(IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return secondary.get(((EnumPattern) pattern).ordinal());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (EnumPattern pattern : EnumPattern.values()) {
|
||||
primary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
|
||||
secondary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +1,33 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.ArrayList;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class DesignerManager
|
||||
{
|
||||
public class DesignerManager {
|
||||
public static DesignerManager instance;
|
||||
List<IDesignSystem> systems;
|
||||
|
||||
public DesignerManager() {
|
||||
this.systems = new ArrayList<IDesignSystem>();
|
||||
}
|
||||
|
||||
public void registerDesignSystem(final IDesignSystem system) {
|
||||
this.systems.add(system);
|
||||
}
|
||||
|
||||
public Collection<IDesignSystem> getDesignSystems() {
|
||||
return this.systems;
|
||||
}
|
||||
|
||||
public void addDesignSystem(final DesignSystem system) {
|
||||
this.systems.add(system);
|
||||
}
|
||||
|
||||
static {
|
||||
DesignerManager.instance = new DesignerManager();
|
||||
}
|
||||
|
||||
List<IDesignSystem> systems;
|
||||
|
||||
public DesignerManager() {
|
||||
systems = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void registerDesignSystem(IDesignSystem system) {
|
||||
systems.add(system);
|
||||
}
|
||||
|
||||
public Collection<IDesignSystem> getDesignSystems() {
|
||||
return systems;
|
||||
}
|
||||
|
||||
public void addDesignSystem(DesignSystem system) {
|
||||
systems.add(system);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,14 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import binnie.extratrees.api.CarpentryManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.api.IDesignCategory;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
|
||||
public enum EnumDesign implements IDesign
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public enum EnumDesign implements IDesign {
|
||||
Blank("Blank"),
|
||||
Octagon("Octagon"),
|
||||
Diamond("Diamond"),
|
||||
@@ -115,209 +111,6 @@ public enum EnumDesign implements IDesign
|
||||
OverlappedBarred("Overlapped Barred"),
|
||||
OverlappedSplitBarred("Overlapped Split Barred");
|
||||
|
||||
String name;
|
||||
ILayout topPattern;
|
||||
ILayout bottomPattern;
|
||||
ILayout northPattern;
|
||||
ILayout southPattern;
|
||||
ILayout eastPattern;
|
||||
ILayout westPattern;
|
||||
|
||||
void setEdgePatterns(final ILayout north, final ILayout east, final ILayout south, final ILayout west) {
|
||||
this.setNorthPattern(north);
|
||||
this.setEastPattern(east);
|
||||
this.setSouthPattern(south);
|
||||
this.setWestPattern(west);
|
||||
}
|
||||
|
||||
void setEdgePatterns(final ILayout face) {
|
||||
this.setEdgePatterns(face, face, face, face);
|
||||
}
|
||||
|
||||
void setupStriped(final ILayout vert) {
|
||||
this.setTopPattern(vert);
|
||||
this.setEdgePatterns(vert.invert(), EnumPattern.Blank.layout(true), vert, EnumPattern.Blank.layout());
|
||||
}
|
||||
|
||||
void setChequered(final ILayout cheq) {
|
||||
this.setAllPatterns(cheq);
|
||||
this.setNorthPattern(cheq.invert());
|
||||
this.setSouthPattern(cheq.invert());
|
||||
this.setBottomPattern(cheq.invert());
|
||||
}
|
||||
|
||||
void setStripedChequered(final ILayout cheq, final ILayout stripe) {
|
||||
this.setAllPatterns(cheq);
|
||||
this.setNorthPattern(stripe.invert());
|
||||
this.setSouthPattern(stripe.invert());
|
||||
this.setEastPattern(stripe);
|
||||
this.setWestPattern(stripe);
|
||||
}
|
||||
|
||||
void setCornered(final ILayout corner, final ILayout edge) {
|
||||
this.setTopPattern(corner);
|
||||
this.setNorthPattern(EnumPattern.Blank.layout());
|
||||
this.setEastPattern(edge.flipHorizontal());
|
||||
this.setSouthPattern(edge);
|
||||
this.setWestPattern(EnumPattern.Blank.layout());
|
||||
}
|
||||
|
||||
void setEdged(final ILayout edge) {
|
||||
this.setAllPatterns(edge);
|
||||
this.setWestPattern(EnumPattern.Blank.layout());
|
||||
this.setEastPattern(EnumPattern.Blank.layout(true));
|
||||
this.northPattern = this.northPattern.flipHorizontal();
|
||||
}
|
||||
|
||||
void setBarred(final ILayout bar) {
|
||||
this.setAllPatterns(bar);
|
||||
this.setEastPattern(EnumPattern.Blank.layout(true));
|
||||
this.setWestPattern(EnumPattern.Blank.layout(true));
|
||||
}
|
||||
|
||||
void setDiagonal(final ILayout diagonal, final ILayout edged) {
|
||||
this.setAllPatterns(edged);
|
||||
this.setTopPattern(diagonal);
|
||||
this.northPattern = this.northPattern.flipHorizontal();
|
||||
this.southPattern = this.southPattern.flipHorizontal();
|
||||
}
|
||||
|
||||
void setSaltire(final ILayout saltire, final ILayout bar) {
|
||||
this.setTopPattern(saltire);
|
||||
this.setEdgePatterns(bar.invert());
|
||||
}
|
||||
|
||||
void setCross(final ILayout saltire, final ILayout bar) {
|
||||
this.setTopPattern(saltire);
|
||||
this.setEdgePatterns(bar);
|
||||
}
|
||||
|
||||
void setTSection(final ILayout tsection, final ILayout bar) {
|
||||
this.setTopPattern(tsection);
|
||||
this.setEdgePatterns(bar);
|
||||
this.setWestPattern(EnumPattern.Blank.layout(true));
|
||||
}
|
||||
|
||||
void setBarredCorner(final ILayout corner, final ILayout bar) {
|
||||
this.setTSection(corner, bar);
|
||||
this.setNorthPattern(EnumPattern.Blank.layout(true));
|
||||
}
|
||||
|
||||
void setStripedCorner(final ILayout corner, final ILayout striped) {
|
||||
this.setCornered(corner, striped);
|
||||
}
|
||||
|
||||
void setLetterPattern(final ILayout letter) {
|
||||
this.setAllPatterns(EnumPattern.Blank.layout(true));
|
||||
this.setTopPattern(letter);
|
||||
this.setBottomPattern(EnumPattern.Blank.layout(true));
|
||||
}
|
||||
|
||||
void setBarredEndPattern(final ILayout end, final ILayout bar) {
|
||||
this.setAllPatterns(EnumPattern.Blank.layout(true));
|
||||
this.setTopPattern(end);
|
||||
this.setWestPattern(bar);
|
||||
}
|
||||
|
||||
void setDiagonalCorner(final ILayout diagonal, final ILayout bar, final ILayout edged) {
|
||||
this.setAllPatterns(EnumPattern.Blank.layout(true));
|
||||
this.setTopPattern(diagonal);
|
||||
this.setWestPattern(bar.invert());
|
||||
this.setNorthPattern(edged.flipHorizontal());
|
||||
this.setSouthPattern(edged);
|
||||
}
|
||||
|
||||
void setDiagonalTSection(final ILayout diagonal, final ILayout bar, final ILayout edged) {
|
||||
this.setAllPatterns(EnumPattern.Blank.layout(true));
|
||||
this.setTopPattern(diagonal);
|
||||
this.setWestPattern(bar.invert());
|
||||
this.setNorthPattern(bar.invert());
|
||||
this.setEastPattern(edged.flipHorizontal());
|
||||
this.setSouthPattern(edged);
|
||||
}
|
||||
|
||||
private EnumDesign(final String name) {
|
||||
this.topPattern = Layout.get(EnumPattern.Blank, false);
|
||||
this.bottomPattern = Layout.get(EnumPattern.Blank, false);
|
||||
this.northPattern = Layout.get(EnumPattern.Blank, false);
|
||||
this.eastPattern = Layout.get(EnumPattern.Blank, false);
|
||||
this.southPattern = Layout.get(EnumPattern.Blank, false);
|
||||
this.westPattern = Layout.get(EnumPattern.Blank, false);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
private void setAllPatterns(final ILayout layout) {
|
||||
this.setTopPattern(layout);
|
||||
this.setBottomPattern(layout);
|
||||
this.setNorthPattern(layout);
|
||||
this.setEastPattern(layout);
|
||||
this.setSouthPattern(layout);
|
||||
this.setWestPattern(layout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getTopPattern() {
|
||||
return this.topPattern;
|
||||
}
|
||||
|
||||
public void setTopPattern(final ILayout layout) {
|
||||
this.setBottomPattern(this.topPattern = layout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getBottomPattern() {
|
||||
return this.bottomPattern;
|
||||
}
|
||||
|
||||
public void setBottomPattern(final ILayout layout) {
|
||||
this.bottomPattern = layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getNorthPattern() {
|
||||
return this.northPattern;
|
||||
}
|
||||
|
||||
public void setNorthPattern(final ILayout layout) {
|
||||
this.northPattern = layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getSouthPattern() {
|
||||
return this.southPattern;
|
||||
}
|
||||
|
||||
public void setSouthPattern(final ILayout layout) {
|
||||
this.southPattern = layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getEastPattern() {
|
||||
return this.eastPattern;
|
||||
}
|
||||
|
||||
public void setEastPattern(final ILayout layout) {
|
||||
this.eastPattern = layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getWestPattern() {
|
||||
return this.westPattern;
|
||||
}
|
||||
|
||||
public void setWestPattern(final ILayout layout) {
|
||||
this.westPattern = layout;
|
||||
}
|
||||
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
static {
|
||||
Category.Design.addDesign(EnumDesign.Blank);
|
||||
Category.Design.addDesign(EnumDesign.Octagon);
|
||||
@@ -480,8 +273,210 @@ public enum EnumDesign implements IDesign
|
||||
EnumDesign.OverlappedBarred.setTopPattern(EnumPattern.OverlappedBarred.layout());
|
||||
}
|
||||
|
||||
enum Category implements IDesignCategory
|
||||
{
|
||||
protected String name;
|
||||
protected ILayout topPattern;
|
||||
protected ILayout bottomPattern;
|
||||
protected ILayout northPattern;
|
||||
protected ILayout southPattern;
|
||||
protected ILayout eastPattern;
|
||||
protected ILayout westPattern;
|
||||
|
||||
EnumDesign(String name) {
|
||||
this.name = name;
|
||||
topPattern = Layout.get(EnumPattern.Blank, false);
|
||||
bottomPattern = Layout.get(EnumPattern.Blank, false);
|
||||
northPattern = Layout.get(EnumPattern.Blank, false);
|
||||
eastPattern = Layout.get(EnumPattern.Blank, false);
|
||||
southPattern = Layout.get(EnumPattern.Blank, false);
|
||||
westPattern = Layout.get(EnumPattern.Blank, false);
|
||||
}
|
||||
|
||||
void setEdgePatterns(ILayout north, ILayout east, ILayout south, ILayout west) {
|
||||
setNorthPattern(north);
|
||||
setEastPattern(east);
|
||||
setSouthPattern(south);
|
||||
setWestPattern(west);
|
||||
}
|
||||
|
||||
void setEdgePatterns(ILayout face) {
|
||||
setEdgePatterns(face, face, face, face);
|
||||
}
|
||||
|
||||
void setupStriped(ILayout vert) {
|
||||
setTopPattern(vert);
|
||||
setEdgePatterns(vert.invert(), EnumPattern.Blank.layout(true), vert, EnumPattern.Blank.layout());
|
||||
}
|
||||
|
||||
void setChequered(ILayout cheq) {
|
||||
setAllPatterns(cheq);
|
||||
setNorthPattern(cheq.invert());
|
||||
setSouthPattern(cheq.invert());
|
||||
setBottomPattern(cheq.invert());
|
||||
}
|
||||
|
||||
void setStripedChequered(ILayout cheq, ILayout stripe) {
|
||||
setAllPatterns(cheq);
|
||||
setNorthPattern(stripe.invert());
|
||||
setSouthPattern(stripe.invert());
|
||||
setEastPattern(stripe);
|
||||
setWestPattern(stripe);
|
||||
}
|
||||
|
||||
void setCornered(ILayout corner, ILayout edge) {
|
||||
setTopPattern(corner);
|
||||
setNorthPattern(EnumPattern.Blank.layout());
|
||||
setEastPattern(edge.flipHorizontal());
|
||||
setSouthPattern(edge);
|
||||
setWestPattern(EnumPattern.Blank.layout());
|
||||
}
|
||||
|
||||
void setEdged(ILayout edge) {
|
||||
setAllPatterns(edge);
|
||||
setWestPattern(EnumPattern.Blank.layout());
|
||||
setEastPattern(EnumPattern.Blank.layout(true));
|
||||
northPattern = northPattern.flipHorizontal();
|
||||
}
|
||||
|
||||
void setBarred(ILayout bar) {
|
||||
setAllPatterns(bar);
|
||||
setEastPattern(EnumPattern.Blank.layout(true));
|
||||
setWestPattern(EnumPattern.Blank.layout(true));
|
||||
}
|
||||
|
||||
void setDiagonal(ILayout diagonal, ILayout edged) {
|
||||
setAllPatterns(edged);
|
||||
setTopPattern(diagonal);
|
||||
northPattern = northPattern.flipHorizontal();
|
||||
southPattern = southPattern.flipHorizontal();
|
||||
}
|
||||
|
||||
void setSaltire(ILayout saltire, ILayout bar) {
|
||||
setTopPattern(saltire);
|
||||
setEdgePatterns(bar.invert());
|
||||
}
|
||||
|
||||
void setCross(ILayout saltire, ILayout bar) {
|
||||
setTopPattern(saltire);
|
||||
setEdgePatterns(bar);
|
||||
}
|
||||
|
||||
void setTSection(ILayout tsection, ILayout bar) {
|
||||
setTopPattern(tsection);
|
||||
setEdgePatterns(bar);
|
||||
setWestPattern(EnumPattern.Blank.layout(true));
|
||||
}
|
||||
|
||||
void setBarredCorner(ILayout corner, ILayout bar) {
|
||||
setTSection(corner, bar);
|
||||
setNorthPattern(EnumPattern.Blank.layout(true));
|
||||
}
|
||||
|
||||
void setStripedCorner(ILayout corner, ILayout striped) {
|
||||
setCornered(corner, striped);
|
||||
}
|
||||
|
||||
void setLetterPattern(ILayout letter) {
|
||||
setAllPatterns(EnumPattern.Blank.layout(true));
|
||||
setTopPattern(letter);
|
||||
setBottomPattern(EnumPattern.Blank.layout(true));
|
||||
}
|
||||
|
||||
void setBarredEndPattern(ILayout end, ILayout bar) {
|
||||
setAllPatterns(EnumPattern.Blank.layout(true));
|
||||
setTopPattern(end);
|
||||
setWestPattern(bar);
|
||||
}
|
||||
|
||||
void setDiagonalCorner(ILayout diagonal, ILayout bar, ILayout edged) {
|
||||
setAllPatterns(EnumPattern.Blank.layout(true));
|
||||
setTopPattern(diagonal);
|
||||
setWestPattern(bar.invert());
|
||||
setNorthPattern(edged.flipHorizontal());
|
||||
setSouthPattern(edged);
|
||||
}
|
||||
|
||||
void setDiagonalTSection(ILayout diagonal, ILayout bar, ILayout edged) {
|
||||
setAllPatterns(EnumPattern.Blank.layout(true));
|
||||
setTopPattern(diagonal);
|
||||
setWestPattern(bar.invert());
|
||||
setNorthPattern(bar.invert());
|
||||
setEastPattern(edged.flipHorizontal());
|
||||
setSouthPattern(edged);
|
||||
}
|
||||
|
||||
private void setAllPatterns(ILayout layout) {
|
||||
setTopPattern(layout);
|
||||
setBottomPattern(layout);
|
||||
setNorthPattern(layout);
|
||||
setEastPattern(layout);
|
||||
setSouthPattern(layout);
|
||||
setWestPattern(layout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getTopPattern() {
|
||||
return topPattern;
|
||||
}
|
||||
|
||||
public void setTopPattern(ILayout layout) {
|
||||
setBottomPattern(topPattern = layout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getBottomPattern() {
|
||||
return bottomPattern;
|
||||
}
|
||||
|
||||
public void setBottomPattern(ILayout layout) {
|
||||
bottomPattern = layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getNorthPattern() {
|
||||
return northPattern;
|
||||
}
|
||||
|
||||
public void setNorthPattern(ILayout layout) {
|
||||
northPattern = layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getSouthPattern() {
|
||||
return southPattern;
|
||||
}
|
||||
|
||||
public void setSouthPattern(ILayout layout) {
|
||||
southPattern = layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getEastPattern() {
|
||||
return eastPattern;
|
||||
}
|
||||
|
||||
public void setEastPattern(ILayout layout) {
|
||||
eastPattern = layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getWestPattern() {
|
||||
return westPattern;
|
||||
}
|
||||
|
||||
public void setWestPattern(ILayout layout) {
|
||||
westPattern = layout;
|
||||
}
|
||||
|
||||
enum Category implements IDesignCategory {
|
||||
Design("Designs & Emblems"),
|
||||
Stripes("Squares & Stripes"),
|
||||
Edges("Edges"),
|
||||
@@ -489,33 +484,33 @@ public enum EnumDesign implements IDesign
|
||||
Letters("Letters"),
|
||||
Diagonal("Diagonals");
|
||||
|
||||
String name;
|
||||
List<IDesign> designs;
|
||||
protected String name;
|
||||
protected List<IDesign> designs;
|
||||
|
||||
private Category(final String name) {
|
||||
this.designs = new ArrayList<IDesign>();
|
||||
Category(String name) {
|
||||
this.name = name;
|
||||
designs = new ArrayList<>();
|
||||
CarpentryManager.carpentryInterface.registerDesignCategory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IDesign> getDesigns() {
|
||||
return this.designs;
|
||||
return designs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDesign(final IDesign design) {
|
||||
this.designs.add(design);
|
||||
public void addDesign(IDesign design) {
|
||||
designs.add(design);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.toString().toLowerCase();
|
||||
return toString().toLowerCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,12 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public enum EnumPattern implements IPattern
|
||||
{
|
||||
public enum EnumPattern implements IPattern {
|
||||
Blank,
|
||||
Octagon,
|
||||
Diamond,
|
||||
@@ -226,122 +221,6 @@ public enum EnumPattern implements IPattern
|
||||
OverlappedBarred,
|
||||
OverlappedBarred2;
|
||||
|
||||
ILayout leftRotation;
|
||||
ILayout horizontalFlip;
|
||||
|
||||
private EnumPattern() {
|
||||
this.leftRotation = Layout.get(this, false);
|
||||
this.horizontalFlip = Layout.get(this, false);
|
||||
}
|
||||
|
||||
static void setupStripedPattern(final EnumPattern vert, final EnumPattern hori) {
|
||||
vert.setLeftRotation(hori, true);
|
||||
hori.setLeftRotation(vert, false);
|
||||
vert.setHorizontalFlip(vert, true);
|
||||
}
|
||||
|
||||
static void setupChequeredPattern(final EnumPattern cheq) {
|
||||
cheq.setLeftRotation(cheq, true);
|
||||
cheq.setHorizontalFlip(cheq, true);
|
||||
}
|
||||
|
||||
static void setupCornerPattern(final EnumPattern tl, final EnumPattern tr, final EnumPattern br, final EnumPattern bl) {
|
||||
tl.setLeftRotation(bl, false);
|
||||
tr.setLeftRotation(tl, false);
|
||||
br.setLeftRotation(tr, false);
|
||||
bl.setLeftRotation(br, false);
|
||||
tl.setHorizontalFlip(tr, false);
|
||||
bl.setHorizontalFlip(br, false);
|
||||
}
|
||||
|
||||
static void setupInvert2Rot(final EnumPattern a, final EnumPattern b) {
|
||||
a.setLeftRotation(b, true);
|
||||
b.setLeftRotation(a, false);
|
||||
a.setHorizontalFlip(b, false);
|
||||
}
|
||||
|
||||
static void set2Rotation(final EnumPattern a, final EnumPattern b) {
|
||||
a.setLeftRotation(b, false);
|
||||
b.setLeftRotation(a, false);
|
||||
a.setHorizontalFlip(b, false);
|
||||
}
|
||||
|
||||
static void setupBarredPattern(final EnumPattern vert, final EnumPattern hori) {
|
||||
vert.setLeftRotation(hori, false);
|
||||
hori.setLeftRotation(vert, false);
|
||||
}
|
||||
|
||||
static void setupEdgedPattern(final EnumPattern l, final EnumPattern t, final EnumPattern r, final EnumPattern b) {
|
||||
l.setLeftRotation(b, false);
|
||||
t.setLeftRotation(l, false);
|
||||
r.setLeftRotation(t, false);
|
||||
b.setLeftRotation(r, false);
|
||||
l.setHorizontalFlip(r, false);
|
||||
}
|
||||
|
||||
static void setupDiagonalPattern(final EnumPattern a, final EnumPattern b) {
|
||||
a.setLeftRotation(b, false);
|
||||
b.setLeftRotation(a, false);
|
||||
a.setHorizontalFlip(b, false);
|
||||
}
|
||||
|
||||
static void setupBarredPattern(final EnumPattern l, final EnumPattern t, final EnumPattern r, final EnumPattern b) {
|
||||
l.setLeftRotation(b, false);
|
||||
t.setLeftRotation(l, false);
|
||||
r.setLeftRotation(t, false);
|
||||
b.setLeftRotation(r, false);
|
||||
l.setHorizontalFlip(r, false);
|
||||
}
|
||||
|
||||
static void setupTSectionPattern(final EnumPattern l, final EnumPattern t, final EnumPattern r, final EnumPattern b) {
|
||||
setupEdgedPattern(l, t, r, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getPrimaryIcon(final IDesignSystem system) {
|
||||
return system.getPrimaryIcon(this);
|
||||
}
|
||||
|
||||
private static void setupRotation(final EnumPattern t, final EnumPattern r, final EnumPattern b, final EnumPattern l) {
|
||||
setupEdgedPattern(l, t, r, b);
|
||||
}
|
||||
|
||||
private void setHorizontalFlip(final EnumPattern pattern, final boolean inverted) {
|
||||
this.horizontalFlip = Layout.get(pattern, inverted);
|
||||
pattern.horizontalFlip = Layout.get(this, inverted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getSecondaryIcon(final IDesignSystem system) {
|
||||
return system.getSecondaryIcon(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getRotation() {
|
||||
return this.leftRotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getHorizontalFlip() {
|
||||
return this.horizontalFlip;
|
||||
}
|
||||
|
||||
protected void setLeftRotation(final EnumPattern pattern, final boolean inverted) {
|
||||
this.leftRotation = Layout.get(pattern, inverted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
}
|
||||
|
||||
public ILayout layout() {
|
||||
return this.layout(false);
|
||||
}
|
||||
|
||||
public ILayout layout(final boolean invert) {
|
||||
return Layout.get(this, invert);
|
||||
}
|
||||
|
||||
static {
|
||||
setupStripedPattern(EnumPattern.ThinStriped, EnumPattern.ThinStriped2);
|
||||
setupStripedPattern(EnumPattern.Striped, EnumPattern.Striped2);
|
||||
@@ -404,4 +283,120 @@ public enum EnumPattern implements IPattern
|
||||
EnumPattern.OverlappedSplitBarred.setLeftRotation(EnumPattern.OverlappedSplitBarred2, false);
|
||||
EnumPattern.OverlappedSplitBarred2.setLeftRotation(EnumPattern.OverlappedSplitBarred, false);
|
||||
}
|
||||
|
||||
protected ILayout leftRotation;
|
||||
protected ILayout horizontalFlip;
|
||||
|
||||
EnumPattern() {
|
||||
leftRotation = Layout.get(this, false);
|
||||
horizontalFlip = Layout.get(this, false);
|
||||
}
|
||||
|
||||
static void setupStripedPattern(EnumPattern vert, EnumPattern hori) {
|
||||
vert.setLeftRotation(hori, true);
|
||||
hori.setLeftRotation(vert, false);
|
||||
vert.setHorizontalFlip(vert, true);
|
||||
}
|
||||
|
||||
static void setupChequeredPattern(EnumPattern cheq) {
|
||||
cheq.setLeftRotation(cheq, true);
|
||||
cheq.setHorizontalFlip(cheq, true);
|
||||
}
|
||||
|
||||
static void setupCornerPattern(EnumPattern tl, EnumPattern tr, EnumPattern br, EnumPattern bl) {
|
||||
tl.setLeftRotation(bl, false);
|
||||
tr.setLeftRotation(tl, false);
|
||||
br.setLeftRotation(tr, false);
|
||||
bl.setLeftRotation(br, false);
|
||||
tl.setHorizontalFlip(tr, false);
|
||||
bl.setHorizontalFlip(br, false);
|
||||
}
|
||||
|
||||
static void setupInvert2Rot(EnumPattern a, EnumPattern b) {
|
||||
a.setLeftRotation(b, true);
|
||||
b.setLeftRotation(a, false);
|
||||
a.setHorizontalFlip(b, false);
|
||||
}
|
||||
|
||||
static void set2Rotation(EnumPattern a, EnumPattern b) {
|
||||
a.setLeftRotation(b, false);
|
||||
b.setLeftRotation(a, false);
|
||||
a.setHorizontalFlip(b, false);
|
||||
}
|
||||
|
||||
static void setupBarredPattern(EnumPattern vert, EnumPattern hori) {
|
||||
vert.setLeftRotation(hori, false);
|
||||
hori.setLeftRotation(vert, false);
|
||||
}
|
||||
|
||||
static void setupEdgedPattern(EnumPattern l, EnumPattern t, EnumPattern r, EnumPattern b) {
|
||||
l.setLeftRotation(b, false);
|
||||
t.setLeftRotation(l, false);
|
||||
r.setLeftRotation(t, false);
|
||||
b.setLeftRotation(r, false);
|
||||
l.setHorizontalFlip(r, false);
|
||||
}
|
||||
|
||||
static void setupDiagonalPattern(EnumPattern a, EnumPattern b) {
|
||||
a.setLeftRotation(b, false);
|
||||
b.setLeftRotation(a, false);
|
||||
a.setHorizontalFlip(b, false);
|
||||
}
|
||||
|
||||
static void setupBarredPattern(EnumPattern l, EnumPattern t, EnumPattern r, EnumPattern b) {
|
||||
l.setLeftRotation(b, false);
|
||||
t.setLeftRotation(l, false);
|
||||
r.setLeftRotation(t, false);
|
||||
b.setLeftRotation(r, false);
|
||||
l.setHorizontalFlip(r, false);
|
||||
}
|
||||
|
||||
static void setupTSectionPattern(EnumPattern l, EnumPattern t, EnumPattern r, EnumPattern b) {
|
||||
setupEdgedPattern(l, t, r, b);
|
||||
}
|
||||
|
||||
private static void setupRotation(EnumPattern t, EnumPattern r, EnumPattern b, EnumPattern l) {
|
||||
setupEdgedPattern(l, t, r, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getPrimaryIcon(IDesignSystem system) {
|
||||
return system.getPrimaryIcon(this);
|
||||
}
|
||||
|
||||
private void setHorizontalFlip(EnumPattern pattern, boolean inverted) {
|
||||
horizontalFlip = Layout.get(pattern, inverted);
|
||||
pattern.horizontalFlip = Layout.get(this, inverted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getSecondaryIcon(IDesignSystem system) {
|
||||
return system.getSecondaryIcon(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getRotation() {
|
||||
return leftRotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getHorizontalFlip() {
|
||||
return horizontalFlip;
|
||||
}
|
||||
|
||||
protected void setLeftRotation(EnumPattern pattern, boolean inverted) {
|
||||
leftRotation = Layout.get(pattern, inverted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
}
|
||||
|
||||
public ILayout layout() {
|
||||
return layout(false);
|
||||
}
|
||||
|
||||
public ILayout layout(boolean invert) {
|
||||
return Layout.get(this, invert);
|
||||
}
|
||||
}
|
||||
@@ -1,52 +1,40 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import java.util.LinkedHashMap;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.block.Block;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
|
||||
public class GlassType implements IDesignMaterial
|
||||
{
|
||||
static Map<Integer, GlassType> types;
|
||||
String name;
|
||||
int colour;
|
||||
int id;
|
||||
public class GlassType implements IDesignMaterial {
|
||||
protected static Map<Integer, GlassType> types;
|
||||
|
||||
private GlassType(final int id, final String name, final int colour) {
|
||||
static {
|
||||
GlassType.types = new LinkedHashMap<>();
|
||||
for (StandardColor c : StandardColor.values()) {
|
||||
GlassType.types.put(c.ordinal(), new GlassType(c.ordinal(), c.name, c.colour));
|
||||
}
|
||||
for (EnumFlowerColor c2 : EnumFlowerColor.values()) {
|
||||
GlassType.types.put(128 + c2.ordinal(), new GlassType(128 + c2.ordinal(), c2.getName(), c2.getColor(false)));
|
||||
}
|
||||
}
|
||||
|
||||
protected String name;
|
||||
protected int colour;
|
||||
protected int id;
|
||||
|
||||
private GlassType(int id, String name, int colour) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.colour = colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
if (this.id < 128) {
|
||||
return new ItemStack(Blocks.stained_glass, 1, this.id);
|
||||
}
|
||||
return TileEntityMetadata.getItemStack(Botany.stained, this.id - 128);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return this.colour;
|
||||
}
|
||||
|
||||
public static int getIndex(final IDesignMaterial id) {
|
||||
for (final Map.Entry<Integer, GlassType> entry : GlassType.types.entrySet()) {
|
||||
public static int getIndex(IDesignMaterial id) {
|
||||
for (Map.Entry<Integer, GlassType> entry : GlassType.types.entrySet()) {
|
||||
if (entry.getValue() == id) {
|
||||
return entry.getKey();
|
||||
}
|
||||
@@ -54,15 +42,15 @@ public class GlassType implements IDesignMaterial
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static IDesignMaterial get(final int id) {
|
||||
public static IDesignMaterial get(int id) {
|
||||
return GlassType.types.get(id);
|
||||
}
|
||||
|
||||
public static IDesignMaterial get(final ItemStack stack) {
|
||||
public static IDesignMaterial get(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
for (final Map.Entry<Integer, GlassType> entry : GlassType.types.entrySet()) {
|
||||
for (Map.Entry<Integer, GlassType> entry : GlassType.types.entrySet()) {
|
||||
if (stack.isItemEqual(entry.getValue().getStack())) {
|
||||
return entry.getValue();
|
||||
}
|
||||
@@ -70,18 +58,25 @@ public class GlassType implements IDesignMaterial
|
||||
return null;
|
||||
}
|
||||
|
||||
static {
|
||||
GlassType.types = new LinkedHashMap<Integer, GlassType>();
|
||||
for (final StandardColor c : StandardColor.values()) {
|
||||
GlassType.types.put(c.ordinal(), new GlassType(c.ordinal(), c.name, c.colour));
|
||||
}
|
||||
for (final EnumFlowerColor c2 : EnumFlowerColor.values()) {
|
||||
GlassType.types.put(128 + c2.ordinal(), new GlassType(128 + c2.ordinal(), c2.getName(), c2.getColor(false)));
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
if (id < 128) {
|
||||
return new ItemStack(Blocks.stained_glass, 1, id);
|
||||
}
|
||||
return TileEntityMetadata.getItemStack(Botany.stained, id - 128);
|
||||
}
|
||||
|
||||
private enum StandardColor
|
||||
{
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return colour;
|
||||
}
|
||||
|
||||
private enum StandardColor {
|
||||
White("White", 16777215),
|
||||
Orange("Orange", 14188339),
|
||||
Magenta("Magenta", 11685080),
|
||||
@@ -99,10 +94,10 @@ public class GlassType implements IDesignMaterial
|
||||
Red("Red", 10040115),
|
||||
Black("Black", 1644825);
|
||||
|
||||
String name;
|
||||
int colour;
|
||||
protected String name;
|
||||
protected int colour;
|
||||
|
||||
private StandardColor(final String name, final int colour) {
|
||||
StandardColor(String name, int colour) {
|
||||
this.name = name;
|
||||
this.colour = colour;
|
||||
}
|
||||
|
||||
@@ -1,82 +1,77 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class Layout implements ILayout
|
||||
{
|
||||
IPattern pattern;
|
||||
boolean inverted;
|
||||
public class Layout implements ILayout {
|
||||
protected IPattern pattern;
|
||||
protected boolean inverted;
|
||||
|
||||
@Override
|
||||
public IPattern getPattern() {
|
||||
return this.pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInverted() {
|
||||
return this.inverted;
|
||||
}
|
||||
|
||||
private Layout(final IPattern pattern, final boolean inverted) {
|
||||
private Layout(IPattern pattern, boolean inverted) {
|
||||
this.pattern = pattern;
|
||||
this.inverted = inverted;
|
||||
}
|
||||
|
||||
private Layout(final IPattern pattern) {
|
||||
private Layout(IPattern pattern) {
|
||||
this(pattern, false);
|
||||
}
|
||||
|
||||
ILayout newLayout(final ILayout newLayout) {
|
||||
return new Layout(newLayout.getPattern(), this.inverted ^ newLayout.isInverted());
|
||||
public static ILayout get(IPattern pattern, boolean inverted) {
|
||||
return new Layout(pattern, inverted);
|
||||
}
|
||||
|
||||
public static ILayout get(IPattern pattern) {
|
||||
return new Layout(pattern, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPattern getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInverted() {
|
||||
return inverted;
|
||||
}
|
||||
|
||||
ILayout newLayout(ILayout newLayout) {
|
||||
return new Layout(newLayout.getPattern(), inverted ^ newLayout.isInverted());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout rotateRight() {
|
||||
return this.rotateLeft().rotateLeft().rotateLeft();
|
||||
return rotateLeft().rotateLeft().rotateLeft();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout rotateLeft() {
|
||||
return this.newLayout(this.pattern.getRotation());
|
||||
return newLayout(pattern.getRotation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout flipHorizontal() {
|
||||
return this.newLayout(this.pattern.getHorizontalFlip());
|
||||
return newLayout(pattern.getHorizontalFlip());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout flipVertical() {
|
||||
return this.newLayout(this.pattern.getHorizontalFlip().rotateLeft().rotateLeft());
|
||||
return newLayout(pattern.getHorizontalFlip().rotateLeft().rotateLeft());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getPrimaryIcon(final IDesignSystem system) {
|
||||
return this.inverted ? this.pattern.getSecondaryIcon(system) : this.pattern.getPrimaryIcon(system);
|
||||
public IIcon getPrimaryIcon(IDesignSystem system) {
|
||||
return inverted ? pattern.getSecondaryIcon(system) : pattern.getPrimaryIcon(system);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getSecondaryIcon(final IDesignSystem system) {
|
||||
return this.inverted ? this.pattern.getPrimaryIcon(system) : this.pattern.getSecondaryIcon(system);
|
||||
public IIcon getSecondaryIcon(IDesignSystem system) {
|
||||
return inverted ? pattern.getPrimaryIcon(system) : pattern.getSecondaryIcon(system);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout invert() {
|
||||
return new Layout(this.pattern, !this.inverted);
|
||||
}
|
||||
|
||||
public static ILayout get(final IPattern pattern, final boolean inverted) {
|
||||
return new Layout(pattern, inverted);
|
||||
}
|
||||
|
||||
public static ILayout get(final IPattern pattern) {
|
||||
return new Layout(pattern, false);
|
||||
return new Layout(pattern, !inverted);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,76 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.api.CarpentryManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import binnie.core.block.MultipassItemRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import binnie.core.block.ItemMetadata;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.core.IInitializable;
|
||||
import binnie.core.block.ItemMetadata;
|
||||
import binnie.core.block.MultipassItemRenderer;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.extratrees.api.CarpentryManager;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ModuleCarpentry implements IInitializable {
|
||||
static {
|
||||
CarpentryManager.carpentryInterface = new CarpentryInterface();
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(BlockDesign block, IDesignMaterial type1, IDesignMaterial type2, IDesign design) {
|
||||
return getItemStack(block, block.getDesignSystem().getMaterialIndex(type1), block.getDesignSystem().getMaterialIndex(type2), CarpentryManager.carpentryInterface.getDesignIndex(design));
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(BlockDesign block, int type1, int type2, int design) {
|
||||
return TileEntityMetadata.getItemStack(block, getMetadata(type1, type2, design, 0, ForgeDirection.UP.ordinal()));
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(BlockDesign blockC, DesignBlock block) {
|
||||
return getItemStack(blockC, block.getPrimaryMaterial(), block.getSecondaryMaterial(), block.getDesign());
|
||||
}
|
||||
|
||||
public static int getMetadata(int plank1, int plank2, int design, int rotation, int facing) {
|
||||
return plank1 + (plank2 << 8) + (design << 16) + (rotation << 26) + (facing << 28);
|
||||
}
|
||||
|
||||
public static DesignBlock getDesignBlock(IDesignSystem system, int meta) {
|
||||
int plankID1 = meta & 0xFF;
|
||||
int plankID2 = meta >> 8 & 0xFF;
|
||||
int tile = meta >> 16 & 0x3FF;
|
||||
int rotation = meta >> 26 & 0x3;
|
||||
int axis = meta >> 28 & 0x7;
|
||||
IDesignMaterial type1 = system.getMaterial(plankID1);
|
||||
IDesignMaterial type2 = system.getMaterial(plankID2);
|
||||
IDesign type3 = CarpentryManager.carpentryInterface.getDesign(tile);
|
||||
return new DesignBlock(system, type1, type2, type3, rotation, ForgeDirection.getOrientation(axis));
|
||||
}
|
||||
|
||||
public static DesignBlock getCarpentryPanel(IDesignSystem system, int meta) {
|
||||
DesignBlock block = getDesignBlock(system, meta);
|
||||
block.setPanel();
|
||||
return block;
|
||||
}
|
||||
|
||||
public static int getBlockMetadata(IDesignSystem system, DesignBlock block) {
|
||||
int plank1 = system.getMaterialIndex(block.getPrimaryMaterial());
|
||||
int plank2 = system.getMaterialIndex(block.getSecondaryMaterial());
|
||||
int design = CarpentryManager.carpentryInterface.getDesignIndex(block.getDesign());
|
||||
int rotation = block.getRotation();
|
||||
int facing = block.getFacing().ordinal();
|
||||
return getMetadata(plank1, plank2, design, rotation, facing);
|
||||
}
|
||||
|
||||
public static int getItemMetadata(IDesignSystem system, DesignBlock block) {
|
||||
int plank1 = system.getMaterialIndex(block.getPrimaryMaterial());
|
||||
int plank2 = system.getMaterialIndex(block.getSecondaryMaterial());
|
||||
int design = CarpentryManager.carpentryInterface.getDesignIndex(block.getDesign());
|
||||
return getMetadata(plank1, plank2, design, 0, ForgeDirection.UP.ordinal());
|
||||
}
|
||||
|
||||
public class ModuleCarpentry implements IInitializable
|
||||
{
|
||||
@Override
|
||||
public void preInit() {
|
||||
ExtraTrees.blockCarpentry = new BlockCarpentry();
|
||||
@@ -40,73 +87,19 @@ public class ModuleCarpentry implements IInitializable
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
for (final EnumDesign design : EnumDesign.values()) {
|
||||
for (EnumDesign design : EnumDesign.values()) {
|
||||
CarpentryManager.carpentryInterface.registerDesign(design.ordinal(), design);
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(final BlockDesign block, final IDesignMaterial type1, final IDesignMaterial type2, final IDesign design) {
|
||||
return getItemStack(block, block.getDesignSystem().getMaterialIndex(type1), block.getDesignSystem().getMaterialIndex(type2), CarpentryManager.carpentryInterface.getDesignIndex(design));
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(final BlockDesign block, final int type1, final int type2, final int design) {
|
||||
return TileEntityMetadata.getItemStack(block, getMetadata(type1, type2, design, 0, ForgeDirection.UP.ordinal()));
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(final BlockDesign blockC, final DesignBlock block) {
|
||||
return getItemStack(blockC, block.getPrimaryMaterial(), block.getSecondaryMaterial(), block.getDesign());
|
||||
}
|
||||
|
||||
public static int getMetadata(final int plank1, final int plank2, final int design, final int rotation, final int facing) {
|
||||
return plank1 + (plank2 << 8) + (design << 16) + (rotation << 26) + (facing << 28);
|
||||
}
|
||||
|
||||
public static DesignBlock getDesignBlock(final IDesignSystem system, final int meta) {
|
||||
final int plankID1 = meta & 0xFF;
|
||||
final int plankID2 = meta >> 8 & 0xFF;
|
||||
final int tile = meta >> 16 & 0x3FF;
|
||||
final int rotation = meta >> 26 & 0x3;
|
||||
final int axis = meta >> 28 & 0x7;
|
||||
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, ForgeDirection.getOrientation(axis));
|
||||
}
|
||||
|
||||
public static DesignBlock getCarpentryPanel(final IDesignSystem system, final int meta) {
|
||||
final DesignBlock block = getDesignBlock(system, meta);
|
||||
block.setPanel();
|
||||
return block;
|
||||
}
|
||||
|
||||
public static int getBlockMetadata(final IDesignSystem system, final DesignBlock block) {
|
||||
final int plank1 = system.getMaterialIndex(block.getPrimaryMaterial());
|
||||
final int plank2 = system.getMaterialIndex(block.getSecondaryMaterial());
|
||||
final int design = CarpentryManager.carpentryInterface.getDesignIndex(block.getDesign());
|
||||
final int rotation = block.getRotation();
|
||||
final int facing = block.getFacing().ordinal();
|
||||
return getMetadata(plank1, plank2, design, rotation, facing);
|
||||
}
|
||||
|
||||
public static int getItemMetadata(final IDesignSystem system, final DesignBlock block) {
|
||||
final int plank1 = system.getMaterialIndex(block.getPrimaryMaterial());
|
||||
final int plank2 = system.getMaterialIndex(block.getSecondaryMaterial());
|
||||
final int design = CarpentryManager.carpentryInterface.getDesignIndex(block.getDesign());
|
||||
return getMetadata(plank1, plank2, design, 0, ForgeDirection.UP.ordinal());
|
||||
}
|
||||
|
||||
static {
|
||||
CarpentryManager.carpentryInterface = new CarpentryInterface();
|
||||
}
|
||||
|
||||
enum Axis
|
||||
{
|
||||
enum Axis {
|
||||
Y,
|
||||
X,
|
||||
Z;
|
||||
Z
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user