mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-26 06:52:58 +00:00
Remove all references to the adaptive smeltery so people don't get confused
RIP Adaptive smeltery
This commit is contained in:
1 parent
e86fa2bb70
commit
168126b900
17 files changed
+12
-2453
No files matched your search
@@ -38,7 +38,6 @@ public class SmelteryProxyClient extends SmelteryProxyCommon
|
||||
void registerRenderer ()
|
||||
{
|
||||
RenderingRegistry.registerBlockHandler(new TankRender());
|
||||
RenderingRegistry.registerBlockHandler(new TankAirRender());
|
||||
RenderingRegistry.registerBlockHandler(new CastingBlockRender());
|
||||
RenderingRegistry.registerBlockHandler(new DryingRackRender());
|
||||
RenderingRegistry.registerBlockHandler(new PaneRender());
|
||||
@@ -50,10 +49,7 @@ public class SmelteryProxyClient extends SmelteryProxyCommon
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(TinkerSmeltery.lavaTank), tankItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(TinkerSmeltery.lavaTankNether), tankItemRenderer);
|
||||
|
||||
if (!PHConstruct.newSmeltery)
|
||||
{
|
||||
RenderingRegistry.registerBlockHandler(new SmelteryRender());
|
||||
}
|
||||
RenderingRegistry.registerBlockHandler(new SmelteryRender());
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(CastingTableLogic.class, new CastingTableSpecialRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(CastingBasinLogic.class, new CastingBasinSpecialRender());
|
||||
@@ -124,10 +120,7 @@ public class SmelteryProxyClient extends SmelteryProxyCommon
|
||||
{
|
||||
if (ID == SmelteryProxyCommon.smelteryGuiID)
|
||||
{
|
||||
if (PHConstruct.newSmeltery)
|
||||
return new AdaptiveSmelteryGui(player.inventory, (AdaptiveSmelteryLogic) world.getTileEntity(x, y, z), world, x, y, z);
|
||||
else
|
||||
return new SmelteryGui(player.inventory, (SmelteryLogic) world.getTileEntity(x, y, z), world, x, y, z);
|
||||
return new SmelteryGui(player.inventory, (SmelteryLogic) world.getTileEntity(x, y, z), world, x, y, z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,6 @@ public class TinkerSmeltery
|
||||
public static Block lavaTank;
|
||||
public static Block searedBlock;
|
||||
public static Block castingChannel;
|
||||
public static Block tankAir;
|
||||
public static Block smelteryNether;
|
||||
public static Block lavaTankNether;
|
||||
public static Block searedBlockNether;
|
||||
@@ -176,8 +175,6 @@ public class TinkerSmeltery
|
||||
|
||||
TinkerSmeltery.castingChannel = (new CastingChannelBlock()).setBlockName("CastingChannel");
|
||||
|
||||
TinkerSmeltery.tankAir = new TankAirBlock(Material.leaves).setBlockUnbreakable().setBlockName("tconstruct.tank.air");
|
||||
|
||||
// Liquids
|
||||
TinkerSmeltery.liquidMetal = new MaterialLiquid(MapColor.tntColor);
|
||||
|
||||
@@ -373,16 +370,10 @@ public class TinkerSmeltery
|
||||
// Smeltery stuff
|
||||
GameRegistry.registerBlock(TinkerSmeltery.smeltery, SmelteryItemBlock.class, "Smeltery");
|
||||
GameRegistry.registerBlock(TinkerSmeltery.smelteryNether, SmelteryItemBlock.class, "SmelteryNether");
|
||||
if (PHConstruct.newSmeltery)
|
||||
{
|
||||
GameRegistry.registerTileEntity(AdaptiveSmelteryLogic.class, "TConstruct.Smeltery");
|
||||
GameRegistry.registerTileEntity(AdaptiveDrainLogic.class, "TConstruct.SmelteryDrain");
|
||||
}
|
||||
else
|
||||
{
|
||||
GameRegistry.registerTileEntity(SmelteryLogic.class, "TConstruct.Smeltery");
|
||||
GameRegistry.registerTileEntity(SmelteryDrainLogic.class, "TConstruct.SmelteryDrain");
|
||||
}
|
||||
|
||||
GameRegistry.registerTileEntity(SmelteryLogic.class, "TConstruct.Smeltery");
|
||||
GameRegistry.registerTileEntity(SmelteryDrainLogic.class, "TConstruct.SmelteryDrain");
|
||||
|
||||
GameRegistry.registerTileEntity(MultiServantLogic.class, "TConstruct.Servants");
|
||||
GameRegistry.registerBlock(TinkerSmeltery.lavaTank, LavaTankItemBlock.class, "LavaTank");
|
||||
GameRegistry.registerBlock(TinkerSmeltery.lavaTankNether, LavaTankItemBlock.class, "LavaTankNether");
|
||||
@@ -397,9 +388,6 @@ public class TinkerSmeltery
|
||||
GameRegistry.registerBlock(TinkerSmeltery.castingChannel, CastingChannelItem.class, "CastingChannel");
|
||||
GameRegistry.registerTileEntity(CastingChannelLogic.class, "CastingChannel");
|
||||
|
||||
GameRegistry.registerBlock(TinkerSmeltery.tankAir, "TankAir");
|
||||
GameRegistry.registerTileEntity(TankAirLogic.class, "tconstruct.tank.air");
|
||||
|
||||
GameRegistry.registerBlock(TinkerSmeltery.speedBlock, SpeedBlockItem.class, "SpeedBlock");
|
||||
|
||||
// Glass
|
||||
|
||||
@@ -82,18 +82,4 @@ public class TinkerSmelteryEvents
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Player interact event - prevent breaking of tank air blocks in creative
|
||||
@SubscribeEvent
|
||||
public void playerInteract (PlayerInteractEvent event)
|
||||
{
|
||||
if (event.action == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
Block block = event.entity.worldObj.getBlock(event.x, event.y, event.z);
|
||||
if (block instanceof TankAirBlock)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class SmelteryBlock extends InventoryBlock
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
return PHConstruct.newSmeltery ? 0 : SmelteryRender.smelteryModel;
|
||||
return SmelteryRender.smelteryModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -237,16 +237,9 @@ public class SmelteryBlock extends InventoryBlock
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
if (PHConstruct.newSmeltery)
|
||||
return new AdaptiveSmelteryLogic();
|
||||
else
|
||||
return new SmelteryLogic();
|
||||
|
||||
return new SmelteryLogic();
|
||||
case 1:
|
||||
if (PHConstruct.newSmeltery)
|
||||
return new AdaptiveDrainLogic();
|
||||
else
|
||||
return new SmelteryDrainLogic();
|
||||
return new SmelteryDrainLogic();
|
||||
case 3:
|
||||
return null; // Furnace
|
||||
}
|
||||
@@ -257,7 +250,7 @@ public class SmelteryBlock extends InventoryBlock
|
||||
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack)
|
||||
{
|
||||
super.onBlockPlacedBy(world, x, y, z, entityliving, stack);
|
||||
if (world.getBlockMetadata(x, y, z) == 0 && !PHConstruct.newSmeltery)
|
||||
if (world.getBlockMetadata(x, y, z) == 0)
|
||||
onBlockPlacedElsewhere(world, x, y, z, entityliving);
|
||||
}
|
||||
|
||||
@@ -324,17 +317,11 @@ public class SmelteryBlock extends InventoryBlock
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0)
|
||||
{
|
||||
if (PHConstruct.newSmeltery)
|
||||
return 0;
|
||||
else
|
||||
return Container.calcRedstoneFromInventory(((SmelteryLogic) world.getTileEntity(x, y, z)));
|
||||
return Container.calcRedstoneFromInventory(((SmelteryLogic) world.getTileEntity(x, y, z)));
|
||||
}
|
||||
if (meta == 1)
|
||||
{
|
||||
if (PHConstruct.newSmeltery)
|
||||
return 0;
|
||||
else
|
||||
return ((SmelteryDrainLogic) world.getTileEntity(x, y, z)).comparatorStrength();
|
||||
return ((SmelteryDrainLogic) world.getTileEntity(x, y, z)).comparatorStrength();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
package tconstruct.smeltery.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.*;
|
||||
import tconstruct.smeltery.logic.TankAirLogic;
|
||||
import tconstruct.smeltery.model.TankAirRender;
|
||||
|
||||
public class TankAirBlock extends BlockContainer
|
||||
{
|
||||
|
||||
public TankAirBlock(Material material)
|
||||
{
|
||||
super(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int var2)
|
||||
{
|
||||
return new TankAirLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
return TankAirRender.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
TankAirLogic tank = (TankAirLogic) world.getTileEntity(x, y, z);
|
||||
if (tank != null && tank.hasItem())
|
||||
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace (World world, int x, int y, int z, Vec3 par5Vec3, Vec3 par6Vec3)
|
||||
{
|
||||
TankAirLogic tank = (TankAirLogic) world.getTileEntity(x, y, z);
|
||||
if (tank.hasItem())
|
||||
return super.collisionRayTrace(world, x, y, z, par5Vec3, par6Vec3);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock (MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock (EntityPlayer player, int meta)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,280 +0,0 @@
|
||||
package tconstruct.smeltery.component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import mantle.world.CoordTuple;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import tconstruct.library.component.*;
|
||||
import tconstruct.library.crafting.Smeltery;
|
||||
import tconstruct.smeltery.logic.AdaptiveSmelteryLogic;
|
||||
|
||||
public class SmelteryComponent extends LogicComponent
|
||||
{
|
||||
final AdaptiveSmelteryLogic master;
|
||||
final SmelteryScan structure;
|
||||
final MultiFluidTank multitank;
|
||||
int maxTemp;
|
||||
|
||||
public int fuelTicks;
|
||||
public int fuelGague;
|
||||
public int fuelAmount;
|
||||
boolean inUse;
|
||||
|
||||
public int[] activeTemps = new int[0];
|
||||
public int[] meltingTemps = new int[0];
|
||||
|
||||
CoordTuple activeLavaTank;
|
||||
|
||||
public SmelteryComponent(AdaptiveSmelteryLogic inventory, SmelteryScan structure, MultiFluidTank multitank, int maxTemp)
|
||||
{
|
||||
master = inventory;
|
||||
this.structure = structure;
|
||||
this.multitank = multitank;
|
||||
this.maxTemp = maxTemp;
|
||||
}
|
||||
|
||||
public void update ()
|
||||
{
|
||||
/*
|
||||
* if (useTime > 0 && inUse) useTime -= 3;
|
||||
*/
|
||||
if (activeTemps.length == 0)
|
||||
inUse = false;
|
||||
|
||||
updateFuelGague();
|
||||
}
|
||||
|
||||
public void adjustSize (int size, boolean forceAdjust)
|
||||
{
|
||||
if (size != activeTemps.length || forceAdjust)
|
||||
{
|
||||
int[] tempActive = activeTemps;
|
||||
activeTemps = new int[size];
|
||||
int activeLength = tempActive.length > activeTemps.length ? activeTemps.length : tempActive.length;
|
||||
System.arraycopy(tempActive, 0, activeTemps, 0, activeLength);
|
||||
|
||||
int[] tempMelting = meltingTemps;
|
||||
meltingTemps = new int[size];
|
||||
int meltingLength = tempMelting.length > meltingTemps.length ? meltingTemps.length : tempMelting.length;
|
||||
System.arraycopy(tempMelting, 0, meltingTemps, 0, meltingLength);
|
||||
|
||||
if (activeTemps.length > 0 && activeTemps.length > tempActive.length)
|
||||
{
|
||||
for (int i = tempActive.length; i < activeTemps.length; i++)
|
||||
{
|
||||
activeTemps[i] = 20;
|
||||
meltingTemps[i] = 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateTemperatures ()
|
||||
{
|
||||
inUse = true;
|
||||
for (int i = 0; i < meltingTemps.length; i++)
|
||||
{
|
||||
meltingTemps[i] = Smeltery.instance.getLiquifyTemperature(master.getStackInSlot(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void heatItems ()
|
||||
{
|
||||
if (fuelTicks > 0)
|
||||
{
|
||||
boolean hasUse = false;
|
||||
for (int i = 0; i < meltingTemps.length; i++)
|
||||
{
|
||||
fuelTicks--;
|
||||
if (fuelTicks <= 0)
|
||||
break;
|
||||
|
||||
ItemStack slot = master.getStackInSlot(i);
|
||||
if (meltingTemps[i] > 20 && slot != null)
|
||||
{
|
||||
hasUse = true;
|
||||
if (activeTemps[i] < maxTemp && activeTemps[i] < meltingTemps[i])
|
||||
{
|
||||
activeTemps[i] += 1;
|
||||
}
|
||||
else if (activeTemps[i] >= meltingTemps[i] && !world.isRemote)
|
||||
{
|
||||
FluidStack result = getResultFor(slot);
|
||||
if (result != null)
|
||||
{
|
||||
if (multitank.addFluidToTank(result, false))
|
||||
{
|
||||
master.setInventorySlotContents(i, null);
|
||||
activeTemps[i] = 20;
|
||||
ArrayList alloys = Smeltery.mixMetals(multitank.fluidlist);
|
||||
for (int al = 0; al < alloys.size(); al++)
|
||||
{
|
||||
FluidStack liquid = (FluidStack) alloys.get(al);
|
||||
multitank.addFluidToTank(liquid, true);
|
||||
}
|
||||
master.markDirty();
|
||||
master.setUpdateFluids();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
activeTemps[i] = 20;
|
||||
}
|
||||
inUse = hasUse;
|
||||
}
|
||||
}
|
||||
|
||||
void updateFuelGague ()
|
||||
{
|
||||
if (activeLavaTank == null || fuelTicks > 0 || structure.lavaTanks.size() < 1)
|
||||
return;
|
||||
|
||||
if (!world.blockExists(activeLavaTank.x, activeLavaTank.y, activeLavaTank.z))
|
||||
{
|
||||
fuelAmount = 0;
|
||||
fuelGague = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity tankContainer = world.getTileEntity(activeLavaTank.x, activeLavaTank.y, activeLavaTank.z);
|
||||
if (tankContainer == null)
|
||||
{
|
||||
fuelAmount = 0;
|
||||
fuelGague = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (tankContainer instanceof IFluidHandler && inUse)
|
||||
{
|
||||
FluidStack liquid = ((IFluidHandler) tankContainer).drain(ForgeDirection.DOWN, drainFuelAmount(), false);
|
||||
if (liquid != null && liquid.getFluid().getBlock() == Blocks.lava)
|
||||
{
|
||||
liquid = ((IFluidHandler) tankContainer).drain(ForgeDirection.DOWN, drainFuelAmount(), true);
|
||||
fuelTicks += liquid.amount * 15;
|
||||
|
||||
FluidTankInfo[] info = ((IFluidHandler) tankContainer).getTankInfo(ForgeDirection.DOWN);
|
||||
liquid = info[0].fluid;
|
||||
int capacity = info[0].capacity;
|
||||
if (liquid != null)
|
||||
{
|
||||
fuelAmount = liquid.amount;
|
||||
fuelGague = liquid.amount * 52 / capacity;
|
||||
}
|
||||
else
|
||||
{
|
||||
fuelAmount = 0;
|
||||
fuelGague = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean foundTank = false;
|
||||
int iter = 0;
|
||||
while (!foundTank)
|
||||
{
|
||||
CoordTuple possibleTank = structure.lavaTanks.get(iter);
|
||||
TileEntity newTankContainer = world.getTileEntity(possibleTank.x, possibleTank.y, possibleTank.z);
|
||||
if (newTankContainer instanceof IFluidHandler)
|
||||
{
|
||||
FluidStack newliquid = ((IFluidHandler) newTankContainer).drain(ForgeDirection.UNKNOWN, drainFuelAmount(), false);
|
||||
if (newliquid != null && newliquid.getFluid().getBlock() == Blocks.lava && newliquid.amount > 0)
|
||||
{
|
||||
foundTank = true;
|
||||
setActiveLavaTank(possibleTank);
|
||||
iter = structure.lavaTanks.size();
|
||||
|
||||
FluidTankInfo[] info = ((IFluidHandler) tankContainer).getTankInfo(ForgeDirection.DOWN);
|
||||
liquid = info[0].fluid;
|
||||
int capacity = info[0].capacity;
|
||||
if (liquid != null)
|
||||
{
|
||||
fuelAmount = liquid.amount;
|
||||
fuelGague = liquid.amount * 52 / capacity;
|
||||
}
|
||||
else
|
||||
{
|
||||
fuelAmount = 0;
|
||||
fuelGague = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
iter++;
|
||||
if (iter >= structure.lavaTanks.size())
|
||||
foundTank = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setActiveLavaTank (CoordTuple coord)
|
||||
{
|
||||
activeLavaTank = coord;
|
||||
}
|
||||
|
||||
private int drainFuelAmount ()
|
||||
{
|
||||
if (activeTemps.length == 0)
|
||||
return 0;
|
||||
|
||||
int amount = activeTemps.length / 3;
|
||||
if (amount < 150)
|
||||
amount = 150;
|
||||
return amount;
|
||||
}
|
||||
|
||||
public FluidStack getResultFor (ItemStack stack)
|
||||
{
|
||||
return Smeltery.instance.getSmelteryResult(stack);
|
||||
}
|
||||
|
||||
public int getInternalTemperature ()
|
||||
{
|
||||
return maxTemp;
|
||||
}
|
||||
|
||||
public int getTempForSlot (int slot)
|
||||
{
|
||||
return activeTemps[slot];
|
||||
}
|
||||
|
||||
public int getMeltingPointForSlot (int slot)
|
||||
{
|
||||
return meltingTemps[slot];
|
||||
}
|
||||
|
||||
public int getScaledFuelGague (int scale)
|
||||
{
|
||||
int ret = (fuelGague * scale) / 52;
|
||||
if (ret < 1)
|
||||
ret = 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* NBT */
|
||||
@Override
|
||||
public void readNetworkNBT (NBTTagCompound tags)
|
||||
{
|
||||
activeTemps = tags.getIntArray("Temperature");
|
||||
meltingTemps = tags.getIntArray("Melting");
|
||||
fuelAmount = tags.getInteger("Fuel");
|
||||
int[] tank = tags.getIntArray("LavaTank");
|
||||
if (tank.length > 0)
|
||||
activeLavaTank = new CoordTuple(tank[0], tank[1], tank[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNetworkNBT (NBTTagCompound tags)
|
||||
{
|
||||
tags.setIntArray("Temperature", activeTemps);
|
||||
tags.setIntArray("Melting", meltingTemps);
|
||||
tags.setInteger("Fuel", fuelAmount);
|
||||
if (activeLavaTank != null)
|
||||
tags.setIntArray("LavaTank", new int[] { activeLavaTank.x, activeLavaTank.y, activeLavaTank.z });
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
package tconstruct.smeltery.component;
|
||||
|
||||
import java.util.*;
|
||||
import mantle.blocks.iface.IServantLogic;
|
||||
import mantle.world.CoordTuple;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import tconstruct.library.component.TankLayerScan;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
|
||||
public class SmelteryScan extends TankLayerScan
|
||||
{
|
||||
public ArrayList<CoordTuple> lavaTanks = new ArrayList<CoordTuple>();
|
||||
|
||||
public SmelteryScan(TileEntity te, Block... id)
|
||||
{
|
||||
super(te, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkValidStructure ()
|
||||
{
|
||||
lavaTanks.clear();
|
||||
super.checkValidStructure();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkAir (int x, int y, int z)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == null || world.isAirBlock(x, y, z) || block == TinkerSmeltery.tankAir)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkServant (int x, int y, int z)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == null || world.isAirBlock(x, y, z) || !isValidBlock(x, y, z))
|
||||
return false;
|
||||
|
||||
if (!block.hasTileEntity(world.getBlockMetadata(x, y, z)))
|
||||
return false;
|
||||
|
||||
TileEntity be = world.getTileEntity(x, y, z);
|
||||
if (be instanceof IServantLogic)
|
||||
{
|
||||
boolean ret = ((IServantLogic) be).setPotentialMaster(this.imaster, this.world, x, y, z);
|
||||
if (ret && block == TinkerSmeltery.lavaTank)
|
||||
lavaTanks.add(new CoordTuple(x, y, z));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalizeStructure ()
|
||||
{
|
||||
super.finalizeStructure();
|
||||
if (lavaTanks.size() < 1)
|
||||
completeStructure = false;
|
||||
else
|
||||
{
|
||||
for (CoordTuple coord : airCoords)
|
||||
{
|
||||
if (world.getBlock(coord.x, coord.y, coord.z) != TinkerSmeltery.tankAir)
|
||||
{
|
||||
world.setBlock(coord.x, coord.y, coord.z, TinkerSmeltery.tankAir);
|
||||
IServantLogic servant = (IServantLogic) world.getTileEntity(coord.x, coord.y, coord.z);
|
||||
servant.verifyMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void invalidateStructure ()
|
||||
{
|
||||
super.invalidateStructure();
|
||||
for (CoordTuple coord : airCoords)
|
||||
{
|
||||
TileEntity servant = world.getTileEntity(coord.x, coord.y, coord.z);
|
||||
if (servant instanceof IServantLogic)
|
||||
((IServantLogic) servant).invalidateMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void invalidateBlocksAbove (int height)
|
||||
{
|
||||
for (CoordTuple coord : airCoords)
|
||||
{
|
||||
if (coord.y < height)
|
||||
continue;
|
||||
|
||||
TileEntity servant = world.getTileEntity(coord.x, coord.y, coord.z);
|
||||
if (servant instanceof IServantLogic)
|
||||
((IServantLogic) servant).invalidateMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup ()
|
||||
{
|
||||
super.cleanup();
|
||||
Iterator i = airCoords.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
CoordTuple coord = (CoordTuple) i.next();
|
||||
TileEntity te = world.getTileEntity(coord.x, coord.y, coord.z);
|
||||
if (te != null && te instanceof IServantLogic)
|
||||
{
|
||||
((IServantLogic) te).invalidateMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sync lava tanks for fuel values
|
||||
@Override
|
||||
public void readNetworkNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.readNetworkNBT(tags);
|
||||
|
||||
NBTTagList tanks = tags.getTagList("Tanks", 10);
|
||||
if (tanks != null)
|
||||
{
|
||||
lavaTanks.clear();
|
||||
|
||||
for (int i = 0; i < tanks.tagCount(); ++i)
|
||||
{
|
||||
int[] coord = tanks.func_150306_c(i);
|
||||
layerAirCoords.add(new CoordTuple(coord[0], coord[1], coord[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNetworkNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.writeNetworkNBT(tags);
|
||||
|
||||
NBTTagList tanks = new NBTTagList();
|
||||
for (CoordTuple coord : lavaTanks)
|
||||
{
|
||||
tanks.appendTag(new NBTTagIntArray(new int[] { coord.x, coord.y, coord.z }));
|
||||
}
|
||||
tags.setTag("Tanks", tanks);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package tconstruct.smeltery.component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import tconstruct.library.component.MultiFluidTank;
|
||||
|
||||
public class TankAirComponent extends MultiFluidTank
|
||||
{
|
||||
public TankAirComponent()
|
||||
{
|
||||
}
|
||||
|
||||
public TankAirComponent(int i)
|
||||
{
|
||||
super(i);
|
||||
}
|
||||
|
||||
public void overrideFluids (ArrayList<FluidStack> fluids)
|
||||
{
|
||||
fluidlist = fluids;
|
||||
}
|
||||
}
|
||||
@@ -1,477 +0,0 @@
|
||||
package tconstruct.smeltery.gui;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.component.MultiFluidTank;
|
||||
import tconstruct.smeltery.component.SmelteryComponent;
|
||||
import tconstruct.smeltery.inventory.*;
|
||||
import tconstruct.smeltery.logic.AdaptiveSmelteryLogic;
|
||||
|
||||
public class AdaptiveSmelteryGui extends ActiveContainerGui
|
||||
{
|
||||
public AdaptiveSmelteryLogic logic;
|
||||
String username;
|
||||
boolean isScrolling = false;
|
||||
boolean wasClicking;
|
||||
float currentScroll = 0.0F;
|
||||
int slotPos = 0;
|
||||
int prevSlotPos = 0;
|
||||
private final SmelteryComponent scomp;
|
||||
private final MultiFluidTank multitank;
|
||||
|
||||
public AdaptiveSmelteryGui(InventoryPlayer inventoryplayer, AdaptiveSmelteryLogic smeltery, World world, int x, int y, int z)
|
||||
{
|
||||
super((ActiveContainer) smeltery.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
logic = smeltery;
|
||||
username = inventoryplayer.player.getDisplayName();
|
||||
xSize = 248;
|
||||
scomp = logic.getSmeltery();
|
||||
multitank = logic.getMultiTank();
|
||||
scomp.update();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen (int mouseX, int mouseY, float par3)
|
||||
{
|
||||
super.drawScreen(mouseX, mouseY, par3);
|
||||
updateScrollbar(mouseX, mouseY, par3);
|
||||
}
|
||||
|
||||
protected void updateScrollbar (int mouseX, int mouseY, float par3)
|
||||
{
|
||||
if (logic.getSizeInventory() > 24)
|
||||
{
|
||||
boolean mouseDown = Mouse.isButtonDown(0);
|
||||
int lefto = this.guiLeft;
|
||||
int topo = this.guiTop;
|
||||
int xScroll = lefto + 67;
|
||||
int yScroll = topo + 8;
|
||||
int scrollWidth = xScroll + 14;
|
||||
int scrollHeight = yScroll + 144;
|
||||
|
||||
if (!this.wasClicking && mouseDown && mouseX >= xScroll && mouseY >= yScroll && mouseX < scrollWidth && mouseY < scrollHeight)
|
||||
{
|
||||
this.isScrolling = true;
|
||||
}
|
||||
|
||||
if (!mouseDown)
|
||||
{
|
||||
this.isScrolling = false;
|
||||
}
|
||||
|
||||
if (wasClicking && !isScrolling && slotPos != prevSlotPos)
|
||||
{
|
||||
prevSlotPos = slotPos;
|
||||
}
|
||||
|
||||
this.wasClicking = mouseDown;
|
||||
|
||||
if (this.isScrolling)
|
||||
{
|
||||
this.currentScroll = (mouseY - yScroll - 7.5F) / (scrollHeight - yScroll - 15.0F);
|
||||
|
||||
if (this.currentScroll < 0.0F)
|
||||
{
|
||||
this.currentScroll = 0.0F;
|
||||
}
|
||||
|
||||
if (this.currentScroll > 1.0F)
|
||||
{
|
||||
this.currentScroll = 1.0F;
|
||||
}
|
||||
|
||||
int s = ((AdaptiveSmelteryContainer) this.inventorySlots).scrollTo(this.currentScroll);
|
||||
if (s != -1)
|
||||
slotPos = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.Smeltery"), 86, 5, 0x404040);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 90, (ySize - 96) + 2, 0x404040);
|
||||
|
||||
int base = 0;
|
||||
int cornerX = (width - xSize) / 2 + 36;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
FluidTankInfo[] info = logic.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
|
||||
int capacity = 0;
|
||||
|
||||
for (int i = 0; i < info.length - 1; i++)
|
||||
{
|
||||
FluidStack liquid = info[i].fluid;
|
||||
if (liquid != null)
|
||||
capacity += info[i].capacity;
|
||||
}
|
||||
|
||||
for (int i = 0; i < info.length - 1; i++)
|
||||
{
|
||||
FluidStack liquid = info[i].fluid;
|
||||
int basePos = 54;
|
||||
int initialLiquidSize = 0;
|
||||
int liquidSize = 0;
|
||||
if (capacity > 0)
|
||||
{
|
||||
liquidSize = liquid.amount * 52 / capacity;
|
||||
if (liquidSize == 0)
|
||||
liquidSize = 1;
|
||||
base += liquidSize;
|
||||
|
||||
}
|
||||
|
||||
int leftX = cornerX + basePos;
|
||||
int topY = (cornerY + 68) - base;
|
||||
int sizeX = 52;
|
||||
int sizeY = liquidSize;
|
||||
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
|
||||
{
|
||||
drawFluidStackTooltip(liquid, mouseX - cornerX + 36, mouseY - cornerY);
|
||||
|
||||
}
|
||||
}
|
||||
if (scomp.fuelGague > 0)
|
||||
{
|
||||
int leftX = cornerX + 117;
|
||||
int topY = (cornerY + 68) - scomp.getScaledFuelGague(52);
|
||||
int sizeX = 12;
|
||||
int sizeY = scomp.getScaledFuelGague(52);
|
||||
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
|
||||
{
|
||||
drawFluidStackTooltip(new FluidStack(-37, scomp.fuelAmount), mouseX - cornerX + 36, mouseY - cornerY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/smeltery.png");
|
||||
private static final ResourceLocation backgroundSide = new ResourceLocation("tinker", "textures/gui/smelteryside.png");
|
||||
private static final ResourceLocation terrain = new ResourceLocation("terrain.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = (width - xSize) / 2 + 36;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(cornerX + 46, cornerY, 0, 0, 176, ySize);
|
||||
|
||||
// Fuel - Lava
|
||||
this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
if (scomp.fuelGague > 0)
|
||||
{
|
||||
IIcon lavaIcon = Blocks.lava.getIcon(0, 0);
|
||||
int fuel = scomp.getScaledFuelGague(52);
|
||||
int count = 0;
|
||||
while (fuel > 0)
|
||||
{
|
||||
int size = fuel >= 16 ? 16 : fuel;
|
||||
fuel -= size;
|
||||
drawLiquidRect(cornerX + 117, (cornerY + 68) - size - 16 * count, lavaIcon, 12, size);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
FluidTankInfo[] info = logic.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
int capacity = 0;
|
||||
|
||||
for (int i = 0; i < info.length - 1; i++)
|
||||
{
|
||||
FluidStack liquid = info[i].fluid;
|
||||
if (liquid != null)
|
||||
capacity += info[i].capacity;
|
||||
}
|
||||
|
||||
// Liquids - molten metal
|
||||
int base = 0;
|
||||
for (int i = 0; i < info.length - 1; i++)
|
||||
{
|
||||
FluidStack liquid = info[i].fluid;
|
||||
IIcon renderIndex = liquid.getFluid().getStillIcon();
|
||||
int basePos = 54;
|
||||
if (capacity > 0)
|
||||
{
|
||||
int liquidSize = liquid.amount * 52 / capacity;
|
||||
if (liquidSize == 0)
|
||||
liquidSize = 1;
|
||||
while (liquidSize > 0)
|
||||
{
|
||||
int size = liquidSize >= 16 ? 16 : liquidSize;
|
||||
drawLiquidRect(cornerX + basePos, (cornerY + 68) - size - base, renderIndex, 16, size);
|
||||
drawLiquidRect(cornerX + basePos + 16, (cornerY + 68) - size - base, renderIndex, 16, size);
|
||||
drawLiquidRect(cornerX + basePos + 32, (cornerY + 68) - size - base, renderIndex, 16, size);
|
||||
drawLiquidRect(cornerX + basePos + 48, (cornerY + 68) - size - base, renderIndex, 4, size);
|
||||
liquidSize -= size;
|
||||
base += size;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Liquid gague
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
drawTexturedModalRect(cornerX + 54, cornerY + 16, 176, 76, 52, 52);
|
||||
|
||||
// Side inventory
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(backgroundSide);
|
||||
// if (logic.layers > 0)
|
||||
{
|
||||
/*
|
||||
* if (logic.layers == 1) { drawTexturedModalRect(cornerX - 46,
|
||||
* cornerY, 0, 0, 98, 43); drawTexturedModalRect(cornerX - 46,
|
||||
* cornerY + 43, 0, 133, 98, 25); } else if (logic.layers == 2) {
|
||||
* drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, 61);
|
||||
* drawTexturedModalRect(cornerX - 46, cornerY + 61, 0, 97, 98, 61);
|
||||
* } else
|
||||
*/
|
||||
{
|
||||
drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, ySize - 8);
|
||||
}
|
||||
drawTexturedModalRect(cornerX + 32, (int) (cornerY + 8 + 127 * currentScroll), 98, 0, 12, 15);
|
||||
}
|
||||
|
||||
// Temperature
|
||||
int slotSize = logic.getSizeInventory();
|
||||
if (slotSize > 24)
|
||||
slotSize = 24;
|
||||
for (int iter = 0; iter < slotSize; iter++)
|
||||
{
|
||||
int slotTemp = logic.getTempForSlot(iter + slotPos * 3) - 20;
|
||||
int maxTemp = logic.getMeltingPointForSlot(iter + slotPos * 3) - 20;
|
||||
if (slotTemp > 0 && maxTemp > 0)
|
||||
{
|
||||
int size = 16 * slotTemp / maxTemp + 1;
|
||||
drawTexturedModalRect(cornerX - 38 + (iter % 3 * 22), cornerY + 8 + (iter / 3 * 18) + 16 - size, 98, 15 + 16 - size, 5, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawFluidStackTooltip (FluidStack par1ItemStack, int par2, int par3)
|
||||
{
|
||||
this.zLevel = 100;
|
||||
List list = getLiquidTooltip(par1ItemStack, this.mc.gameSettings.advancedItemTooltips);
|
||||
|
||||
for (int k = 0; k < list.size(); ++k)
|
||||
{
|
||||
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
|
||||
}
|
||||
|
||||
this.drawToolTip(list, par2, par3);
|
||||
this.zLevel = 0;
|
||||
}
|
||||
|
||||
public List getLiquidTooltip (FluidStack liquid, boolean par2)
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
if (liquid.fluidID == -37)
|
||||
{
|
||||
list.add("\u00A7f" + StatCollector.translateToLocal("gui.smeltery1"));
|
||||
list.add("mB: " + liquid.amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
String name = StatCollector.translateToLocal(FluidRegistry.getFluidName(liquid));
|
||||
list.add("\u00A7f" + name);
|
||||
if (name.equals("liquified emerald"))
|
||||
{
|
||||
list.add("Emeralds: " + liquid.amount / 320f);
|
||||
}
|
||||
else if (name.contains("Molten"))
|
||||
{
|
||||
int ingots = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (ingots > 0)
|
||||
list.add("Ingots: " + ingots);
|
||||
int mB = liquid.amount % TConstruct.ingotLiquidValue;
|
||||
if (mB > 0)
|
||||
{
|
||||
int nuggets = mB / TConstruct.nuggetLiquidValue;
|
||||
int junk = (mB % TConstruct.nuggetLiquidValue);
|
||||
if (nuggets > 0)
|
||||
list.add("Nuggets: " + nuggets);
|
||||
if (junk > 0)
|
||||
list.add("mB: " + junk);
|
||||
}
|
||||
}
|
||||
else if (name.equals("Seared Stone"))
|
||||
{
|
||||
int ingots = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (ingots > 0)
|
||||
list.add("Blocks: " + ingots);
|
||||
int mB = liquid.amount % TConstruct.ingotLiquidValue;
|
||||
if (mB > 0)
|
||||
list.add("mB: " + mB);
|
||||
}
|
||||
else if (name.equals("Molten Glass"))
|
||||
{
|
||||
int blocks = liquid.amount / 1000;
|
||||
if (blocks > 0)
|
||||
list.add("Blocks: " + blocks);
|
||||
int panels = (liquid.amount % 1000) / 250;
|
||||
if (panels > 0)
|
||||
list.add("Panels: " + panels);
|
||||
int mB = (liquid.amount % 1000) % 250;
|
||||
if (mB > 0)
|
||||
list.add("mB: " + mB);
|
||||
}
|
||||
else
|
||||
{
|
||||
list.add("mB: " + liquid.amount);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
protected void drawToolTip (List par1List, int par2, int par3)
|
||||
{
|
||||
if (!par1List.isEmpty())
|
||||
{
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
int k = 0;
|
||||
Iterator iterator = par1List.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String s = (String) iterator.next();
|
||||
int l = this.fontRendererObj.getStringWidth(s);
|
||||
|
||||
if (l > k)
|
||||
{
|
||||
k = l;
|
||||
}
|
||||
}
|
||||
|
||||
int i1 = par2 + 12;
|
||||
int j1 = par3 - 12;
|
||||
int k1 = 8;
|
||||
|
||||
if (par1List.size() > 1)
|
||||
{
|
||||
k1 += 2 + (par1List.size() - 1) * 10;
|
||||
}
|
||||
|
||||
if (i1 + k > this.width)
|
||||
{
|
||||
i1 -= 28 + k;
|
||||
}
|
||||
|
||||
if (j1 + k1 + 6 > this.height)
|
||||
{
|
||||
j1 = this.height - k1 - 6;
|
||||
}
|
||||
|
||||
this.zLevel = 300.0F;
|
||||
itemRender.zLevel = 300.0F;
|
||||
int l1 = -267386864;
|
||||
this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
|
||||
this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
|
||||
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
|
||||
this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
|
||||
this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
|
||||
int i2 = 1347420415;
|
||||
int j2 = (i2 & 16711422) >> 1 | i2 & -16777216;
|
||||
this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
|
||||
this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
|
||||
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
|
||||
this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);
|
||||
|
||||
for (int k2 = 0; k2 < par1List.size(); ++k2)
|
||||
{
|
||||
String s1 = (String) par1List.get(k2);
|
||||
this.fontRendererObj.drawStringWithShadow(s1, i1, j1, -1);
|
||||
|
||||
if (k2 == 0)
|
||||
{
|
||||
j1 += 2;
|
||||
}
|
||||
|
||||
j1 += 10;
|
||||
}
|
||||
|
||||
this.zLevel = 0.0F;
|
||||
itemRender.zLevel = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
public void drawLiquidRect (int startU, int startV, IIcon par3Icon, int endU, int endV)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(startU + 0, startV + endV, this.zLevel, par3Icon.getMinU(), par3Icon.getMaxV());// Bottom left
|
||||
tessellator.addVertexWithUV(startU + endU, startV + endV, this.zLevel, par3Icon.getMaxU(), par3Icon.getMaxV());// Bottom right
|
||||
tessellator.addVertexWithUV(startU + endU, startV + 0, this.zLevel, par3Icon.getMaxU(), par3Icon.getMinV());// Top right
|
||||
tessellator.addVertexWithUV(startU + 0, startV + 0, this.zLevel, par3Icon.getMinU(), par3Icon.getMinV()); // Top left
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public void mouseClicked(int mouseX, int mouseY, int
|
||||
* mouseButton) { super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
*
|
||||
* int base = 0; int cornerX = (width - xSize) / 2 + 36; int cornerY =
|
||||
* (height - ySize) / 2; int fluidToBeBroughtUp = -1;
|
||||
*
|
||||
* for (FluidStack liquid : multitank.getAllFluids()) { int basePos = 54;
|
||||
* int initialLiquidSize = 0; int liquidSize = 0;//liquid.amount * 52 /
|
||||
* liquidLayers; if (multitank.getCapacity() > 0) { int total =
|
||||
* multitank.getFluidAmount(); int liquidLayers = (total / 20000 + 1) *
|
||||
* 20000; if (liquidLayers > 0) { liquidSize = liquid.amount * 52 /
|
||||
* liquidLayers; if (liquidSize == 0) liquidSize = 1; base += liquidSize; }
|
||||
* }
|
||||
*
|
||||
* int leftX = cornerX + basePos; int topY = (cornerY + 68) - base; int
|
||||
* sizeX = 52; int sizeY = liquidSize; if (mouseX >= leftX && mouseX <=
|
||||
* leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY) {
|
||||
* fluidToBeBroughtUp = liquid.fluidID;
|
||||
*
|
||||
* Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
*
|
||||
* ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream
|
||||
* dos = new DataOutputStream(bos);
|
||||
*
|
||||
* try { dos.write(11);
|
||||
*
|
||||
* dos.writeInt(logic.worldObj.provider.dimensionId);
|
||||
* dos.writeInt(logic.xCoord); dos.writeInt(logic.yCoord);
|
||||
* dos.writeInt(logic.zCoord);
|
||||
*
|
||||
* dos.writeBoolean(this.isShiftKeyDown());
|
||||
*
|
||||
* dos.writeInt(fluidToBeBroughtUp); } catch (Exception e) {
|
||||
* e.printStackTrace(); }
|
||||
*
|
||||
* packet.channel = "TConstruct"; packet.data = bos.toByteArray();
|
||||
* packet.length = bos.size();
|
||||
*
|
||||
* PacketDispatcher.sendPacketToServer(packet); } } }
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onGuiClosed ()
|
||||
{
|
||||
super.onGuiClosed();
|
||||
logic.getWorldObj().markBlockForUpdate(logic.xCoord, logic.yCoord, logic.zCoord);
|
||||
}
|
||||
}
|
||||
@@ -1,248 +0,0 @@
|
||||
package tconstruct.smeltery.inventory;
|
||||
|
||||
import net.minecraft.entity.player.*;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.smeltery.logic.AdaptiveSmelteryLogic;
|
||||
|
||||
public class AdaptiveSmelteryContainer extends ActiveContainer
|
||||
{
|
||||
public AdaptiveSmelteryLogic logic;
|
||||
public InventoryPlayer playerInv;
|
||||
public int fuel = 0;
|
||||
int slotRow;
|
||||
|
||||
public AdaptiveSmelteryContainer(InventoryPlayer inventoryplayer, AdaptiveSmelteryLogic smeltery)
|
||||
{
|
||||
logic = smeltery;
|
||||
playerInv = inventoryplayer;
|
||||
slotRow = 0;
|
||||
|
||||
/* Smeltery inventory */
|
||||
|
||||
int height = smeltery.getSizeInventory() / 3;
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
this.addDualSlotToContainer(new ActiveSlot(smeltery, x + y * 3, 2 + x * 22, 8 + y * 18, y < 8));
|
||||
}
|
||||
}
|
||||
int leftovers = smeltery.getSizeInventory() % 3;
|
||||
for (int x = 0; x < leftovers; x++)
|
||||
{
|
||||
this.addDualSlotToContainer(new ActiveSlot(smeltery, x + height * 3, 2 + x * 22, 8 + height * 18, height < 8));
|
||||
}
|
||||
|
||||
/* Player inventory */
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 90 + row * 18, 84 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column, 90 + column * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
public int updateRows (int invRow)
|
||||
{
|
||||
if (invRow != slotRow)
|
||||
{
|
||||
slotRow = invRow;
|
||||
// TConstruct.logger.info(invRow);
|
||||
int basePos = invRow * 3;
|
||||
for (int iter = 0; iter < activeInventorySlots.size(); iter++)
|
||||
{
|
||||
ActiveSlot slot = (ActiveSlot) activeInventorySlots.get(iter);
|
||||
if (slot.activeSlotNumber >= basePos && slot.activeSlotNumber < basePos + 24)
|
||||
{
|
||||
slot.setActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.setActive(false);
|
||||
}
|
||||
int xPos = (iter - basePos) % 3;
|
||||
int yPos = (iter - basePos) / 3;
|
||||
slot.xDisplayPosition = 2 + 22 * xPos;
|
||||
slot.yDisplayPosition = 8 + 18 * yPos;
|
||||
}
|
||||
return slotRow;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int scrollTo (float scrollPos)
|
||||
{
|
||||
float total = (logic.getSizeInventory() - 24) / 3;
|
||||
int rowPos = (int) (total * scrollPos);
|
||||
return updateRows(rowPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar (int id, int value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
{
|
||||
return logic.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack slotStack = slot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if (slotID < logic.getSizeInventory())
|
||||
{
|
||||
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (slotStack.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean mergeItemStack (ItemStack inputStack, int startSlot, int endSlot, boolean flag)
|
||||
{
|
||||
// TConstruct.logger.info("Merge");
|
||||
boolean merged = false;
|
||||
int slotPos = startSlot;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
slotPos = endSlot - 1;
|
||||
}
|
||||
|
||||
Slot slot;
|
||||
ItemStack slotStack;
|
||||
|
||||
/*
|
||||
* if (inputStack.isStackable() && startSlot >=
|
||||
* logic.getSizeInventory()) { TConstruct.logger.info("Rawr!"); while
|
||||
* (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag &&
|
||||
* slotPos >= startSlot)) { slot = (Slot)
|
||||
* this.inventorySlots.get(slotPos); slotStack = slot.getStack();
|
||||
*
|
||||
* if (slotStack != null && ItemStack.areItemStacksEqual(inputStack,
|
||||
* slotStack) && !inputStack.getHasSubtypes()) { int totalSize =
|
||||
* slotStack.stackSize + inputStack.stackSize;
|
||||
*
|
||||
* if (totalSize <= inputStack.getMaxStackSize()) { inputStack.stackSize
|
||||
* = 0; slotStack.stackSize = totalSize; slot.onSlotChanged(); merged =
|
||||
* true; } else if (slotStack.stackSize < inputStack.getMaxStackSize())
|
||||
* { inputStack.stackSize -= inputStack.getMaxStackSize() -
|
||||
* slotStack.stackSize; slotStack.stackSize =
|
||||
* inputStack.getMaxStackSize(); slot.onSlotChanged(); merged = true; }
|
||||
* }
|
||||
*
|
||||
* if (flag) { --slotPos; } else { ++slotPos; } } }
|
||||
*/
|
||||
|
||||
if (inputStack.isStackable() && startSlot >= logic.getSizeInventory())
|
||||
{
|
||||
while (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag && slotPos >= startSlot))
|
||||
{
|
||||
slot = (Slot) this.inventorySlots.get(slotPos);
|
||||
slotStack = slot.getStack();
|
||||
|
||||
if (slotStack != null && ItemStack.areItemStacksEqual(slotStack, inputStack))
|
||||
{
|
||||
int l = slotStack.stackSize + inputStack.stackSize;
|
||||
|
||||
if (l <= inputStack.getMaxStackSize())
|
||||
{
|
||||
inputStack.stackSize = 0;
|
||||
slotStack.stackSize = l;
|
||||
slot.onSlotChanged();
|
||||
merged = true;
|
||||
}
|
||||
else if (slotStack.stackSize < inputStack.getMaxStackSize())
|
||||
{
|
||||
inputStack.stackSize -= inputStack.getMaxStackSize() - slotStack.stackSize;
|
||||
slotStack.stackSize = inputStack.getMaxStackSize();
|
||||
slot.onSlotChanged();
|
||||
merged = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
--slotPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
++slotPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inputStack.stackSize > 0)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
slotPos = endSlot - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
slotPos = startSlot;
|
||||
}
|
||||
|
||||
while (!flag && slotPos < endSlot || flag && slotPos >= startSlot)
|
||||
{
|
||||
slot = (Slot) this.inventorySlots.get(slotPos);
|
||||
slotStack = slot.getStack();
|
||||
|
||||
if (slotStack == null)
|
||||
{
|
||||
slot.putStack(inputStack.copy());
|
||||
slot.onSlotChanged();
|
||||
inputStack.stackSize -= 1;
|
||||
merged = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
--slotPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
++slotPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return merged;
|
||||
}
|
||||
}
|
||||
@@ -1,175 +0,0 @@
|
||||
package tconstruct.smeltery.logic;
|
||||
|
||||
import mantle.blocks.abstracts.MultiServantLogic;
|
||||
import mantle.blocks.iface.*;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.*;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandler, IFacingLogic// , ISwitchableMaster
|
||||
{
|
||||
byte direction;
|
||||
|
||||
public boolean canUpdate ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPotentialMaster (IMasterLogic master, World world, int x, int y, int z)
|
||||
{
|
||||
// TConstruct.logger.info("Master: "+master);
|
||||
return (master instanceof AdaptiveSmelteryLogic || master instanceof AdaptiveDrainLogic) && !getHasMaster();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill (ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (hasValidMaster() && canDrain(from, null))
|
||||
{
|
||||
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
return smeltery.fill(from, resource, doFill);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
// TConstruct.logger.info("Attempting drain " + hasValidMaster());
|
||||
if (hasValidMaster() && canDrain(from, null))
|
||||
{
|
||||
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
// TConstruct.logger.info("Found master");
|
||||
return smeltery.drain(from, maxDrain, doDrain);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
if (hasValidMaster() && canDrain(from, null))
|
||||
{
|
||||
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
return smeltery.drain(from, resource, doDrain);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
if (hasValidMaster())
|
||||
{
|
||||
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
return smeltery.getFillState() < 2;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
if (hasValidMaster())
|
||||
{
|
||||
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
return smeltery.getFillState() > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo (ForgeDirection from)
|
||||
{
|
||||
if (hasValidMaster() && (from == getForgeDirection() || from == getForgeDirection().getOpposite() || from == ForgeDirection.UNKNOWN))
|
||||
{
|
||||
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
return smeltery.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getRenderDirection ()
|
||||
{
|
||||
return direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getForgeDirection ()
|
||||
{
|
||||
return ForgeDirection.VALID_DIRECTIONS[direction];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection (int side)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection (float yaw, float pitch, EntityLivingBase player)
|
||||
{
|
||||
if (pitch > 45)
|
||||
direction = 1;
|
||||
else if (pitch < -45)
|
||||
direction = 0;
|
||||
else
|
||||
{
|
||||
int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3;
|
||||
switch (facing)
|
||||
{
|
||||
case 0:
|
||||
direction = 2;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
direction = 5;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
direction = 3;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
direction = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.readFromNBT(tags);
|
||||
direction = tags.getByte("Direction");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.writeToNBT(tags);
|
||||
tags.setByte("Direction", direction);
|
||||
}
|
||||
|
||||
/* Packets */
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeToNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
readFromNBT(packet.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
@@ -1,600 +0,0 @@
|
||||
package tconstruct.smeltery.logic;
|
||||
|
||||
import java.util.*;
|
||||
import mantle.blocks.abstracts.AdaptiveInventoryLogic;
|
||||
import mantle.blocks.iface.*;
|
||||
import mantle.world.CoordTuple;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.*;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.component.*;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.smeltery.component.*;
|
||||
import tconstruct.smeltery.inventory.AdaptiveSmelteryContainer;
|
||||
|
||||
public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IActiveLogic, IMasterLogic, IComponentHolder, IFluidHandler
|
||||
{
|
||||
byte direction;
|
||||
boolean updateFluids = false;
|
||||
boolean recheckStructure = false;
|
||||
boolean updateAir = false;
|
||||
SmelteryScan structure = new SmelteryScan(this, TinkerSmeltery.smeltery, TinkerSmeltery.lavaTank);
|
||||
MultiFluidTank multitank = new MultiFluidTank();
|
||||
SmelteryComponent smeltery = new SmelteryComponent(this, structure, multitank, 800);
|
||||
HashMap<CoordTuple, LiquidDataInstance> airUpdates = new HashMap<CoordTuple, LiquidDataInstance>();
|
||||
int tick = 0;
|
||||
|
||||
public MultiFluidTank getMultiTank ()
|
||||
{
|
||||
return multitank;
|
||||
}
|
||||
|
||||
public SmelteryComponent getSmeltery ()
|
||||
{
|
||||
return smeltery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
tick++;
|
||||
if (tick % 4 == 0)
|
||||
smeltery.heatItems();
|
||||
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
if (tick % 20 == 0)
|
||||
{
|
||||
if (structure.isComplete())
|
||||
smeltery.update();
|
||||
|
||||
if (updateFluids)
|
||||
{
|
||||
distributeFluids();
|
||||
updateFluids = false;
|
||||
}
|
||||
|
||||
if (updateAir)
|
||||
{
|
||||
updateAir();
|
||||
updateAir = false;
|
||||
}
|
||||
|
||||
if (recheckStructure)
|
||||
{
|
||||
structure.recheckStructure();
|
||||
recheckStructure = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (tick >= 60)
|
||||
{
|
||||
if (!structure.isComplete())
|
||||
{
|
||||
structure.checkValidStructure();
|
||||
if (structure.isComplete())
|
||||
{
|
||||
validateSmeltery();
|
||||
}
|
||||
}
|
||||
tick = 0;
|
||||
}
|
||||
|
||||
if (airUpdates.size() > 0)
|
||||
updateFluidBlocks();
|
||||
}
|
||||
}
|
||||
|
||||
public void setUpdateFluids ()
|
||||
{
|
||||
updateFluids = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LogicComponent> getComponents ()
|
||||
{
|
||||
ArrayList<LogicComponent> ret = new ArrayList<LogicComponent>(3);
|
||||
ret.add(structure);
|
||||
ret.add(multitank);
|
||||
ret.add(smeltery);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Structure */
|
||||
|
||||
@Override
|
||||
public void setWorldObj (World world)
|
||||
{
|
||||
super.setWorldObj(world);
|
||||
structure.setWorld(world);
|
||||
smeltery.setWorld(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyChange (IServantLogic servant, int x, int y, int z)
|
||||
{
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
// System.out.println("Notifying of change from "+new CoordTuple(x,
|
||||
// y, z));
|
||||
recheckStructure = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placeBlock (EntityLivingBase entity, ItemStack itemstack)
|
||||
{
|
||||
structure.checkValidStructure();
|
||||
if (structure.isComplete())
|
||||
{
|
||||
validateSmeltery();
|
||||
}
|
||||
}
|
||||
|
||||
void validateSmeltery ()
|
||||
{
|
||||
adjustInventory(structure.getAirSize(), true);
|
||||
smeltery.adjustSize(structure.getAirSize(), true);
|
||||
multitank.setCapacity(structure.getAirSize() * (TConstruct.ingotLiquidValue * 18));
|
||||
smeltery.setActiveLavaTank(structure.lavaTanks.get(0));
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBlock ()
|
||||
{
|
||||
structure.cleanup();
|
||||
}
|
||||
|
||||
/* Direction */
|
||||
|
||||
@Override
|
||||
public byte getRenderDirection ()
|
||||
{
|
||||
return direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getForgeDirection ()
|
||||
{
|
||||
return ForgeDirection.VALID_DIRECTIONS[direction];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection (int side)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection (float yaw, float pitch, EntityLivingBase player)
|
||||
{
|
||||
int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3;
|
||||
switch (facing)
|
||||
{
|
||||
case 0:
|
||||
direction = 2;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
direction = 5;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
direction = 3;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
direction = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getActive ()
|
||||
{
|
||||
return structure.isComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActive (boolean flag)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/* Inventory */
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
inventory[slot] = itemstack;
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
updateWorldBlock(slot, itemstack);
|
||||
updateAir = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int quantity)
|
||||
{
|
||||
if (inventory[slot] != null)
|
||||
{
|
||||
if (inventory[slot].stackSize <= quantity)
|
||||
{
|
||||
ItemStack stack = inventory[slot];
|
||||
inventory[slot] = null;
|
||||
updateWorldBlock(slot, inventory[slot]);
|
||||
return stack;
|
||||
}
|
||||
ItemStack split = inventory[slot].splitStack(quantity);
|
||||
if (inventory[slot].stackSize == 0)
|
||||
{
|
||||
inventory[slot] = null;
|
||||
}
|
||||
|
||||
updateWorldBlock(slot, inventory[slot]);
|
||||
return split;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty ()
|
||||
{
|
||||
smeltery.updateTemperatures();
|
||||
updateAir = true;
|
||||
super.markDirty();
|
||||
}
|
||||
|
||||
void updateWorldBlock (int slot, ItemStack itemstack)
|
||||
{
|
||||
CoordTuple air = structure.getAirByIndex(slot);
|
||||
if (air != null)
|
||||
{
|
||||
TileEntity te = worldObj.getTileEntity(air.x, air.y, air.z);
|
||||
if (te != null && te instanceof TankAirLogic)
|
||||
{
|
||||
((TankAirLogic) te).setInventorySlotContents(0, itemstack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static final int pixelLayer = 162;
|
||||
|
||||
// Do the Monster Mash~
|
||||
public void distributeFluids ()
|
||||
{
|
||||
// Calculate liquids in each block
|
||||
int size = structure.getAirLayerSize();
|
||||
// HashMap<CoordTuple, LiquidDataInstance> blocks = new
|
||||
// HashMap<CoordTuple, LiquidDataInstance>();
|
||||
|
||||
for (FluidStack fluid : multitank.fluidlist)
|
||||
{
|
||||
// Base calculations per liquid
|
||||
LiquidData data = new LiquidData(fluid.amount, size);
|
||||
int baseY = structure.airCoords.get(0).y;
|
||||
int layerSize = structure.getAirLayerSize();
|
||||
|
||||
// Calculate where to distribute liquids
|
||||
for (int i = 0; i < structure.airCoords.size(); i++)
|
||||
{
|
||||
LiquidDataInstance instance;
|
||||
CoordTuple coord = structure.airCoords.get(i);
|
||||
int height = 16 * (coord.y - baseY);
|
||||
int position = i % layerSize;
|
||||
|
||||
if (!airUpdates.containsKey(coord))
|
||||
{
|
||||
instance = new LiquidDataInstance();
|
||||
airUpdates.put(coord, instance);
|
||||
}
|
||||
else
|
||||
{
|
||||
instance = airUpdates.get(coord);
|
||||
}
|
||||
|
||||
if (instance.openLayers() > 0) // This is capable of sending
|
||||
// negative liquid sizes to
|
||||
// blocks without the stopgap
|
||||
// check
|
||||
{
|
||||
if (position > data.blocksWithExtra)
|
||||
{
|
||||
// Calculate open layers
|
||||
int open = data.layers - height + 1;
|
||||
if (open < 1) // Temporary stopgap check
|
||||
continue;
|
||||
if (open > instance.openLayers())
|
||||
open = instance.openLayers();
|
||||
|
||||
// Copy fluid
|
||||
FluidStack newFluid = fluid.copy();
|
||||
newFluid.amount = pixelLayer * open;
|
||||
instance.addFluid(open, newFluid);
|
||||
|
||||
// Subtract from total
|
||||
data.totalAmount -= newFluid.amount;
|
||||
if (data.totalAmount <= 0)
|
||||
break;
|
||||
}
|
||||
else if (position == data.blocksWithExtra && data.leftovers > 0)
|
||||
{
|
||||
// Calculate open layers
|
||||
int open = data.layers - height + 1;
|
||||
if (open < 1) // Temporary stopgap check
|
||||
continue;
|
||||
boolean full = false;
|
||||
if (open > instance.openLayers())
|
||||
{
|
||||
open = instance.openLayers();
|
||||
full = true;
|
||||
}
|
||||
|
||||
// Copy fluid
|
||||
FluidStack newFluid = fluid.copy();
|
||||
newFluid.amount = pixelLayer * open;
|
||||
if (!full)
|
||||
newFluid.amount += data.leftovers;
|
||||
instance.addFluid(open, newFluid);
|
||||
|
||||
// Subtract from total
|
||||
data.totalAmount -= newFluid.amount;
|
||||
if (data.totalAmount <= 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Calculate open layers
|
||||
int open = data.layers - height;
|
||||
if (open < 1) // Temporary stopgap check
|
||||
continue;
|
||||
if (open > instance.openLayers())
|
||||
open = instance.openLayers();
|
||||
|
||||
// Copy fluid
|
||||
FluidStack newFluid = fluid.copy();
|
||||
newFluid.amount = pixelLayer * open;
|
||||
instance.addFluid(open, newFluid);
|
||||
|
||||
// Subtract from total
|
||||
data.totalAmount -= newFluid.amount;
|
||||
if (data.totalAmount <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Distribute liquids to each block
|
||||
}
|
||||
|
||||
protected void updateFluidBlocks ()
|
||||
{
|
||||
Iterator iter = airUpdates.entrySet().iterator();
|
||||
byte count = 0;
|
||||
while (iter.hasNext() && count < 40)
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iter.next();
|
||||
CoordTuple coord = (CoordTuple) pairs.getKey();
|
||||
TileEntity te = worldObj.getTileEntity(coord.x, coord.y, coord.z);
|
||||
if (te instanceof TankAirLogic)
|
||||
{
|
||||
((TankAirLogic) te).overrideFluids(((LiquidDataInstance) pairs.getValue()).fluids);
|
||||
}
|
||||
iter.remove();
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateAir ()
|
||||
{
|
||||
for (CoordTuple loc : structure.airCoords)
|
||||
worldObj.markBlockForUpdate(loc.x, loc.y, loc.z);
|
||||
}
|
||||
|
||||
class LiquidData
|
||||
{
|
||||
public int totalAmount;
|
||||
public int layers;
|
||||
public int leftovers;
|
||||
public int blocksWithExtra;
|
||||
|
||||
LiquidData(int amount, int blocks)
|
||||
{
|
||||
totalAmount = amount;
|
||||
int layerAmount = pixelLayer * blocks;
|
||||
layers = amount / layerAmount;
|
||||
leftovers = amount % pixelLayer;
|
||||
blocksWithExtra = (amount % layerAmount) / pixelLayer;
|
||||
}
|
||||
}
|
||||
|
||||
class LiquidDataInstance
|
||||
{
|
||||
public ArrayList<FluidStack> fluids = new ArrayList<FluidStack>();
|
||||
int layers = 0;
|
||||
|
||||
public int openLayers ()
|
||||
{
|
||||
return 16 - layers;
|
||||
}
|
||||
|
||||
public void addFluid (int l, FluidStack fluid)
|
||||
{
|
||||
layers += l;
|
||||
fluids.add(fluid);
|
||||
}
|
||||
}
|
||||
|
||||
/* Gui */
|
||||
|
||||
@Override
|
||||
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
|
||||
{
|
||||
return new AdaptiveSmelteryContainer(inventoryplayer, this);
|
||||
}
|
||||
|
||||
public int getTempForSlot (int slot)
|
||||
{
|
||||
return smeltery.activeTemps[slot];
|
||||
}
|
||||
|
||||
public int getMeltingPointForSlot (int slot)
|
||||
{
|
||||
return smeltery.meltingTemps[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultName ()
|
||||
{
|
||||
return "crafters.Smeltery";
|
||||
}
|
||||
|
||||
/* Fluids */
|
||||
|
||||
@Override
|
||||
public int fill (ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
return multitank.fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
return multitank.drain(resource.amount, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return multitank.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo (ForgeDirection from)
|
||||
{
|
||||
return multitank.getMultiTankInfo();
|
||||
}
|
||||
|
||||
public int getFillState ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* NBT */
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.readFromNBT(tags);
|
||||
readNetworkNBT(tags);
|
||||
|
||||
structure.readFromNBT(tags);
|
||||
multitank.readFromNBT(tags);
|
||||
smeltery.readFromNBT(tags);
|
||||
}
|
||||
|
||||
public void readNetworkNBT (NBTTagCompound tags)
|
||||
{
|
||||
direction = tags.getByte("Direction");
|
||||
adjustInventory(tags.getInteger("InvSize"), false);
|
||||
super.readInventoryFromNBT(tags);
|
||||
|
||||
structure.readNetworkNBT(tags);
|
||||
multitank.readNetworkNBT(tags);
|
||||
smeltery.readNetworkNBT(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.writeToNBT(tags);
|
||||
writeNetworkNBT(tags);
|
||||
|
||||
structure.writeToNBT(tags);
|
||||
multitank.writeToNBT(tags);
|
||||
smeltery.writeToNBT(tags);
|
||||
}
|
||||
|
||||
public void writeNetworkNBT (NBTTagCompound tags)
|
||||
{
|
||||
tags.setByte("Direction", direction);
|
||||
tags.setInteger("InvSize", inventory.length);
|
||||
super.writeInventoryToNBT(tags);
|
||||
|
||||
structure.writeNetworkNBT(tags);
|
||||
multitank.writeNetworkNBT(tags);
|
||||
smeltery.writeNetworkNBT(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
readNetworkNBT(packet.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeNetworkNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName ()
|
||||
{
|
||||
return getDefaultName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory ()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory ()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package tconstruct.smeltery.logic;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class AqueductLogic extends TileEntity // implements ITankContainer
|
||||
{
|
||||
|
||||
/*
|
||||
* @Override public int fill (ForgeDirection from, FluidStack resource,
|
||||
* boolean doFill) { return 0; }
|
||||
*
|
||||
* @Override public int fill (int tankIndex, FluidStack resource, boolean
|
||||
* doFill) { return 0; }
|
||||
*
|
||||
* @Override public FluidStack drain (ForgeDirection from, int maxDrain,
|
||||
* boolean doDrain) { return null; }
|
||||
*
|
||||
* @Override public FluidStack drain (int tankIndex, int maxDrain, boolean
|
||||
* doDrain) { return null; }
|
||||
*
|
||||
* @Override public ILiquidTank[] getTanks (ForgeDirection direction) {
|
||||
* return null; }
|
||||
*
|
||||
* @Override public ILiquidTank getTank (ForgeDirection direction,
|
||||
* FluidStack type) { return null; }
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
package tconstruct.smeltery.logic;
|
||||
|
||||
import java.util.*;
|
||||
import mantle.blocks.abstracts.InventoryLogic;
|
||||
import mantle.blocks.iface.*;
|
||||
import mantle.world.CoordTuple;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.*;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.smeltery.component.TankAirComponent;
|
||||
|
||||
public class TankAirLogic extends InventoryLogic implements IServantLogic, ISidedInventory
|
||||
{
|
||||
TankAirComponent multitank = new TankAirComponent(TConstruct.ingotLiquidValue * 18);
|
||||
CoordTuple master;
|
||||
|
||||
public TankAirLogic()
|
||||
{
|
||||
super(1);
|
||||
}
|
||||
|
||||
public void overrideFluids (ArrayList<FluidStack> fluids)
|
||||
{
|
||||
/*
|
||||
* multitank.overrideFluids(fluids); worldObj.markBlockForUpdate(xCoord,
|
||||
* yCoord, zCoord);
|
||||
*/
|
||||
}
|
||||
|
||||
public boolean hasItem ()
|
||||
{
|
||||
return inventory[0] != null;
|
||||
}
|
||||
|
||||
public boolean hasFluids ()
|
||||
{
|
||||
return multitank.fluidlist.size() > 0;
|
||||
}
|
||||
|
||||
public List<FluidStack> getFluids ()
|
||||
{
|
||||
return multitank.fluidlist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
/*
|
||||
* inventory[slot] = itemstack; if (itemstack != null &&
|
||||
* itemstack.stackSize > getInventoryStackLimit()) { itemstack.stackSize
|
||||
* = getInventoryStackLimit();
|
||||
* worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord,
|
||||
* itemstack.getItemDamage(), 3); worldObj.markBlockForUpdate(xCoord,
|
||||
* yCoord, zCoord); }
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
|
||||
{
|
||||
return null; // Not a gui block
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultName ()
|
||||
{
|
||||
return null; // Not a gui block
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoordTuple getMasterPosition ()
|
||||
{
|
||||
return master;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyMasterOfChange ()
|
||||
{
|
||||
// Probably not useful here
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPotentialMaster (IMasterLogic master, World world, int xMaster, int yMaster, int zMaster)
|
||||
{
|
||||
return false; // Master should be verified right after placement
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verifyMaster (IMasterLogic logic, World world, int xMaster, int yMaster, int zMaster)
|
||||
{
|
||||
/*
|
||||
* if (master != null) //Is this even needed? return false;
|
||||
*/
|
||||
|
||||
master = new CoordTuple(xMaster, yMaster, zMaster);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidateMaster (IMasterLogic master, World world, int xMaster, int yMaster, int zMaster)
|
||||
{
|
||||
world.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide (int var1)
|
||||
{
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem (int i, ItemStack itemstack, int j)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem (int i, ItemStack itemstack, int j)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public boolean canUpdate() { return false; }
|
||||
*/
|
||||
|
||||
// DELETE
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
// Keep TE regardless of metadata
|
||||
public boolean shouldRefresh (int oldID, int newID, int oldMeta, int newMeta, World world, int x, int y, int z)
|
||||
{
|
||||
return oldID != newID;
|
||||
}
|
||||
|
||||
/* NBT */
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.readFromNBT(tags);
|
||||
readNetworkNBT(tags);
|
||||
multitank.readFromNBT(tags);
|
||||
}
|
||||
|
||||
public void readNetworkNBT (NBTTagCompound tags)
|
||||
{
|
||||
multitank.readNetworkNBT(tags);
|
||||
super.readInventoryFromNBT(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
super.writeToNBT(tags);
|
||||
writeNetworkNBT(tags);
|
||||
multitank.writeToNBT(tags);
|
||||
}
|
||||
|
||||
public void writeNetworkNBT (NBTTagCompound tags)
|
||||
{
|
||||
multitank.writeNetworkNBT(tags);
|
||||
super.writeInventoryToNBT(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
readNetworkNBT(packet.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeNetworkNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName ()
|
||||
{
|
||||
return this.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory ()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory ()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package tconstruct.smeltery.logic;
|
||||
|
||||
import mantle.blocks.abstracts.AdaptiveInventoryLogic;
|
||||
import mantle.blocks.iface.*;
|
||||
|
||||
//Not actually abstract
|
||||
public abstract class TowerFurnaceLogic extends AdaptiveInventoryLogic implements IActiveLogic, IFacingLogic, IMasterLogic
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package tconstruct.smeltery.model;
|
||||
|
||||
import cpw.mods.fml.client.registry.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.client.BlockSkinRenderHelper;
|
||||
import tconstruct.smeltery.logic.TankAirLogic;
|
||||
|
||||
public class TankAirRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int model = RenderingRegistry.getNextAvailableRenderId();
|
||||
private static final double capacity = TConstruct.ingotLiquidValue * 18;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
//No inventory block
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == model)
|
||||
{
|
||||
TankAirLogic logic = (TankAirLogic) world.getTileEntity(x, y, z);
|
||||
if (logic.hasItem())
|
||||
{
|
||||
ItemStack item = logic.getStackInSlot(0);
|
||||
if (item.getItem() instanceof ItemBlock)
|
||||
{
|
||||
Block inv = Block.getBlockFromItem(item.getItem());
|
||||
renderer.setOverrideBlockTexture(inv.getIcon(1, item.getItemDamage()));
|
||||
renderer.renderBlockByRenderType(inv, x, y, z);
|
||||
renderer.clearOverrideBlockTexture();
|
||||
}
|
||||
}
|
||||
else if (logic.hasFluids())
|
||||
{
|
||||
int base = 0;
|
||||
for (FluidStack fluidstack : logic.getFluids())
|
||||
{
|
||||
Fluid fluid = fluidstack.getFluid();
|
||||
//System.out.println("Base: "+getBaseAmount(base)+", Height: "+getHeightAmount(base, fluidstack.amount)+", fluid amount: "+fluidstack.amount);
|
||||
renderer.setRenderBounds(0.0, getBaseAmount(base), 0.0, 1.0, getHeightAmount(base, fluidstack.amount), 1.0);
|
||||
if (fluid.canBePlacedInWorld())
|
||||
BlockSkinRenderHelper.renderMetadataBlock(fluid.getBlock(), 0, x, y, z, renderer, world);
|
||||
else
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
|
||||
base += fluidstack.amount;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private double getBaseAmount (int base)
|
||||
{
|
||||
return base / capacity;
|
||||
}
|
||||
|
||||
private double getHeightAmount (int base, int amount)
|
||||
{
|
||||
return (base + amount) / capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory (int modelID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,6 @@ public class PHConstruct
|
||||
|
||||
// Experimental functionality
|
||||
throwableSmeltery = config.get("Experimental", "Items can be thrown into smelteries", true).getBoolean(true);
|
||||
newSmeltery = config.get("Experimental", "Use new adaptive Smeltery code", false, "Warning: Very buggy").getBoolean(false);
|
||||
meltableHorses = config.get("Experimental", "Allow horses to be melted down for glue", true).getBoolean(true);
|
||||
meltableVillagers = config.get("Experimental", "Allow villagers to be melted down for emeralds", true).getBoolean(true);
|
||||
minimalTextures = config.get("Experimental", "Minimal Textures", false).getBoolean(false);
|
||||
@@ -361,7 +360,6 @@ public class PHConstruct
|
||||
|
||||
// Experimental functionality
|
||||
public static boolean throwableSmeltery;
|
||||
public static boolean newSmeltery;
|
||||
public static boolean meltableHorses;
|
||||
public static boolean meltableVillagers;
|
||||
public static boolean minimalTextures;
|
||||
|
||||
Reference in new issue
Block a user