2013-08-16 13:51:33 -07:00
|
|
|
package tconstruct.blocks;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
|
import net.minecraft.util.AxisAlignedBB;
|
2013-12-31 20:24:06 -05:00
|
|
|
import net.minecraft.util.IIcon;
|
2013-08-16 13:51:33 -07:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
import tconstruct.TConstruct;
|
|
|
|
|
import tconstruct.blocks.logic.CraftingStationLogic;
|
|
|
|
|
import tconstruct.blocks.logic.PartBuilderLogic;
|
|
|
|
|
import tconstruct.blocks.logic.PatternChestLogic;
|
|
|
|
|
import tconstruct.blocks.logic.StencilTableLogic;
|
|
|
|
|
import tconstruct.blocks.logic.ToolForgeLogic;
|
|
|
|
|
import tconstruct.blocks.logic.ToolStationLogic;
|
|
|
|
|
import tconstruct.common.TProxyCommon;
|
2013-11-29 23:16:32 -05:00
|
|
|
import tconstruct.common.TRepo;
|
2013-08-16 13:51:33 -07:00
|
|
|
import tconstruct.library.TConstructRegistry;
|
2013-12-01 12:19:43 +00:00
|
|
|
import mantle.blocks.abstracts.InventorySlab;
|
2013-10-01 19:44:04 -07:00
|
|
|
import tconstruct.util.config.PHConstruct;
|
2013-08-16 13:51:33 -07:00
|
|
|
|
2013-11-09 14:28:48 -08:00
|
|
|
public class CraftingSlab extends InventorySlab
|
2013-08-16 13:51:33 -07:00
|
|
|
{
|
2013-12-31 15:30:34 -05:00
|
|
|
public CraftingSlab(Material material)
|
2013-08-16 13:51:33 -07:00
|
|
|
{
|
2013-12-31 15:30:34 -05:00
|
|
|
super(material);
|
2014-01-16 01:36:18 -05:00
|
|
|
this.func_149647_a(TConstructRegistry.blockTab);
|
2014-01-15 23:19:27 -05:00
|
|
|
this.func_149711_c(2f);
|
2013-08-16 13:51:33 -07:00
|
|
|
this.setStepSound(Block.soundWoodFootstep);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Rendering */
|
|
|
|
|
@Override
|
|
|
|
|
public String[] getTextureNames ()
|
|
|
|
|
{
|
2013-08-31 05:13:31 -07:00
|
|
|
String[] textureNames = { "craftingstation_top", "craftingstation_slab_side", "craftingstation_bottom", "toolstation_top", "toolstation_slab_side", "toolstation_bottom",
|
|
|
|
|
"partbuilder_oak_top", "partbuilder_slab_side", "partbuilder_oak_bottom", "stenciltable_oak_top", "stenciltable_slab_side", "stenciltable_oak_bottom", "patternchest_top",
|
|
|
|
|
"patternchest_slab_side", "patternchest_bottom", "toolforge_top", "toolforge_slab_side", "toolforge_top" };
|
2013-08-16 13:51:33 -07:00
|
|
|
|
|
|
|
|
return textureNames;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2013-12-31 15:30:34 -05:00
|
|
|
public IIcon getIcon (int side, int meta)
|
2013-08-16 13:51:33 -07:00
|
|
|
{
|
|
|
|
|
return icons[(meta % 8) * 3 + getTextureIndex(side)];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getTextureIndex (int side)
|
|
|
|
|
{
|
|
|
|
|
if (side == 0)
|
|
|
|
|
return 2;
|
|
|
|
|
if (side == 1)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z)
|
|
|
|
|
{
|
|
|
|
|
int metadata = world.getBlockMetadata(x, y, z);
|
|
|
|
|
if (metadata == 5)
|
|
|
|
|
return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125,
|
|
|
|
|
(double) z + this.maxZ);
|
|
|
|
|
return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public TileEntity createTileEntity (World world, int metadata)
|
|
|
|
|
{
|
|
|
|
|
switch (metadata % 8)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
return new CraftingStationLogic();
|
|
|
|
|
case 1:
|
|
|
|
|
return new ToolStationLogic();
|
|
|
|
|
case 2:
|
|
|
|
|
return new PartBuilderLogic();
|
|
|
|
|
case 3:
|
|
|
|
|
return new StencilTableLogic();
|
|
|
|
|
case 4:
|
|
|
|
|
return new PatternChestLogic();
|
|
|
|
|
case 5:
|
|
|
|
|
return new ToolForgeLogic();
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
|
|
|
|
|
{
|
2013-08-21 14:40:22 -07:00
|
|
|
int meta = world.getBlockMetadata(x, y, z) % 8;
|
2013-08-16 13:51:33 -07:00
|
|
|
switch (meta)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
return TProxyCommon.craftingStationID;
|
2013-08-31 05:13:31 -07:00
|
|
|
case 1:
|
2013-08-16 13:51:33 -07:00
|
|
|
return TProxyCommon.toolStationID;
|
|
|
|
|
case 2:
|
|
|
|
|
return TProxyCommon.partBuilderID;
|
|
|
|
|
case 3:
|
|
|
|
|
return TProxyCommon.stencilTableID;
|
|
|
|
|
case 4:
|
|
|
|
|
return TProxyCommon.patternChestID;
|
|
|
|
|
case 5:
|
|
|
|
|
return TProxyCommon.toolForgeID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object getModInstance ()
|
|
|
|
|
{
|
|
|
|
|
return TConstruct.instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2014-01-15 23:19:27 -05:00
|
|
|
public void getSubBlocks (Item b, CreativeTabs tab, List list)
|
2013-08-16 13:51:33 -07:00
|
|
|
{
|
|
|
|
|
for (int iter = 0; iter < 6; iter++)
|
|
|
|
|
{
|
2013-12-31 15:30:34 -05:00
|
|
|
list.add(new ItemStack(b, 1, iter));
|
2013-08-16 13:51:33 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack)
|
|
|
|
|
{
|
|
|
|
|
if (PHConstruct.freePatterns)
|
|
|
|
|
{
|
|
|
|
|
int meta = world.getBlockMetadata(x, y, z);
|
|
|
|
|
if (meta == 4)
|
|
|
|
|
{
|
|
|
|
|
PatternChestLogic logic = (PatternChestLogic) world.getBlockTileEntity(x, y, z);
|
|
|
|
|
for (int i = 1; i <= 13; i++)
|
|
|
|
|
{
|
2013-11-29 23:16:32 -05:00
|
|
|
logic.setInventorySlotContents(i - 1, new ItemStack(TRepo.woodPattern, 1, i));
|
2013-08-16 13:51:33 -07:00
|
|
|
}
|
2013-11-29 23:16:32 -05:00
|
|
|
logic.setInventorySlotContents(13, new ItemStack(TRepo.woodPattern, 1, 22));
|
2013-08-16 13:51:33 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
super.onBlockPlacedBy(world, x, y, z, entityliving, stack);
|
|
|
|
|
}
|
|
|
|
|
}
|