mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 04:32:26 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -12,84 +12,102 @@ import net.minecraft.world.*;
|
||||
import tconstruct.tools.logic.BattlesignLogic;
|
||||
import tconstruct.tools.model.BattlesignRender;
|
||||
|
||||
public class BattlesignBlock extends EquipBlock
|
||||
{
|
||||
public class BattlesignBlock extends EquipBlock {
|
||||
|
||||
public BattlesignBlock(Material material)
|
||||
{
|
||||
public BattlesignBlock(Material material) {
|
||||
super(material);
|
||||
|
||||
this.setBlockBounds(0.45F, 0F, 0.45F, 0.55F, 1.125F, 0.55F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return BattlesignRender.battlesignModelID;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean shouldSideBeRendered (IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
|
||||
{
|
||||
return p_149646_5_ == 0 && this.minY > 0.0D ? true : (p_149646_5_ == 1 && this.maxY < 1.0D ? true : (p_149646_5_ == 2 && this.minZ > 0.0D ? true : (p_149646_5_ == 3 && this.maxZ < 1.0D ? true : (p_149646_5_ == 4 && this.minX > 0.0D ? true : (p_149646_5_ == 5 && this.maxX < 1.0D ? true : !(p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_).isOpaqueCube() && p_149646_1_.getBlock(p_149646_2_, p_149646_3_ + 1, p_149646_4_).isOpaqueCube()))))));
|
||||
public boolean shouldSideBeRendered(
|
||||
IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
|
||||
return p_149646_5_ == 0 && this.minY > 0.0D
|
||||
? true
|
||||
: (p_149646_5_ == 1 && this.maxY < 1.0D
|
||||
? true
|
||||
: (p_149646_5_ == 2 && this.minZ > 0.0D
|
||||
? true
|
||||
: (p_149646_5_ == 3 && this.maxZ < 1.0D
|
||||
? true
|
||||
: (p_149646_5_ == 4 && this.minX > 0.0D
|
||||
? true
|
||||
: (p_149646_5_ == 5 && this.maxX < 1.0D
|
||||
? true
|
||||
: !(p_149646_1_
|
||||
.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)
|
||||
.isOpaqueCube()
|
||||
&& p_149646_1_
|
||||
.getBlock(
|
||||
p_149646_2_,
|
||||
p_149646_3_ + 1,
|
||||
p_149646_4_)
|
||||
.isOpaqueCube()))))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int metadata)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new BattlesignLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy (World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
|
||||
{
|
||||
public void onBlockPlacedBy(
|
||||
World par1World,
|
||||
int par2,
|
||||
int par3,
|
||||
int par4,
|
||||
EntityLivingBase par5EntityLivingBase,
|
||||
ItemStack par6ItemStack) {
|
||||
super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack);
|
||||
int i3 = MathHelper.floor_double((par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
|
||||
int newMeta = 0;
|
||||
|
||||
switch (i3)
|
||||
{
|
||||
case 3:
|
||||
newMeta = 0;
|
||||
break;
|
||||
case 0:
|
||||
newMeta = 3;
|
||||
break;
|
||||
case 1:
|
||||
newMeta = 1;
|
||||
break;
|
||||
case 2:
|
||||
newMeta = 2;
|
||||
break;
|
||||
switch (i3) {
|
||||
case 3:
|
||||
newMeta = 0;
|
||||
break;
|
||||
case 0:
|
||||
newMeta = 3;
|
||||
break;
|
||||
case 1:
|
||||
newMeta = 1;
|
||||
break;
|
||||
case 2:
|
||||
newMeta = 2;
|
||||
break;
|
||||
}
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, newMeta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess blockAccess, int x, int y, int z)
|
||||
{
|
||||
switch (blockAccess.getBlockMetadata(x, y, z))
|
||||
{
|
||||
case 0:
|
||||
setBlockBounds(0.42F, 0.5F, 0F, 0.50F, 1.1F, 1F);
|
||||
break;
|
||||
case 1:
|
||||
setBlockBounds(0.50F, 0.5F, 0F, 0.58F, 1.1F, 1F);
|
||||
break;
|
||||
case 2:
|
||||
setBlockBounds(0F, 0.5F, 0.50F, 1F, 1.1F, 0.58F);
|
||||
break;
|
||||
case 3:
|
||||
setBlockBounds(0F, 0.5F, 0.42F, 1F, 1.1F, 0.50F);
|
||||
break;
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {
|
||||
switch (blockAccess.getBlockMetadata(x, y, z)) {
|
||||
case 0:
|
||||
setBlockBounds(0.42F, 0.5F, 0F, 0.50F, 1.1F, 1F);
|
||||
break;
|
||||
case 1:
|
||||
setBlockBounds(0.50F, 0.5F, 0F, 0.58F, 1.1F, 1F);
|
||||
break;
|
||||
case 2:
|
||||
setBlockBounds(0F, 0.5F, 0.50F, 1F, 1.1F, 0.58F);
|
||||
break;
|
||||
case 3:
|
||||
setBlockBounds(0F, 0.5F, 0.42F, 1F, 1.1F, 0.50F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList (World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity)
|
||||
{
|
||||
public void addCollisionBoxesToList(
|
||||
World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) {
|
||||
setBlockBoundsBasedOnState(world, x, y, z);
|
||||
|
||||
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
|
||||
@@ -100,15 +118,12 @@ public class BattlesignBlock extends EquipBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity (World world, int metadata)
|
||||
{
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new BattlesignLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
|
||||
{
|
||||
public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,10 +20,8 @@ import tconstruct.tools.*;
|
||||
import tconstruct.tools.logic.*;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
public class CraftingSlab extends InventorySlab
|
||||
{
|
||||
public CraftingSlab(Material material)
|
||||
{
|
||||
public class CraftingSlab extends InventorySlab {
|
||||
public CraftingSlab(Material material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
this.setHardness(2f);
|
||||
@@ -32,115 +30,129 @@ public class CraftingSlab extends InventorySlab
|
||||
|
||||
/* Rendering */
|
||||
@Override
|
||||
public String[] getTextureNames ()
|
||||
{
|
||||
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" };
|
||||
public String[] getTextureNames() {
|
||||
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"
|
||||
};
|
||||
|
||||
return textureNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureDomain (int textureNameIndex)
|
||||
{
|
||||
public String getTextureDomain(int textureNameIndex) {
|
||||
return "tinker";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icons[(meta % 8) * 3 + getTextureIndex(side)];
|
||||
}
|
||||
|
||||
public int getTextureIndex (int side)
|
||||
{
|
||||
if (side == 0)
|
||||
return 2;
|
||||
if (side == 1)
|
||||
return 0;
|
||||
public int getTextureIndex(int side) {
|
||||
if (side == 0) return 2;
|
||||
if (side == 1) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (metadata == 5)
|
||||
return AxisAlignedBB.getBoundingBox((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.getBoundingBox((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
(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.getBoundingBox(
|
||||
(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;
|
||||
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)
|
||||
{
|
||||
public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
||||
int meta = world.getBlockMetadata(x, y, z) % 8;
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return ToolProxyCommon.craftingStationID;
|
||||
case 1:
|
||||
return ToolProxyCommon.toolStationID;
|
||||
case 2:
|
||||
return ToolProxyCommon.partBuilderID;
|
||||
case 3:
|
||||
return ToolProxyCommon.stencilTableID;
|
||||
case 4:
|
||||
return ToolProxyCommon.patternChestID;
|
||||
case 5:
|
||||
return ToolProxyCommon.toolForgeID;
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return ToolProxyCommon.craftingStationID;
|
||||
case 1:
|
||||
return ToolProxyCommon.toolStationID;
|
||||
case 2:
|
||||
return ToolProxyCommon.partBuilderID;
|
||||
case 3:
|
||||
return ToolProxyCommon.stencilTableID;
|
||||
case 4:
|
||||
return ToolProxyCommon.patternChestID;
|
||||
case 5:
|
||||
return ToolProxyCommon.toolForgeID;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getModInstance ()
|
||||
{
|
||||
public Object getModInstance() {
|
||||
return TConstruct.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < 6; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item b, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < 6; iter++) {
|
||||
list.add(new ItemStack(b, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack)
|
||||
{
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack) {
|
||||
boolean keptInventory = false;
|
||||
if (stack.hasTagCompound())
|
||||
{
|
||||
if (stack.hasTagCompound()) {
|
||||
NBTTagCompound inventory = stack.getTagCompound().getCompoundTag("Inventory");
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (inventory != null && te instanceof PatternChestLogic)
|
||||
{
|
||||
if (inventory != null && te instanceof PatternChestLogic) {
|
||||
PatternChestLogic logic = (PatternChestLogic) te;
|
||||
logic.readInventoryFromNBT(inventory);
|
||||
logic.xCoord = x;
|
||||
@@ -149,14 +161,11 @@ public class CraftingSlab extends InventorySlab
|
||||
keptInventory = true;
|
||||
}
|
||||
}
|
||||
if (!keptInventory && PHConstruct.freePatterns)
|
||||
{
|
||||
if (!keptInventory && PHConstruct.freePatterns) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 4)
|
||||
{
|
||||
if (meta == 4) {
|
||||
PatternChestLogic logic = (PatternChestLogic) world.getTileEntity(x, y, z);
|
||||
for (int i = 1; i <= 13; i++)
|
||||
{
|
||||
for (int i = 1; i <= 13; i++) {
|
||||
logic.setInventorySlotContents(i - 1, new ItemStack(TinkerTools.woodPattern, 1, i));
|
||||
}
|
||||
logic.setInventorySlotContents(13, new ItemStack(TinkerTools.woodPattern, 1, 22));
|
||||
@@ -166,38 +175,33 @@ public class CraftingSlab extends InventorySlab
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World var1, 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;
|
||||
public TileEntity createNewTileEntity(World var1, 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;
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep pattern chest inventory */
|
||||
@Override
|
||||
public boolean removedByPlayer (World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
|
||||
{
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
player.addExhaustion(0.025F);
|
||||
|
||||
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops"))
|
||||
{
|
||||
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 4)
|
||||
{
|
||||
if (meta == 4) {
|
||||
ItemStack chest = new ItemStack(this, 1, 4);
|
||||
NBTTagCompound inventory = new NBTTagCompound();
|
||||
PatternChestLogic logic = (PatternChestLogic) world.getTileEntity(x, y, z);
|
||||
@@ -208,17 +212,16 @@ public class CraftingSlab extends InventorySlab
|
||||
|
||||
// remove content. This is necessary because otherwise the patterns would also spill into the world
|
||||
// we don't want to prevent that since that's the intended behaviour for explosions.
|
||||
for(int i = 0; i < logic.getSizeInventory(); i++)
|
||||
logic.setInventorySlotContents(i, null);
|
||||
for (int i = 0; i < logic.getSizeInventory(); i++) logic.setInventorySlotContents(i, null);
|
||||
|
||||
//Spawn item
|
||||
if (!player.capabilities.isCreativeMode || player.isSneaking())
|
||||
{
|
||||
// Spawn item
|
||||
if (!player.capabilities.isCreativeMode || player.isSneaking()) {
|
||||
float f = 0.7F;
|
||||
double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, chest);
|
||||
EntityItem entityitem =
|
||||
new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, chest);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
@@ -228,10 +231,8 @@ public class CraftingSlab extends InventorySlab
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock (World world, EntityPlayer player, int x, int y, int z, int meta)
|
||||
{
|
||||
if (meta != 4)
|
||||
super.harvestBlock(world, player, x, y, z, meta);
|
||||
//Do nothing
|
||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
||||
if (meta != 4) super.harvestBlock(world, player, x, y, z, meta);
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@@ -17,98 +17,81 @@ import tconstruct.tools.ToolProxyCommon;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
import tconstruct.tools.model.TableRender;
|
||||
|
||||
public class CraftingStationBlock extends InventoryBlock
|
||||
{
|
||||
public CraftingStationBlock(Material material)
|
||||
{
|
||||
public class CraftingStationBlock extends InventoryBlock {
|
||||
public CraftingStationBlock(Material material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
this.setHardness(2f);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
//Block.hasComparatorInputOverride and Block.getComparatorInputOverride
|
||||
// Block.hasComparatorInputOverride and Block.getComparatorInputOverride
|
||||
|
||||
/* Rendering */
|
||||
@Override
|
||||
public String[] getTextureNames ()
|
||||
{
|
||||
String[] textureNames = { "craftingstation_top", "craftingstation_side", "craftingstation_bottom" };
|
||||
public String[] getTextureNames() {
|
||||
String[] textureNames = {"craftingstation_top", "craftingstation_side", "craftingstation_bottom"};
|
||||
|
||||
return textureNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureDomain (int textureNameIndex)
|
||||
{
|
||||
public String getTextureDomain(int textureNameIndex) {
|
||||
return "tinker";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icons[getTextureIndex(side)];
|
||||
}
|
||||
|
||||
public int getTextureIndex (int side)
|
||||
{
|
||||
if (side == 0)
|
||||
return 2;
|
||||
if (side == 1)
|
||||
return 0;
|
||||
public int getTextureIndex(int side) {
|
||||
if (side == 0) return 2;
|
||||
if (side == 1) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return TableRender.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
|
||||
{
|
||||
public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
||||
return ToolProxyCommon.craftingStationID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getModInstance ()
|
||||
{
|
||||
public Object getModInstance() {
|
||||
return TConstruct.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < 1; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < 1; iter++) {
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World arg0, int arg1)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World arg0, int arg1) {
|
||||
return new CraftingStationLogic();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,11 +21,9 @@ import tconstruct.tools.ToolProxyCommon;
|
||||
import tconstruct.tools.logic.*;
|
||||
import tconstruct.tools.model.FrypanRender;
|
||||
|
||||
public class EquipBlock extends InventoryBlock
|
||||
{
|
||||
public class EquipBlock extends InventoryBlock {
|
||||
|
||||
public EquipBlock(Material material)
|
||||
{
|
||||
public EquipBlock(Material material) {
|
||||
super(material);
|
||||
this.setHardness(0.3f);
|
||||
this.setBlockBounds(0, 0, 0, 1, 0.25f, 1);
|
||||
@@ -33,67 +31,56 @@ public class EquipBlock extends InventoryBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTextureNames ()
|
||||
{
|
||||
return new String[] { "toolstation_top" };
|
||||
public String[] getTextureNames() {
|
||||
return new String[] {"toolstation_top"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureDomain (int textureNameIndex)
|
||||
{
|
||||
public String getTextureDomain(int textureNameIndex) {
|
||||
return "tinker";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Blocks.iron_block.getIcon(side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// this.blockIcon =
|
||||
// par1iconRegister.registerIcon(Block.blockIron.getUnlocalizedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return FrypanRender.frypanModelID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped (int par1, Random par2Random, int par3)
|
||||
{
|
||||
public Item getItemDropped(int par1, Random par2Random, int par3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int metadata)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new FrypanLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (isActive(world, x, y, z))
|
||||
{
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||
if (isActive(world, x, y, z)) {
|
||||
float f = (float) x + 0.5F;
|
||||
float f1 = (float) y + 0.25F + (random.nextFloat() * 6F) / 16F;
|
||||
float f2 = (float) z + 0.5F;
|
||||
@@ -104,64 +91,67 @@ public class EquipBlock extends InventoryBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy (World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
|
||||
{
|
||||
public void onBlockPlacedBy(
|
||||
World par1World,
|
||||
int par2,
|
||||
int par3,
|
||||
int par4,
|
||||
EntityLivingBase par5EntityLivingBase,
|
||||
ItemStack par6ItemStack) {
|
||||
super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack);
|
||||
int i3 = MathHelper.floor_double((par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
|
||||
int newMeta = 0;
|
||||
|
||||
switch (i3)
|
||||
{
|
||||
case 3:
|
||||
newMeta = 0;
|
||||
break;
|
||||
case 0:
|
||||
newMeta = 3;
|
||||
break;
|
||||
case 1:
|
||||
newMeta = 1;
|
||||
break;
|
||||
case 2:
|
||||
newMeta = 2;
|
||||
break;
|
||||
switch (i3) {
|
||||
case 3:
|
||||
newMeta = 0;
|
||||
break;
|
||||
case 0:
|
||||
newMeta = 3;
|
||||
break;
|
||||
case 1:
|
||||
newMeta = 1;
|
||||
break;
|
||||
case 2:
|
||||
newMeta = 2;
|
||||
break;
|
||||
}
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, newMeta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock (World par1World, int x, int y, int z, Block par5, int meta)
|
||||
{
|
||||
public void breakBlock(World par1World, int x, int y, int z, Block par5, int meta) {
|
||||
TileEntity te = par1World.getTileEntity(x, y, z);
|
||||
|
||||
if (te != null && te instanceof EquipLogic)
|
||||
{
|
||||
if (te != null && te instanceof EquipLogic) {
|
||||
EquipLogic logic = (EquipLogic) te;
|
||||
for (int iter = 0; iter < logic.getSizeInventory(); ++iter)
|
||||
{
|
||||
for (int iter = 0; iter < logic.getSizeInventory(); ++iter) {
|
||||
ItemStack stack = iter == 0 ? logic.getEquipmentItem() : logic.getStackInSlot(iter);
|
||||
|
||||
if (stack != null && logic.canDropInventorySlot(iter))
|
||||
{
|
||||
if (stack != null && logic.canDropInventorySlot(iter)) {
|
||||
float jumpX = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float jumpY = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float jumpZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (stack.stackSize > 0)
|
||||
{
|
||||
while (stack.stackSize > 0) {
|
||||
int itemSize = rand.nextInt(21) + 10;
|
||||
|
||||
if (itemSize > stack.stackSize)
|
||||
{
|
||||
if (itemSize > stack.stackSize) {
|
||||
itemSize = stack.stackSize;
|
||||
}
|
||||
|
||||
stack.stackSize -= itemSize;
|
||||
EntityItem entityitem = new EntityItem(par1World, (double) ((float) x + jumpX), (double) ((float) y + jumpY), (double) ((float) z + jumpZ), new ItemStack(stack.getItem(), itemSize, stack.getItemDamage()));
|
||||
EntityItem entityitem = new EntityItem(
|
||||
par1World,
|
||||
(double) ((float) x + jumpX),
|
||||
(double) ((float) y + jumpY),
|
||||
(double) ((float) z + jumpZ),
|
||||
new ItemStack(stack.getItem(), itemSize, stack.getItemDamage()));
|
||||
|
||||
if (stack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
|
||||
if (stack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)
|
||||
stack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float offset = 0.05F;
|
||||
@@ -178,39 +168,34 @@ public class EquipBlock extends InventoryBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
return !isActive(world, x, y, z) ? 0 : 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
|
||||
{
|
||||
public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
||||
return ToolProxyCommon.frypanGuiID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getModInstance ()
|
||||
{
|
||||
public Object getModInstance() {
|
||||
return TConstruct.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier (IBlockAccess blockAccess, int x, int y, int z)
|
||||
{
|
||||
public int colorMultiplier(IBlockAccess blockAccess, int x, int y, int z) {
|
||||
TileEntity te = blockAccess.getTileEntity(x, y, z);
|
||||
|
||||
if (te instanceof EquipLogic)
|
||||
{
|
||||
if (te instanceof EquipLogic) {
|
||||
EquipLogic logic = (EquipLogic) te;
|
||||
ItemStack stack = logic.getEquipmentItem();
|
||||
if (stack != null && stack.hasTagCompound() && stack.getTagCompound().hasKey("InfiTool"))
|
||||
{
|
||||
if (stack != null
|
||||
&& stack.hasTagCompound()
|
||||
&& stack.getTagCompound().hasKey("InfiTool")) {
|
||||
NBTTagCompound tag = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
if (tag != null)
|
||||
{
|
||||
if (tag != null) {
|
||||
int head = tag.getInteger("Head");
|
||||
|
||||
return TConstructRegistry.getMaterial(head).primaryColor();
|
||||
@@ -222,9 +207,7 @@ public class EquipBlock extends InventoryBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity (World world, int metadata)
|
||||
{
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new FrypanLogic();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,73 +15,58 @@ import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.tools.ToolProxyCommon;
|
||||
import tconstruct.tools.logic.FurnaceLogic;
|
||||
|
||||
public class FurnaceSlab extends InventorySlab
|
||||
{
|
||||
public class FurnaceSlab extends InventorySlab {
|
||||
|
||||
public FurnaceSlab(Material material)
|
||||
{
|
||||
public FurnaceSlab(Material material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
this.setHardness(3.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity (World world, int metadata)
|
||||
{
|
||||
switch (metadata % 8)
|
||||
{
|
||||
case 0:
|
||||
return new FurnaceLogic();
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
switch (metadata % 8) {
|
||||
case 0:
|
||||
return new FurnaceLogic();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
|
||||
{
|
||||
public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
||||
return ToolProxyCommon.furnaceID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getModInstance ()
|
||||
{
|
||||
public Object getModInstance() {
|
||||
return TConstruct.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTextureNames ()
|
||||
{
|
||||
String[] textureNames = { "furnaceslab_front", "furnaceslab_front_active", "furnaceslab_side", "furnace_top" };
|
||||
public String[] getTextureNames() {
|
||||
String[] textureNames = {"furnaceslab_front", "furnaceslab_front_active", "furnaceslab_side", "furnace_top"};
|
||||
|
||||
return textureNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icons[(meta % 8) * 3 + getTextureIndex(side)];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity logic = world.getTileEntity(x, y, z);
|
||||
short direction = (logic instanceof IFacingLogic) ? ((IFacingLogic) logic).getRenderDirection() : 0;
|
||||
int meta = world.getBlockMetadata(x, y, z) % 8;
|
||||
|
||||
if (meta == 0)
|
||||
{
|
||||
if (side == direction)
|
||||
{
|
||||
if (((IActiveLogic) logic).getActive())
|
||||
return icons[1];
|
||||
else
|
||||
return icons[0];
|
||||
}
|
||||
else if (side > 1)
|
||||
{
|
||||
if (meta == 0) {
|
||||
if (side == direction) {
|
||||
if (((IActiveLogic) logic).getActive()) return icons[1];
|
||||
else return icons[0];
|
||||
} else if (side > 1) {
|
||||
return icons[2];
|
||||
}
|
||||
return icons[3];
|
||||
@@ -89,87 +74,66 @@ public class FurnaceSlab extends InventorySlab
|
||||
return icons[0];
|
||||
}
|
||||
|
||||
public int getTextureIndex (int side)
|
||||
{
|
||||
if (side == 0 || side == 1)
|
||||
return 3;
|
||||
if (side == 3)
|
||||
return 0;
|
||||
public int getTextureIndex(int side) {
|
||||
if (side == 0 || side == 1) return 3;
|
||||
if (side == 3) return 0;
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureDomain (int textureNameIndex)
|
||||
{
|
||||
public String getTextureDomain(int textureNameIndex) {
|
||||
return "tinker";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
String[] textureNames = getTextureNames();
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
if (i == 3)
|
||||
this.icons[i] = iconRegister.registerIcon("minecraft:" + textureNames[i]);
|
||||
else
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
if (i == 3) this.icons[i] = iconRegister.registerIcon("minecraft:" + textureNames[i]);
|
||||
else this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World var1, int metadata)
|
||||
{
|
||||
switch (metadata % 8)
|
||||
{
|
||||
case 0:
|
||||
return new FurnaceLogic();
|
||||
public TileEntity createNewTileEntity(World var1, int metadata) {
|
||||
switch (metadata % 8) {
|
||||
case 0:
|
||||
return new FurnaceLogic();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void randomDisplayTick (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||
TileEntity logic = world.getTileEntity(x, y, z);
|
||||
short direction = (logic instanceof IFacingLogic) ? ((IFacingLogic) logic).getRenderDirection() : 0;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int metaType = meta % 8;
|
||||
int metaPos = meta / 8;
|
||||
|
||||
if (metaType == 0)
|
||||
{
|
||||
if (((IActiveLogic) logic).getActive())
|
||||
{
|
||||
if (metaType == 0) {
|
||||
if (((IActiveLogic) logic).getActive()) {
|
||||
float offset = random.nextFloat() * 0.6F - 0.3F;
|
||||
float offsetY = random.nextFloat() * 6.0F / 16.0F;
|
||||
|
||||
if (metaPos == 1)
|
||||
{
|
||||
if (metaPos == 1) {
|
||||
offsetY += 0.5F;
|
||||
}
|
||||
|
||||
if (direction == 4)
|
||||
{
|
||||
if (direction == 4) {
|
||||
world.spawnParticle("smoke", x - 0.02F, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", x - 0.02F, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (direction == 5)
|
||||
{
|
||||
} else if (direction == 5) {
|
||||
world.spawnParticle("smoke", x + 1.02F, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", x + 1.02F, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (direction == 2)
|
||||
{
|
||||
} else if (direction == 2) {
|
||||
world.spawnParticle("smoke", x + offset + 0.5F, y + offsetY, z - 0.02F, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", x + offset + 0.5F, y + offsetY, z - 0.02F, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (direction == 3)
|
||||
{
|
||||
} else if (direction == 3) {
|
||||
world.spawnParticle("smoke", x + offset + 0.5F, y + offsetY, z + 1.02F, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", x + offset + 0.5F, y + offsetY, z + 1.02F, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
@@ -9,109 +9,126 @@ import net.minecraft.util.*;
|
||||
import net.minecraft.world.*;
|
||||
import tconstruct.blocks.TConstructBlock;
|
||||
|
||||
public class MultiBrick extends TConstructBlock
|
||||
{
|
||||
static String blockTextures[] = { "brick_obsidian", "brick_sandstone", "brick_netherrack", "brick_stone_refined", "brick_iron", "brick_gold", "brick_lapis", "brick_diamond", "brick_redstone", "brick_bone", "brick_slime", "brick_blueslime", "brick_endstone", "brick_obsidian_ingot" };
|
||||
public class MultiBrick extends TConstructBlock {
|
||||
static String blockTextures[] = {
|
||||
"brick_obsidian",
|
||||
"brick_sandstone",
|
||||
"brick_netherrack",
|
||||
"brick_stone_refined",
|
||||
"brick_iron",
|
||||
"brick_gold",
|
||||
"brick_lapis",
|
||||
"brick_diamond",
|
||||
"brick_redstone",
|
||||
"brick_bone",
|
||||
"brick_slime",
|
||||
"brick_blueslime",
|
||||
"brick_endstone",
|
||||
"brick_obsidian_ingot"
|
||||
};
|
||||
|
||||
public MultiBrick()
|
||||
{
|
||||
public MultiBrick() {
|
||||
super(Material.rock, 3f, blockTextures);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness (World world, int x, int y, int z)
|
||||
{
|
||||
public float getBlockHardness(World world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return Blocks.obsidian.getBlockHardness(world, x, y, z);
|
||||
case 1:
|
||||
return Blocks.sandstone.getBlockHardness(world, x, y, z);
|
||||
case 2:
|
||||
return Blocks.netherrack.getBlockHardness(world, x, y, z);
|
||||
case 3:
|
||||
return Blocks.stone.getBlockHardness(world, x, y, z);
|
||||
case 4:
|
||||
return Blocks.iron_block.getBlockHardness(world, x, y, z);
|
||||
case 5:
|
||||
return Blocks.gold_block.getBlockHardness(world, x, y, z);
|
||||
case 6:
|
||||
return Blocks.lapis_block.getBlockHardness(world, x, y, z);
|
||||
case 7:
|
||||
return Blocks.diamond_block.getBlockHardness(world, x, y, z);
|
||||
case 8:
|
||||
return Blocks.redstone_block.getBlockHardness(world, x, y, z);
|
||||
case 9:
|
||||
return 1.0F;
|
||||
case 10:
|
||||
return 1.5F;
|
||||
case 11:
|
||||
return 1.5F;
|
||||
case 12:
|
||||
return Blocks.end_stone.getBlockHardness(world, x, y, z);
|
||||
case 13:
|
||||
return Blocks.obsidian.getBlockHardness(world, x, y, z);
|
||||
default:
|
||||
return blockHardness;
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return Blocks.obsidian.getBlockHardness(world, x, y, z);
|
||||
case 1:
|
||||
return Blocks.sandstone.getBlockHardness(world, x, y, z);
|
||||
case 2:
|
||||
return Blocks.netherrack.getBlockHardness(world, x, y, z);
|
||||
case 3:
|
||||
return Blocks.stone.getBlockHardness(world, x, y, z);
|
||||
case 4:
|
||||
return Blocks.iron_block.getBlockHardness(world, x, y, z);
|
||||
case 5:
|
||||
return Blocks.gold_block.getBlockHardness(world, x, y, z);
|
||||
case 6:
|
||||
return Blocks.lapis_block.getBlockHardness(world, x, y, z);
|
||||
case 7:
|
||||
return Blocks.diamond_block.getBlockHardness(world, x, y, z);
|
||||
case 8:
|
||||
return Blocks.redstone_block.getBlockHardness(world, x, y, z);
|
||||
case 9:
|
||||
return 1.0F;
|
||||
case 10:
|
||||
return 1.5F;
|
||||
case 11:
|
||||
return 1.5F;
|
||||
case 12:
|
||||
return Blocks.end_stone.getBlockHardness(world, x, y, z);
|
||||
case 13:
|
||||
return Blocks.obsidian.getBlockHardness(world, x, y, z);
|
||||
default:
|
||||
return blockHardness;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExplosionResistance (Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
|
||||
{
|
||||
public float getExplosionResistance(
|
||||
Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return Blocks.obsidian.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 1:
|
||||
return Blocks.sandstone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 2:
|
||||
return Blocks.netherrack.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 3:
|
||||
return Blocks.stone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 4:
|
||||
return Blocks.iron_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 5:
|
||||
return Blocks.gold_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 6:
|
||||
return Blocks.lapis_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 7:
|
||||
return Blocks.diamond_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 8:
|
||||
return Blocks.redstone_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 9:
|
||||
return 1.0F;
|
||||
case 10:
|
||||
return 1.5F;
|
||||
case 11:
|
||||
return 1.5F;
|
||||
case 12:
|
||||
return Blocks.end_stone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 13:
|
||||
return Blocks.obsidian.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
default:
|
||||
return getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return Blocks.obsidian.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 1:
|
||||
return Blocks.sandstone.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 2:
|
||||
return Blocks.netherrack.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 3:
|
||||
return Blocks.stone.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 4:
|
||||
return Blocks.iron_block.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 5:
|
||||
return Blocks.gold_block.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 6:
|
||||
return Blocks.lapis_block.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 7:
|
||||
return Blocks.diamond_block.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 8:
|
||||
return Blocks.redstone_block.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 9:
|
||||
return 1.0F;
|
||||
case 10:
|
||||
return 1.5F;
|
||||
case 11:
|
||||
return 1.5F;
|
||||
case 12:
|
||||
return Blocks.end_stone.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 13:
|
||||
return Blocks.obsidian.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
default:
|
||||
return getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 10 || meta == 11)
|
||||
{
|
||||
if (entity.motionY < 0)
|
||||
entity.motionY *= -1.2F;
|
||||
if (meta == 10 || meta == 11) {
|
||||
if (entity.motionY < 0) entity.motionY *= -1.2F;
|
||||
entity.fallDistance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO getCollisionBoundingBoxFromPool
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 10 || meta == 11)
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 0.625D, (double) z + 1.0D);
|
||||
@@ -123,37 +140,30 @@ public class MultiBrick extends TConstructBlock
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower ()
|
||||
{
|
||||
public boolean canProvidePower() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
if (world.getBlockMetadata(x, y, z) == 8)
|
||||
return 4;
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
|
||||
if (world.getBlockMetadata(x, y, z) == 8) return 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:bricks/" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public boolean isNormalCube(IBlockAccess world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta != 8)
|
||||
{
|
||||
if (meta != 8) {
|
||||
return true;
|
||||
}
|
||||
return super.isNormalCube(world, x, y, z);
|
||||
|
||||
@@ -9,114 +9,133 @@ import net.minecraft.util.*;
|
||||
import net.minecraft.world.*;
|
||||
import tconstruct.blocks.TConstructBlock;
|
||||
|
||||
public class MultiBrickFancy extends TConstructBlock
|
||||
{
|
||||
static String blockTextures[] = { "fancybrick_obsidian", "fancybrick_sandstone", "fancybrick_netherrack", "fancybrick_stone_refined", "fancybrick_iron", "fancybrick_gold", "fancybrick_lapis", "fancybrick_diamond", "fancybrick_redstone", "fancybrick_bone", "fancybrick_slime", "fancybrick_blueslime", "fancybrick_endstone", "fancybrick_obsidian_ingot", "fancybrick_stone", "road_stone" };
|
||||
public class MultiBrickFancy extends TConstructBlock {
|
||||
static String blockTextures[] = {
|
||||
"fancybrick_obsidian",
|
||||
"fancybrick_sandstone",
|
||||
"fancybrick_netherrack",
|
||||
"fancybrick_stone_refined",
|
||||
"fancybrick_iron",
|
||||
"fancybrick_gold",
|
||||
"fancybrick_lapis",
|
||||
"fancybrick_diamond",
|
||||
"fancybrick_redstone",
|
||||
"fancybrick_bone",
|
||||
"fancybrick_slime",
|
||||
"fancybrick_blueslime",
|
||||
"fancybrick_endstone",
|
||||
"fancybrick_obsidian_ingot",
|
||||
"fancybrick_stone",
|
||||
"road_stone"
|
||||
};
|
||||
|
||||
public MultiBrickFancy()
|
||||
{
|
||||
public MultiBrickFancy() {
|
||||
super(Material.rock, 3f, blockTextures);
|
||||
}
|
||||
|
||||
// TODO getBlockHardness
|
||||
@Override
|
||||
public float getBlockHardness (World world, int x, int y, int z)
|
||||
{
|
||||
public float getBlockHardness(World world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return Blocks.obsidian.getBlockHardness(world, x, y, z);
|
||||
case 1:
|
||||
return Blocks.sandstone.getBlockHardness(world, x, y, z);
|
||||
case 2:
|
||||
return Blocks.netherrack.getBlockHardness(world, x, y, z);
|
||||
case 4:
|
||||
return Blocks.iron_block.getBlockHardness(world, x, y, z);
|
||||
case 5:
|
||||
return Blocks.gold_block.getBlockHardness(world, x, y, z);
|
||||
case 6:
|
||||
return Blocks.lapis_block.getBlockHardness(world, x, y, z);
|
||||
case 7:
|
||||
return Blocks.diamond_block.getBlockHardness(world, x, y, z);
|
||||
case 8:
|
||||
return Blocks.redstone_block.getBlockHardness(world, x, y, z);
|
||||
case 9:
|
||||
return 1.0F;
|
||||
case 10:
|
||||
return 1.5F;
|
||||
case 11:
|
||||
return 1.5F;
|
||||
case 12:
|
||||
return Blocks.end_stone.getBlockHardness(world, x, y, z);
|
||||
case 13:
|
||||
return Blocks.obsidian.getBlockHardness(world, x, y, z);
|
||||
case 3:
|
||||
case 14:
|
||||
case 15:
|
||||
return Blocks.stone.getBlockHardness(world, x, y, z);
|
||||
default:
|
||||
return blockHardness;
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return Blocks.obsidian.getBlockHardness(world, x, y, z);
|
||||
case 1:
|
||||
return Blocks.sandstone.getBlockHardness(world, x, y, z);
|
||||
case 2:
|
||||
return Blocks.netherrack.getBlockHardness(world, x, y, z);
|
||||
case 4:
|
||||
return Blocks.iron_block.getBlockHardness(world, x, y, z);
|
||||
case 5:
|
||||
return Blocks.gold_block.getBlockHardness(world, x, y, z);
|
||||
case 6:
|
||||
return Blocks.lapis_block.getBlockHardness(world, x, y, z);
|
||||
case 7:
|
||||
return Blocks.diamond_block.getBlockHardness(world, x, y, z);
|
||||
case 8:
|
||||
return Blocks.redstone_block.getBlockHardness(world, x, y, z);
|
||||
case 9:
|
||||
return 1.0F;
|
||||
case 10:
|
||||
return 1.5F;
|
||||
case 11:
|
||||
return 1.5F;
|
||||
case 12:
|
||||
return Blocks.end_stone.getBlockHardness(world, x, y, z);
|
||||
case 13:
|
||||
return Blocks.obsidian.getBlockHardness(world, x, y, z);
|
||||
case 3:
|
||||
case 14:
|
||||
case 15:
|
||||
return Blocks.stone.getBlockHardness(world, x, y, z);
|
||||
default:
|
||||
return blockHardness;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExplosionResistance (Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
|
||||
{
|
||||
public float getExplosionResistance(
|
||||
Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return Blocks.obsidian.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 1:
|
||||
return Blocks.sandstone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 2:
|
||||
return Blocks.netherrack.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 4:
|
||||
return Blocks.iron_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 5:
|
||||
return Blocks.gold_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 6:
|
||||
return Blocks.lapis_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 7:
|
||||
return Blocks.diamond_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 8:
|
||||
return Blocks.redstone_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 9:
|
||||
return 1.0F;
|
||||
case 10:
|
||||
return 1.5F;
|
||||
case 11:
|
||||
return 1.5F;
|
||||
case 12:
|
||||
return Blocks.end_stone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 13:
|
||||
return Blocks.obsidian.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 3:
|
||||
case 14:
|
||||
case 15:
|
||||
return Blocks.stone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
default:
|
||||
return getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return Blocks.obsidian.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 1:
|
||||
return Blocks.sandstone.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 2:
|
||||
return Blocks.netherrack.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 4:
|
||||
return Blocks.iron_block.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 5:
|
||||
return Blocks.gold_block.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 6:
|
||||
return Blocks.lapis_block.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 7:
|
||||
return Blocks.diamond_block.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 8:
|
||||
return Blocks.redstone_block.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 9:
|
||||
return 1.0F;
|
||||
case 10:
|
||||
return 1.5F;
|
||||
case 11:
|
||||
return 1.5F;
|
||||
case 12:
|
||||
return Blocks.end_stone.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 13:
|
||||
return Blocks.obsidian.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
case 3:
|
||||
case 14:
|
||||
case 15:
|
||||
return Blocks.stone.getExplosionResistance(
|
||||
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
default:
|
||||
return getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO onEntityCollidedWithBlock
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 10 || meta == 11)
|
||||
{
|
||||
if (entity.motionY < 0)
|
||||
entity.motionY *= -1.2F;
|
||||
if (meta == 10 || meta == 11) {
|
||||
if (entity.motionY < 0) entity.motionY *= -1.2F;
|
||||
entity.fallDistance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 10 || meta == 11)
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 0.625D, (double) z + 1.0D);
|
||||
@@ -128,37 +147,30 @@ public class MultiBrickFancy extends TConstructBlock
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower ()
|
||||
{
|
||||
public boolean canProvidePower() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
if (world.getBlockMetadata(x, y, z) == 8)
|
||||
return 4;
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
|
||||
if (world.getBlockMetadata(x, y, z) == 8) return 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:bricks/" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public boolean isNormalCube(IBlockAccess world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta != 8)
|
||||
{
|
||||
if (meta != 8) {
|
||||
return true;
|
||||
}
|
||||
return super.isNormalCube(world, x, y, z);
|
||||
|
||||
@@ -9,22 +9,28 @@ import net.minecraft.util.IIcon;
|
||||
import tconstruct.blocks.TConstructBlock;
|
||||
|
||||
public class MultiBrickMetal extends TConstructBlock {
|
||||
static String blockTextures[] = { "brick_alumite", "brick_ardite", "brick_cobalt", "brick_manyullyn", "fancybrick_alumite", "fancybrick_ardite", "fancybrick_cobalt", "fancybrick_manyullyn"};
|
||||
static String blockTextures[] = {
|
||||
"brick_alumite",
|
||||
"brick_ardite",
|
||||
"brick_cobalt",
|
||||
"brick_manyullyn",
|
||||
"fancybrick_alumite",
|
||||
"fancybrick_ardite",
|
||||
"fancybrick_cobalt",
|
||||
"fancybrick_manyullyn"
|
||||
};
|
||||
|
||||
public MultiBrickMetal()
|
||||
{
|
||||
public MultiBrickMetal() {
|
||||
super(Material.iron, 10f, blockTextures);
|
||||
this.setStepSound(Block.soundTypeMetal);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:bricks/" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,63 +21,69 @@ import tconstruct.tools.logic.ToolForgeLogic;
|
||||
import tconstruct.tools.model.TableRender;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
public class ToolForgeBlock extends InventoryBlock
|
||||
{
|
||||
public class ToolForgeBlock extends InventoryBlock {
|
||||
|
||||
public ToolForgeBlock(Material material)
|
||||
{
|
||||
public ToolForgeBlock(Material material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
this.setHardness(2f);
|
||||
this.setStepSound(Block.soundTypeMetal);
|
||||
}
|
||||
|
||||
String[] textureNames = { "toolforge_iron", "toolforge_gold", "toolforge_diamond", "toolforge_emerald", "toolforge_cobalt", "toolforge_ardite", "toolforge_manyullyn", "toolforge_copper", "toolforge_bronze", "toolforge_tin", "toolforge_aluminum", "toolforge_alubrass", "toolforge_alumite", "toolforge_steel" };
|
||||
String[] textureNames = {
|
||||
"toolforge_iron",
|
||||
"toolforge_gold",
|
||||
"toolforge_diamond",
|
||||
"toolforge_emerald",
|
||||
"toolforge_cobalt",
|
||||
"toolforge_ardite",
|
||||
"toolforge_manyullyn",
|
||||
"toolforge_copper",
|
||||
"toolforge_bronze",
|
||||
"toolforge_tin",
|
||||
"toolforge_aluminum",
|
||||
"toolforge_alubrass",
|
||||
"toolforge_alumite",
|
||||
"toolforge_steel"
|
||||
};
|
||||
|
||||
/* Rendering */
|
||||
@Override
|
||||
public String[] getTextureNames ()
|
||||
{
|
||||
public String[] getTextureNames() {
|
||||
return textureNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureDomain (int textureNameIndex)
|
||||
{
|
||||
public String getTextureDomain(int textureNameIndex) {
|
||||
return "tinker";
|
||||
}
|
||||
|
||||
IIcon textureTop;
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
super.registerBlockIcons(iconRegister);
|
||||
textureTop = iconRegister.registerIcon("tinker:toolforge_top");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
if (side == 1)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side == 1) {
|
||||
return textureTop;
|
||||
}
|
||||
if (side == 0)
|
||||
{
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return Blocks.iron_block.getIcon(side, 0);
|
||||
case 1:
|
||||
return Blocks.gold_block.getIcon(side, 0);
|
||||
case 2:
|
||||
return Blocks.diamond_block.getIcon(side, 0);
|
||||
case 3:
|
||||
return Blocks.emerald_block.getIcon(side, 0);
|
||||
default:
|
||||
return TinkerWorld.metalBlock.getIcon(side, meta - 4);
|
||||
if (side == 0) {
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return Blocks.iron_block.getIcon(side, 0);
|
||||
case 1:
|
||||
return Blocks.gold_block.getIcon(side, 0);
|
||||
case 2:
|
||||
return Blocks.diamond_block.getIcon(side, 0);
|
||||
case 3:
|
||||
return Blocks.emerald_block.getIcon(side, 0);
|
||||
default:
|
||||
return TinkerWorld.metalBlock.getIcon(side, meta - 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,58 +91,48 @@ public class ToolForgeBlock extends InventoryBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid (IBlockAccess world, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
return side == ForgeDirection.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return TableRender.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int metadata)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new ToolForgeLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
|
||||
{
|
||||
public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
||||
return ToolProxyCommon.toolForgeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getModInstance ()
|
||||
{
|
||||
public Object getModInstance() {
|
||||
return TConstruct.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < textureNames.length; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item b, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < textureNames.length; iter++) {
|
||||
list.add(new ItemStack(b, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,166 +22,180 @@ import tconstruct.tools.logic.*;
|
||||
import tconstruct.tools.model.TableRender;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
public class ToolStationBlock extends InventoryBlock
|
||||
{
|
||||
public ToolStationBlock(Material material)
|
||||
{
|
||||
public class ToolStationBlock extends InventoryBlock {
|
||||
public ToolStationBlock(Material material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
this.setHardness(2f);
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
}
|
||||
|
||||
//Block.hasComparatorInputOverride and Block.getComparatorInputOverride
|
||||
// Block.hasComparatorInputOverride and Block.getComparatorInputOverride
|
||||
|
||||
/* Rendering */
|
||||
@Override
|
||||
public String[] getTextureNames ()
|
||||
{
|
||||
String[] textureNames = { "toolstation_top", "toolstation_side", "toolstation_bottom", "partbuilder_oak_top", "partbuilder_oak_side", "partbuilder_oak_bottom", "partbuilder_spruce_top", "partbuilder_spruce_side", "partbuilder_spruce_bottom", "partbuilder_birch_top", "partbuilder_birch_side", "partbuilder_birch_bottom", "partbuilder_jungle_top", "partbuilder_jungle_side", "partbuilder_jungle_bottom", "patternchest_top", "patternchest_side", "patternchest_bottom", "stenciltable_oak_top", "stenciltable_oak_side", "stenciltable_oak_bottom", "stenciltable_spruce_top", "stenciltable_spruce_side", "stenciltable_spruce_bottom", "stenciltable_birch_top", "stenciltable_birch_side", "stenciltable_birch_bottom", "stenciltable_jungle_top", "stenciltable_jungle_side", "stenciltable_jungle_bottom" };
|
||||
public String[] getTextureNames() {
|
||||
String[] textureNames = {
|
||||
"toolstation_top",
|
||||
"toolstation_side",
|
||||
"toolstation_bottom",
|
||||
"partbuilder_oak_top",
|
||||
"partbuilder_oak_side",
|
||||
"partbuilder_oak_bottom",
|
||||
"partbuilder_spruce_top",
|
||||
"partbuilder_spruce_side",
|
||||
"partbuilder_spruce_bottom",
|
||||
"partbuilder_birch_top",
|
||||
"partbuilder_birch_side",
|
||||
"partbuilder_birch_bottom",
|
||||
"partbuilder_jungle_top",
|
||||
"partbuilder_jungle_side",
|
||||
"partbuilder_jungle_bottom",
|
||||
"patternchest_top",
|
||||
"patternchest_side",
|
||||
"patternchest_bottom",
|
||||
"stenciltable_oak_top",
|
||||
"stenciltable_oak_side",
|
||||
"stenciltable_oak_bottom",
|
||||
"stenciltable_spruce_top",
|
||||
"stenciltable_spruce_side",
|
||||
"stenciltable_spruce_bottom",
|
||||
"stenciltable_birch_top",
|
||||
"stenciltable_birch_side",
|
||||
"stenciltable_birch_bottom",
|
||||
"stenciltable_jungle_top",
|
||||
"stenciltable_jungle_side",
|
||||
"stenciltable_jungle_bottom"
|
||||
};
|
||||
|
||||
return textureNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
if (meta <= 4)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (meta <= 4) {
|
||||
return icons[meta * 3 + getTextureIndex(side)];
|
||||
}
|
||||
else if (meta <= 9)
|
||||
{
|
||||
} else if (meta <= 9) {
|
||||
return icons[15 + getTextureIndex(side)];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return icons[meta * 3 + getTextureIndex(side) - 12];
|
||||
}
|
||||
}
|
||||
|
||||
public int getTextureIndex (int side)
|
||||
{
|
||||
if (side == 0)
|
||||
return 2;
|
||||
if (side == 1)
|
||||
return 0;
|
||||
public int getTextureIndex(int side) {
|
||||
if (side == 0) return 2;
|
||||
if (side == 1) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid (IBlockAccess world, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
return side == ForgeDirection.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return TableRender.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (metadata == 5)
|
||||
return AxisAlignedBB.getBoundingBox((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.getBoundingBox((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
(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.getBoundingBox(
|
||||
(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 createNewTileEntity (World world, int metadata)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
return new ToolStationLogic();
|
||||
case 1:
|
||||
return new PartBuilderLogic();
|
||||
case 2:
|
||||
return new PartBuilderLogic();
|
||||
case 3:
|
||||
return new PartBuilderLogic();
|
||||
case 4:
|
||||
return new PartBuilderLogic();
|
||||
case 5:
|
||||
return new PatternChestLogic();
|
||||
case 6:
|
||||
return new PatternChestLogic();
|
||||
case 7:
|
||||
return new PatternChestLogic();
|
||||
case 8:
|
||||
return new PatternChestLogic();
|
||||
case 9:
|
||||
return new PatternChestLogic();
|
||||
case 10:
|
||||
return new StencilTableLogic();
|
||||
case 11:
|
||||
return new StencilTableLogic();
|
||||
case 12:
|
||||
return new StencilTableLogic();
|
||||
case 13:
|
||||
return new StencilTableLogic();
|
||||
/*case 14:
|
||||
return new CastingTableLogic();*/
|
||||
default:
|
||||
return null;
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
switch (metadata) {
|
||||
case 0:
|
||||
return new ToolStationLogic();
|
||||
case 1:
|
||||
return new PartBuilderLogic();
|
||||
case 2:
|
||||
return new PartBuilderLogic();
|
||||
case 3:
|
||||
return new PartBuilderLogic();
|
||||
case 4:
|
||||
return new PartBuilderLogic();
|
||||
case 5:
|
||||
return new PatternChestLogic();
|
||||
case 6:
|
||||
return new PatternChestLogic();
|
||||
case 7:
|
||||
return new PatternChestLogic();
|
||||
case 8:
|
||||
return new PatternChestLogic();
|
||||
case 9:
|
||||
return new PatternChestLogic();
|
||||
case 10:
|
||||
return new StencilTableLogic();
|
||||
case 11:
|
||||
return new StencilTableLogic();
|
||||
case 12:
|
||||
return new StencilTableLogic();
|
||||
case 13:
|
||||
return new StencilTableLogic();
|
||||
/*case 14:
|
||||
return new CastingTableLogic();*/
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
|
||||
{
|
||||
public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
||||
int md = world.getBlockMetadata(x, y, z);
|
||||
if (md == 0)
|
||||
return 0;
|
||||
else if (md < 5)
|
||||
return 1;
|
||||
else if (md < 10)
|
||||
return 2;
|
||||
else
|
||||
return 3;
|
||||
if (md == 0) return 0;
|
||||
else if (md < 5) return 1;
|
||||
else if (md < 10) return 2;
|
||||
else return 3;
|
||||
|
||||
//return -1;
|
||||
// return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getModInstance ()
|
||||
{
|
||||
public Object getModInstance() {
|
||||
return TConstruct.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < 6; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < 6; iter++) {
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
|
||||
for (int iter = 10; iter < 14; iter++)
|
||||
{
|
||||
for (int iter = 10; iter < 14; iter++) {
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
}
|
||||
@@ -206,22 +220,18 @@ public class ToolStationBlock extends InventoryBlock
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public String getTextureDomain (int textureNameIndex)
|
||||
{
|
||||
public String getTextureDomain(int textureNameIndex) {
|
||||
return "tinker";
|
||||
}
|
||||
|
||||
/* Keep pattern chest inventory */
|
||||
@Override
|
||||
public boolean removedByPlayer (World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
|
||||
{
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
player.addExhaustion(0.025F);
|
||||
|
||||
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops"))
|
||||
{
|
||||
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta >= 5 && meta <= 9)
|
||||
{
|
||||
if (meta >= 5 && meta <= 9) {
|
||||
ItemStack chest = new ItemStack(this, 1, 5);
|
||||
NBTTagCompound inventory = new NBTTagCompound();
|
||||
PatternChestLogic logic = (PatternChestLogic) world.getTileEntity(x, y, z);
|
||||
@@ -232,17 +242,16 @@ public class ToolStationBlock extends InventoryBlock
|
||||
|
||||
// remove content. This is necessary because otherwise the patterns would also spill into the world
|
||||
// we don't want to prevent that since that's the intended behaviour for explosions.
|
||||
for(int i = 0; i < logic.getSizeInventory(); i++)
|
||||
logic.setInventorySlotContents(i, null);
|
||||
for (int i = 0; i < logic.getSizeInventory(); i++) logic.setInventorySlotContents(i, null);
|
||||
|
||||
//Spawn item
|
||||
if (!player.capabilities.isCreativeMode || player.isSneaking())
|
||||
{
|
||||
// Spawn item
|
||||
if (!player.capabilities.isCreativeMode || player.isSneaking()) {
|
||||
float f = 0.7F;
|
||||
double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, chest);
|
||||
EntityItem entityitem =
|
||||
new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, chest);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
@@ -252,23 +261,18 @@ public class ToolStationBlock extends InventoryBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock (World world, EntityPlayer player, int x, int y, int z, int meta)
|
||||
{
|
||||
if (meta < 5 || meta > 9)
|
||||
super.harvestBlock(world, player, x, y, z, meta);
|
||||
//Do nothing
|
||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
||||
if (meta < 5 || meta > 9) super.harvestBlock(world, player, x, y, z, meta);
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
|
||||
{
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) {
|
||||
boolean keptInventory = false;
|
||||
if (stack.hasTagCompound())
|
||||
{
|
||||
if (stack.hasTagCompound()) {
|
||||
NBTTagCompound inventory = stack.getTagCompound().getCompoundTag("Inventory");
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (inventory != null && te instanceof PatternChestLogic)
|
||||
{
|
||||
if (inventory != null && te instanceof PatternChestLogic) {
|
||||
PatternChestLogic logic = (PatternChestLogic) te;
|
||||
logic.readInventoryFromNBT(inventory);
|
||||
logic.xCoord = x;
|
||||
@@ -277,14 +281,11 @@ public class ToolStationBlock extends InventoryBlock
|
||||
keptInventory = true;
|
||||
}
|
||||
}
|
||||
if (!keptInventory && PHConstruct.freePatterns)
|
||||
{
|
||||
if (!keptInventory && PHConstruct.freePatterns) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 5)
|
||||
{
|
||||
if (meta == 5) {
|
||||
PatternChestLogic logic = (PatternChestLogic) world.getTileEntity(x, y, z);
|
||||
for (int i = 1; i <= 13; i++)
|
||||
{
|
||||
for (int i = 1; i <= 13; i++) {
|
||||
logic.setInventorySlotContents(i - 1, new ItemStack(TinkerTools.woodPattern, 1, i));
|
||||
}
|
||||
logic.setInventorySlotContents(13, new ItemStack(TinkerTools.woodPattern, 1, 22));
|
||||
@@ -292,4 +293,4 @@ public class ToolStationBlock extends InventoryBlock
|
||||
}
|
||||
super.onBlockPlacedBy(world, x, y, z, living, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user