Fluid tank info, tests with fluoride tanks, more ore dict support

This commit is contained in:
HbmMods 2017-07-18 19:24:42 +02:00
parent 3889d4df80
commit f2a2a9454a
5 changed files with 91 additions and 62 deletions

View File

@ -3,6 +3,7 @@ package com.hbm.inventory;
import java.util.Arrays;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.gui.GuiFluidContainer;
import com.hbm.items.ModItems;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.TEAssemblerPacket;
@ -96,6 +97,16 @@ public class FluidTank {
gui.drawTexturedModalRect(x, y - i, tx, ty - i, width, i);
}
public void renderTankInfo(GuiContainer gui, int mouseX, int mouseY, int x, int y, int width, int height) {
if(gui instanceof GuiFluidContainer)
renderTankInfo((GuiFluidContainer)gui, mouseX, mouseY, x, y, width, height);
}
public void renderTankInfo(GuiFluidContainer gui, int mouseX, int mouseY, int x, int y, int width, int height) {
if(x <= mouseX && x + width > mouseX && y < mouseY && y + height >= mouseY)
gui.drawFluidInfo(new String[] { this.type.getName(), fluid + "/" + maxFluid + "mB" }, mouseX, mouseY);
}
//Called by TE to save fillstate
public void writeToNBT(NBTTagCompound nbt, String s) {
nbt.setInteger(s, fluid);

View File

@ -48,22 +48,23 @@ public class MachineRecipes {
return new ItemStack(ModItems.neutron_reflector, 2);
}
if (item == ModItems.ingot_lead && item2 == ModItems.ingot_copper
|| item == ModItems.ingot_copper && item2 == ModItems.ingot_lead) {
return new ItemStack(ModItems.neutron_reflector, 2);
if (mODE(item, new String[] {"ingotLead", "dustLead"}) && mODE(item2, new String[] {"ingotCopper", "dustCopper"})
|| mODE(item, new String[] {"ingotCopper", "dustCopper"}) && mODE(item2, new String[] {"ingotLead", "dustLead"})) {
return new ItemStack(ModItems.neutron_reflector, 4);
}
if (item == ModItems.plate_lead && item2 == ModItems.plate_copper
|| item == ModItems.plate_copper && item2 == ModItems.plate_lead) {
if (mODE(item, "plateLead") && mODE(item2, "plateCopper")
|| mODE(item, "plateCopper") && mODE(item2, "plateLead")) {
return new ItemStack(ModItems.neutron_reflector, 1);
}
if (item == Items.iron_ingot && item2 == Items.coal || item == Items.coal && item2 == Items.iron_ingot) {
if (mODE(item, new String[] {"ingotIron", "dustIron"}) && mODE(item2, new String[] {"gemCoal", "dustCoal"})
|| mODE(item, new String[] {"gemCoal", "dustCoal"}) && mODE(item2, new String[] {"ingotIron", "dustIron"})) {
return new ItemStack(ModItems.ingot_steel, 2);
}
if (item == ModItems.ingot_copper && item2 == Items.redstone
|| item == Items.redstone && item2 == ModItems.ingot_copper) {
if (mODE(item, new String[] {"ingotCopper", "dustCopper"}) && item2 == Items.redstone
|| item == Items.redstone && mODE(item2, new String[] {"ingotCopper", "dustCopper"})) {
return new ItemStack(ModItems.ingot_red_copper, 2);
}
@ -72,18 +73,18 @@ public class MachineRecipes {
return new ItemStack(ModItems.canister_napalm, 1);
}
if (item == ModItems.ingot_red_copper && item2 == ModItems.ingot_steel
|| item == ModItems.ingot_steel && item2 == ModItems.ingot_red_copper) {
if (mODE(item, new String[] {"ingotRedstoneAlloy", "dustRedstoneAlloy"}) && mODE(item2, new String[] {"ingotSteel", "dustSteel"})
|| mODE(item, new String[] {"ingotSteel", "dustSteel"}) && mODE(item2, new String[] {"ingotRedstoneAlloy", "dustRedstoneAlloy"})) {
return new ItemStack(ModItems.ingot_advanced_alloy, 2);
}
if (item == ModItems.ingot_tungsten && item2 == ModItems.nugget_schrabidium
|| item == ModItems.nugget_schrabidium && item2 == ModItems.ingot_tungsten) {
if (mODE(item, new String[] {"ingotTungsten", "dustTungsten"}) && mODE(item2, "nuggetSchrabidium")
|| mODE(item, "nuggetSchrabidium") && mODE(item2, new String[] {"ingotTungsten", "dustTungsten"})) {
return new ItemStack(ModItems.ingot_magnetized_tungsten, 1);
}
if (item == ModItems.plate_mixed && item2 == ModItems.plate_gold
|| item == ModItems.plate_gold && item2 == ModItems.plate_mixed) {
if (item == ModItems.plate_mixed && mODE(item2, "plateGold")
|| mODE(item, "plateGold") && item2 == ModItems.plate_mixed) {
return new ItemStack(ModItems.plate_paa, 2);
}
@ -107,23 +108,18 @@ public class MachineRecipes {
return new ItemStack(ModItems.nugget_euphemium, 2, 34);
}
if (item == ModItems.oil_canola && item2 == ModItems.canister_empty
|| item == ModItems.canister_empty && item2 == ModItems.oil_canola) {
return new ItemStack(ModItems.canister_canola);
}
if (item == Items.coal && item2 == ModItems.niter
|| item == ModItems.niter && item2 == Items.coal) {
if (mODE(item, new String[] {"gemCoal", "dustCoal"}) && mODE(item2, "dustSalpeter")
|| mODE(item, "dustSalpeter") && mODE(item2, new String[] {"gemCoal", "dustCoal"})) {
return new ItemStack(ModItems.ingot_polymer, 2);
}
if (item == ModItems.ingot_steel && item2 == ModItems.ingot_tungsten
|| item == ModItems.ingot_tungsten && item2 == ModItems.ingot_steel) {
if (mODE(item, new String[] {"ingotSteel", "dustSteel"}) && mODE(item2, new String[] {"ingotTungsten", "dustTungsten"})
|| mODE(item, new String[] {"ingotTungsten", "dustTungsten"}) && mODE(item2, new String[] {"ingotSteel", "dustSteel"})) {
return new ItemStack(ModItems.ingot_dura_steel, 2);
}
if (item == ModItems.ingot_steel && item2 == ModItems.powder_cobalt
|| item == ModItems.powder_cobalt && item2 == ModItems.ingot_steel) {
if (mODE(item, new String[] {"ingotSteel", "dustSteel"}) && item2 == ModItems.powder_cobalt
|| item == ModItems.powder_cobalt && mODE(item2, new String[] {"ingotSteel", "dustSteel"})) {
return new ItemStack(ModItems.ingot_dura_steel, 2);
}
@ -599,42 +595,39 @@ public class MachineRecipes {
public Map<Object[], Object> getAlloyRecipes() {
Map<Object[], Object> recipes = new HashMap<Object[], Object>();
if (MainRegistry.enableDebugMode) {
recipes.put(new ItemStack[] { new ItemStack(Items.iron_ingot), new ItemStack(Items.quartz) },
new ItemStack(Item.getItemFromBlock(ModBlocks.test_render)));
}
try {
recipes.put(new ItemStack[] { new ItemStack(Items.iron_ingot), new ItemStack(Items.coal) },
new ItemStack(ModItems.ingot_steel, 2));
getFurnaceOutput(Items.iron_ingot, Items.coal).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_lead), new ItemStack(ModItems.ingot_copper) },
new ItemStack(ModItems.neutron_reflector, 2));
getFurnaceOutput(ModItems.ingot_lead, ModItems.ingot_copper).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.plate_lead), new ItemStack(ModItems.plate_copper) },
new ItemStack(ModItems.neutron_reflector));
getFurnaceOutput(ModItems.plate_lead, ModItems.plate_copper).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_tungsten), new ItemStack(Items.coal) },
new ItemStack(ModItems.neutron_reflector, 2));
getFurnaceOutput(ModItems.ingot_tungsten, Items.coal).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_copper), new ItemStack(Items.redstone) },
new ItemStack(ModItems.ingot_red_copper, 2));
getFurnaceOutput(ModItems.ingot_copper, Items.redstone).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_red_copper), new ItemStack(ModItems.ingot_steel) },
new ItemStack(ModItems.ingot_advanced_alloy, 2));
getFurnaceOutput(ModItems.ingot_red_copper, ModItems.ingot_steel).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.canister_fuel), new ItemStack(Items.slime_ball) },
new ItemStack(ModItems.canister_napalm, 1));
recipes.put(
new ItemStack[] { new ItemStack(ModItems.ingot_tungsten), new ItemStack(ModItems.nugget_schrabidium) },
new ItemStack(ModItems.ingot_magnetized_tungsten, 1));
recipes.put(
new ItemStack[] { new ItemStack(ModItems.plate_mixed), new ItemStack(ModItems.plate_gold) },
new ItemStack(ModItems.plate_paa, 2));
recipes.put(
new ItemStack[] { new ItemStack(ModItems.canister_empty), new ItemStack(ModItems.oil_canola) },
new ItemStack(ModItems.canister_canola, 1));
recipes.put(
new ItemStack[] { new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.ingot_tungsten) },
new ItemStack(ModItems.ingot_dura_steel, 2));
recipes.put(
new ItemStack[] { new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.powder_cobalt) },
new ItemStack(ModItems.ingot_dura_steel, 2));
recipes.put(
new ItemStack[] { new ItemStack(Items.coal), new ItemStack(ModItems.niter) },
new ItemStack(ModItems.ingot_polymer, 2));
getFurnaceOutput(ModItems.canister_fuel, Items.slime_ball).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_tungsten), new ItemStack(ModItems.nugget_schrabidium) },
getFurnaceOutput(ModItems.ingot_tungsten, ModItems.nugget_schrabidium).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.plate_mixed), new ItemStack(ModItems.plate_gold) },
getFurnaceOutput(ModItems.plate_mixed, ModItems.plate_gold).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.ingot_tungsten) },
getFurnaceOutput(ModItems.ingot_steel, ModItems.ingot_tungsten).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.powder_cobalt) },
getFurnaceOutput(ModItems.ingot_steel, ModItems.powder_cobalt).copy());
recipes.put(new ItemStack[] { new ItemStack(Items.coal), new ItemStack(ModItems.niter) },
getFurnaceOutput(Items.coal, ModItems.niter).copy());
} catch (Exception x) {
System.out.println("Unable to register alloy recipes for NEI!");
}
return recipes;
}

