finished flare stack upgrades, more assemfac GUI work

This commit is contained in:
Bob 2022-05-17 22:27:34 +02:00
parent 0bbacd5f25
commit aa385f2a21
9 changed files with 151 additions and 97 deletions

View File

@ -57,11 +57,12 @@ public class MachineGasFlare extends BlockDummyable implements ITooltipProvider
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
list.add(EnumChatFormatting.GOLD + "Can burn or vent gasses");
list.add(EnumChatFormatting.GOLD + "Can burn fluids and vent gasses");
list.add(EnumChatFormatting.GOLD + "Burns up to " + EnumChatFormatting.RED + "10mB/t");
list.add(EnumChatFormatting.GOLD + "Vents up to " + EnumChatFormatting.RED + "50mB/t");
list.add("");
list.add(EnumChatFormatting.YELLOW + "Fuel efficiency:");
list.add(EnumChatFormatting.YELLOW + "-Flammable Gasses: " + EnumChatFormatting.RED + "50%");
list.add(EnumChatFormatting.YELLOW + "-Flammable Liquids: " + EnumChatFormatting.RED + "10%");
}
}

View File

@ -1,10 +1,13 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotUpgrade;
import com.hbm.tileentity.machine.TileEntityMachineAssemfac;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerAssemfac extends Container {
@ -12,11 +15,51 @@ public class ContainerAssemfac extends Container {
public ContainerAssemfac(InventoryPlayer playerInv, TileEntityMachineAssemfac tile) {
assemfac = tile;
//Battery
this.addSlotToContainer(new Slot(tile, 0, 234, 218));
for(int i = 0; i < 4; i++) {
this.addSlotToContainer(new SlotUpgrade(tile, 1 + i, 5, 172 + i * 18));
}
for(int i = 0; i < 4; i++) {
for(int j = 0; j < 2; j++) {
int offX = 7 + j * 118;
int offY = 14 + i * 38;
int startIndex = 5 + (i * 2 + j) * 14;
for(int k = 0; k < 2; k++) {
for(int l = 0; l < 6; l++) {
this.addSlotToContainer(new Slot(tile, startIndex + k * 6 + l, offX + l * 16, offY + k * 16));
}
}
}
}
for(int i = 0; i < 8; i++) {
this.addSlotToContainer(new Slot(tile, 17 + i * 14, 106, 13 + i * 19 - (i % 2 == 1 ? 1 : 0)));
this.addSlotToContainer(new Slot(tile, 18 + i * 14, 234, 13 + i * 16));
}
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 34 + j * 18, 174 + i * 18));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(playerInv, i, 34 + i * 18, 232));
}
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return false;
public boolean canInteractWith(EntityPlayer player) {
return assemfac.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
return null;
}
}

View File

