mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-18 19:39:12 +00:00
Push everything i did.
This commit is contained in:
1 parent
e0a254fd3f
commit
06ec60d1ee
29 files changed
+132
-164
No files matched your search
@@ -3,7 +3,6 @@ package tconstruct.blocks;
|
||||
import java.util.List;
|
||||
|
||||
import mantle.blocks.iface.IServantLogic;
|
||||
import mantle.world.WorldHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -22,7 +21,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import tconstruct.blocks.logic.LavaTankLogic;
|
||||
import tconstruct.client.block.TankRender;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
@@ -38,8 +36,8 @@ public class LavaTankBlock extends BlockContainer
|
||||
setHardness(3F);
|
||||
setResistance(20F);
|
||||
setCreativeTab(TConstructRegistry.blockTab);
|
||||
setBlockName("TConstruct.LavaTank");
|
||||
stepSound = Block.soundTypeGlass;
|
||||
this.setBlockName("TConstruct.LavaTank");
|
||||
setStepSound(Block.soundTypeGrass);
|
||||
}
|
||||
|
||||
public LavaTankBlock(String prefix)
|
||||
@@ -59,14 +57,14 @@ public class LavaTankBlock extends BlockContainer
|
||||
return textureNames;
|
||||
}
|
||||
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
public void registerBlockIcons (IIconRegister IIconRegister)
|
||||
{
|
||||
String[] textureNames = getTextureNames();
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
this.icons[i] = IIconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,9 +90,9 @@ public class LavaTankBlock extends BlockContainer
|
||||
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
//if (side == 0 && world.getBlockMetadata(x, y, z) == 0)
|
||||
//return super. shouldSideBeRendered(world, x, y, z, side);
|
||||
Block b = world.getBlock(x, y, z);
|
||||
return b == (Block) this ? false : super.shouldSideBeRendered(world, x, y, z, side);
|
||||
//return super.shouldSideBeRendered(world, x, y, z, side);
|
||||
Block bID = world.getBlock(x, y, z);
|
||||
return bID == this ? false : super.shouldSideBeRendered(world, x, y, z, side);
|
||||
//return true;
|
||||
}
|
||||
|
||||
@@ -151,18 +149,45 @@ public class LavaTankBlock extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int metadata)
|
||||
public TileEntity createTileEntity (World world, int metadata)
|
||||
{
|
||||
return new LavaTankLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
|
||||
public boolean onBlockActivated (World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
ItemStack heldItem = player.inventory.getCurrentItem();
|
||||
if (heldItem != null)
|
||||
ItemStack current = entityplayer.inventory.getCurrentItem();
|
||||
|
||||
if (current != null)
|
||||
{
|
||||
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(player.getCurrentEquippedItem());
|
||||
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(current);
|
||||
|
||||
LavaTankLogic tank = (LavaTankLogic) world.getTileEntity(i, j, k);
|
||||
|
||||
if (liquid != null)
|
||||
{
|
||||
int qty = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
|
||||
|
||||
if (qty != 0 && !entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, consumeItem(current));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**ItemStack current = entityplayer.inventory.getCurrentItem();
|
||||
if (current != null)
|
||||
{
|
||||
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(current);
|
||||
//FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(current);
|
||||
LavaTankLogic logic = (LavaTankLogic) world.getTileEntity(x, y, z);
|
||||
if (liquid != null)
|
||||
{
|
||||
@@ -170,34 +195,34 @@ public class LavaTankBlock extends BlockContainer
|
||||
if (amount == liquid.amount)
|
||||
{
|
||||
logic.fill(ForgeDirection.UNKNOWN, liquid, true);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, consumeItem(heldItem));
|
||||
if (!entityplayer.capabilities.isCreativeMode)
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, consumeItem(current));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
else if (FluidContainerRegistry.isBucket(heldItem))
|
||||
else if (FluidContainerRegistry.isFilledContainer(current))
|
||||
{
|
||||
FluidTankInfo[] tanks = logic.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
FluidStack fillFluid = tanks[0].fluid;//getFluid();
|
||||
ItemStack fillStack = FluidContainerRegistry.fillFluidContainer(fillFluid, heldItem);
|
||||
ItemStack fillStack = FluidContainerRegistry.fillFluidContainer(fillFluid, current);
|
||||
if (fillStack != null)
|
||||
{
|
||||
logic.drain(ForgeDirection.UNKNOWN, FluidContainerRegistry.getFluidForFilledItem(fillStack).amount, true);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
if (!entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
if (heldItem.stackSize == 1)
|
||||
if (current.stackSize == 1)
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, fillStack);
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, fillStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, consumeItem(heldItem));
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, consumeItem(current));
|
||||
|
||||
if (!player.inventory.addItemStackToInventory(fillStack))
|
||||
if (!entityplayer.inventory.addItemStackToInventory(fillStack))
|
||||
{
|
||||
player.dropPlayerItemWithRandomChoice(fillStack, false);
|
||||
entityplayer.dropPlayerItemWithRandomChoice(fillStack, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,7 +233,7 @@ public class LavaTankBlock extends BlockContainer
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -231,11 +256,17 @@ public class LavaTankBlock extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item i, CreativeTabs tab, List list)
|
||||
public TileEntity createNewTileEntity (World world, int test)
|
||||
{
|
||||
return createTileEntity(world, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < 3; iter++)
|
||||
{
|
||||
list.add(new ItemStack(i, 1, iter));
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +305,7 @@ public class LavaTankBlock extends BlockContainer
|
||||
if (!player.capabilities.isCreativeMode || player.isSneaking())
|
||||
dropTankBlock(world, x, y, z, stack);
|
||||
|
||||
return WorldHelper.setBlockToAirBool(world, x, y, z);
|
||||
return world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
protected void dropTankBlock (World world, int x, int y, int z, ItemStack stack)
|
||||
@@ -310,4 +341,4 @@ public class LavaTankBlock extends BlockContainer
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user