mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Plenty of changes
This commit is contained in:
parent
66663ca502
commit
671948754b
@ -22,16 +22,15 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe {
|
||||
PositionedStack input;
|
||||
PositionedStack result1;
|
||||
PositionedStack result2;
|
||||
PositionedStack result3;
|
||||
List<PositionedStack> output = new ArrayList();
|
||||
|
||||
public SmeltingSet(ItemStack input, ItemStack result1, ItemStack result2, ItemStack result3) {
|
||||
public SmeltingSet(ItemStack input, ItemStack[] results) {
|
||||
input.stackSize = 1;
|
||||
this.input = new PositionedStack(input, 25, 35 - 11);
|
||||
this.result1 = new PositionedStack(result1, 128, 26 - 11);
|
||||
this.result2 = new PositionedStack(result2, 128, 44 - 11);
|
||||
this.result3 = new PositionedStack(result3, 146, 35 - 11);
|
||||
|
||||
for(byte i = 0; i < results.length; i++) {
|
||||
this.output.add(new PositionedStack(results[i], i % 2 == 0 ? 128 : 146, i < 2 ? 26 - 11 : 44 - 11 ));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,14 +42,13 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler {
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
List<PositionedStack> stacks = new ArrayList<PositionedStack>();
|
||||
stacks.add(fuels.get((cycleticks / 48) % fuels.size()).stack);
|
||||
stacks.add(result2);
|
||||
stacks.add(result3);
|
||||
stacks.addAll(output);
|
||||
return stacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return result1;
|
||||
return output.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +91,7 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler {
|
||||
if((outputId.equals("gascentprocessing")) && getClass() == GasCentrifugeRecipeHandler.class) {
|
||||
Map<Object, Object[]> recipes = GasCentrifugeRecipes.getGasCentrifugeRecipes();
|
||||
for(Map.Entry<Object, Object[]> recipe : recipes.entrySet()) {
|
||||
this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack) recipe.getValue()[0], (ItemStack) recipe.getValue()[1], (ItemStack) recipe.getValue()[2]));
|
||||
this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack[]) recipe.getValue()));
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
@ -106,7 +104,7 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler {
|
||||
for(Map.Entry<Object, Object[]> recipe : recipes.entrySet()) {
|
||||
if(NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[0], result) || NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[1], result)
|
||||
|| NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[2], result))
|
||||
this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack) recipe.getValue()[0], (ItemStack) recipe.getValue()[1], (ItemStack) recipe.getValue()[2]));
|
||||
this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack[]) recipe.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +122,7 @@ public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler {
|
||||
Map<Object, Object[]> recipes = GasCentrifugeRecipes.getGasCentrifugeRecipes();
|
||||
for(Map.Entry<Object, Object[]> recipe : recipes.entrySet()) {
|
||||
if(compareFluidStacks(ingredient, (ItemStack) recipe.getKey()))
|
||||
this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack) recipe.getValue()[0], (ItemStack) recipe.getValue()[1], (ItemStack) recipe.getValue()[2]));
|
||||
this.arecipes.add(new SmeltingSet((ItemStack) recipe.getKey(), (ItemStack[]) recipe.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,27 +18,27 @@ public class ContainerMachineGasCent extends Container {
|
||||
|
||||
gasCent = tedf;
|
||||
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 8, 53));
|
||||
//Fluid ID IO
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 30, 35));
|
||||
//Output
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, 2, 133, 26));
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, 3, 133, 44));
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, 4, 151, 35));
|
||||
//upgrade
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 82, 19));
|
||||
for(int i = 0; i < 2; i++) {
|
||||
for(int j = 0; j < 2; j++) {
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, j + i * 2, 133 + j * 18, 26 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
for(int j = 0; j < 9; j++)
|
||||
{
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 8, 53));
|
||||
//Fluid ID IO
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 30, 35));
|
||||
//upgrade
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 82, 19));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
@ -51,37 +51,29 @@ public class ContainerMachineGasCent extends Container {
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index)
|
||||
{
|
||||
ItemStack var3 = null;
|
||||
ItemStack returnStack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
var3 = stack.copy();
|
||||
returnStack = stack.copy();
|
||||
|
||||
if (index <= 5) {
|
||||
if (!this.mergeItemStack(stack, 6, this.inventorySlots.size(), true))
|
||||
{
|
||||
if(index <= 6) {
|
||||
if (!this.mergeItemStack(stack, 7, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(stack, 0, 2, false))
|
||||
{
|
||||
if (!this.mergeItemStack(stack, 3, 4, false))
|
||||
return null;
|
||||
} else if(!this.mergeItemStack(stack, 4, 7, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (stack.stackSize == 0)
|
||||
{
|
||||
if (stack.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
return returnStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -15,7 +15,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineGasCent extends GuiInfoContainer {
|
||||
|
||||
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/centrifuge_gas.png");
|
||||
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_centrifuge_gas.png");
|
||||
private TileEntityMachineGasCent gasCent;
|
||||
|
||||
public GUIMachineGasCent(InventoryPlayer invPlayer, TileEntityMachineGasCent tedf) {
|
||||
|
||||
@ -14,27 +14,28 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class GasCentrifugeRecipes {
|
||||
|
||||
//TODO: Change "String name" to I18n instead of unlocalized BS
|
||||
public static enum PseudoFluidType {
|
||||
NONE (0, 0, "NONE", "Empty", false, (ItemStack[])null),
|
||||
NONE (0, 0, null, "Empty", false, (ItemStack[])null),
|
||||
|
||||
NUF6 (400, 300, "LEUF6", "Natural UF6", false, new ItemStack(ModItems.nugget_u238, 1)),
|
||||
LEUF6 (300, 200, "MEUF6", "Low Enriched UF6", false, new ItemStack(ModItems.nugget_u238, 1), new ItemStack(ModItems.fluorite, 1)),
|
||||
MEUF6 (200, 100, "HEUF6", "Medium Enriched UF6", false, new ItemStack(ModItems.nugget_u238, 1)),
|
||||
HEUF6 (300, 0, "NONE", "High Enriched UF6", true, new ItemStack(ModItems.nugget_u238, 2), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 1)),
|
||||
HEUF6 (300, 0, NONE, "High Enriched UF6", true, new ItemStack(ModItems.nugget_u238, 2), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 1)),
|
||||
MEUF6 (200, 100, HEUF6, "Medium Enriched UF6", false, new ItemStack(ModItems.nugget_u238, 1)),
|
||||
LEUF6 (300, 200, MEUF6, "Low Enriched UF6", false, new ItemStack(ModItems.nugget_u238, 1), new ItemStack(ModItems.fluorite, 1)),
|
||||
NUF6 (400, 300, LEUF6, "Natural UF6", false, new ItemStack(ModItems.nugget_u238, 1)),
|
||||
|
||||
PF6 (300, 0, "NONE", "Plutonium Hexafluoride", false, new ItemStack(ModItems.nugget_pu238, 1), new ItemStack(ModItems.nugget_pu_mix, 2), new ItemStack(ModItems.fluorite, 1)),
|
||||
|
||||
MUD (1000, 500, "MUD_HEAVY", "Poisonous Mud", false, new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.dust, 1)),
|
||||
MUD_HEAVY (500, 0, "NONE", "Heavy Mud Fraction", false, new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.dust, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1));
|
||||
PF6 (300, 0, NONE, "Plutonium Hexafluoride", false, new ItemStack(ModItems.nugget_pu238, 1), new ItemStack(ModItems.nugget_pu_mix, 2), new ItemStack(ModItems.fluorite, 1)),
|
||||
|
||||
MUD_HEAVY (500, 0, NONE, "Heavy Mud Fraction", false, new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.dust, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1)),
|
||||
MUD (1000, 500, MUD_HEAVY, "Poisonous Mud", false, new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.dust, 1));
|
||||
|
||||
int fluidConsumed;
|
||||
int fluidProduced;
|
||||
String outputFluid;
|
||||
PseudoFluidType outputFluid;
|
||||
String name;
|
||||
boolean isHighSpeed;
|
||||
ItemStack[] output;
|
||||
|
||||
PseudoFluidType(int fluidConsumed, int fluidProduced, String outputFluid, String name, boolean isHighSpeed, ItemStack... output) {
|
||||
PseudoFluidType(int fluidConsumed, int fluidProduced, PseudoFluidType outputFluid, String name, boolean isHighSpeed, ItemStack... output) {
|
||||
this.fluidConsumed = fluidConsumed;
|
||||
this.fluidProduced = fluidProduced;
|
||||
this.outputFluid = outputFluid;
|
||||
@ -51,8 +52,8 @@ public class GasCentrifugeRecipes {
|
||||
return this.fluidProduced;
|
||||
}
|
||||
|
||||
public PseudoFluidType getOutputFluid() {
|
||||
return this.valueOf(this.outputFluid);
|
||||
public PseudoFluidType getOutputType() {
|
||||
return this.outputFluid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -97,8 +98,11 @@ public class GasCentrifugeRecipes {
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
gasCent.put(new FluidStack(1200, Fluids.UF6), new ItemStack[] {new ItemStack(ModItems.nugget_u238, 11), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 4)});
|
||||
gasCent.put(new FluidStack(900, Fluids.PUF6), new ItemStack[] {new ItemStack(ModItems.nugget_pu238, 3), new ItemStack(ModItems.nugget_pu_mix, 6), new ItemStack(ModItems.fluorite, 3)});
|
||||
gasCent.put(new FluidStack(1000, Fluids.WATZ), new ItemStack[] {new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1)});
|
||||
gasCent.put(new FluidStack(1200, Fluids.UF6), new ItemStack[]
|
||||
{new ItemStack(ModItems.nugget_u238, 11), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 4)});
|
||||
gasCent.put(new FluidStack(900, Fluids.PUF6), new ItemStack[]
|
||||
{new ItemStack(ModItems.nugget_pu238, 3), new ItemStack(ModItems.nugget_pu_mix, 6), new ItemStack(ModItems.fluorite, 3)});
|
||||
gasCent.put(new FluidStack(1000, Fluids.WATZ), new ItemStack[]
|
||||
{new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1), new ItemStack(ModItems.dust, 2)});
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,21 +4,22 @@ import java.util.HashMap;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.Spaghetti;
|
||||
import com.hbm.interfaces.Untested;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.recipes.GasCentrifugeRecipes.PseudoFluidType;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.items.machine.ItemFluidIdentifier;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.LoopedSoundPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -28,10 +29,9 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Spaghetti("I still can't believe this was my idea of a 'rework'")
|
||||
public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyUser, IFluidContainer, IFluidAcceptor {
|
||||
//epic!
|
||||
public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor, IFluidStandardReceiver {
|
||||
|
||||
public byte age;
|
||||
public long power;
|
||||
public int progress;
|
||||
public boolean isProgressing;
|
||||
@ -42,11 +42,10 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
public PseudoFluidTank inputTank;
|
||||
public PseudoFluidTank outputTank;
|
||||
|
||||
private static final int[] slots_top = new int[] {0};
|
||||
private static final int[] slots_io = new int[] { 0, 2, 3, 4 };
|
||||
private static final int[] slots_bottom = new int[] {2, 3, 4};
|
||||
private static final int[] slots_side = new int[] { };
|
||||
|
||||
@Untested
|
||||
private static HashMap<FluidType, PseudoFluidType> fluidConversions = new HashMap();
|
||||
|
||||
static {
|
||||
@ -56,7 +55,7 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
}
|
||||
|
||||
public TileEntityMachineGasCent() {
|
||||
super(6);
|
||||
super(7);
|
||||
tank = new FluidTank(Fluids.UF6, 2000, 0);
|
||||
inputTank = new PseudoFluidTank(PseudoFluidType.NUF6, 8000);
|
||||
outputTank = new PseudoFluidTank(PseudoFluidType.LEUF6, 8000);
|
||||
@ -66,10 +65,15 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
public String getName() {
|
||||
return "container.gasCentrifuge";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
return i < 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return side == 0 ? slots_bottom : side == 1 ? slots_top : slots_side;
|
||||
return slots_io;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,11 +96,6 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
inputTank.writeToNBT(nbt, "inputTank");
|
||||
outputTank.writeToNBT(nbt, "outputTank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
return (i != 0 && i != 1) || j == 1;
|
||||
}
|
||||
|
||||
public int getCentrifugeProgressScaled(int i) {
|
||||
return (progress * i) / getProcessingSpeed();
|
||||
@ -121,31 +120,17 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
ItemStack[] list = inputTank.getTankType().getOutput();
|
||||
|
||||
if(this.inputTank.getTankType().getIfHighSpeed())
|
||||
if(!(slots[5] != null && slots[5].getItem() == ModItems.upgrade_gc_speed))
|
||||
if(!(slots[6] != null && slots[6].getItem() == ModItems.upgrade_gc_speed))
|
||||
return false;
|
||||
|
||||
if(list == null)
|
||||
return false;
|
||||
|
||||
if(list.length < 1 || list.length > 3)
|
||||
if(list.length < 1)
|
||||
return false;
|
||||
|
||||
for(int i = 0; i < list.length; i++) {
|
||||
|
||||
int slot = i + 2;
|
||||
|
||||
if(slots[slot] == null)
|
||||
continue;
|
||||
|
||||
if(slots[slot].getItem() == list[i].getItem() &&
|
||||
slots[slot].getItemDamage() == list[i].getItemDamage() &&
|
||||
slots[slot].stackSize + list[i].stackSize <= slots[slot].getMaxStackSize())
|
||||
continue;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
if(InventoryUtil.doesArrayHaveSpace(slots, 0, 3, list))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -158,54 +143,42 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
inputTank.setFill(inputTank.getFill() - inputTank.getTankType().getFluidConsumed());
|
||||
outputTank.setFill(outputTank.getFill() + inputTank.getTankType().getFluidProduced());
|
||||
|
||||
for(byte i = 0; i < output.length && i < 3; i++) {
|
||||
if(slots[i + 2] == null) {
|
||||
slots[i + 2] = output[i].copy();
|
||||
} else {
|
||||
slots[i + 2].stackSize += output[i].stackSize;
|
||||
}
|
||||
}
|
||||
for(byte i = 0; i < output.length; i++)
|
||||
InventoryUtil.tryAddItemToInventory(slots, 0, 3, output[i].copy()); //reference types almost got me again
|
||||
}
|
||||
|
||||
private void attemptConversion() {
|
||||
if(inputTank.getFill() <= inputTank.getMaxFill() && tank.getFill() > 0) {
|
||||
int fill = inputTank.getMaxFill() - inputTank.getFill();
|
||||
if(inputTank.getFill() < inputTank.getMaxFill() && tank.getFill() > 0) {
|
||||
int fill = Math.min(inputTank.getMaxFill() - inputTank.getFill(), tank.getFill());
|
||||
|
||||
if(tank.getFill() >= fill) {
|
||||
tank.setFill(tank.getFill() - fill);
|
||||
inputTank.setFill(inputTank.getFill() + fill);
|
||||
} else {
|
||||
inputTank.setFill(inputTank.getFill() + tank.getFill());
|
||||
tank.setFill(0);
|
||||
}
|
||||
tank.setFill(tank.getFill() - fill);
|
||||
inputTank.setFill(inputTank.getFill() + fill);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean attemptTransfer(TileEntity te) {
|
||||
if(te instanceof TileEntityMachineGasCent) {
|
||||
TileEntityMachineGasCent gasCent = (TileEntityMachineGasCent) te;
|
||||
TileEntityMachineGasCent cent = (TileEntityMachineGasCent) te;
|
||||
|
||||
if(gasCent.tank.getFill() == 0 && gasCent.tank.getTankType() == this.tank.getTankType()) {
|
||||
if(gasCent.inputTank.getTankType() != this.outputTank.getTankType()) {
|
||||
gasCent.inputTank.setTankType(this.outputTank.getTankType());
|
||||
gasCent.outputTank.setTankType(this.outputTank.getTankType().getOutputFluid());
|
||||
if(cent.tank.getFill() == 0 && cent.tank.getTankType() == tank.getTankType()) {
|
||||
if(cent.inputTank.getTankType() != outputTank.getTankType()) {
|
||||
cent.inputTank.setTankType(outputTank.getTankType());
|
||||
cent.outputTank.setTankType(outputTank.getTankType().getOutputType());
|
||||
}
|
||||
|
||||
if(gasCent.inputTank.getFill() < gasCent.inputTank.getMaxFill() && this.outputTank.getFill() > 0) {
|
||||
int fill = gasCent.inputTank.getMaxFill() - gasCent.inputTank.getFill();
|
||||
//God, why did I forget about the entirety of the fucking math library?
|
||||
if(cent.inputTank.getFill() < cent.inputTank.getMaxFill() && outputTank.getFill() > 0) {
|
||||
int fill = Math.min(cent.inputTank.getMaxFill() - cent.inputTank.getFill(), outputTank.getFill());
|
||||
|
||||
if(this.outputTank.getFill() >= fill) {
|
||||
this.outputTank.setFill(this.outputTank.getFill() - fill);
|
||||
gasCent.inputTank.setFill(gasCent.inputTank.getFill() + fill);
|
||||
} else {
|
||||
gasCent.inputTank.setFill(gasCent.inputTank.getFill() + this.outputTank.getFill());
|
||||
this.outputTank.setFill(0);
|
||||
}
|
||||
outputTank.setFill(outputTank.getFill() - fill);
|
||||
cent.inputTank.setFill(cent.inputTank.getFill() + fill);
|
||||
}
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
@ -220,26 +193,25 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateStandardConnections(worldObj, xCoord, yCoord, zCoord);
|
||||
updateConnections();
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
setTankType(1);
|
||||
setTankType(5);
|
||||
|
||||
if(inputTank.getTankType() == PseudoFluidType.PF6 || inputTank.getTankType() == PseudoFluidType.NUF6 || inputTank.getTankType() == PseudoFluidType.MUD) {
|
||||
tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
if(fluidConversions.containsValue(inputTank.getTankType())) {
|
||||
tank.updateTank(this);
|
||||
attemptConversion();
|
||||
}
|
||||
|
||||
if(canEnrich()) {
|
||||
|
||||
isProgressing = true;
|
||||
|
||||
this.progress++;
|
||||
|
||||
if(slots[5] != null && slots[5].getItem() == ModItems.upgrade_gc_speed)
|
||||
if(slots[6] != null && slots[6].getItem() == ModItems.upgrade_gc_speed)
|
||||
this.power -= 300;
|
||||
else
|
||||
this.power -= 200;
|
||||
@ -251,28 +223,20 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
|
||||
if(progress >= getProcessingSpeed())
|
||||
enrich();
|
||||
|
||||
|
||||
} else {
|
||||
isProgressing = false;
|
||||
this.progress = 0;
|
||||
}
|
||||
|
||||
age++;
|
||||
if(age >= 10) {
|
||||
age = 0;
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 10 == 0) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
TileEntity te = worldObj.getTileEntity(this.xCoord - dir.offsetX, this.yCoord, this.zCoord - dir.offsetZ);
|
||||
|
||||
if(attemptTransfer(te) && this.inputTank.getTankType() == PseudoFluidType.LEUF6) {
|
||||
if(this.outputTank.getFill() >= 100 && (slots[4] == null || (slots[4].getItem() == ModItems.nugget_uranium_fuel && slots[4].stackSize + 1 <= slots[4].getMaxStackSize()))) {
|
||||
//*AT THE MOMENT*, there's not really any need for a dedicated method for this. Yet.
|
||||
if(!attemptTransfer(te) && this.inputTank.getTankType() == PseudoFluidType.LEUF6) {
|
||||
if(this.outputTank.getFill() >= 100 && InventoryUtil.tryAddItemToInventory(slots, 0, 3, new ItemStack(ModItems.nugget_uranium_fuel)) == null) {
|
||||
this.outputTank.setFill(this.outputTank.getFill() - 100);
|
||||
if(slots[4] == null) {
|
||||
slots[4] = new ItemStack(ModItems.nugget_uranium_fuel, 1);
|
||||
} else {
|
||||
slots[4].stackSize += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -290,6 +254,26 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
|
||||
if(fluidConversions.containsValue(inputTank.getTankType())) {
|
||||
this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DirPos[] getConPos() {
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord, yCoord - 1, zCoord, Library.NEG_Y),
|
||||
new DirPos(xCoord + 1, yCoord, zCoord, Library.POS_X),
|
||||
new DirPos(xCoord - 1, yCoord, zCoord, Library.NEG_X),
|
||||
new DirPos(xCoord, yCoord, zCoord + 1, Library.POS_Z),
|
||||
new DirPos(xCoord, yCoord, zCoord - 1, Library.NEG_Z)
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
@ -308,58 +292,62 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
}
|
||||
|
||||
public int getProcessingSpeed() {
|
||||
if(slots[5] != null && slots[5].getItem() == ModItems.upgrade_gc_speed) {
|
||||
if(slots[6] != null && slots[6].getItem() == ModItems.upgrade_gc_speed) {
|
||||
return processingSpeed - 70;
|
||||
}
|
||||
return processingSpeed;
|
||||
}
|
||||
|
||||
|
||||
public void setTankType(int in) {
|
||||
|
||||
if(slots[in] != null && slots[in].getItem() instanceof IItemFluidIdentifier) {
|
||||
IItemFluidIdentifier id = (IItemFluidIdentifier) slots[in].getItem();
|
||||
FluidType newType = id.getType(null, 0, 0, 0, slots[in]);
|
||||
|
||||
if(tank.getTankType() != newType) {
|
||||
PseudoFluidType pseudo = fluidConversions.get(newType);
|
||||
|
||||
if(pseudo != null) {
|
||||
inputTank.setTankType(pseudo);
|
||||
outputTank.setTankType(pseudo.getOutputType());
|
||||
tank.setTankType(newType);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeForSync(FluidType type, int index) {
|
||||
tank.setTankType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillForSync(int fill, int index) {
|
||||
tank.setFill(fill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeForSync(FluidType type, int index) {
|
||||
tank.setTankType(type);
|
||||
public void setFluidFill(int fill, FluidType type) {
|
||||
if(type == tank.getTankType())
|
||||
tank.setFill(fill);
|
||||
}
|
||||
|
||||
public void setTankType(int in) {
|
||||
|
||||
if(slots[in] != null && slots[in].getItem() instanceof ItemFluidIdentifier) {
|
||||
FluidType newType = ItemFluidIdentifier.getType(slots[in]);
|
||||
|
||||
if(tank.getTankType() != newType) {
|
||||
|
||||
PseudoFluidType pseudo = fluidConversions.get(newType);
|
||||
|
||||
if(pseudo != null) {
|
||||
inputTank.setTankType(pseudo);
|
||||
outputTank.setTankType(pseudo.getOutputFluid());
|
||||
tank.setTankType(newType);
|
||||
tank.setFill(0);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
return tank.getTankType() == type ? tank.getFill() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
return type.name().equals(this.tank.getTankType().name()) ? tank.getMaxFill() : 0;
|
||||
return tank.getTankType() == type ? tank.getMaxFill() : 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
return type.name().equals(this.tank.getTankType().name()) ? tank.getFill() : 0;
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int i, FluidType type) {
|
||||
if(type.name().equals(tank.getTankType().name()))
|
||||
tank.setFill(i);
|
||||
}
|
||||
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
@ -394,10 +382,14 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
|
||||
public void setTankType(PseudoFluidType type) {
|
||||
|
||||
if(this.type.name().equals(type.name()))
|
||||
if(this.type.equals(type))
|
||||
return;
|
||||
|
||||
this.type = type;
|
||||
if(type == null)
|
||||
this.type = PseudoFluidType.NONE;
|
||||
else
|
||||
this.type = type;
|
||||
|
||||
this.setFill(0);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
Loading…
x
Reference in New Issue
Block a user