@ -2,6 +2,7 @@ package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.items.machine.IItemFluidIdentifier;
import com.hbm.items.machine.ItemMachineUpgrade;
import com.hbm.tileentity.machine.oil.TileEntityMachineGasFlare;
import api.hbm.energy.IBatteryItem;
@ -28,6 +29,9 @@ public class ContainerMachineGasFlare extends Container {
this.addSlotToContainer(new SlotMachineOutput(tedf, 2, 17, 53));
//Fluid ID
this.addSlotToContainer(new Slot(tedf, 3, 35, 71));
//Upgrades
this.addSlotToContainer(new Slot(tedf, 4, 80, 71));
this.addSlotToContainer(new Slot(tedf, 5, 98, 71));
int offset = 37;
@ -56,22 +60,26 @@ public class ContainerMachineGasFlare extends Container {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if(par2 <= 3) {
if(!this.mergeItemStack(var5, 4, this.inventorySlots.size(), true)) {
if(par2 <= 5) {
if(!this.mergeItemStack(var5, 6, this.inventorySlots.size(), true)) {
return null;
}
} else {
if(var3.getItem() instanceof IItemFluidIdentifier) {
if(!this.mergeItemStack(var5, 3, 4, true)) {
if(!this.mergeItemStack(var5, 3, 4, false)) {
return null;
}
} else if(var3.getItem() instanceof IBatteryItem) {
if(!this.mergeItemStack(var5, 0, 1, true)) {
if(!this.mergeItemStack(var5, 0, 1, false)) {
return null;
}
} else if(var3.getItem() instanceof ItemMachineUpgrade) {
if(!this.mergeItemStack(var5, 4, 6, false)) {
return null;
}
} else {
if(!this.mergeItemStack(var5, 1, 2, true)) {
if(!this.mergeItemStack(var5, 1, 2, false)) {
return null;
}
}

View File

@ -12,137 +12,118 @@ import net.minecraft.item.ItemStack;
public class ContainerMachinePress extends Container {
private TileEntityMachinePress nukeBoy;
private TileEntityMachinePress press;
private int power;
private int progress;
private int burnTime;
private int maxBurn;
public ContainerMachinePress(InventoryPlayer invPlayer, TileEntityMachinePress tedf) {
power = 0;
progress = 0;
burnTime = 0;
maxBurn = 0;
nukeBoy = tedf;
//Coal
press = tedf;
// Coal
this.addSlotToContainer(new Slot(tedf, 0, 26, 53));
//Stamp
// Stamp
this.addSlotToContainer(new Slot(tedf, 1, 80, 17));
//Input
// Input
this.addSlotToContainer(new Slot(tedf, 2, 80, 53));
//Output
// Output
this.addSlotToContainer(new SlotMachineOutput(tedf, 3, 140, 35));
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 9; j++)
{
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));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
{
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if (var4 != null && var4.getHasStack())
{
if(var4 != null && var4.getHasStack()) {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 <= 3) {
if (!this.mergeItemStack(var5, 4, this.inventorySlots.size(), true))
{
if(par2 <= 3) {
if(!this.mergeItemStack(var5, 4, this.inventorySlots.size(), true)) {
return null;
}
}
else if (!this.mergeItemStack(var5, 2, 3, false))
if (!this.mergeItemStack(var5, 0, 1, false))
if (!this.mergeItemStack(var5, 1, 2, false))
} else if(!this.mergeItemStack(var5, 2, 3, false))
if(!this.mergeItemStack(var5, 0, 1, false))
if(!this.mergeItemStack(var5, 1, 2, false))
return null;
if (var5.stackSize == 0)
{
if(var5.stackSize == 0) {
var4.putStack((ItemStack) null);
}
else
{
} else {
var4.onSlotChanged();
}
}
return var3;
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return nukeBoy.isUseableByPlayer(player);
return press.isUseableByPlayer(player);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for(int i = 0; i < this.crafters.size(); i++)
{
ICrafting par1 = (ICrafting)this.crafters.get(i);
if(this.power != this.nukeBoy.power)
{
par1.sendProgressBarUpdate(this, 0, this.nukeBoy.power);
for(int i = 0; i < this.crafters.size(); i++) {
ICrafting par1 = (ICrafting) this.crafters.get(i);
if(this.power != this.press.power) {
par1.sendProgressBarUpdate(this, 0, this.press.power);
}
if(this.progress != this.nukeBoy.progress)
{
par1.sendProgressBarUpdate(this, 1, this.nukeBoy.progress);
if(this.progress != this.press.progress) {
par1.sendProgressBarUpdate(this, 1, this.press.progress);
}
if(this.burnTime != this.nukeBoy.burnTime)
{
par1.sendProgressBarUpdate(this, 2, this.nukeBoy.burnTime);
if(this.burnTime != this.press.burnTime) {
par1.sendProgressBarUpdate(this, 2, this.press.burnTime);
}
if(this.maxBurn != this.nukeBoy.maxBurn)
{
par1.sendProgressBarUpdate(this, 3, this.nukeBoy.maxBurn);
if(this.maxBurn != this.press.maxBurn) {
par1.sendProgressBarUpdate(this, 3, this.press.maxBurn);
}
}
this.power = this.nukeBoy.power;
this.progress = this.nukeBoy.progress;
this.burnTime = this.nukeBoy.burnTime;
this.maxBurn = this.nukeBoy.maxBurn;
this.power = this.press.power;
this.progress = this.press.progress;
this.burnTime = this.press.burnTime;
this.maxBurn = this.press.maxBurn;
}
@Override
public void updateProgressBar(int i, int j) {
if(i == 0)
{
nukeBoy.power = j;
if(i == 0) {
press.power = j;
}
if(i == 1)
{
nukeBoy.progress = j;
if(i == 1) {
press.progress = j;
}
if(i == 2)
{
nukeBoy.burnTime = j;
if(i == 2) {
press.burnTime = j;
}
if(i == 3)
{
nukeBoy.maxBurn = j;
if(i == 3) {
press.maxBurn = j;
}
}
}

View File

@ -3,7 +3,6 @@ package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMachineGasFlare;
import com.hbm.inventory.fluid.FluidType.FluidTrait;
import com.hbm.inventory.fluid.types.FluidTypeFlammable;
import com.hbm.lib.RefStrings;
import com.hbm.packet.NBTControlPacket;
@ -77,10 +76,10 @@ public class GUIMachineGasFlare extends GuiInfoContainer {
int j = (int)flare.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 143, guiTop + 69 - j, 176, 94 - j, 16, j);
if(flare.isOn) drawTexturedModalRect(guiLeft + 79, guiTop + 16, 176, 0, 35, 10);
if(flare.doesBurn) drawTexturedModalRect(guiLeft + 79, guiTop + 50, 176, 10, 35, 14);
if(flare.isOn) drawTexturedModalRect(guiLeft + 79, guiTop + 15, 176, 0, 35, 10);
if(flare.doesBurn) drawTexturedModalRect(guiLeft + 79, guiTop + 49, 176, 10, 35, 14);
if(flare.isOn && flare.doesBurn && flare.tank.getFill() > 0 && flare.tank.getTankType().traits.contains(FluidTrait.GASEOUS) && flare.tank.getTankType() instanceof FluidTypeFlammable)
if(flare.isOn && flare.doesBurn && flare.tank.getFill() > 0 && flare.tank.getTankType() instanceof FluidTypeFlammable)
drawTexturedModalRect(guiLeft + 88, guiTop + 29, 176, 24, 18, 18);
flare.tank.renderTank(guiLeft + 35, guiTop + 69, this.zLevel, 16, 52);

View File

@ -286,7 +286,7 @@ public class AssemblerRecipes {
makeRecipe(new ComparableStack(ModBlocks.machine_shredder, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 2), new OreDictStack(STEEL.plate(), 4), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.wire_red_copper, 2), new ComparableStack(ModBlocks.steel_beam, 2), new ComparableStack(Blocks.iron_bars, 2), new ComparableStack(ModBlocks.red_wire_coated, 1), },200);
makeRecipe(new ComparableStack(ModBlocks.machine_well, 1), new AStack[] {new ComparableStack(ModBlocks.steel_scaffold, 20), new ComparableStack(ModBlocks.steel_beam, 8), new ComparableStack(ModItems.tank_steel, 2), new ComparableStack(ModItems.motor, 1), new ComparableStack(ModItems.pipes_steel, 3), new ComparableStack(ModItems.drill_titanium, 1), new ComparableStack(ModItems.wire_red_copper, 6), },250);
makeRecipe(new ComparableStack(ModBlocks.machine_pumpjack, 1), new AStack[] {new ComparableStack(ModBlocks.steel_scaffold, 8), new OreDictStack(STEEL.block(), 8), new ComparableStack(ModItems.pipes_steel, 4), new ComparableStack(ModItems.tank_steel, 4), new OreDictStack(STEEL.ingot(), 24), new OreDictStack(STEEL.plate(), 16), new OreDictStack(AL.plate(), 6), new ComparableStack(ModItems.drill_titanium, 1), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.wire_red_copper, 8), },400);
makeRecipe(new ComparableStack(ModBlocks.machine_flare, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 8), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.tank_steel, 1), new ComparableStack(ModBlocks.deco_pipe_quad, 8), new ComparableStack(ModItems.hull_small_steel, 4), new ComparableStack(ModItems.thermo_element, 3), },200);
makeRecipe(new ComparableStack(ModBlocks.machine_flare, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 12), new OreDictStack(IRON.ingot(), 12), new OreDictStack(CU.plate(), 4), new ComparableStack(ModItems.tank_steel, 1), new ComparableStack(ModBlocks.deco_pipe_quad, 8), new ComparableStack(ModItems.hull_small_steel, 4), new ComparableStack(ModItems.thermo_element, 3), },200);
makeRecipe(new ComparableStack(ModBlocks.machine_refinery, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 16), new OreDictStack(STEEL.plate(), 20), new OreDictStack(CU.plate(), 16), new ComparableStack(ModItems.hull_big_steel, 6), new ComparableStack(ModItems.pipes_steel, 2), new ComparableStack(ModItems.coil_tungsten, 8), new ComparableStack(ModItems.wire_red_copper, 8), new ComparableStack(ModItems.circuit_copper, 2), new ComparableStack(ModItems.circuit_red_copper, 1), new ComparableStack(ModItems.plate_polymer, 8), },350);
makeRecipe(new ComparableStack(ModBlocks.machine_epress, 1), new AStack[] {new OreDictStack(STEEL.plate(), 8), new ComparableStack(ModItems.plate_polymer, 4), new ComparableStack(ModItems.pipes_steel, 1), new ComparableStack(ModItems.bolt_tungsten, 4), new ComparableStack(ModItems.coil_copper, 2), new ComparableStack(ModItems.motor, 1), new ComparableStack(ModItems.circuit_copper, 1), new ComparableStack(ModItems.canister_full, 1, Fluids.LUBRICANT.getID()), },160);
makeRecipe(new ComparableStack(ModBlocks.machine_chemplant, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 8), new OreDictStack(CU.plate(), 6), new ComparableStack(ModItems.tank_steel, 4), new ComparableStack(ModItems.hull_big_steel, 1), new ComparableStack(ModItems.coil_tungsten, 3), new ComparableStack(ModItems.circuit_copper, 2), new ComparableStack(ModItems.circuit_red_copper, 1), new ComparableStack(ModItems.plate_polymer, 8), },200);

View File

@ -47,6 +47,8 @@ public class ItemMachineUpgrade extends Item {
list.add("Delay -" + (20 * this.tier) + "% / Consumption +" + (1000 * this.tier) + "HE/t");
list.add(EnumChatFormatting.RED + "Cyclotron:");
list.add("Speed x" + (1 + this.tier));
list.add(EnumChatFormatting.RED + "Flare Stack:");
list.add("Speed x" + (1 + this.tier));
list.add(EnumChatFormatting.RED + "Maxwell:");
list.add("Damage +" + (0.25 * (double)this.tier) + "dmg/t");
}
@ -58,6 +60,8 @@ public class ItemMachineUpgrade extends Item {
list.add("+" + (5 * this.tier) + "% chance of not consuming an item / Acid consumption +" + (1000 * this.tier) + "mB");
list.add(EnumChatFormatting.RED + "Cyclotron:");
list.add("-" + (100 - 100 / (this.tier + 1)) + "% chance of incrementing overheat counter");
list.add(EnumChatFormatting.RED + "Flare Stack:");
list.add("+" + (100 * this.tier / 3) + "% power production");
list.add(EnumChatFormatting.RED + "Maxwell:");
list.add("Range +" + (3 * this.tier) + "m");
}

View File

@ -7,10 +7,12 @@ import com.hbm.interfaces.IControlReceiver;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.UpgradeManager;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.FluidType.FluidTrait;
import com.hbm.inventory.fluid.types.FluidTypeFlammable;
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.TileEntityMachineBase;
@ -35,7 +37,7 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
public boolean doesBurn = false;
public TileEntityMachineGasFlare() {
super(4);
super(6);
tank = new FluidTank(Fluids.GAS, 64000, 0);
}
@ -102,6 +104,13 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
if(isOn && tank.getFill() > 0) {
UpgradeManager.eval(slots, 4, 5);
int burn = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
int yield = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3);
maxVent += maxVent * burn;
maxBurn += maxBurn * burn;
if(!doesBurn || !(tank.getTankType() instanceof FluidTypeFlammable)) {
if(tank.getTankType().traits.contains(FluidTrait.GASEOUS)) {
@ -114,10 +123,19 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
}
} else {
if(tank.getTankType().traits.contains(FluidTrait.GASEOUS) && tank.getTankType() instanceof FluidTypeFlammable) {
if(tank.getTankType() instanceof FluidTypeFlammable) {
int eject = Math.min(maxBurn, tank.getFill());
tank.setFill(tank.getFill() - eject);
power += ((FluidTypeFlammable) tank.getTankType()).getHeatEnergy() * eject / 2_000; // divided by 1000 per mB and 2 for the 50% penalty
int penalty = 2;
if(!tank.getTankType().traits.contains(FluidTrait.GASEOUS))
penalty = 10;
long powerProd = ((FluidTypeFlammable) tank.getTankType()).getHeatEnergy() * eject / 1_000; // divided by 1000 per mB
powerProd /= penalty;
powerProd += powerProd * yield / 3;
power += powerProd;
if(power > maxPower)
power = maxPower;
@ -147,9 +165,9 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
} else {
if(isOn && tank.getFill() > 0 && tank.getTankType().traits.contains(FluidTrait.GASEOUS)) {
if(isOn && tank.getFill() > 0) {
if(!doesBurn || !(tank.getTankType() instanceof FluidTypeFlammable)) {
if((!doesBurn || !(tank.getTankType() instanceof FluidTypeFlammable)) && tank.getTankType().traits.contains(FluidTrait.GASEOUS)) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "tower");

View File

@ -413,7 +413,7 @@ container.frackingTower=Hydraulic Fracking Tower
container.fusionMultiblock=Big Fusion Reactor
container.fusionaryWatzPlant=Fusionary Watz Plant
container.gasCentrifuge=Gas Centrifuge
container.gasFlare=Gas Flare
container.gasFlare=Flare Stack
container.generator=Nuclear Reactor
container.hadron=Particle Accelerator
container.iGenerator=Industrial Generator
@ -3728,7 +3728,7 @@ tile.machine_electric_furnace_on.name=Electric Furnace
tile.machine_epress.name=Electric Press
tile.machine_fel.name=FEL
tile.machine_fensu.name=FEnSU
tile.machine_flare.name=Gas Flare
tile.machine_flare.name=Flare Stack
tile.machine_fluidtank.name=Tank
tile.machine_forcefield.name=Forcefield Emitter
tile.machine_fraction_tower.name=Fractioning Tower