mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-28 07:55:41 +00:00
Merge branch 'master' into AE2_MEConduits
Conflicts: build.gradle src/main/java/crazypants/enderio/conduit/IConduitBundle.java src/main/java/crazypants/enderio/conduit/TileConduitBundle.java src/main/java/crazypants/enderio/conduit/gas/GasConduitNetwork.java src/main/java/crazypants/enderio/conduit/liquid/AdvancedLiquidConduitNetwork.java src/main/java/crazypants/enderio/conduit/me/IMEConduit.java src/main/java/crazypants/enderio/conduit/me/MEConduit.java src/main/java/crazypants/enderio/conduit/me/MEConduitGrid.java src/main/java/crazypants/enderio/conduit/me/MEConduitRenderer.java
This commit is contained in:
commit
f6a9b0d845
64 files changed
+607
-367
No files matched your search
@@ -34,7 +34,6 @@ import crazypants.enderio.conduit.liquid.EnderLiquidConduitRenderer;
|
||||
import crazypants.enderio.conduit.liquid.LiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.LiquidConduitRenderer;
|
||||
import crazypants.enderio.conduit.me.MEConduit;
|
||||
import crazypants.enderio.conduit.me.MEConduitNetwork;
|
||||
import crazypants.enderio.conduit.power.PowerConduit;
|
||||
import crazypants.enderio.conduit.power.PowerConduitRenderer;
|
||||
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package crazypants.enderio;
|
||||
|
||||
import static crazypants.enderio.EnderIO.MODID;
|
||||
import static crazypants.enderio.EnderIO.MOD_NAME;
|
||||
import static crazypants.enderio.EnderIO.VERSION;
|
||||
import static crazypants.enderio.EnderIO.*;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
@@ -17,8 +15,6 @@ import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import buildcraft.api.fuels.IronEngineCoolant;
|
||||
import buildcraft.api.fuels.IronEngineFuel;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@@ -61,6 +57,7 @@ import crazypants.enderio.enderface.BlockEnderIO;
|
||||
import crazypants.enderio.enderface.EnderfaceRecipes;
|
||||
import crazypants.enderio.enderface.ItemEnderface;
|
||||
import crazypants.enderio.fluid.BlockFluidEio;
|
||||
import crazypants.enderio.fluid.FluidFuelRegister;
|
||||
import crazypants.enderio.fluid.Fluids;
|
||||
import crazypants.enderio.fluid.ItemBucketEio;
|
||||
import crazypants.enderio.item.ItemConduitProbe;
|
||||
@@ -427,29 +424,25 @@ public class EnderIO {
|
||||
f = new Fluid(Fluids.HOOTCH_NAME).setDensity(900).setViscosity(1000);
|
||||
FluidRegistry.registerFluid(f);
|
||||
fluidHootch = FluidRegistry.getFluid(f.getName());
|
||||
blockHootch = BlockFluidEio.create(fluidHootch, Material.water);
|
||||
IronEngineFuel.addFuel(Fluids.HOOTCH_NAME, Config.hootchPowerPerCycle, Config.hootchPowerTotalBurnTime);
|
||||
FMLInterModComms.sendMessage("Railcraft", "boiler-fuel-liquid", Fluids.HOOTCH_NAME + "@" + (Config.hootchPowerPerCycle * Config.hootchPowerTotalBurnTime));
|
||||
blockHootch = BlockFluidEio.create(fluidHootch, Material.water);
|
||||
FluidFuelRegister.instance.addFuel(f, Config.hootchPowerPerCycleRF, Config.hootchPowerTotalBurnTime);
|
||||
FMLInterModComms.sendMessage("Railcraft", "boiler-fuel-liquid", Fluids.HOOTCH_NAME + "@" + (Config.hootchPowerPerCycleRF/10 * Config.hootchPowerTotalBurnTime));
|
||||
|
||||
f = new Fluid(Fluids.ROCKET_FUEL_NAME).setDensity(900).setViscosity(1000);
|
||||
FluidRegistry.registerFluid(f);
|
||||
fluidRocketFuel = FluidRegistry.getFluid(f.getName());
|
||||
blockRocketFuel = BlockFluidEio.create(fluidRocketFuel, Material.water);
|
||||
IronEngineFuel.addFuel(Fluids.ROCKET_FUEL_NAME, Config.rocketFuelPowerPerCycle, Config.rocketFuelPowerTotalBurnTime);
|
||||
FluidFuelRegister.instance.addFuel(f, Config.rocketFuelPowerPerCycleRF, Config.rocketFuelPowerTotalBurnTime);
|
||||
FMLInterModComms.sendMessage("Railcraft", "boiler-fuel-liquid", Fluids.ROCKET_FUEL_NAME + "@"
|
||||
+ (Config.rocketFuelPowerPerCycle * Config.rocketFuelPowerTotalBurnTime));
|
||||
+ (Config.rocketFuelPowerPerCycleRF/10 * Config.rocketFuelPowerTotalBurnTime));
|
||||
|
||||
f = new Fluid(Fluids.FIRE_WATER_NAME).setDensity(900).setViscosity(1000);
|
||||
FluidRegistry.registerFluid(f);
|
||||
fluidFireWater = FluidRegistry.getFluid(f.getName());
|
||||
blockFireWater = BlockFluidEio.create(fluidFireWater, Material.lava);
|
||||
IronEngineFuel.addFuel(Fluids.FIRE_WATER_NAME, Config.fireWaterPowerPerCycle, Config.fireWaterPowerTotalBurnTime);
|
||||
FluidFuelRegister.instance.addFuel(f, Config.fireWaterPowerPerCycleRF, Config.fireWaterPowerTotalBurnTime);
|
||||
FMLInterModComms.sendMessage("Railcraft", "boiler-fuel-liquid", Fluids.FIRE_WATER_NAME + "@"
|
||||
+ (Config.fireWaterPowerPerCycle * Config.fireWaterPowerTotalBurnTime));
|
||||
|
||||
if(!IronEngineCoolant.isCoolant(FluidRegistry.getFluid("water"))) {
|
||||
IronEngineCoolant.addCoolant(FluidRegistry.getFluid("water"), 0.0023F);
|
||||
}
|
||||
+ (Config.fireWaterPowerPerCycleRF/10 * Config.fireWaterPowerTotalBurnTime));
|
||||
|
||||
fluidXpJuice = FluidRegistry.getFluid("xpjuice");
|
||||
if(!Loader.isModLoaded("OpenBlocks")) {
|
||||
|
||||
@@ -38,4 +38,10 @@ public abstract class TileEntityEio extends TileEntity {
|
||||
protected abstract void writeCustomNBT(NBTTagCompound root);
|
||||
|
||||
protected abstract void readCustomNBT(NBTTagCompound root);
|
||||
|
||||
protected void updateBlock() {
|
||||
if (worldObj != null) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public abstract class AbstractConduit implements IConduit {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCoord getBlockCoord() {
|
||||
public BlockCoord getLocation() {
|
||||
if(bundle == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (IConduit con : conduits) {
|
||||
sb.append(con.getBlockCoord());
|
||||
sb.append(con.getLocation());
|
||||
sb.append(", ");
|
||||
}
|
||||
return "AbstractConduitNetwork [conduits=" + sb.toString() + "]";
|
||||
|
||||
@@ -112,7 +112,7 @@ public class ConduitUtil {
|
||||
|
||||
public static <T extends IConduit> void disconectConduits(T con, ForgeDirection connDir) {
|
||||
con.conduitConnectionRemoved(connDir);
|
||||
BlockCoord loc = con.getBlockCoord().getLocation(connDir);
|
||||
BlockCoord loc = con.getLocation().getLocation(connDir);
|
||||
IConduit neighbour = ConduitUtil.getConduit(con.getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, con.getBaseConduitType());
|
||||
if(neighbour != null) {
|
||||
neighbour.conduitConnectionRemoved(connDir.getOpposite());
|
||||
@@ -126,7 +126,7 @@ public class ConduitUtil {
|
||||
}
|
||||
|
||||
public static <T extends IConduit> boolean joinConduits(T con, ForgeDirection faceHit) {
|
||||
BlockCoord loc = con.getBlockCoord().getLocation(faceHit);
|
||||
BlockCoord loc = con.getLocation().getLocation(faceHit);
|
||||
IConduit neighbour = ConduitUtil.getConduit(con.getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, con.getBaseConduitType());
|
||||
if(neighbour != null && con.canConnectToConduit(faceHit, neighbour) && neighbour.canConnectToConduit(faceHit.getOpposite(), con)) {
|
||||
con.conduitConnectionAdded(faceHit);
|
||||
@@ -226,6 +226,8 @@ public class ConduitUtil {
|
||||
return conduitType == IItemConduit.class;
|
||||
case GAS:
|
||||
return conduitType == IGasConduit.class;
|
||||
case ME:
|
||||
return conduitType == IMEConduit.class;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public interface IConduit {
|
||||
|
||||
void onRemovedFromBundle();
|
||||
|
||||
BlockCoord getBlockCoord();
|
||||
BlockCoord getLocation();
|
||||
|
||||
// Conections
|
||||
boolean hasConnections();
|
||||
|
||||
@@ -12,7 +12,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.me.helpers.IGridProxyable;
|
||||
import cofh.api.transport.IItemDuct;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -27,7 +26,7 @@ public interface IConduitBundle extends IInternalPowerReceptor, IFluidHandler, I
|
||||
|
||||
TileEntity getEntity();
|
||||
|
||||
BlockCoord getBlockCoord();
|
||||
BlockCoord getLocation();
|
||||
|
||||
// conduits
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -278,7 +276,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCoord getBlockCoord() {
|
||||
public BlockCoord getLocation() {
|
||||
return new BlockCoord(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@@ -842,8 +840,6 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
public World getWorld() {
|
||||
return getWorldObj();
|
||||
}
|
||||
|
||||
/* AE2 */
|
||||
|
||||
private Object node; // IGridNode object, untyped to avoid crash w/o AE2
|
||||
|
||||
@@ -882,7 +878,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
return mode == ConnectionMode.DISABLED ? AECableType.NONE : AECableType.SMART;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Method(modid = "appliedenergistics2")
|
||||
public void securityBreak() {
|
||||
|
||||
@@ -29,7 +29,7 @@ public abstract class AbstractGasConduit extends AbstractConduit implements IGas
|
||||
protected boolean redstoneStateDirty = true;
|
||||
|
||||
public IGasHandler getExternalHandler(ForgeDirection direction) {
|
||||
IGasHandler con = GasUtil.getExternalGasHandler(getBundle().getWorld(), getBlockCoord().getLocation(direction));
|
||||
IGasHandler con = GasUtil.getExternalGasHandler(getBundle().getWorld(), getLocation().getLocation(direction));
|
||||
return (con != null && !(con instanceof IConduitBundle)) ? con : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class AbstractGasTankConduit extends AbstractGasConduit {
|
||||
return true;
|
||||
}
|
||||
|
||||
BlockCoord loc = getBlockCoord().getLocation(faceHit);
|
||||
BlockCoord loc = getLocation().getLocation(faceHit);
|
||||
IGasConduit n = ConduitUtil.getConduit(getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, IGasConduit.class);
|
||||
if(n == null) {
|
||||
return false;
|
||||
|
||||
@@ -80,7 +80,7 @@ public class GasConduit extends AbstractGasTankConduit {
|
||||
}
|
||||
|
||||
private void doExtract() {
|
||||
BlockCoord loc = getBlockCoord();
|
||||
BlockCoord loc = getLocation();
|
||||
if(!hasConnectionMode(ConnectionMode.INPUT)) {
|
||||
return;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public class GasConduit extends AbstractGasTankConduit {
|
||||
if(network == null) {
|
||||
return;
|
||||
}
|
||||
GasOutput lo = new GasOutput(getBlockCoord().getLocation(dir), dir.getOpposite());
|
||||
GasOutput lo = new GasOutput(getLocation().getLocation(dir), dir.getOpposite());
|
||||
network.removeInput(lo);
|
||||
if(getConnectionMode(dir).acceptsOutput() && containsExternalConnection(dir)) {
|
||||
network.addInput(lo);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit>
|
||||
}
|
||||
for (ForgeDirection dir : con.getExternalConnections()) {
|
||||
if(con.getConnectionMode(dir).acceptsOutput()) {
|
||||
outputs.add(new GasOutput(con.getBlockCoord().getLocation(dir), dir.getOpposite()));
|
||||
outputs.add(new GasOutput(con.getLocation().getLocation(dir), dir.getOpposite()));
|
||||
}
|
||||
}
|
||||
outputIterator = null;
|
||||
@@ -91,7 +91,7 @@ public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit>
|
||||
leftOvers--;
|
||||
}
|
||||
con.getTank().setGas(f);
|
||||
BlockCoord bc = con.getBlockCoord();
|
||||
BlockCoord bc = con.getLocation();
|
||||
con.getBundle().getEntity().getWorldObj().markTileEntityChunkModified(bc.x, bc.y, bc.z, con.getBundle().getEntity());
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit>
|
||||
}
|
||||
|
||||
public IGasHandler getTankContainer(GasConduit con, ForgeDirection dir) {
|
||||
BlockCoord bc = con.getBlockCoord().getLocation(dir);
|
||||
BlockCoord bc = con.getLocation().getLocation(dir);
|
||||
return getTankContainer(bc);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class GuiExternalConnectionSelector extends GuiScreen {
|
||||
protected void actionPerformed(GuiButton b) {
|
||||
ForgeDirection dir = ForgeDirection.values()[b.id];
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
BlockCoord loc = cb.getBlockCoord();
|
||||
BlockCoord loc = cb.getLocation();
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketOpenConduitUI(cb.getEntity(), dir));
|
||||
player.openGui(EnderIO.instance, GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE + dir.ordinal(), player.worldObj, loc.x, loc.y, loc.z);
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
|
||||
if(world == null) {
|
||||
return null;
|
||||
}
|
||||
BlockCoord loc = getBlockCoord().getLocation(direction);
|
||||
BlockCoord loc = getLocation().getLocation(direction);
|
||||
TileEntity te = world.getTileEntity(loc.x, loc.y, loc.z);
|
||||
if(te instanceof IInventory && !(te instanceof IConduitBundle)) {
|
||||
return (IInventory) te;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
@Override
|
||||
public void addConduit(IItemConduit con) {
|
||||
super.addConduit(con);
|
||||
conMap.put(con.getBlockCoord(), con);
|
||||
conMap.put(con.getLocation(), con);
|
||||
|
||||
TileEntity te = con.getBundle().getEntity();
|
||||
if(te != null) {
|
||||
@@ -91,7 +91,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
List<NetworkedInventory> invs = getOrCreate(bc);
|
||||
NetworkedInventory remove = null;
|
||||
for (NetworkedInventory ni : invs) {
|
||||
if(ni.con.getBlockCoord().equals(itemConduit.getBlockCoord())) {
|
||||
if(ni.con.getLocation().equals(itemConduit.getLocation())) {
|
||||
remove = ni;
|
||||
break;
|
||||
}
|
||||
@@ -119,13 +119,13 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
|
||||
try {
|
||||
doingSend = true;
|
||||
BlockCoord loc = itemConduit.getBlockCoord().getLocation(side);
|
||||
BlockCoord loc = itemConduit.getLocation().getLocation(side);
|
||||
|
||||
ItemStack result = item.copy();
|
||||
List<NetworkedInventory> invs = getOrCreate(loc);
|
||||
for (NetworkedInventory inv : invs) {
|
||||
|
||||
if(inv.con.getBlockCoord().equals(itemConduit.getBlockCoord())) {
|
||||
if(inv.con.getLocation().equals(itemConduit.getLocation())) {
|
||||
int numInserted = inv.insertIntoTargets(item.copy());
|
||||
if(numInserted >= item.stackSize) {
|
||||
return null;
|
||||
@@ -145,7 +145,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
|
||||
List<NetworkedInventory> invs = getOrCreate(extractFrom);
|
||||
for (NetworkedInventory source : invs) {
|
||||
|
||||
if(source.con.getBlockCoord().equals(con.getBlockCoord())) {
|
||||
if(source.con.getLocation().equals(con.getLocation())) {
|
||||
if(source != null && source.sendPriority != null) {
|
||||
for (Target t : source.sendPriority) {
|
||||
IItemFilter f = t.inv.con.getOutputFilter(t.inv.conDir);
|
||||
|
||||
@@ -293,7 +293,7 @@ public class NetworkedInventory {
|
||||
if(!result.isEmpty()) {
|
||||
Map<BlockCoord, Integer> visited = new HashMap<BlockCoord, Integer>();
|
||||
List<BlockCoord> steps = new ArrayList<BlockCoord>();
|
||||
steps.add(con.getBlockCoord());
|
||||
steps.add(con.getLocation());
|
||||
calculateDistances(result, visited, steps, 0);
|
||||
|
||||
sendPriority.addAll(result);
|
||||
@@ -339,15 +339,15 @@ public class NetworkedInventory {
|
||||
}
|
||||
|
||||
private Target getTarget(List<Target> targets, IItemConduit con, ForgeDirection dir) {
|
||||
if(targets == null || con == null || con.getBlockCoord() == null) {
|
||||
if(targets == null || con == null || con.getLocation() == null) {
|
||||
return null;
|
||||
}
|
||||
for (Target target : targets) {
|
||||
BlockCoord targetConLoc = null;
|
||||
if(target != null && target.inv != null && target.inv.con != null) {
|
||||
targetConLoc = target.inv.con.getBlockCoord();
|
||||
targetConLoc = target.inv.con.getLocation();
|
||||
}
|
||||
if(targetConLoc != null && target.inv.conDir == dir && targetConLoc.equals(con.getBlockCoord())) {
|
||||
if(targetConLoc != null && target.inv.conDir == dir && targetConLoc.equals(con.getLocation())) {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
@@ -355,7 +355,7 @@ public class NetworkedInventory {
|
||||
}
|
||||
|
||||
private int distanceTo(NetworkedInventory other) {
|
||||
return con.getBlockCoord().distanceSquared(other.con.getBlockCoord());
|
||||
return con.getLocation().distanceSquared(other.con.getLocation());
|
||||
}
|
||||
|
||||
public ISidedInventory getInventory() {
|
||||
|
||||
@@ -30,7 +30,7 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
|
||||
protected boolean redstoneStateDirty = true;
|
||||
|
||||
public IFluidHandler getExternalHandler(ForgeDirection direction) {
|
||||
IFluidHandler con = FluidUtil.getExternalFluidHandler(getBundle().getWorld(), getBlockCoord().getLocation(direction));
|
||||
IFluidHandler con = FluidUtil.getExternalFluidHandler(getBundle().getWorld(), getLocation().getLocation(direction));
|
||||
return (con != null && !(con instanceof IConduitBundle)) ? con : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class AbstractTankConduit extends AbstractLiquidConduit {
|
||||
return true;
|
||||
}
|
||||
|
||||
BlockCoord loc = getBlockCoord().getLocation(faceHit);
|
||||
BlockCoord loc = getLocation().getLocation(faceHit);
|
||||
ILiquidConduit n = ConduitUtil.getConduit(getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, ILiquidConduit.class);
|
||||
if(n == null) {
|
||||
return false;
|
||||
|
||||
@@ -84,7 +84,7 @@ public class AdvancedLiquidConduit extends AbstractTankConduit {
|
||||
}
|
||||
|
||||
private void doExtract() {
|
||||
BlockCoord loc = getBlockCoord();
|
||||
BlockCoord loc = getLocation();
|
||||
if(!hasConnectionMode(ConnectionMode.INPUT)) {
|
||||
return;
|
||||
}
|
||||
@@ -175,7 +175,7 @@ public class AdvancedLiquidConduit extends AbstractTankConduit {
|
||||
if(network == null) {
|
||||
return;
|
||||
}
|
||||
LiquidOutput lo = new LiquidOutput(getBlockCoord().getLocation(dir), dir.getOpposite());
|
||||
LiquidOutput lo = new LiquidOutput(getLocation().getLocation(dir), dir.getOpposite());
|
||||
network.removeInput(lo);
|
||||
if(getConnectionMode(dir).acceptsOutput() && containsExternalConnection(dir)) {
|
||||
network.addInput(lo);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class AdvancedLiquidConduitNetwork extends AbstractTankConduitNetwork<Adv
|
||||
}
|
||||
for (ForgeDirection dir : con.getExternalConnections()) {
|
||||
if(con.getConnectionMode(dir).acceptsOutput()) {
|
||||
outputs.add(new LiquidOutput(con.getBlockCoord().getLocation(dir), dir.getOpposite()));
|
||||
outputs.add(new LiquidOutput(con.getLocation().getLocation(dir), dir.getOpposite()));
|
||||
}
|
||||
}
|
||||
outputIterator = null;
|
||||
@@ -102,7 +102,7 @@ public class AdvancedLiquidConduitNetwork extends AbstractTankConduitNetwork<Adv
|
||||
leftOvers--;
|
||||
}
|
||||
con.getTank().setLiquid(f);
|
||||
BlockCoord bc = con.getBlockCoord();
|
||||
BlockCoord bc = con.getLocation();
|
||||
con.getBundle().getEntity().getWorldObj().markTileEntityChunkModified(bc.x, bc.y, bc.z, con.getBundle().getEntity());
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public class AdvancedLiquidConduitNetwork extends AbstractTankConduitNetwork<Adv
|
||||
}
|
||||
|
||||
public IFluidHandler getTankContainer(AdvancedLiquidConduit con, ForgeDirection dir) {
|
||||
BlockCoord bc = con.getBlockCoord().getLocation(dir);
|
||||
BlockCoord bc = con.getLocation().getLocation(dir);
|
||||
return getTankContainer(bc);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public class EnderLiquidConduit extends AbstractLiquidConduit {
|
||||
return true;
|
||||
}
|
||||
|
||||
BlockCoord loc = getBlockCoord().getLocation(faceHit);
|
||||
BlockCoord loc = getLocation().getLocation(faceHit);
|
||||
ILiquidConduit n = ConduitUtil.getConduit(getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, ILiquidConduit.class);
|
||||
if(n == null) {
|
||||
return false;
|
||||
@@ -217,7 +217,7 @@ public class EnderLiquidConduit extends AbstractLiquidConduit {
|
||||
}
|
||||
|
||||
private void doExtract() {
|
||||
BlockCoord loc = getBlockCoord();
|
||||
BlockCoord loc = getLocation();
|
||||
if(!hasConnectionMode(ConnectionMode.INPUT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
BlockCoord conduitLoc;
|
||||
|
||||
public NetworkTankKey(EnderLiquidConduit con, ForgeDirection conDir) {
|
||||
this(con.getBlockCoord(), conDir);
|
||||
this(con.getLocation(), conDir);
|
||||
}
|
||||
|
||||
public NetworkTankKey(BlockCoord conduitLoc, ForgeDirection conDir) {
|
||||
@@ -196,7 +196,7 @@ public class EnderLiquidConduitNetwork extends AbstractConduitNetwork<ILiquidCon
|
||||
public NetworkTank(EnderLiquidConduit con, ForgeDirection conDir) {
|
||||
this.con = con;
|
||||
this.conDir = conDir;
|
||||
conduitLoc = con.getBlockCoord();
|
||||
conduitLoc = con.getLocation();
|
||||
tankDir = conDir.getOpposite();
|
||||
externalTank = FluidUtil.getExternalFluidHandler(con.getBundle().getWorld(), conduitLoc.getLocation(conDir));
|
||||
acceptsOuput = con.getConnectionMode(conDir).acceptsOutput();
|
||||
|
||||
@@ -110,7 +110,7 @@ public class LiquidConduit extends AbstractTankConduit {
|
||||
|
||||
//need to send a custom packet as we don't want want to trigger a full chunk update, just
|
||||
//need to get the required values to the entity renderer
|
||||
BlockCoord loc = getBlockCoord();
|
||||
BlockCoord loc = getLocation();
|
||||
PacketHandler.INSTANCE.sendToAllAround(new PacketFluidLevel(this), new TargetPoint(world.provider.dimensionId, loc.x, loc.y, loc.z, 64));
|
||||
lastSyncRatio = tank.getFilledRatio();
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public class LiquidConduit extends AbstractTankConduit {
|
||||
|
||||
private void doExtract() {
|
||||
|
||||
BlockCoord loc = getBlockCoord();
|
||||
BlockCoord loc = getLocation();
|
||||
if(!hasConnectionMode(ConnectionMode.INPUT)) {
|
||||
return;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public class LiquidConduit extends AbstractTankConduit {
|
||||
for (ForgeDirection dir : externalConnections) {
|
||||
if(autoExtractForDir(dir)) {
|
||||
|
||||
IFluidHandler extTank = getTankContainer(getBlockCoord().getLocation(dir));
|
||||
IFluidHandler extTank = getTankContainer(getLocation().getLocation(dir));
|
||||
if(extTank != null) {
|
||||
|
||||
boolean foundFluid = false;
|
||||
@@ -193,13 +193,13 @@ public class LiquidConduit extends AbstractTankConduit {
|
||||
// Note: This is just a guard against mekansims pipes that will continuously
|
||||
// call
|
||||
// fill on us if we push liquid to them.
|
||||
if(filledFromThisTick.contains(getBlockCoord().getLocation(from))) {
|
||||
if(filledFromThisTick.contains(getLocation().getLocation(from))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(network.lockNetworkForFill()) {
|
||||
if(doFill) {
|
||||
filledFromThisTick.add(getBlockCoord().getLocation(from));
|
||||
filledFromThisTick.add(getLocation().getLocation(from));
|
||||
}
|
||||
try {
|
||||
int res = fill(from, resource, doFill, true, network == null ? -1 : network.getNextPushToken());
|
||||
@@ -287,7 +287,7 @@ public class LiquidConduit extends AbstractTankConduit {
|
||||
pushed += toCon;
|
||||
}
|
||||
} else if(getExternalConnections().contains(dir)) {
|
||||
IFluidHandler con = getTankContainer(getBlockCoord().getLocation(dir));
|
||||
IFluidHandler con = getTankContainer(getLocation().getLocation(dir));
|
||||
if(con != null) {
|
||||
int toExt = con.fill(dir.getOpposite(), toPush, doPush);
|
||||
toPush.amount -= toExt;
|
||||
|
||||
@@ -159,7 +159,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
if(con.canOutputToDir(dir)) {
|
||||
IFluidHandler externalTank = con.getExternalHandler(dir);
|
||||
if(externalTank != null) {
|
||||
externals.add(new LocatedFluidHandler(externalTank, con.getBlockCoord().getLocation(dir), dir.getOpposite()));
|
||||
externals.add(new LocatedFluidHandler(externalTank, con.getLocation().getLocation(dir), dir.getOpposite()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
}
|
||||
|
||||
private void drainConduitToNearestExternal(LiquidConduit con, List<LocatedFluidHandler> externals) {
|
||||
BlockCoord conLoc = con.getBlockCoord();
|
||||
BlockCoord conLoc = con.getLocation();
|
||||
FluidStack toDrain = con.getTank().getFluid();
|
||||
if(toDrain == null) {
|
||||
return;
|
||||
@@ -230,7 +230,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
|
||||
// First flow all we can down, then balance the rest
|
||||
if(con.getConduitConnections().contains(ForgeDirection.DOWN)) {
|
||||
BlockCoord loc = con.getBlockCoord().getLocation(ForgeDirection.DOWN);
|
||||
BlockCoord loc = con.getLocation().getLocation(ForgeDirection.DOWN);
|
||||
ILiquidConduit dc = ConduitUtil.getConduit(con.getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, ILiquidConduit.class);
|
||||
if(dc instanceof LiquidConduit) {
|
||||
LiquidConduit downCon = (LiquidConduit) dc;
|
||||
@@ -290,7 +290,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
}
|
||||
int totalCapacity = tank.getCapacity();
|
||||
|
||||
BlockCoord loc = con.getBlockCoord();
|
||||
BlockCoord loc = con.getLocation();
|
||||
Collection<ILiquidConduit> connections =
|
||||
ConduitUtil.getConnectedConduits(con.getBundle().getEntity().getWorldObj(),
|
||||
loc.x, loc.y, loc.z, ILiquidConduit.class);
|
||||
@@ -331,7 +331,7 @@ public class LiquidConduitNetwork extends AbstractTankConduitNetwork<LiquidCondu
|
||||
if(neighbour.getNetwork() != this) {
|
||||
return false;
|
||||
}
|
||||
if(neighbour.getBlockCoord().y > con.getBlockCoord().y) {
|
||||
if(neighbour.getLocation().y > con.getLocation().y) {
|
||||
return false;
|
||||
}
|
||||
float nr = neighbour.getTank().getFilledRatio();
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package crazypants.enderio.conduit.me;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.AbstractItemConduit;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.ItemConduitSubtype;
|
||||
|
||||
public class ItemMEConduit extends AbstractItemConduit {
|
||||
|
||||
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
new ItemConduitSubtype(ModObject.itemMEConduit.name(), "enderio:itemMEConduit"),
|
||||
};
|
||||
|
||||
public static ItemMEConduit create() {
|
||||
ItemMEConduit result = new ItemMEConduit();
|
||||
result.init(subtypes);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected ItemMEConduit() {
|
||||
super(ModObject.itemMEConduit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IConduit> getBaseConduitType() {
|
||||
return IMEConduit.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConduit createConduit(ItemStack item) {
|
||||
return new MEConduit();
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
|
||||
@Override
|
||||
public boolean canConnectToExternal(ForgeDirection direction, boolean ignoreConnectionMode) {
|
||||
return canConnectTo(getBundle().getWorld(), direction, getBundle().getBlockCoord());
|
||||
return canConnectTo(getBundle().getWorld(), direction, getBundle().getLocation());
|
||||
}
|
||||
|
||||
@Method(modid = "appliedenergistics2")
|
||||
@@ -200,7 +200,7 @@ public class MEConduit extends AbstractConduit implements IMEConduit {
|
||||
boolean foundConnection = false;
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileEntity te = getBundle().getBlockCoord().getLocation(dir).getTileEntity(getBundle().getWorld());
|
||||
TileEntity te = getBundle().getLocation().getLocation(dir).getTileEntity(getBundle().getWorld());
|
||||
if (te != null && te instanceof IGridHost) {
|
||||
IGridNode node = ((IGridHost)te).getGridNode(ForgeDirection.UNKNOWN);
|
||||
foundConnection |= validConnections.contains(dir);
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MEConduitGrid implements IGridBlock {
|
||||
|
||||
@Override
|
||||
public void onGridNotification(GridNotification notification) {
|
||||
gridChanged();
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,9 +73,6 @@ public class MEConduitGrid implements IGridBlock {
|
||||
|
||||
@Override
|
||||
public void gridChanged() {
|
||||
IGridNode node = conduit.getBundle().getGridNode(null);
|
||||
if(node != null) {
|
||||
node.updateState();
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package crazypants.enderio.conduit.me;
|
||||
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
|
||||
public class MEConduitNetwork extends AbstractConduitNetwork<IMEConduit, IMEConduit> {
|
||||
|
||||
public MEConduitNetwork() {
|
||||
super(IMEConduit.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IMEConduit> getBaseConduitType() {
|
||||
return IMEConduit.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConduit(IMEConduit con) {
|
||||
// TODO Auto-generated method stub
|
||||
super.addConduit(con);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package crazypants.enderio.conduit.me;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
|
||||
public class MEConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof IMEConduit;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean renderComponent(CollidableComponent component) {
|
||||
// TODO Auto-generated method stub
|
||||
return super.renderComponent(component);
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
|
||||
} else if(connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {
|
||||
|
||||
BlockCoord loc = getBlockCoord().getLocation(faceHit);
|
||||
BlockCoord loc = getLocation().getLocation(faceHit);
|
||||
Block id = world.getBlock(loc.x, loc.y, loc.z);
|
||||
if(id == EnderIO.blockConduitBundle) {
|
||||
IRedstoneConduit neighbour = ConduitUtil.getConduit(world, loc.x, loc.y, loc.z, IRedstoneConduit.class);
|
||||
@@ -126,7 +126,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
return true;
|
||||
|
||||
} else if(containsConduitConnection(connDir)) {
|
||||
BlockCoord loc = getBlockCoord().getLocation(connDir);
|
||||
BlockCoord loc = getLocation().getLocation(connDir);
|
||||
IRedstoneConduit neighbour = ConduitUtil.getConduit(getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, IRedstoneConduit.class);
|
||||
if(neighbour != null) {
|
||||
if(network != null) {
|
||||
@@ -256,7 +256,7 @@ public class InsulatedRedstoneConduit extends RedstoneConduit implements IInsula
|
||||
return true;
|
||||
}
|
||||
//Not set so figure it out
|
||||
BlockCoord loc = getBlockCoord().getLocation(direction);
|
||||
BlockCoord loc = getLocation().getLocation(direction);
|
||||
Block block = getBundle().getEntity().getWorldObj().getBlock(loc.x, loc.y, loc.z);
|
||||
|
||||
if(VANILLA_CONECTABLES.contains(block)) {
|
||||
|
||||
@@ -101,7 +101,7 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
|
||||
}
|
||||
|
||||
protected boolean acceptSignalsForDir(ForgeDirection dir) {
|
||||
BlockCoord loc = getBlockCoord().getLocation(dir);
|
||||
BlockCoord loc = getLocation().getLocation(dir);
|
||||
return ConduitUtil.getConduit(getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, IRedstoneConduit.class) == null;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
|
||||
int input = getExternalPowerLevel(dir);
|
||||
if(input > 1) { // need to degrade external signals by one as they
|
||||
// enter
|
||||
BlockCoord loc = getBlockCoord().getLocation(dir);
|
||||
BlockCoord loc = getLocation().getLocation(dir);
|
||||
Signal signal = new Signal(loc.x, loc.y, loc.z, dir, input - 1, getSignalColor(dir));
|
||||
res.add(signal);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
|
||||
// RedNet API, without requiring a piece of RedNet cable in-between.
|
||||
int[] bundledInput = getExternalBundledPowerLevel(dir);
|
||||
if(bundledInput != null) {
|
||||
BlockCoord loc = getBlockCoord().getLocation(dir);
|
||||
BlockCoord loc = getLocation().getLocation(dir);
|
||||
for (int subnet = 0; subnet < bundledInput.length; ++subnet) {
|
||||
if(bundledInput[subnet] > 1) { // force signal strength reduction to avoid cycles
|
||||
int color = convertColorForRedNet(subnet);
|
||||
@@ -196,7 +196,7 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
|
||||
//returns 16 for string power inputs
|
||||
protected int getExternalPowerLevel(ForgeDirection dir) {
|
||||
World world = getBundle().getEntity().getWorldObj();
|
||||
BlockCoord loc = getBlockCoord();
|
||||
BlockCoord loc = getLocation();
|
||||
loc = loc.getLocation(dir);
|
||||
|
||||
int strong = world.isBlockProvidingPowerTo(loc.x, loc.y, loc.z, dir.ordinal());
|
||||
@@ -214,7 +214,7 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
|
||||
|
||||
protected int[] getExternalBundledPowerLevel(ForgeDirection dir) {
|
||||
World world = getBundle().getEntity().getWorldObj();
|
||||
BlockCoord loc = getBlockCoord();
|
||||
BlockCoord loc = getLocation();
|
||||
loc = loc.getLocation(dir);
|
||||
|
||||
Block block = world.getBlock(loc.x, loc.y, loc.z);
|
||||
@@ -266,7 +266,7 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
|
||||
|
||||
Set<Signal> outs = network != null ? network.getSignals() : null;
|
||||
if(outs != null) {
|
||||
BlockCoord loc = getBlockCoord().getLocation(side);
|
||||
BlockCoord loc = getLocation().getLocation(side);
|
||||
for (Signal s : outs) {
|
||||
// Avoid "feedback loops", i.e. don't report an output on a side where
|
||||
// we have an input (otherwise a RedNet cable connected to a conduit
|
||||
@@ -289,7 +289,7 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
|
||||
public int getOutputValue(World world, int x, int y, int z, ForgeDirection side, int subnet) {
|
||||
Set<Signal> outs = network != null ? network.getSignals() : null;
|
||||
if(outs != null) {
|
||||
BlockCoord loc = getBlockCoord().getLocation(side);
|
||||
BlockCoord loc = getLocation().getLocation(side);
|
||||
int color = convertColorForRedNet(subnet);
|
||||
for (Signal s : outs) {
|
||||
// Avoid "feedback loops", see comment in getOutputValues.
|
||||
@@ -312,7 +312,7 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
|
||||
// with zero signal strength no signals are stored.
|
||||
Set<Signal> inputs = getNetworkInputs(side);
|
||||
externalSignals.get(side.ordinal()).clear();
|
||||
BlockCoord loc = getBlockCoord().getLocation(side);
|
||||
BlockCoord loc = getLocation().getLocation(side);
|
||||
for (int subnet = 0; subnet < inputValues.length; ++subnet) {
|
||||
int color = convertColorForRedNet(subnet);
|
||||
int newInput = inputValues[subnet];
|
||||
|
||||
@@ -129,7 +129,7 @@ public class RedstoneSwitch extends RedstoneConduit {
|
||||
public Set<Signal> getNetworkInputs() {
|
||||
Set<Signal> res = super.getNetworkInputs();
|
||||
if(isOn) {
|
||||
BlockCoord loc = getBlockCoord();
|
||||
BlockCoord loc = getLocation();
|
||||
Signal signal = new Signal(loc.x, loc.y, loc.z, ForgeDirection.UNKNOWN, 15, DyeColor.RED);
|
||||
res.add(signal);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
ConduitRenderer renderer = EnderIO.proxy.getRendererForConduit(con);
|
||||
if(renderer.isDynamic()) {
|
||||
if(brightness == -1) {
|
||||
BlockCoord loc = bundle.getBlockCoord();
|
||||
BlockCoord loc = bundle.getLocation();
|
||||
brightness = bundle.getEntity().getWorldObj().getLightBrightnessForSkyBlocks(loc.x, loc.y, loc.z, 0);
|
||||
|
||||
RenderUtil.bindBlockTexture();
|
||||
@@ -106,7 +106,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
boolean renderConduit = renderFacade(x, y, z, rb, bundle, player);
|
||||
|
||||
if(renderConduit) {
|
||||
BlockCoord loc = bundle.getBlockCoord();
|
||||
BlockCoord loc = bundle.getLocation();
|
||||
float brightness;
|
||||
if(!Config.updateLightingWhenHidingFacades && bundle.hasFacade() && ConduitUtil.isFacadeHidden(bundle, player)) {
|
||||
brightness = 15 << 20 | 15 << 4;
|
||||
|
||||
@@ -209,11 +209,11 @@ public final class Config {
|
||||
|
||||
public static float darkSteelAnvilDamageChance = 0.024f;
|
||||
|
||||
public static int hootchPowerPerCycle = 6;
|
||||
public static int hootchPowerPerCycleRF = 60;
|
||||
public static int hootchPowerTotalBurnTime = 6000;
|
||||
public static int rocketFuelPowerPerCycle = 16;
|
||||
public static int rocketFuelPowerPerCycleRF = 160;
|
||||
public static int rocketFuelPowerTotalBurnTime = 7000;
|
||||
public static int fireWaterPowerPerCycle = 8;
|
||||
public static int fireWaterPowerPerCycleRF = 80;
|
||||
public static int fireWaterPowerTotalBurnTime = 15000;
|
||||
public static int vatPowerUserPerTickRF = 20;
|
||||
|
||||
@@ -261,6 +261,9 @@ public final class Config {
|
||||
public static int poweredSpawnerMaxPlayerDistance = 0;
|
||||
public static boolean poweredSpawnerUseVanillaSpawChecks = false;
|
||||
public static double brokenSpawnerDropChance = 1;
|
||||
public static String[] brokenSpawnerToolBlacklist = new String[] {
|
||||
"RotaryCraft:rotarycraft_item_bedpick"
|
||||
};
|
||||
public static int powerSpawnerAddSpawnerCost = 30;
|
||||
|
||||
public static int painterEnergyPerTaskRF = 2000;
|
||||
@@ -757,18 +760,18 @@ public final class Config {
|
||||
|
||||
darkSteelAnvilDamageChance = (float) config.get(sectionDarkSteel.name, "darkSteelAnvilDamageChance", darkSteelAnvilDamageChance, "Chance that the dark steel anvil will take damage after repairing something.").getDouble();
|
||||
|
||||
hootchPowerPerCycle = config.get(sectionPower.name, "hootchPowerPerCycle", hootchPowerPerCycle,
|
||||
"The amount of power generated per BC engine cycle. Examples: BC Oil = 3, BC Fuel = 6").getInt(hootchPowerPerCycle);
|
||||
hootchPowerPerCycleRF = config.get(sectionPower.name, "hootchPowerPerCycleRF", hootchPowerPerCycleRF,
|
||||
"The amount of power generated per BC engine cycle. Examples: BC Oil = 30, BC Fuel = 60").getInt(hootchPowerPerCycleRF);
|
||||
hootchPowerTotalBurnTime = config.get(sectionPower.name, "hootchPowerTotalBurnTime", hootchPowerTotalBurnTime,
|
||||
"The total burn time. Examples: BC Oil = 5000, BC Fuel = 25000").getInt(hootchPowerTotalBurnTime);
|
||||
|
||||
rocketFuelPowerPerCycle = config.get(sectionPower.name, "rocketFuelPowerPerCycle", rocketFuelPowerPerCycle,
|
||||
"The amount of power generated per BC engine cycle. Examples: BC Oil = 3, BC Fuel = 6").getInt(rocketFuelPowerPerCycle);
|
||||
rocketFuelPowerPerCycleRF = config.get(sectionPower.name, "rocketFuelPowerPerCycleRF", rocketFuelPowerPerCycleRF,
|
||||
"The amount of power generated per BC engine cycle. Examples: BC Oil = 3, BC Fuel = 6").getInt(rocketFuelPowerPerCycleRF);
|
||||
rocketFuelPowerTotalBurnTime = config.get(sectionPower.name, "rocketFuelPowerTotalBurnTime", rocketFuelPowerTotalBurnTime,
|
||||
"The total burn time. Examples: BC Oil = 5000, BC Fuel = 25000").getInt(rocketFuelPowerTotalBurnTime);
|
||||
|
||||
fireWaterPowerPerCycle = config.get(sectionPower.name, "fireWaterPowerPerCycle", fireWaterPowerPerCycle,
|
||||
"The amount of power generated per BC engine cycle. Examples: BC Oil = 3, BC Fuel = 6").getInt(fireWaterPowerPerCycle);
|
||||
fireWaterPowerPerCycleRF = config.get(sectionPower.name, "fireWaterPowerPerCycleRF", fireWaterPowerPerCycleRF,
|
||||
"The amount of power generated per BC engine cycle. Examples: BC Oil = 30, BC Fuel = 60").getInt(fireWaterPowerPerCycleRF);
|
||||
fireWaterPowerTotalBurnTime = config.get(sectionPower.name, "fireWaterPowerTotalBurnTime", fireWaterPowerTotalBurnTime,
|
||||
"The total burn time. Examples: BC Oil = 5000, BC Fuel = 25000").getInt(fireWaterPowerTotalBurnTime);
|
||||
|
||||
@@ -842,7 +845,10 @@ public final class Config {
|
||||
poweredSpawnerUseVanillaSpawChecks = config.get(sectionSpawner.name, "poweredSpawnerUseVanillaSpawChecks", poweredSpawnerUseVanillaSpawChecks,
|
||||
"If true, regular spawn checks such as lighting level and dimension will be made before spawning mobs").getBoolean(poweredSpawnerUseVanillaSpawChecks);
|
||||
brokenSpawnerDropChance = (float) config.get(sectionSpawner.name, "brokenSpawnerDropChance", brokenSpawnerDropChance,
|
||||
"The chance a broken spawner will be dropped when a spawner is broken. 1 = 100% chance, 0 = 0% chance").getDouble(brokenSpawnerDropChance);
|
||||
"The chance a broken spawner will be dropped when a spawner is broken. 1 = 100% chance, 0 = 0% chance").getDouble(brokenSpawnerDropChance);
|
||||
brokenSpawnerToolBlacklist = config.getStringList("brokenSpawnerToolBlacklist", sectionSpawner.name, brokenSpawnerToolBlacklist,
|
||||
"When a spawner is broken with these tools they will not drop a broken spawner");
|
||||
|
||||
powerSpawnerAddSpawnerCost = config.get(sectionSpawner.name, "powerSpawnerAddSpawnerCost", powerSpawnerAddSpawnerCost,
|
||||
"The number of levels it costs to add a broken spawner").getInt(powerSpawnerAddSpawnerCost);
|
||||
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
package crazypants.enderio.fluid;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import buildcraft.api.fuels.BuildcraftFuelRegistry;
|
||||
import buildcraft.api.fuels.ICoolant;
|
||||
import buildcraft.api.fuels.IFuel;
|
||||
|
||||
|
||||
public class FluidFuelRegister {
|
||||
|
||||
public static final FluidFuelRegister instance = new FluidFuelRegister();
|
||||
|
||||
private final Map<String, IFluidCoolant> coolants = new HashMap<String, IFluidCoolant>();
|
||||
private final Map<String, IFluidFuel> fuels = new HashMap<String, IFluidFuel>();
|
||||
|
||||
private FluidFuelRegister() {
|
||||
addCoolant(FluidRegistry.WATER, 0.0023f);
|
||||
}
|
||||
|
||||
private void addCoolant(Fluid fluid, float degreesCoolingPerMB) {
|
||||
if(fluid == null || coolants.get(fluid.getName()) != null) {
|
||||
return;
|
||||
}
|
||||
coolants.put(fluid.getName(), new Coolant(fluid, degreesCoolingPerMB));
|
||||
if(BuildcraftFuelRegistry.coolant != null && BuildcraftFuelRegistry.coolant.getCoolant(fluid) == null) {
|
||||
BuildcraftFuelRegistry.coolant.addCoolant(fluid, degreesCoolingPerMB);
|
||||
}
|
||||
}
|
||||
|
||||
public IFluidCoolant getCoolant(Fluid fluid) {
|
||||
if(fluid == null) {
|
||||
return null;
|
||||
}
|
||||
IFluidCoolant res = coolants.get(fluid.getName());
|
||||
if(res == null && !coolants.containsKey(fluid.getName()) && BuildcraftFuelRegistry.coolant != null) {
|
||||
ICoolant bcCool = BuildcraftFuelRegistry.coolant.getCoolant(fluid);
|
||||
if(bcCool != null) {
|
||||
res = new CoolantBC(bcCool);
|
||||
}
|
||||
coolants.put(fluid.getName(), res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public IFluidCoolant getCoolant(FluidStack fluid) {
|
||||
if(fluid == null || fluid.getFluid() == null) {
|
||||
return null;
|
||||
}
|
||||
return getCoolant(fluid.getFluid());
|
||||
}
|
||||
|
||||
|
||||
public void addFuel(Fluid fluid, int powerPerCycleRF, int totalBurnTime) {
|
||||
if(fluid == null || fuels.get(fluid.getName()) != null) {
|
||||
return;
|
||||
}
|
||||
fuels.put(fluid.getName(), new Fuel(fluid, powerPerCycleRF, totalBurnTime));
|
||||
if(BuildcraftFuelRegistry.fuel != null && BuildcraftFuelRegistry.fuel.getFuel(fluid) == null) {
|
||||
BuildcraftFuelRegistry.fuel.addFuel(fluid, powerPerCycleRF, totalBurnTime);
|
||||
}
|
||||
}
|
||||
|
||||
public IFluidFuel getFuel(Fluid fluid) {
|
||||
if(fluid == null) {
|
||||
return null;
|
||||
}
|
||||
IFluidFuel res = fuels.get(fluid.getName());
|
||||
if(res == null && !fuels.containsKey(fluid.getName()) && BuildcraftFuelRegistry.fuel != null) {
|
||||
IFuel bcFuel = BuildcraftFuelRegistry.fuel.getFuel(fluid);
|
||||
if(bcFuel != null) {
|
||||
res = new FuelBC(bcFuel);
|
||||
}
|
||||
fuels.put(fluid.getName(), res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public IFluidFuel getFuel(FluidStack fluid) {
|
||||
if(fluid == null || fluid.getFluid() == null) {
|
||||
return null;
|
||||
}
|
||||
return getFuel(fluid.getFluid());
|
||||
}
|
||||
|
||||
private static class Fuel implements IFluidFuel {
|
||||
|
||||
private final Fluid fluid;
|
||||
private final int powerPerCycle;
|
||||
private final int totalBurningTime;
|
||||
|
||||
Fuel(Fluid fluid, int powerPerCycle, int totalBurningTime) {
|
||||
this.fluid = fluid;
|
||||
this.powerPerCycle = powerPerCycle;
|
||||
this.totalBurningTime = totalBurningTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fluid getFluid() {
|
||||
return fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalBurningTime() {
|
||||
return totalBurningTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPowerPerCycle() {
|
||||
return powerPerCycle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class FuelBC extends Fuel {
|
||||
|
||||
FuelBC(IFuel fuel) {
|
||||
super(fuel.getFluid(), fuel.getPowerPerCycle(), fuel.getTotalBurningTime());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class Coolant implements IFluidCoolant {
|
||||
|
||||
private final Fluid fluid;
|
||||
private final float degreesCoolingPerMB;
|
||||
|
||||
Coolant(Fluid fluid, float degreesCoolingPerMB) {
|
||||
this.fluid = fluid;
|
||||
this.degreesCoolingPerMB = degreesCoolingPerMB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fluid getFluid() {
|
||||
return fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDegreesCoolingPerMB(float heat) {
|
||||
return degreesCoolingPerMB;
|
||||
}
|
||||
}
|
||||
|
||||
private static class CoolantBC extends Coolant {
|
||||
|
||||
CoolantBC(ICoolant coolant) {
|
||||
//NB: in the current BC impl the temperature to getDegreesCoolingPerMB is ignored
|
||||
super(coolant.getFluid(), coolant.getDegreesCoolingPerMB(100));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package crazypants.enderio.fluid;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public interface IFluidCoolant {
|
||||
|
||||
Fluid getFluid();
|
||||
|
||||
float getDegreesCoolingPerMB(float heat);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package crazypants.enderio.fluid;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public interface IFluidFuel {
|
||||
|
||||
Fluid getFluid();
|
||||
|
||||
int getTotalBurningTime();
|
||||
|
||||
int getPowerPerCycle();
|
||||
}
|
||||
@@ -21,12 +21,13 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import buildcraft.api.fuels.IronEngineFuel;
|
||||
import buildcraft.api.fuels.IronEngineFuel.Fuel;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.fluid.FluidFuelRegister;
|
||||
import crazypants.enderio.fluid.IFluidCoolant;
|
||||
import crazypants.enderio.fluid.IFluidFuel;
|
||||
import crazypants.enderio.machine.crusher.CrusherRecipeManager;
|
||||
import crazypants.enderio.machine.crusher.IGrindingMultiplier;
|
||||
import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
@@ -35,7 +36,6 @@ import crazypants.util.Lang;
|
||||
|
||||
public class TooltipAddera {
|
||||
|
||||
|
||||
public static TooltipAddera instance = new TooltipAddera();
|
||||
|
||||
//TODO: Need to decouple this stuff with a callback
|
||||
@@ -56,28 +56,28 @@ public class TooltipAddera {
|
||||
evt.toolTip.add("Burn time " + time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(Config.addDurabilityTootip) {
|
||||
addDurabilityTooltip(evt.toolTip, evt.itemStack);
|
||||
}
|
||||
|
||||
if(evt.itemStack.getItem() instanceof IAdvancedTooltipProvider) {
|
||||
IAdvancedTooltipProvider ttp = (IAdvancedTooltipProvider)evt.itemStack.getItem();
|
||||
IAdvancedTooltipProvider ttp = (IAdvancedTooltipProvider) evt.itemStack.getItem();
|
||||
addInformation(ttp, evt.itemStack, evt.entityPlayer, evt.toolTip, false);
|
||||
return;
|
||||
} else if(evt.itemStack.getItem() instanceof IResourceTooltipProvider) {
|
||||
addInformation((IResourceTooltipProvider)evt.itemStack.getItem(), evt);
|
||||
addInformation((IResourceTooltipProvider) evt.itemStack.getItem(), evt);
|
||||
return;
|
||||
}
|
||||
|
||||
Block blk = Block.getBlockFromItem(evt.itemStack.getItem());
|
||||
if(blk instanceof IAdvancedTooltipProvider) {
|
||||
addInformation((IAdvancedTooltipProvider)blk, evt.itemStack, evt.entityPlayer, evt.toolTip, false);
|
||||
addInformation((IAdvancedTooltipProvider) blk, evt.itemStack, evt.entityPlayer, evt.toolTip, false);
|
||||
return;
|
||||
} else if(blk instanceof IResourceTooltipProvider) {
|
||||
addInformation((IResourceTooltipProvider)blk, evt);
|
||||
addInformation((IResourceTooltipProvider) blk, evt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(Config.addFuelTooltipsToAllFluidContainers) {
|
||||
addTooltipForFluid(evt.toolTip, evt.itemStack);
|
||||
@@ -95,10 +95,10 @@ public class TooltipAddera {
|
||||
return;
|
||||
}
|
||||
Item item = itemStack.getItem();
|
||||
if(item instanceof ItemTool || item instanceof ItemArmor ||
|
||||
if(item instanceof ItemTool || item instanceof ItemArmor ||
|
||||
item instanceof ItemSword || item instanceof ItemHoe || item instanceof ItemBow) {
|
||||
toolTip.add(ItemUtil.getDurabilityString(itemStack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addTooltipForFluid(List list, ItemStack stk) {
|
||||
@@ -111,29 +111,42 @@ public class TooltipAddera {
|
||||
|
||||
public static void addTooltipForFluid(List list, Fluid fluid) {
|
||||
if(fluid != null) {
|
||||
Fuel fuel = IronEngineFuel.getFuelForFluid(fluid);
|
||||
IFluidFuel fuel = FluidFuelRegister.instance.getFuel(fluid);
|
||||
if(fuel != null) {
|
||||
if(showAdvancedTooltips()) {
|
||||
list.add(Lang.localize("fuel.tooltip.heading"));
|
||||
list.add(EnumChatFormatting.ITALIC + " " + PowerDisplayUtil.formatPowerPerTick( (int)(fuel.powerPerCycle * 10) ));
|
||||
list.add(EnumChatFormatting.ITALIC + " " + fuel.totalBurningTime + " " + Lang.localize("fuel.tooltip.burnTime"));
|
||||
list.add(EnumChatFormatting.ITALIC + " " + PowerDisplayUtil.formatPowerPerTick(fuel.getPowerPerCycle()));
|
||||
list.add(EnumChatFormatting.ITALIC + " " + fuel.getTotalBurningTime() + " " + Lang.localize("fuel.tooltip.burnTime"));
|
||||
} else {
|
||||
addShowDetailsTooltip(list);
|
||||
}
|
||||
} else {
|
||||
IFluidCoolant coolant = FluidFuelRegister.instance.getCoolant(fluid);
|
||||
if(coolant != null) {
|
||||
if(showAdvancedTooltips()) {
|
||||
list.add(Lang.localize("coolant.tooltip.heading"));
|
||||
list.add(EnumChatFormatting.ITALIC + " "
|
||||
+ list.add(Lang.localize("fuel.tooltip.degreesPerBucket") + " "
|
||||
+ PowerDisplayUtil.formatPowerFloat(coolant.getDegreesCoolingPerMB(100) * 1000)));
|
||||
} else {
|
||||
addShowDetailsTooltip(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void addInformation(IResourceTooltipProvider item, ItemTooltipEvent evt) {
|
||||
addInformation(item, evt.itemStack, evt.entityPlayer, evt.toolTip);
|
||||
}
|
||||
|
||||
|
||||
public static void addInformation(IResourceTooltipProvider tt, ItemStack itemstack, EntityPlayer entityplayer, List list) {
|
||||
String name = tt.getUnlocalizedNameForTooltip(itemstack);
|
||||
if(showAdvancedTooltips()) {
|
||||
addCommonTooltipFromResources(list, name);
|
||||
addDetailedTooltipFromResources(list, name);
|
||||
} else {
|
||||
} else {
|
||||
addBasicTooltipFromResources(list, name);
|
||||
addCommonTooltipFromResources(list, name);
|
||||
addShowDetailsTooltip(list);
|
||||
@@ -174,7 +187,7 @@ public class TooltipAddera {
|
||||
String keyBase = unlocalizedName + tooltipTag;
|
||||
boolean done = false;
|
||||
int line = 1;
|
||||
while(!done) {
|
||||
while (!done) {
|
||||
String key = keyBase + line;
|
||||
String val = Lang.localize(key, false);
|
||||
if(val == null || val.trim().length() < 0 || val.equals(key) || line > 12) {
|
||||
@@ -186,15 +199,15 @@ public class TooltipAddera {
|
||||
}
|
||||
}
|
||||
|
||||
public static void addDetailedTooltipFromResources(List list,ItemStack itemstack) {
|
||||
public static void addDetailedTooltipFromResources(List list, ItemStack itemstack) {
|
||||
if(itemstack.getItem() == null) {
|
||||
return;
|
||||
}
|
||||
String unlock = null;
|
||||
// Block blk = Block.getBlockFromItem(itemstack.getItem());
|
||||
// if(blk != null && blk != Blocks.air) {
|
||||
// unlock = blk.getUnlocalizedName();
|
||||
// }
|
||||
// Block blk = Block.getBlockFromItem(itemstack.getItem());
|
||||
// if(blk != null && blk != Blocks.air) {
|
||||
// unlock = blk.getUnlocalizedName();
|
||||
// }
|
||||
if(unlock == null) {
|
||||
unlock = itemstack.getItem().getUnlocalizedName();
|
||||
}
|
||||
@@ -235,5 +248,4 @@ public class TooltipAddera {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class PacketConduitProbe implements IMessage, IMessageHandler<PacketCondu
|
||||
sb.append(input.getDisplayName());
|
||||
}
|
||||
sb.append(" ");
|
||||
List<String> targets = icn.getTargetsForExtraction(conduit.getBlockCoord().getLocation(dir), conduit, input);
|
||||
List<String> targets = icn.getTargetsForExtraction(conduit.getLocation().getLocation(dir), conduit, input);
|
||||
if(targets.isEmpty()) {
|
||||
sb.append(" ");
|
||||
sb.append(Lang.localize("gui.mjReader.noOutputs"));
|
||||
|
||||
@@ -116,6 +116,8 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
faceModes.put(faceHit, mode);
|
||||
forceClientUpdate = true;
|
||||
notifyNeighbours = true;
|
||||
|
||||
updateBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,6 +187,7 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
public void setRedstoneControlMode(RedstoneControlMode redstoneControlMode) {
|
||||
this.redstoneControlMode = redstoneControlMode;
|
||||
redstoneStateDirty = true;
|
||||
updateBlock();
|
||||
}
|
||||
|
||||
public short getFacing() {
|
||||
|
||||
@@ -53,7 +53,6 @@ public class PacketIoMode implements IMessage, IMessageHandler<PacketIoMode, IMe
|
||||
if(te instanceof IIoConfigurable) {
|
||||
IIoConfigurable me = (IIoConfigurable) te;
|
||||
me.setIoMode(message.face, message.mode);
|
||||
player.worldObj.markBlockForUpdate(message.x, message.y, message.z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ public class PacketRedstoneMode implements IMessage, IMessageHandler<PacketRedst
|
||||
if(te instanceof IRedstoneModeControlable) {
|
||||
IRedstoneModeControlable me = (IRedstoneModeControlable) te;
|
||||
me.setRedstoneControlMode(message.mode);
|
||||
player.worldObj.markBlockForUpdate(message.x, message.y, message.z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+37
-28
@@ -1,6 +1,5 @@
|
||||
package crazypants.enderio.machine.generator.combustion;
|
||||
|
||||
import scala.xml.persistent.SetStorage;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -11,11 +10,10 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import buildcraft.api.fuels.IronEngineCoolant;
|
||||
import buildcraft.api.fuels.IronEngineCoolant.Coolant;
|
||||
import buildcraft.api.fuels.IronEngineFuel;
|
||||
import buildcraft.api.fuels.IronEngineFuel.Fuel;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.fluid.IFluidCoolant;
|
||||
import crazypants.enderio.fluid.IFluidFuel;
|
||||
import crazypants.enderio.fluid.FluidFuelRegister;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
@@ -46,8 +44,8 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
|
||||
private static int IO_MB_TICK = 250;
|
||||
|
||||
private Fuel curFuel;
|
||||
private Coolant curCoolant;
|
||||
private IFluidFuel curFuel;
|
||||
private IFluidCoolant curCoolant;
|
||||
|
||||
public TileCombustionGenerator() {
|
||||
super(new SlotDefinition(-1, -1, -1, -1, -1, -1));
|
||||
@@ -115,11 +113,16 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
return 0;
|
||||
}
|
||||
int res = 0;
|
||||
if(IronEngineCoolant.isCoolant(resource.getFluid())) {
|
||||
|
||||
IFluidCoolant cool = FluidFuelRegister.instance.getCoolant(resource.getFluid());
|
||||
if(cool != null) {
|
||||
res = getCoolantTank().fill(resource, doFill);
|
||||
} else if(IronEngineFuel.getFuelForFluid(resource.getFluid()) != null) {
|
||||
res = getFuelTank().fill(resource, doFill);
|
||||
}
|
||||
} else {
|
||||
IFluidFuel f = FluidFuelRegister.instance.getFuel(resource.getFluid());
|
||||
if(f != null) {
|
||||
res = getFuelTank().fill(resource, doFill);
|
||||
}
|
||||
}
|
||||
if(res > 0) {
|
||||
tanksDirty = true;
|
||||
}
|
||||
@@ -227,7 +230,7 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
boolean res = false;
|
||||
ticksRemaingFuel--;
|
||||
if(ticksRemaingFuel <= 0) {
|
||||
curFuel = getFuelTank().getFluid() == null ? null : IronEngineFuel.getFuelForFluid(getFuelTank().getFluid().getFluid());
|
||||
curFuel = FluidFuelRegister.instance.getFuel(getFuelTank().getFluid());
|
||||
if(curFuel == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -240,7 +243,7 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
res = true;
|
||||
tanksDirty = true;
|
||||
} else if(curFuel == null) {
|
||||
curFuel = getFuelTank().getFluid() == null ? null : IronEngineFuel.getFuelForFluid(getFuelTank().getFluid().getFluid());
|
||||
curFuel = FluidFuelRegister.instance.getFuel(getFuelTank().getFluid());
|
||||
if(curFuel == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -248,7 +251,7 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
|
||||
ticksRemaingCoolant--;
|
||||
if(ticksRemaingCoolant <= 0) {
|
||||
curCoolant = IronEngineCoolant.getCoolant(getCoolantTank().getFluid());
|
||||
updateCoolantFromTank();
|
||||
if(curCoolant == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -259,7 +262,7 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
ticksRemaingCoolant = getNumTicksPerMbCoolant(curCoolant, curFuel) * drained.amount;
|
||||
res = true;
|
||||
} else if(curCoolant == null) {
|
||||
curCoolant = IronEngineCoolant.getCoolant(getCoolantTank().getFluid());
|
||||
updateCoolantFromTank();
|
||||
if(curCoolant == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -272,15 +275,19 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
return getFuelTank().getFluidAmount() > 0 && getCoolantTank().getFluidAmount() > 0;
|
||||
}
|
||||
|
||||
protected void updateCoolantFromTank() {
|
||||
curCoolant = FluidFuelRegister.instance.getCoolant(getCoolantTank().getFluid());
|
||||
}
|
||||
|
||||
private int getPowerPerCycle() {
|
||||
return curFuel == null ? 0 : (int)(curFuel.powerPerCycle * 10);
|
||||
return curFuel == null ? 0 : curFuel.getPowerPerCycle();
|
||||
}
|
||||
|
||||
public int getNumTicksPerMbFuel() {
|
||||
if(getFuelTank().getFluidAmount() <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return getNumTicksPerMbFuel(IronEngineFuel.getFuelForFluid(getFuelTank().getFluid().getFluid()));
|
||||
return getNumTicksPerMbFuel(FluidFuelRegister.instance.getFuel(getFuelTank().getFluid().getFluid()));
|
||||
}
|
||||
|
||||
public int getNumTicksPerMbCoolant() {
|
||||
@@ -288,36 +295,38 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
return 0;
|
||||
}
|
||||
if(worldObj.isRemote) {
|
||||
curFuel = IronEngineFuel.getFuelForFluid(getFuelTank().getFluid().getFluid());
|
||||
curCoolant = IronEngineCoolant.getCoolant(getCoolantTank().getFluid());
|
||||
curFuel = FluidFuelRegister.instance.getFuel(getFuelTank().getFluid());
|
||||
updateCoolantFromTank();
|
||||
}
|
||||
return getNumTicksPerMbCoolant(curCoolant, curFuel);
|
||||
}
|
||||
|
||||
static int getNumTicksPerMbFuel(Fuel fuel) {
|
||||
static int getNumTicksPerMbFuel(IFluidFuel fuel) {
|
||||
if(fuel == null) {
|
||||
return 0;
|
||||
}
|
||||
return fuel.totalBurningTime / 1000;
|
||||
return fuel.getTotalBurningTime() / 1000;
|
||||
}
|
||||
|
||||
static int getNumTicksPerMbCoolant(Coolant coolant, Fuel fuel) {
|
||||
public static float HEAT_PER_RF = 0.00023F;
|
||||
|
||||
static int getNumTicksPerMbCoolant(IFluidCoolant coolant, IFluidFuel fuel) {
|
||||
if(coolant == null || fuel == null) {
|
||||
return 0;
|
||||
}
|
||||
float power = fuel.powerPerCycle;
|
||||
float power = fuel.getPowerPerCycle();
|
||||
float cooling = coolant.getDegreesCoolingPerMB(100);
|
||||
double toCool = 1d / (0.027 * power);
|
||||
double toCool = 1d / (HEAT_PER_RF * power);
|
||||
int numTicks = (int) Math.round(toCool / (cooling * 1000));
|
||||
return numTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
if(isSideDisabled(from.ordinal())) {
|
||||
if(isSideDisabled(from.ordinal()) || fluid == null) {
|
||||
return false;
|
||||
}
|
||||
return IronEngineCoolant.isCoolant(fluid) || IronEngineFuel.getFuelForFluid(fluid) != null;
|
||||
return FluidFuelRegister.instance.getCoolant(fluid) != null || FluidFuelRegister.instance.getFuel(fluid) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -405,11 +414,11 @@ public class TileCombustionGenerator extends AbstractMachineEntity implements IF
|
||||
if(getFuelTank().getFluidAmount() <= 0) {
|
||||
return 0;
|
||||
}
|
||||
Fuel fuel = IronEngineFuel.getFuelForFluid(getFuelTank().getFluid().getFluid());
|
||||
IFluidFuel fuel = FluidFuelRegister.instance.getFuel(getFuelTank().getFluid());
|
||||
if(fuel == null) {
|
||||
return 0;
|
||||
}
|
||||
return (int)fuel.powerPerCycle;
|
||||
return fuel.getPowerPerCycle();
|
||||
}
|
||||
|
||||
public FluidTank getCoolantTank() {
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
|
||||
if(powerDis == null) {
|
||||
powerDis = new PowerDistributor(new BlockCoord(this));
|
||||
}
|
||||
int canTransmit = Math.min(getEnergyStored(), capacitorType.capacitor.getMaxEnergyExtracted());
|
||||
int canTransmit = Math.min(getEnergyStored(), getPowerUsePerTick() * 2);
|
||||
if(canTransmit <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -143,6 +143,7 @@ public class TileHyperCube extends TileEntityEio implements IInternalPowerRecept
|
||||
public void setRedstoneControlMode(RedstoneControlMode redstoneControlMode) {
|
||||
this.redstoneControlMode = redstoneControlMode;
|
||||
redstoneStateDirty = true;
|
||||
updateBlock();
|
||||
}
|
||||
|
||||
public IoMode getModeForChannel(SubChannel channel) {
|
||||
|
||||
@@ -176,7 +176,11 @@ public class BlockElectricLight extends BlockEio {
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
Item equipped = player.getCurrentEquippedItem().getItem();
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
Item equipped = stack.getItem();
|
||||
if ((equipped instanceof IToolWrench || equipped instanceof IToolHammer) && player.isSneaking() && !world.isRemote) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileElectricLight) {
|
||||
|
||||
@@ -100,8 +100,8 @@ public class GuiPowerMonitor extends GuiContainerBase {
|
||||
int x = MARGIN + Minecraft.getMinecraft().fontRenderer.getStringWidth(titleStr) + SPACING;
|
||||
|
||||
enabledB = new CheckBoxEIO(this, 21267, x, 8);
|
||||
enabledB.setSelectedToolTip(Lang.localize("enderio.gui.enabled"));
|
||||
enabledB.setUnselectedToolTip(Lang.localize("enderio.gui.disabled"));
|
||||
enabledB.setSelectedToolTip(Lang.localize("gui.enabled"));
|
||||
enabledB.setUnselectedToolTip(Lang.localize("gui.disabled"));
|
||||
enabledB.setSelected(te.engineControlEnabled);
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +69,6 @@ public class PacketClientState implements IMessage, IMessageHandler<PacketClient
|
||||
cb.setOutputControlMode(message.outputMode);
|
||||
cb.setMaxInput(message.maxInput);
|
||||
cb.setMaxOutput(message.maxOutput);
|
||||
player.worldObj.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -154,6 +154,8 @@ public class TileCapacitorBank extends TileEntityEio implements IInternalPowerRe
|
||||
notifyNeighbours = true;
|
||||
}
|
||||
render = true;
|
||||
|
||||
updateBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -425,7 +427,6 @@ public class TileCapacitorBank extends TileEntityEio implements IInternalPowerRe
|
||||
if(mode == IoMode.NONE && !(ph.getDelegate() instanceof IInternalPowerReceptor)) {
|
||||
setIoMode(dir, IoMode.PULL, false);
|
||||
r.mode = IoMode.PULL;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
render = true;
|
||||
}
|
||||
}
|
||||
@@ -448,6 +449,7 @@ public class TileCapacitorBank extends TileEntityEio implements IInternalPowerRe
|
||||
|
||||
public void setMaxInput(int maxInput) {
|
||||
getController().doSetMaxInput(maxInput);
|
||||
updateBlock();
|
||||
}
|
||||
|
||||
public int getMaxOutput() {
|
||||
@@ -456,6 +458,7 @@ public class TileCapacitorBank extends TileEntityEio implements IInternalPowerRe
|
||||
|
||||
public void setMaxOutput(int maxOutput) {
|
||||
getController().doSetMaxOutput(maxOutput);
|
||||
updateBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1128,5 +1131,4 @@ public class TileCapacitorBank extends TileEntityEio implements IInternalPowerRe
|
||||
public boolean isMaxSize() {
|
||||
return isMultiblock() && multiblock.length >= MAX_SIZE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -79,8 +79,6 @@ public class BlockSolarPanel extends BlockEio implements IResourceTooltipProvide
|
||||
if(wrench.canWrench(entityPlayer, x, y, z)) {
|
||||
if(!world.isRemote && !entityPlayer.capabilities.isCreativeMode) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
System.out.println("BlockSolarPanel.onBlockActivated: " + meta);
|
||||
System.out.println("BlockSolarPanel.onBlockActivated: " + meta);
|
||||
ItemStack is = new ItemStack(this,1,meta);
|
||||
Util.dropItems(world, is, x, y, z, true);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import net.minecraftforge.event.world.BlockEvent.BreakEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
@@ -33,7 +35,7 @@ import crazypants.util.Lang;
|
||||
import crazypants.util.Util;
|
||||
|
||||
public class BlockPoweredSpawner extends AbstractMachineBlock<TilePoweredSpawner> implements IAdvancedTooltipProvider {
|
||||
|
||||
|
||||
public static void writeMobTypeToNBT(NBTTagCompound nbt, String type) {
|
||||
if(nbt == null) {
|
||||
return;
|
||||
@@ -44,7 +46,7 @@ public class BlockPoweredSpawner extends AbstractMachineBlock<TilePoweredSpawner
|
||||
nbt.setString("mobType", type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String readMobTypeFromNBT(NBTTagCompound nbt) {
|
||||
if(nbt == null) {
|
||||
return null;
|
||||
@@ -54,31 +56,37 @@ public class BlockPoweredSpawner extends AbstractMachineBlock<TilePoweredSpawner
|
||||
}
|
||||
return nbt.getString("mobType");
|
||||
}
|
||||
|
||||
|
||||
public static String getSpawnerTypeFromItemStack(ItemStack stack) {
|
||||
if(stack == null || stack.getItem() != Item.getItemFromBlock(EnderIO.blockPoweredSpawner)) {
|
||||
return null;
|
||||
}
|
||||
return readMobTypeFromNBT(stack.stackTagCompound);
|
||||
}
|
||||
|
||||
public static BlockPoweredSpawner create() {
|
||||
|
||||
public static BlockPoweredSpawner create() {
|
||||
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPoweredSpawner.unlocalisedName, new DummyRecipe());
|
||||
|
||||
|
||||
//Ensure costs are loaded at startup
|
||||
PoweredSpawnerConfig.getInstance();
|
||||
|
||||
|
||||
BlockPoweredSpawner res = new BlockPoweredSpawner();
|
||||
MinecraftForge.EVENT_BUS.register(res);
|
||||
FMLCommonHandler.instance().bus().register(res);
|
||||
res.init();
|
||||
return res;
|
||||
}
|
||||
|
||||
private List<DropInfo> dropQueue = new ArrayList<BlockPoweredSpawner.DropInfo>();
|
||||
|
||||
}
|
||||
|
||||
private final List<DropInfo> dropQueue = new ArrayList<BlockPoweredSpawner.DropInfo>();
|
||||
private final List<UniqueIdentifier> toolBlackList = new ArrayList<UniqueIdentifier>();
|
||||
|
||||
protected BlockPoweredSpawner() {
|
||||
super(ModObject.blockPoweredSpawner, TilePoweredSpawner.class);
|
||||
super(ModObject.blockPoweredSpawner, TilePoweredSpawner.class);
|
||||
|
||||
String[] blackListNames = Config.brokenSpawnerToolBlacklist;
|
||||
for (String name : blackListNames) {
|
||||
toolBlackList.add(new UniqueIdentifier(name));
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -87,25 +95,35 @@ public class BlockPoweredSpawner extends AbstractMachineBlock<TilePoweredSpawner
|
||||
if(evt.getPlayer() != null && !evt.getPlayer().capabilities.isCreativeMode && !evt.getPlayer().worldObj.isRemote && !evt.isCanceled()) {
|
||||
TileEntity tile = evt.getPlayer().worldObj.getTileEntity(evt.x, evt.y, evt.z);
|
||||
if(tile instanceof TileEntityMobSpawner) {
|
||||
|
||||
if(Math.random() > Config.brokenSpawnerDropChance) {
|
||||
|
||||
if(Math.random() > Config.brokenSpawnerDropChance) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntityMobSpawner spawner = (TileEntityMobSpawner)tile;
|
||||
ItemStack equipped = evt.getPlayer().getCurrentEquippedItem();
|
||||
if(equipped != null) {
|
||||
for (UniqueIdentifier uid : toolBlackList) {
|
||||
Item blackListItem = GameRegistry.findItem(uid.modId, uid.name);
|
||||
if(blackListItem == equipped.getItem()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TileEntityMobSpawner spawner = (TileEntityMobSpawner) tile;
|
||||
MobSpawnerBaseLogic logic = spawner.func_145881_a();
|
||||
if(logic != null) {
|
||||
String name = logic.getEntityNameToSpawn();
|
||||
if(name != null && !isBlackListed(name)) {
|
||||
ItemStack drop = ItemBrokenSpawner.createStackForMobType(name);
|
||||
dropQueue.add(new DropInfo(evt, drop));
|
||||
ItemStack drop = ItemBrokenSpawner.createStackForMobType(name);
|
||||
dropQueue.add(new DropInfo(evt, drop));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onServerTick(TickEvent.ServerTickEvent event) {
|
||||
if(event.phase != TickEvent.Phase.END) {
|
||||
@@ -116,38 +134,38 @@ public class BlockPoweredSpawner extends AbstractMachineBlock<TilePoweredSpawner
|
||||
}
|
||||
dropQueue.clear();
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void handleAnvilEvent(AnvilUpdateEvent evt) {
|
||||
if(evt.left == null || evt.left.stackSize != 1 || evt.left.getItem() != Item.getItemFromBlock(EnderIO.blockPoweredSpawner) ||
|
||||
evt.right == null || ItemBrokenSpawner.getMobTypeFromStack(evt.right) == null) {
|
||||
evt.right == null || ItemBrokenSpawner.getMobTypeFromStack(evt.right) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String spawnerType = ItemBrokenSpawner.getMobTypeFromStack(evt.right);
|
||||
if(isBlackListed(spawnerType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
evt.cost = Config.powerSpawnerAddSpawnerCost;
|
||||
|
||||
evt.cost = Config.powerSpawnerAddSpawnerCost;
|
||||
evt.output = evt.left.copy();
|
||||
if(evt.output.stackTagCompound == null) {
|
||||
evt.output.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
evt.output.stackTagCompound.setBoolean("eio.abstractMachine", true);
|
||||
writeMobTypeToNBT(evt.output.stackTagCompound, spawnerType);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public boolean isBlackListed(String entityId) {
|
||||
|
||||
public boolean isBlackListed(String entityId) {
|
||||
return PoweredSpawnerConfig.getInstance().isBlackListed(entityId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TilePoweredSpawner) {
|
||||
return new ContainerPoweredSpawner(player.inventory, (TilePoweredSpawner)te);
|
||||
return new ContainerPoweredSpawner(player.inventory, (TilePoweredSpawner) te);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -156,7 +174,7 @@ public class BlockPoweredSpawner extends AbstractMachineBlock<TilePoweredSpawner
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TilePoweredSpawner) {
|
||||
return new GuiPoweredSpawner(player.inventory, (TilePoweredSpawner)te);
|
||||
return new GuiPoweredSpawner(player.inventory, (TilePoweredSpawner) te);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -173,7 +191,7 @@ public class BlockPoweredSpawner extends AbstractMachineBlock<TilePoweredSpawner
|
||||
}
|
||||
return "enderio:poweredSpawnerFront";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
@@ -190,7 +208,7 @@ public class BlockPoweredSpawner extends AbstractMachineBlock<TilePoweredSpawner
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
|
||||
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -202,7 +220,7 @@ public class BlockPoweredSpawner extends AbstractMachineBlock<TilePoweredSpawner
|
||||
TooltipAddera.addDetailedTooltipFromResources(list, "tile.blockPoweredSpawner");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TilePoweredSpawner te = (TilePoweredSpawner) world.getTileEntity(x, y, z);
|
||||
@@ -213,26 +231,25 @@ public class BlockPoweredSpawner extends AbstractMachineBlock<TilePoweredSpawner
|
||||
public int getDefaultDisplayMask(World world, int x, int y, int z) {
|
||||
return IWailaInfoProvider.BIT_DETAILED;
|
||||
}
|
||||
|
||||
|
||||
private static class DropInfo {
|
||||
|
||||
|
||||
BlockEvent.BreakEvent evt;
|
||||
ItemStack drop;
|
||||
|
||||
|
||||
DropInfo(BreakEvent evt, ItemStack stack) {
|
||||
super();
|
||||
this.evt = evt;
|
||||
this.drop = stack;
|
||||
}
|
||||
|
||||
|
||||
void doDrop() {
|
||||
if(evt.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
Util.dropItems(evt.getPlayer().worldObj, drop, evt.x, evt.y, evt.z, true);
|
||||
|
||||
Util.dropItems(evt.getPlayer().worldObj, drop, evt.x, evt.y, evt.z, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ public class BlockVat extends AbstractMachineBlock<TileVat> {
|
||||
|
||||
public static BlockVat create() {
|
||||
PacketHandler.INSTANCE.registerMessage(PacketTanks.class,PacketTanks.class,PacketHandler.nextID(), Side.CLIENT);
|
||||
PacketHandler.INSTANCE.registerMessage(PacketDumpTank.class,PacketDumpTank.class,PacketHandler.nextID(), Side.SERVER);
|
||||
BlockVat res = new BlockVat();
|
||||
res.init();
|
||||
return res;
|
||||
|
||||
@@ -3,21 +3,24 @@ package crazypants.enderio.machine.still;
|
||||
import java.awt.Color;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import crazypants.enderio.fluid.Fluids;
|
||||
import crazypants.enderio.gui.IconButtonEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.machine.GuiMachineBase;
|
||||
import crazypants.enderio.machine.IMachineRecipe;
|
||||
import crazypants.enderio.machine.IMachineRecipe.ResultStack;
|
||||
import crazypants.enderio.machine.IPoweredTask;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.MachineRecipeInput;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.gui.GuiToolTip;
|
||||
import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
@@ -28,6 +31,8 @@ public class GuiVat extends GuiMachineBase {
|
||||
private static final String GUI_TEXTURE = "enderio:textures/gui/vat.png";
|
||||
|
||||
private final TileVat vat;
|
||||
|
||||
private IconButtonEIO dump1, dump2;
|
||||
|
||||
public GuiVat(InventoryPlayer inventory, TileVat te) {
|
||||
super(te, new ContainerVat(inventory, te));
|
||||
@@ -62,7 +67,18 @@ public class GuiVat extends GuiMachineBase {
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
dump1 = new IconButtonEIO(this, 1, 29, 62, IconEIO.REDSTONE_MODE_NEVER);
|
||||
dump1.setToolTip(Lang.localize("gui.machine.vat.dump.1"));
|
||||
dump2 = new IconButtonEIO(this, 2, 131, 62, IconEIO.REDSTONE_MODE_NEVER);
|
||||
dump2.setToolTip(Lang.localize("gui.machine.vat.dump.2"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
dump1.onGuiInit();
|
||||
dump2.onGuiInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,6 +190,21 @@ public class GuiVat extends GuiMachineBase {
|
||||
RenderUtil.bindTexture(GUI_TEXTURE);
|
||||
drawTexturedModalRect(x, y, 0, 256 - 28, 26, 28);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton b) {
|
||||
super.actionPerformed(b);
|
||||
|
||||
if (b == dump1) {
|
||||
dump(1);
|
||||
} else if (b == dump2) {
|
||||
dump(2);
|
||||
}
|
||||
}
|
||||
|
||||
private void dump(int i) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketDumpTank(vat, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPowerX() {
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package crazypants.enderio.machine.still;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.network.MessageTileEntity;
|
||||
|
||||
public class PacketDumpTank extends MessageTileEntity<TileVat> implements IMessageHandler<PacketDumpTank, IMessage> {
|
||||
|
||||
private int tank;
|
||||
|
||||
public PacketDumpTank() {
|
||||
super();
|
||||
}
|
||||
|
||||
public PacketDumpTank(TileVat te, int tank) {
|
||||
super(te);
|
||||
this.tank = tank;
|
||||
getTank(te).setFluid(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
super.toBytes(buf);
|
||||
buf.writeInt(tank);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
tank = buf.readInt();
|
||||
}
|
||||
|
||||
private FluidTank getTank(TileVat te) {
|
||||
if (tank == 1) {
|
||||
return te.inputTank;
|
||||
} else if (tank == 2) {
|
||||
return te.outputTank;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketDumpTank message, MessageContext ctx) {
|
||||
TileVat te = message.getTileEntity(ctx.getServerHandler().playerEntity.worldObj);
|
||||
if (te != null) {
|
||||
message.getTank(te).setFluid(null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.network.MessageTileEntity;
|
||||
import crazypants.enderio.network.NetworkUtil;
|
||||
@@ -46,7 +47,7 @@ public class PacketTanks extends MessageTileEntity<TileVat> implements IMessageH
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketTanks message, MessageContext ctx) {
|
||||
EntityPlayer player = EnderIO.proxy.getClientPlayer();
|
||||
EntityPlayer player = ctx.side == Side.SERVER ? ctx.getServerHandler().playerEntity : EnderIO.proxy.getClientPlayer();
|
||||
TileVat tile = message.getTileEntity(player.worldObj);
|
||||
if(tile == null) {
|
||||
return null;
|
||||
|
||||
@@ -57,6 +57,7 @@ public class TileTransceiver extends AbstractPoweredTaskEntity implements IFluid
|
||||
private final EnderRailController railController;
|
||||
|
||||
private boolean inFluidFill = false;
|
||||
private boolean inGetTankInfo = false;
|
||||
|
||||
public TileTransceiver() {
|
||||
super(new SlotDefinition(8, 8, 0));
|
||||
@@ -361,13 +362,25 @@ public class TileTransceiver extends AbstractPoweredTaskEntity implements IFluid
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
if(getSendChannels(ChannelType.FLUID).isEmpty()) {
|
||||
if(inFluidFill) {
|
||||
return false;
|
||||
}
|
||||
return ServerChannelRegister.instance.canFill(this, getSendChannels(ChannelType.FLUID), fluid);
|
||||
try {
|
||||
inFluidFill = true;
|
||||
if(getSendChannels(ChannelType.FLUID).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return ServerChannelRegister.instance.canFill(this, getSendChannels(ChannelType.FLUID), fluid);
|
||||
} finally {
|
||||
inFluidFill = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canReceive(List<Channel> channels, Fluid fluid) {
|
||||
if(inFluidFill) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!hasRecieveChannel(channels, ChannelType.FLUID)) {
|
||||
return false;
|
||||
}
|
||||
@@ -382,6 +395,9 @@ public class TileTransceiver extends AbstractPoweredTaskEntity implements IFluid
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
if(inFluidFill) {
|
||||
return 0;
|
||||
}
|
||||
try {
|
||||
inFluidFill = true;
|
||||
if(getSendChannels(ChannelType.FLUID).isEmpty() || !redstoneCheckPassed || !getIoMode(from).canRecieveInput()) {
|
||||
@@ -415,21 +431,37 @@ public class TileTransceiver extends AbstractPoweredTaskEntity implements IFluid
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return ServerChannelRegister.instance.getTankInfoForChannels(this, getSendChannels(ChannelType.FLUID));
|
||||
if(inGetTankInfo) {
|
||||
return new FluidTankInfo[0];
|
||||
}
|
||||
try {
|
||||
inGetTankInfo = true;
|
||||
return ServerChannelRegister.instance.getTankInfoForChannels(this, getSendChannels(ChannelType.FLUID));
|
||||
} finally {
|
||||
inGetTankInfo = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void getRecieveTankInfo(List<FluidTankInfo> infos, List<Channel> channels) {
|
||||
if(!hasRecieveChannel(channels, ChannelType.FLUID)) {
|
||||
if(inGetTankInfo) {
|
||||
return;
|
||||
}
|
||||
Map<ForgeDirection, IFluidHandler> fluidHandlers = getNeighbouringFluidHandlers();
|
||||
for (Entry<ForgeDirection, IFluidHandler> entry : fluidHandlers.entrySet()) {
|
||||
FluidTankInfo[] tanks = entry.getValue().getTankInfo(entry.getKey().getOpposite());
|
||||
if(tanks != null) {
|
||||
for (FluidTankInfo info : tanks) {
|
||||
infos.add(info);
|
||||
try {
|
||||
inGetTankInfo = true;
|
||||
if(!hasRecieveChannel(channels, ChannelType.FLUID)) {
|
||||
return;
|
||||
}
|
||||
Map<ForgeDirection, IFluidHandler> fluidHandlers = getNeighbouringFluidHandlers();
|
||||
for (Entry<ForgeDirection, IFluidHandler> entry : fluidHandlers.entrySet()) {
|
||||
FluidTankInfo[] tanks = entry.getValue().getTankInfo(entry.getKey().getOpposite());
|
||||
if(tanks != null) {
|
||||
for (FluidTankInfo info : tanks) {
|
||||
infos.add(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
inGetTankInfo = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package crazypants.enderio.power;
|
||||
|
||||
import buildcraft.api.mj.IBatteryObject;
|
||||
import buildcraft.api.mj.MjAPI;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
@@ -16,11 +14,7 @@ public class PowerHandlerUtil {
|
||||
return new PowerInterfaceRF((IEnergyHandler) o);
|
||||
}
|
||||
|
||||
if(Config.powerConduitOutputMJ) {
|
||||
IBatteryObject battery = MjAPI.getMjBattery(o);
|
||||
if(battery != null) {
|
||||
return new PowerInterfaceBC2(battery);
|
||||
}
|
||||
if(Config.powerConduitOutputMJ) {
|
||||
if(o instanceof IPowerReceptor) {
|
||||
return new PowerInterfaceBC((IPowerReceptor) o);
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package crazypants.enderio.power;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.mj.IBatteryObject;
|
||||
|
||||
public class PowerInterfaceBC2 implements IPowerInterface {
|
||||
|
||||
private final IBatteryObject battery;
|
||||
|
||||
public PowerInterfaceBC2(IBatteryObject battery) {
|
||||
this.battery = battery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDelegate() {
|
||||
return battery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConduitConnect(ForgeDirection direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection dir) {
|
||||
return (int) (battery.getEnergyStored() * 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection dir) {
|
||||
return (int) (battery.maxCapacity() * 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPowerRequest(ForgeDirection dir) {
|
||||
return (int)( battery.getEnergyRequested() * 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinEnergyReceived(ForgeDirection dir) {
|
||||
return (int) (battery.minimumConsumption() * 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recieveEnergy(ForgeDirection opposite, int canOffer) {
|
||||
double offer = Math.min(battery.getEnergyRequested(), canOffer/10f);
|
||||
return (int) (battery.addEnergy(offer) * 10);
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.gui.IResourceTooltipProvider;
|
||||
import crazypants.enderio.machine.transceiver.Channel;
|
||||
@@ -44,7 +45,7 @@ public class BlockEnderRail extends BlockRail implements IResourceTooltipProvide
|
||||
if(isEastWest(meta)) {
|
||||
result = ForgeDirection.EAST;
|
||||
} else {
|
||||
result = ForgeDirection.NORTH;
|
||||
result = ForgeDirection.SOUTH;
|
||||
}
|
||||
if(isReverse(meta)) {
|
||||
result = result.getOpposite();
|
||||
@@ -106,15 +107,14 @@ public class BlockEnderRail extends BlockRail implements IResourceTooltipProvide
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
// //TODO: Don't let people decide which way the carts come out. Can't figure out how to reliably reverse directions
|
||||
// if(ConduitUtil.isToolEquipped(player)) {
|
||||
// if(!world.isRemote) {
|
||||
// int meta = world.getBlockMetadata(x, y, z);
|
||||
// meta = MetadataUtil.setBit(3, !MetadataUtil.isBitSet(3, meta), meta);
|
||||
// world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
if(ConduitUtil.isToolEquipped(player)) {
|
||||
if(!world.isRemote) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
meta = MetadataUtil.setBit(3, !MetadataUtil.isBitSet(3, meta), meta);
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,9 +110,13 @@ public class EnderRailController {
|
||||
if(failedSpawn) {
|
||||
doRandomSpawn(ent);
|
||||
} else {
|
||||
TeleportUtil.spawn(transciever.getWorldObj(), ent);
|
||||
EntityMinecart cart = null;
|
||||
if(ent instanceof EntityMinecart) {
|
||||
EntityMinecart cart = (EntityMinecart) ent;
|
||||
cart = (EntityMinecart) ent;
|
||||
setCartDirection(cart);
|
||||
}
|
||||
TeleportUtil.spawn(transciever.getWorldObj(), ent);
|
||||
if(cart != null) {
|
||||
newlySpawnedCarts.add(cart.getPersistentID());
|
||||
CartLinkUtil.recreateLinks(cart);
|
||||
}
|
||||
@@ -123,6 +127,15 @@ public class EnderRailController {
|
||||
|
||||
}
|
||||
|
||||
private void setCartDirection(EntityMinecart cart) {
|
||||
int meta = transciever.getWorldObj().getBlockMetadata(transciever.xCoord, transciever.yCoord + 1, transciever.zCoord);
|
||||
ForgeDirection dir = BlockEnderRail.getDirection(meta);
|
||||
double velocity = Math.max(Math.abs(cart.motionX), Math.abs(cart.motionZ));
|
||||
cart.motionX = dir.offsetX * velocity;
|
||||
cart.motionZ = dir.offsetZ * velocity;
|
||||
|
||||
}
|
||||
|
||||
public void onTrainRecieved(List<List<Entity>> toTeleport) {
|
||||
cartsToSpawn.addAll(toTeleport);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user