Skip to content

Commit

Permalink
Push everything i did.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander committed Feb 15, 2014
1 parent e0a254f commit 06ec60d
Show file tree
Hide file tree
Showing 29 changed files with 129 additions and 161 deletions.
89 changes: 60 additions & 29 deletions src/main/java/tconstruct/blocks/LavaTankBlock.java
Expand Up @@ -3,7 +3,6 @@
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;
Expand All @@ -22,7 +21,6 @@
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;
Expand All @@ -38,8 +36,8 @@ public LavaTankBlock()
setHardness(3F);
setResistance(20F);
setCreativeTab(TConstructRegistry.blockTab);
setBlockName("TConstruct.LavaTank");
stepSound = Block.soundTypeGlass;
this.setBlockName("TConstruct.LavaTank");
setStepSound(Block.soundTypeGrass);
}

public LavaTankBlock(String prefix)
Expand All @@ -59,14 +57,14 @@ public String[] getTextureNames ()
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]);
}
}

Expand All @@ -92,9 +90,9 @@ public boolean renderAsNormalBlock ()
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;
}

Expand Down Expand Up @@ -151,53 +149,80 @@ public int getTextureIndex (int side)
}

@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)
{
int amount = logic.fill(ForgeDirection.UNKNOWN, liquid, false);
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);
}
}
}
Expand All @@ -208,7 +233,7 @@ else if (FluidContainerRegistry.isBucket(heldItem))
return true;
}
}
}
}*/

return false;
}
Expand All @@ -231,11 +256,17 @@ public static ItemStack consumeItem (ItemStack stack)
}

@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));
}
}

Expand Down Expand Up @@ -274,7 +305,7 @@ public boolean removedByPlayer (World world, EntityPlayer player, int x, int y,
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)
Expand Down Expand Up @@ -310,4 +341,4 @@ public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase
}
}
}
}
}
14 changes: 7 additions & 7 deletions src/main/java/tconstruct/blocks/SmelteryBlock.java
Expand Up @@ -51,6 +51,7 @@ public SmelteryBlock(String prefix)
}

/* Rendering */

@Override
public int getRenderType ()
{
Expand Down Expand Up @@ -269,18 +270,18 @@ public void breakBlock (World world, int x, int y, int z, int par5, int par6) //
}*/

@Override
public void getSubBlocks (Item b, CreativeTabs tab, List list)
public void getSubBlocks (Item id, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 12; iter++)
{
if (iter != 3)
list.add(new ItemStack(b, 1, iter));
list.add(new ItemStack(id, 1, iter));
}
}

/* Updating */
@Override
public void onNeighborBlockChange (World world, int x, int y, int z, Block block)
public void onNeighborBlockChange (World world, int x, int y, int z, Block nBlockID)
{
//System.out.println("Neighbor changed");
TileEntity logic = world.getTileEntity(x, y, z);
Expand All @@ -295,14 +296,13 @@ else if (logic instanceof IMasterLogic)
}

@Override
public void breakBlock (World world, int x, int y, int z, Block block, int meta)
public void breakBlock (World world, int x, int y, int z, Block blockID, int meta)
{
TileEntity logic = world.getTileEntity(x, y, z);
if (logic instanceof IServantLogic)
{
((IServantLogic) logic).notifyMasterOfChange();
}
super.breakBlock(world, x, y, z, block, meta);
super.breakBlock(world, x, y, z, blockID, meta);
}

}
}
7 changes: 3 additions & 4 deletions src/main/java/tconstruct/blocks/TankAirBlock.java
Expand Up @@ -41,7 +41,7 @@ public int getRenderType ()
}

@SideOnly(Side.CLIENT)
public void registerBlockIcons (IIconRegister par1IconRegister)
public void registerIcons (IIconRegister par1IconRegister)
{

}
Expand Down Expand Up @@ -102,8 +102,7 @@ public boolean isAir (IBlockAccess world, int x, int y, int z)
}

@Override
public void getSubBlocks (Item i, CreativeTabs tab, List list)
public void getSubBlocks (Item id, CreativeTabs tab, List list)
{
}

}
}
Expand Up @@ -3,7 +3,6 @@
import java.util.ArrayList;

import mantle.world.CoordTuple;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/tconstruct/blocks/logic/AdaptiveDrainLogic.java
@@ -1,7 +1,5 @@
package tconstruct.blocks.logic;

import tconstruct.TConstruct;
import tconstruct.library.crafting.AlloyMix;
import mantle.blocks.abstracts.MultiServantLogic;
import mantle.blocks.iface.IFacingLogic;
import mantle.blocks.iface.IMasterLogic;
Expand Down
Expand Up @@ -30,7 +30,6 @@
import tconstruct.TConstruct;
import tconstruct.blocks.component.SmelteryComponent;
import tconstruct.blocks.component.SmelteryScan;
import tconstruct.common.TContent;
import tconstruct.common.TRepo;
import tconstruct.inventory.AdaptiveSmelteryContainer;
import tconstruct.library.component.IComponentHolder;
Expand Down Expand Up @@ -573,8 +572,8 @@ public void writeNetworkNBT (NBTTagCompound tags)
@Override
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
{
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
readNetworkNBT(packet.func_148857_g());
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}

@Override
Expand All @@ -584,7 +583,7 @@ public Packet getDescriptionPacket ()
writeNetworkNBT(tag);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
}

@Override
public String getInventoryName ()
{
Expand All @@ -606,4 +605,4 @@ public void openInventory ()
public void closeInventory ()
{
}
}
}
6 changes: 3 additions & 3 deletions src/main/java/tconstruct/blocks/logic/CastingTableLogic.java
@@ -1,8 +1,5 @@
package tconstruct.blocks.logic;

import tconstruct.TConstruct;
import tconstruct.library.crafting.CastingRecipe;
import tconstruct.library.util.IPattern;
import mantle.blocks.abstracts.InventoryLogic;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
Expand All @@ -20,6 +17,9 @@
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank;
import tconstruct.TConstruct;
import tconstruct.library.crafting.CastingRecipe;
import tconstruct.library.util.IPattern;

public class CastingTableLogic extends InventoryLogic implements IFluidTank, IFluidHandler, ISidedInventory
{
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/tconstruct/blocks/logic/LavaTankLogic.java
Expand Up @@ -13,7 +13,6 @@
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank;

public class LavaTankLogic extends MultiServantLogic implements IFluidHandler
{
Expand Down Expand Up @@ -160,8 +159,8 @@ public Packet getDescriptionPacket ()
@Override
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
{
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
readCustomNBT(packet.func_148857_g());
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}

/* Updating */
Expand Down
@@ -1,6 +1,5 @@
package tconstruct.blocks.logic;

import tconstruct.library.crafting.AlloyMix;
import mantle.blocks.abstracts.MultiServantLogic;
import mantle.blocks.iface.IFacingLogic;
import net.minecraft.entity.EntityLivingBase;
Expand Down

0 comments on commit 06ec60d

Please sign in to comment.