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 java.util.Arrays;
import com.hbm.handler.FluidTypeHandler.FluidType; import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.gui.GuiFluidContainer;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.packet.PacketDispatcher; import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.TEAssemblerPacket; import com.hbm.packet.TEAssemblerPacket;
@ -96,6 +97,16 @@ public class FluidTank {
gui.drawTexturedModalRect(x, y - i, tx, ty - i, width, i); 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 //Called by TE to save fillstate
public void writeToNBT(NBTTagCompound nbt, String s) { public void writeToNBT(NBTTagCompound nbt, String s) {
nbt.setInteger(s, fluid); nbt.setInteger(s, fluid);

View File

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

View File

@ -12,7 +12,7 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation; 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 static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/uf6Tank.png");
private TileEntityMachineUF6Tank tank; private TileEntityMachineUF6Tank tank;
@ -24,6 +24,13 @@ public class GUIMachineUF6Tank extends GuiContainer {
this.xSize = 176; this.xSize = 176;
this.ySize = 166; 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 @Override
protected void drawGuiContainerForegroundLayer( int i, int j) { protected void drawGuiContainerForegroundLayer( int i, int j) {

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[]; private ItemStack slots[];
public int fillState; 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_top = new int[] {0};
private static final int[] slots_bottom = new int[] {1, 3}; private static final int[] slots_bottom = new int[] {1, 3};
@ -228,7 +228,7 @@ public class TileEntityMachinePuF6Tank extends TileEntity implements ISidedInven
slots[0] = null; slots[0] = null;
} }
this.fillState++; this.fillState += 1000;
if(slots[1] != null) if(slots[1] != null)
{ {
@ -247,8 +247,8 @@ public class TileEntityMachinePuF6Tank extends TileEntity implements ISidedInven
{ {
slots[2] = null; slots[2] = null;
} }
this.fillState--; this.fillState -= 1000;
if(slots[3] != null) if(slots[3] != null)
{ {