View File

@ -12,7 +12,7 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIMachineUF6Tank extends GuiContainer {
public class GUIMachineUF6Tank extends GuiFluidContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/uf6Tank.png");
private TileEntityMachineUF6Tank tank;
@ -25,6 +25,13 @@ public class GUIMachineUF6Tank extends GuiContainer {
this.ySize = 166;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
tank.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 69 - 52, 16, 52);
}
@Override
protected void drawGuiContainerForegroundLayer( int i, int j) {
String name = this.tank.hasCustomInventoryName() ? this.tank.getInventoryName() : I18n.format(this.tank.getInventoryName());

View File

@ -0,0 +1,18 @@
package com.hbm.inventory.gui;
import java.util.Arrays;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
public abstract class GuiFluidContainer extends GuiContainer {
public GuiFluidContainer(Container p_i1072_1_) {
super(p_i1072_1_);
}
public void drawFluidInfo(String[] text, int x, int y) {
this.func_146283_a(Arrays.asList(text), x, y);
}
}

View File

@ -18,7 +18,7 @@ public class TileEntityMachinePuF6Tank extends TileEntity implements ISidedInven
private ItemStack slots[];
public int fillState;
public static final int maxFill = 64 * 3;
public static final int maxFill = 64000;
private static final int[] slots_top = new int[] {0};
private static final int[] slots_bottom = new int[] {1, 3};
@ -228,7 +228,7 @@ public class TileEntityMachinePuF6Tank extends TileEntity implements ISidedInven
slots[0] = null;
}
this.fillState++;
this.fillState += 1000;
if(slots[1] != null)
{
@ -248,7 +248,7 @@ public class TileEntityMachinePuF6Tank extends TileEntity implements ISidedInven
slots[2] = null;
}
this.fillState--;
this.fillState -= 1000;
if(slots[3] != null)
{