Skip to content

Commit

Permalink
remove redundant classes that are in mantle, use mantle's implementat…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
progwml6 committed Dec 2, 2013
1 parent a181dc9 commit b57eb8b
Show file tree
Hide file tree
Showing 21 changed files with 87 additions and 239 deletions.
2 changes: 1 addition & 1 deletion src/main/java/tconstruct/blocks/FurnaceSlab.java
Expand Up @@ -12,7 +12,7 @@
import tconstruct.common.TProxyCommon;
import tconstruct.library.TConstructRegistry;
import mantle.blocks.abstracts.InventorySlab;
import tconstruct.library.util.IActiveLogic;
import mantle.blocks.iface.IActiveLogic;
import mantle.blocks.iface.IFacingLogic;

public class FurnaceSlab extends InventorySlab
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/tconstruct/blocks/component/SmelteryComponent.java
Expand Up @@ -2,6 +2,7 @@

import java.util.ArrayList;

import mantle.world.CoordTuple;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
Expand All @@ -14,7 +15,6 @@
import tconstruct.library.component.LogicComponent;
import tconstruct.library.component.MultiFluidTank;
import tconstruct.library.crafting.Smeltery;
import tconstruct.library.util.CoordTuple;

public class SmelteryComponent extends LogicComponent
{
Expand Down Expand Up @@ -138,14 +138,14 @@ void updateFuelGague ()
if (activeLavaTank == null || fuelTicks > 0 || structure.lavaTanks.size() < 1)
return;

if (!world.blockExists(activeLavaTank.x, activeLavaTank.y, activeLavaTank.z))
if (!world.blockExists(activeLavaTank.x(), activeLavaTank.y(), activeLavaTank.z()))
{
fuelAmount = 0;
fuelGague = 0;
return;
}

TileEntity tankContainer = world.getBlockTileEntity(activeLavaTank.x, activeLavaTank.y, activeLavaTank.z);
TileEntity tankContainer = world.getBlockTileEntity(activeLavaTank.x(), activeLavaTank.y(), activeLavaTank.z());
if (tankContainer == null)
{
fuelAmount = 0;
Expand Down Expand Up @@ -182,7 +182,7 @@ void updateFuelGague ()
while (!foundTank)
{
CoordTuple possibleTank = structure.lavaTanks.get(iter);
TileEntity newTankContainer = world.getBlockTileEntity(possibleTank.x, possibleTank.y, possibleTank.z);
TileEntity newTankContainer = world.getBlockTileEntity(possibleTank.x(), possibleTank.y(), possibleTank.z());
if (newTankContainer instanceof IFluidHandler)
{
FluidStack newliquid = ((IFluidHandler) newTankContainer).drain(ForgeDirection.UNKNOWN, drainFuelAmount(), false);
Expand Down Expand Up @@ -276,6 +276,6 @@ public void writeNetworkNBT (NBTTagCompound tags)
tags.setIntArray("Melting", meltingTemps);
tags.setInteger("Fuel", fuelAmount);
if (activeLavaTank != null)
tags.setIntArray("LavaTank", new int[] { activeLavaTank.x, activeLavaTank.y, activeLavaTank.z });
tags.setIntArray("LavaTank", new int[] { activeLavaTank.x(), activeLavaTank.y(), activeLavaTank.z() });
}
}
18 changes: 9 additions & 9 deletions src/main/java/tconstruct/blocks/component/SmelteryScan.java
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.Iterator;

import mantle.world.CoordTuple;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagIntArray;
Expand All @@ -11,7 +12,6 @@
import tconstruct.common.TContent;
import tconstruct.common.TRepo;
import tconstruct.library.component.TankLayerScan;
import tconstruct.library.util.CoordTuple;
import tconstruct.library.util.IServantLogic;

public class SmelteryScan extends TankLayerScan
Expand Down Expand Up @@ -71,10 +71,10 @@ protected void finalizeStructure ()
{
for (CoordTuple coord : airCoords)
{
if (world.getBlockId(coord.x, coord.y, coord.z) != TRepo.tankAir.blockID)
if (world.getBlockId(coord.x(), coord.y(), coord.z()) != TRepo.tankAir.blockID)
{
world.setBlock(coord.x, coord.y, coord.z, TRepo.tankAir.blockID);
IServantLogic servant = (IServantLogic) world.getBlockTileEntity(coord.x, coord.y, coord.z);
world.setBlock(coord.x(), coord.y(), coord.z(), TRepo.tankAir.blockID);
IServantLogic servant = (IServantLogic) world.getBlockTileEntity(coord.x(), coord.y(), coord.z());
servant.verifyMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
}
}
Expand All @@ -87,7 +87,7 @@ protected void invalidateStructure ()
super.invalidateStructure();
for (CoordTuple coord : airCoords)
{
TileEntity servant = world.getBlockTileEntity(coord.x, coord.y, coord.z);
TileEntity servant = world.getBlockTileEntity(coord.x(), coord.y(), coord.z());
if (servant instanceof IServantLogic)
((IServantLogic) servant).invalidateMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
}
Expand All @@ -98,10 +98,10 @@ protected void invalidateBlocksAbove (int height)
{
for (CoordTuple coord : airCoords)
{
if (coord.y < height)
if (coord.y() < height)
continue;

TileEntity servant = world.getBlockTileEntity(coord.x, coord.y, coord.z);
TileEntity servant = world.getBlockTileEntity(coord.x(), coord.y(), coord.z());
if (servant instanceof IServantLogic)
((IServantLogic) servant).invalidateMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
}
Expand All @@ -115,7 +115,7 @@ public void cleanup ()
while (i.hasNext())
{
CoordTuple coord = (CoordTuple) i.next();
TileEntity te = world.getBlockTileEntity(coord.x, coord.y, coord.z);
TileEntity te = world.getBlockTileEntity(coord.x(), coord.y(), coord.z());
if (te != null && te instanceof IServantLogic)
{
((IServantLogic) te).invalidateMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
Expand Down Expand Up @@ -151,7 +151,7 @@ public void writeNetworkNBT (NBTTagCompound tags)
NBTTagList tanks = new NBTTagList();
for (CoordTuple coord : lavaTanks)
{
tanks.appendTag(new NBTTagIntArray("coord", new int[] { coord.x, coord.y, coord.z }));
tanks.appendTag(new NBTTagIntArray("coord", new int[] { coord.x(), coord.y(), coord.z() }));
}
tags.setTag("Tanks", tanks);
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/tconstruct/blocks/logic/AdaptiveDrainLogic.java
Expand Up @@ -36,7 +36,7 @@ public int fill (ForgeDirection from, FluidStack resource, boolean doFill)
{
if (hasValidMaster() && canDrain(from, null))
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x(), master.y(), master.z());
return smeltery.fill(from, resource, doFill);
}
return 0;
Expand All @@ -48,7 +48,7 @@ public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
// TConstruct.logger.info("Attempting drain " + hasValidMaster());
if (hasValidMaster() && canDrain(from, null))
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x(), master.y(), master.z());
// TConstruct.logger.info("Found master");
return smeltery.drain(from, maxDrain, doDrain);
}
Expand All @@ -60,7 +60,7 @@ public FluidStack drain (ForgeDirection from, FluidStack resource, boolean doDra
{
if (hasValidMaster() && canDrain(from, null))
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x(), master.y(), master.z());
return smeltery.drain(from, resource, doDrain);
}
return null;
Expand All @@ -71,7 +71,7 @@ public boolean canFill (ForgeDirection from, Fluid fluid)
{
if (hasValidMaster())
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x(), master.y(), master.z());
return smeltery.getFillState() < 2;
}
return false;
Expand All @@ -82,7 +82,7 @@ public boolean canDrain (ForgeDirection from, Fluid fluid)
{
if (hasValidMaster())
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x(), master.y(), master.z());
return smeltery.getFillState() > 0;
}
return false;
Expand All @@ -93,7 +93,7 @@ public FluidTankInfo[] getTankInfo (ForgeDirection from)
{
if (hasValidMaster() && (from == getForgeDirection() || from == getForgeDirection().getOpposite() || from == ForgeDirection.UNKNOWN))
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x(), master.y(), master.z());
return smeltery.getTankInfo(ForgeDirection.UNKNOWN);
}
return null;
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java
Expand Up @@ -32,8 +32,8 @@
import tconstruct.library.component.IComponentHolder;
import tconstruct.library.component.LogicComponent;
import tconstruct.library.component.MultiFluidTank;
import tconstruct.library.util.CoordTuple;
import tconstruct.library.util.IActiveLogic;
import mantle.blocks.iface.IActiveLogic;
import mantle.world.CoordTuple;
import tconstruct.library.util.IMasterLogic;
import tconstruct.library.util.IServantLogic;

Expand Down Expand Up @@ -285,7 +285,7 @@ void updateWorldBlock (int slot, ItemStack itemstack)
CoordTuple air = structure.getAirByIndex(slot);
if (air != null)
{
TileEntity te = worldObj.getBlockTileEntity(air.x, air.y, air.z);
TileEntity te = worldObj.getBlockTileEntity(air.x(), air.y(), air.z());
if (te != null && te instanceof TankAirLogic)
{
((TankAirLogic) te).setInventorySlotContents(0, itemstack);
Expand All @@ -306,15 +306,15 @@ public void distributeFluids ()
{
//Base calculations per liquid
LiquidData data = new LiquidData(fluid.amount, size);
int baseY = structure.airCoords.get(0).y;
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 height = 16 * (coord.y() - baseY);
int position = i % layerSize;

if (!airUpdates.containsKey(coord))
Expand Down Expand Up @@ -407,7 +407,7 @@ protected void updateFluidBlocks ()
{
Map.Entry pairs = (Map.Entry) iter.next();
CoordTuple coord = (CoordTuple) pairs.getKey();
TileEntity te = worldObj.getBlockTileEntity(coord.x, coord.y, coord.z);
TileEntity te = worldObj.getBlockTileEntity(coord.x(), coord.y(), coord.z());
if (te instanceof TankAirLogic)
{
((TankAirLogic) te).overrideFluids(((LiquidDataInstance) pairs.getValue()).fluids);
Expand All @@ -420,7 +420,7 @@ protected void updateFluidBlocks ()
public void updateAir ()
{
for (CoordTuple loc : structure.airCoords)
worldObj.markBlockForUpdate(loc.x, loc.y, loc.z);
worldObj.markBlockForUpdate(loc.x(), loc.y(), loc.z());
}

class LiquidData
Expand Down
Expand Up @@ -15,7 +15,7 @@
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank;
import tconstruct.TConstruct;
import tconstruct.library.util.IActiveLogic;
import mantle.blocks.iface.IActiveLogic;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/tconstruct/blocks/logic/FaucetLogic.java
@@ -1,8 +1,8 @@
package tconstruct.blocks.logic;

import tconstruct.TConstruct;
import tconstruct.library.util.IActiveLogic;
import mantle.blocks.iface.IFacingLogic;;
import mantle.blocks.iface.IActiveLogic;
import mantle.blocks.iface.IFacingLogic;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tconstruct/blocks/logic/FrypanLogic.java
@@ -1,7 +1,7 @@
package tconstruct.blocks.logic;

import tconstruct.inventory.FrypanContainer;
import tconstruct.library.util.IActiveLogic;
import mantle.blocks.iface.IActiveLogic;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.InventoryPlayer;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tconstruct/blocks/logic/FurnaceLogic.java
Expand Up @@ -21,7 +21,7 @@
import net.minecraftforge.common.ForgeDirection;
import tconstruct.inventory.FurnaceContainer;
import mantle.blocks.abstracts.InventoryLogic;
import tconstruct.library.util.IActiveLogic;
import mantle.blocks.iface.IActiveLogic;
import mantle.blocks.iface.IFacingLogic;
import cpw.mods.fml.common.registry.GameRegistry;

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/tconstruct/blocks/logic/MultiServantLogic.java
@@ -1,12 +1,12 @@
package tconstruct.blocks.logic;

import mantle.world.CoordTuple;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import tconstruct.library.util.CoordTuple;
import tconstruct.library.util.IMasterLogic;
import tconstruct.library.util.IServantLogic;

Expand All @@ -27,7 +27,7 @@ public boolean hasValidMaster ()
if (!hasMaster)
return false;

if (worldObj.getBlockId(master.x, master.y, master.z) == masterID && worldObj.getBlockMetadata(master.x, master.y, master.z) == masterMeat)
if (worldObj.getBlockId(master.x(), master.y(), master.z()) == masterID && worldObj.getBlockMetadata(master.x(), master.y(), master.z()) == masterMeat)
return true;

else
Expand Down Expand Up @@ -71,7 +71,7 @@ public boolean verifyMaster (IMasterLogic logic, int x, int y, int z)
@Deprecated
public boolean setMaster (int x, int y, int z)
{
if (!hasMaster || worldObj.getBlockId(master.x, master.y, master.z) != masterID || (worldObj.getBlockMetadata(master.x, master.y, master.z) != masterMeat))
if (!hasMaster || worldObj.getBlockId(master.x(), master.y(), master.z()) != masterID || (worldObj.getBlockMetadata(master.x(), master.y(), master.z()) != masterMeat))
{
overrideMaster(x, y, z);
return true;
Expand Down Expand Up @@ -113,7 +113,7 @@ public void notifyMasterOfChange ()
{
if (hasValidMaster())
{
IMasterLogic logic = (IMasterLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
IMasterLogic logic = (IMasterLogic) worldObj.getBlockTileEntity(master.x(), master.y(), master.z());
logic.notifyChange(this, xCoord, yCoord, zCoord);
}
}
Expand All @@ -137,9 +137,9 @@ public void writeCustomNBT (NBTTagCompound tags)
tags.setBoolean("TiedToMaster", hasMaster);
if (hasMaster)
{
tags.setInteger("xCenter", master.x);
tags.setInteger("yCenter", master.y);
tags.setInteger("zCenter", master.z);
tags.setInteger("xCenter", master.x());
tags.setInteger("yCenter", master.y());
tags.setInteger("zCenter", master.z());
tags.setShort("MasterID", masterID);
tags.setByte("masterMeat", masterMeat);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/tconstruct/blocks/logic/SmelteryDrainLogic.java
Expand Up @@ -29,7 +29,7 @@ public int fill (ForgeDirection from, FluidStack resource, boolean doFill)
{
if (doFill)
{
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x(), master.y(), master.z());
return smeltery.fill(resource, doFill);
}
else
Expand All @@ -48,7 +48,7 @@ public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
{
if (hasValidMaster() && canDrain(from, null))
{
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x(), master.y(), master.z());
return smeltery.drain(maxDrain, doDrain);
}
else
Expand Down Expand Up @@ -79,7 +79,7 @@ public boolean canDrain (ForgeDirection from, Fluid fluid)
boolean containsFluid = fluid == null;
if (fluid != null)
{
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x(), master.y(), master.z());
for (FluidStack fstack : smeltery.moltenMetal)
{
if (fstack.fluidID == fluid.getID())
Expand All @@ -98,7 +98,7 @@ public FluidTankInfo[] getTankInfo (ForgeDirection from)
{
if (hasValidMaster() && (from == getForgeDirection() || from == getForgeDirection().getOpposite() || from == ForgeDirection.UNKNOWN))
{
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x(), master.y(), master.z());
return smeltery.getMultiTankInfo();
//return new FluidTankInfo[] { smeltery.getInfo() };
}
Expand Down

0 comments on commit b57eb8b

Please sign in to comment.