mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
ough
This commit is contained in:
parent
1b1682a9d6
commit
9965ada88f
@ -10,4 +10,5 @@
|
||||
* If I see one more person complaining about the chances I'm reducing it down to 10%
|
||||
* Catalytic reformers now have a tooltip informing about the need for a catalytic converter
|
||||
* Several guns now have reload animations including most .357 revolvers and Samuel
|
||||
* Updated stealth missile texture
|
||||
* Updated stealth missile texture
|
||||
* Some of the larger oil machines now render using display lists which should make them somewhat more performant
|
||||
@ -987,6 +987,7 @@ public class ModBlocks {
|
||||
public static Block fraction_spacer;
|
||||
public static Block machine_catalytic_cracker;
|
||||
public static Block machine_catalytic_reformer;
|
||||
public static Block machine_hydrotreater;
|
||||
public static Block machine_coker;
|
||||
|
||||
public static Block machine_boiler_off;
|
||||
@ -2253,6 +2254,7 @@ public class ModBlocks {
|
||||
fraction_spacer = new FractionSpacer(Material.iron).setBlockName("fraction_spacer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_catalytic_cracker = new MachineCatalyticCracker(Material.iron).setBlockName("machine_catalytic_cracker").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_catalytic_reformer = new MachineCatalyticReformer(Material.iron).setBlockName("machine_catalytic_reformer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_hydrotreater = new MachineHydrotreater(Material.iron).setBlockName("machine_hydrotreater").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_coker = new MachineCoker(Material.iron).setBlockName("machine_coker").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_autosaw = new MachineAutosaw().setBlockName("machine_autosaw").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_excavator = new MachineExcavator().setBlockName("machine_excavator").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
@ -3361,6 +3363,7 @@ public class ModBlocks {
|
||||
register(fraction_spacer);
|
||||
register(machine_catalytic_cracker);
|
||||
register(machine_catalytic_reformer);
|
||||
register(machine_hydrotreater);
|
||||
register(machine_coker);
|
||||
register(machine_autosaw);
|
||||
register(machine_excavator);
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineHydrotreater;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class MachineHydrotreater extends BlockDummyable {
|
||||
|
||||
public MachineHydrotreater(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachineHydrotreater();
|
||||
if(meta >= 6) return new TileEntityProxyCombo().fluid().power();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return standardOpenBehavior(world, x, y, z, player, side);
|
||||
}
|
||||
|
||||
@Override public int[] getDimensions() { return new int[] {6, 0, 1, 1, 1, 1}; }
|
||||
@Override public int getOffset() { return 1; }
|
||||
|
||||
@Override
|
||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
this.makeExtra(world, x - dir.offsetX + 1, y, z - dir.offsetZ + 1);
|
||||
this.makeExtra(world, x - dir.offsetX + 1, y, z - dir.offsetZ - 1);
|
||||
this.makeExtra(world, x - dir.offsetX - 1, y, z - dir.offsetZ + 1);
|
||||
this.makeExtra(world, x - dir.offsetX - 1, y, z - dir.offsetZ - 1);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,107 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotTakeOnly;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineHydrotreater;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
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 ContainerMachineHydrotreater extends Container {
|
||||
|
||||
private TileEntityMachineHydrotreater hydrotreater;
|
||||
|
||||
public ContainerMachineHydrotreater(InventoryPlayer invPlayer, TileEntityMachineHydrotreater tedf) {
|
||||
|
||||
hydrotreater = tedf;
|
||||
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 17, 90));
|
||||
//Canister Input
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 35, 90));
|
||||
//Canister Output
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 2, 35, 108));
|
||||
//Hydrogen Input
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 53, 90));
|
||||
//Hydrogen Output
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 53, 108));
|
||||
//Desulfated Oil Input
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 125, 90));
|
||||
//Desulfated Oil Output
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 6, 125, 108));
|
||||
//Sour Gas Input
|
||||
this.addSlotToContainer(new Slot(tedf, 7, 143, 90));
|
||||
//Sour Gas Oil Output
|
||||
this.addSlotToContainer(new SlotTakeOnly(tedf, 8, 143, 108));
|
||||
//Fluid ID
|
||||
this.addSlotToContainer(new Slot(tedf, 9, 17, 108));
|
||||
//Catalyst
|
||||
this.addSlotToContainer(new Slot(tedf, 10, 89, 36));
|
||||
|
||||
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, 156 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 214));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if(par2 <= 10) {
|
||||
if(!this.mergeItemStack(var5, 11, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
|
||||
if(var3.getItem() instanceof IBatteryItem) {
|
||||
if(!this.mergeItemStack(var5, 0, 1, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if(var3.getItem() instanceof IItemFluidIdentifier) {
|
||||
if(!this.mergeItemStack(var5, 9, 10, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if(var3.getItem() == ModItems.catalytic_converter) {
|
||||
if(!this.mergeItemStack(var5, 10, 11, false)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if(!this.mergeItemStack(var5, 1, 2, false))
|
||||
if(!this.mergeItemStack(var5, 3, 4, false))
|
||||
if(!this.mergeItemStack(var5, 5, 6, false))
|
||||
if(!this.mergeItemStack(var5, 7, 8, false))
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return hydrotreater.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -15,6 +15,7 @@ import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.TEFluidPacket;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.Item;
|
||||
@ -300,5 +301,18 @@ public class FluidTank {
|
||||
|
||||
this.pressure = nbt.getShort(s + "_p");
|
||||
}
|
||||
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeInt(fluid);
|
||||
buf.writeInt(maxFluid);
|
||||
buf.writeInt(type.getID());
|
||||
buf.writeShort((short) pressure);
|
||||
}
|
||||
|
||||
public void deserialize(ByteBuf buf) {
|
||||
fluid = buf.readInt();
|
||||
maxFluid = buf.readInt();
|
||||
type = Fluids.fromID(buf.readInt());
|
||||
pressure = buf.readShort();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineHydrotreater;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.oil.TileEntityMachineHydrotreater;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineHydrotreater extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_hydrotreater.png");
|
||||
private TileEntityMachineHydrotreater refinery;
|
||||
|
||||
public GUIMachineHydrotreater(InventoryPlayer invPlayer, TileEntityMachineHydrotreater tedf) {
|
||||
super(new ContainerMachineHydrotreater(invPlayer, tedf));
|
||||
refinery = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 238;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
refinery.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 35, guiTop + 70 - 52, 16, 52);
|
||||
refinery.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 53, guiTop + 70 - 52, 16, 52);
|
||||
refinery.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 125, guiTop + 70 - 52, 16, 52);
|
||||
refinery.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 143, guiTop + 70 - 52, 16, 52);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 17, guiTop + 70 - 52, 16, 52, refinery.power, refinery.maxPower);
|
||||
|
||||
if(this.mc.thePlayer.inventory.getItemStack() == null && this.isMouseOverSlot(this.inventorySlots.getSlot(10), mouseX, mouseY) && !this.inventorySlots.getSlot(10).getHasStack()) {
|
||||
List<Object[]> lines = new ArrayList();
|
||||
ItemStack converter = new ItemStack(ModItems.catalytic_converter);
|
||||
lines.add(new Object[] {converter});
|
||||
lines.add(new Object[] {converter.getDisplayName()});
|
||||
this.drawStackText(lines, mouseX, mouseY, this.fontRendererObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.refinery.hasCustomInventoryName() ? this.refinery.getInventoryName() : I18n.format(this.refinery.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 5, 0xffffff);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int j = (int) (refinery.power * 54 / refinery.maxPower);
|
||||
drawTexturedModalRect(guiLeft + 17, guiTop + 70 - j, 176, 52 - j, 16, j);
|
||||
|
||||
refinery.tanks[0].renderTank(guiLeft + 35, guiTop + 70, this.zLevel, 16, 52);
|
||||
refinery.tanks[1].renderTank(guiLeft + 53, guiTop + 70, this.zLevel, 16, 52);
|
||||
refinery.tanks[2].renderTank(guiLeft + 125, guiTop + 70, this.zLevel, 16, 52);
|
||||
refinery.tanks[3].renderTank(guiLeft + 143, guiTop + 70, this.zLevel, 16, 52);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package com.hbm.inventory.recipes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||
import com.hbm.items.machine.ItemFluidIcon;
|
||||
import com.hbm.util.Tuple.Triplet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class HydrotreatingRecipes extends SerializableRecipe {
|
||||
|
||||
private static HashMap<FluidType, Triplet<FluidStack, FluidStack, FluidStack>> recipes = new HashMap();
|
||||
|
||||
@Override
|
||||
public void registerDefaults() {
|
||||
|
||||
}
|
||||
|
||||
public static Triplet<FluidStack, FluidStack, FluidStack> getOutput(FluidType type) {
|
||||
return recipes.get(type);
|
||||
}
|
||||
|
||||
public static HashMap<Object, Object[]> getRecipes() {
|
||||
|
||||
HashMap<Object, Object[]> map = new HashMap<Object, Object[]>();
|
||||
|
||||
for(Entry<FluidType, Triplet<FluidStack, FluidStack, FluidStack>> recipe : recipes.entrySet()) {
|
||||
map.put(new ItemStack[] {
|
||||
ItemFluidIcon.make(recipe.getKey(), 1000),
|
||||
ItemFluidIcon.make(recipe.getValue().getX().type, recipe.getValue().getX().fill * 10) },
|
||||
new ItemStack[] {
|
||||
ItemFluidIcon.make(recipe.getValue().getY().type, recipe.getValue().getY().fill * 10),
|
||||
ItemFluidIcon.make(recipe.getValue().getZ().type, recipe.getValue().getZ().fill * 10) });
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return "hbmHydrotreating.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getRecipeObject() {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readRecipe(JsonElement recipe) {
|
||||
JsonObject obj = (JsonObject) recipe;
|
||||
|
||||
FluidType input = Fluids.fromName(obj.get("input").getAsString());
|
||||
FluidStack hydrogen = this.readFluidStack(obj.get("hydrogen").getAsJsonArray());
|
||||
FluidStack output1 = this.readFluidStack(obj.get("output1").getAsJsonArray());
|
||||
FluidStack output2 = this.readFluidStack(obj.get("output2").getAsJsonArray());
|
||||
|
||||
recipes.put(input, new Triplet(hydrogen, output1, output2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRecipe(Object recipe, JsonWriter writer) throws IOException {
|
||||
Entry<FluidType, Triplet<FluidStack, FluidStack, FluidStack>> rec = (Entry<FluidType, Triplet<FluidStack, FluidStack, FluidStack>>) recipe;
|
||||
|
||||
writer.name("input").value(rec.getKey().getName());
|
||||
writer.name("hydrogen"); this.writeFluidStack(rec.getValue().getX(), writer);
|
||||
writer.name("output1"); this.writeFluidStack(rec.getValue().getY(), writer);
|
||||
writer.name("output2"); this.writeFluidStack(rec.getValue().getZ(), writer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRecipes() {
|
||||
recipes.clear();
|
||||
}
|
||||
}
|
||||
@ -52,6 +52,7 @@ public abstract class SerializableRecipe {
|
||||
recipeHandlers.add(new FractionRecipes());
|
||||
recipeHandlers.add(new CrackingRecipes());
|
||||
recipeHandlers.add(new ReformingRecipes());
|
||||
recipeHandlers.add(new HydrotreatingRecipes());
|
||||
recipeHandlers.add(new LiquefactionRecipes());
|
||||
recipeHandlers.add(new SolidificationRecipes());
|
||||
recipeHandlers.add(new CokerRecipes());
|
||||
|
||||
@ -294,6 +294,7 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAutosaw.class, new RenderAutosaw());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineVacuumDistill.class, new RenderVacuumDistill());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineCatalyticReformer.class, new RenderCatalyticReformer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineHydrotreater.class, new RenderHydrotreater());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineCoker.class, new RenderCoker());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFan.class, new RenderFan());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPistonInserter.class, new RenderPistonInserter());
|
||||
|
||||
@ -80,12 +80,13 @@ public class ResourceManager {
|
||||
public static final IModelCustom refinery_exploded = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/refinery_exploded.obj"));
|
||||
public static final IModelCustom fraction_tower = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/fraction_tower.obj"));
|
||||
public static final IModelCustom fraction_spacer = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/fraction_spacer.obj"));
|
||||
public static final IModelCustom cracking_tower = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/cracking_tower.obj"));
|
||||
public static final IModelCustom catalytic_reformer = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/catalytic_reformer.obj"));
|
||||
public static final IModelCustom cracking_tower = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/cracking_tower.obj")).asDisplayList();
|
||||
public static final IModelCustom catalytic_reformer = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/catalytic_reformer.obj")).asDisplayList();
|
||||
public static final IModelCustom hydrotreater = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/hydrotreater.obj")).asDisplayList();
|
||||
public static final IModelCustom liquefactor = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/liquefactor.obj"));
|
||||
public static final IModelCustom solidifier = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/solidifier.obj"));
|
||||
public static final IModelCustom compressor = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/compressor.obj"));
|
||||
public static final IModelCustom coker = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/coker.obj"));
|
||||
public static final IModelCustom coker = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/coker.obj")).asDisplayList();
|
||||
|
||||
//Flare Stack
|
||||
public static final IModelCustom oilflare = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/flare_stack.obj"));
|
||||
@ -479,6 +480,7 @@ public class ResourceManager {
|
||||
public static final ResourceLocation fraction_spacer_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/fraction_spacer.png");
|
||||
public static final ResourceLocation cracking_tower_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cracking_tower.png");
|
||||
public static final ResourceLocation catalytic_reformer_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/catalytic_reformer.png");
|
||||
public static final ResourceLocation hydrotreater_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/hydrotreater.png");
|
||||
public static final ResourceLocation liquefactor_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/liquefactor.png");
|
||||
public static final ResourceLocation solidifier_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/solidifier.png");
|
||||
public static final ResourceLocation compressor_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/compressor.png");
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderBase;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class RenderHydrotreater extends TileEntitySpecialRenderer implements IItemRendererProvider {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y, z + 0.5);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.hydrotreater_tex);
|
||||
ResourceManager.hydrotreater.renderAll();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemForRenderer() {
|
||||
return Item.getItemFromBlock(ModBlocks.machine_hydrotreater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemRenderer getRenderer() {
|
||||
return new ItemRenderBase() {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -4, 0);
|
||||
GL11.glScaled(4, 4, 4);
|
||||
}
|
||||
public void renderCommon() {
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.hydrotreater_tex);
|
||||
ResourceManager.hydrotreater.renderAll();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}};
|
||||
}
|
||||
}
|
||||
@ -55,7 +55,7 @@ public class TileEntityMachineCatalyticReformer extends TileEntityMachineBase im
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
if(this.worldObj.getTotalWorldTime() % 20 == 0) this.updateConnections();
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
tanks[0].setType(9, slots);
|
||||
tanks[0].loadTank(1, 2, slots);
|
||||
|
||||
@ -0,0 +1,208 @@
|
||||
package com.hbm.tileentity.machine.oil;
|
||||
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.container.ContainerMachineHydrotreater;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachineHydrotreater;
|
||||
import com.hbm.inventory.recipes.HydrotreatingRecipes;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.Tuple.Triplet;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineHydrotreater extends TileEntityMachineBase implements IEnergyUser, IFluidStandardTransceiver, IPersistentNBT, IGUIProvider {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1_000_000;
|
||||
|
||||
public FluidTank[] tanks;
|
||||
|
||||
public TileEntityMachineHydrotreater() {
|
||||
super(11);
|
||||
|
||||
this.tanks = new FluidTank[4];
|
||||
this.tanks[0] = new FluidTank(Fluids.OIL, 64_000);
|
||||
this.tanks[1] = new FluidTank(Fluids.HYDROGEN, 64_000);
|
||||
this.tanks[2] = new FluidTank(Fluids.NONE, 24_000);
|
||||
this.tanks[3] = new FluidTank(Fluids.SOURGAS, 24_000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.hydrotreater";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(this.worldObj.getTotalWorldTime() % 20 == 0) this.updateConnections();
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
tanks[0].setType(9, slots);
|
||||
|
||||
tanks[0].loadTank(1, 2, slots);
|
||||
tanks[1].loadTank(3, 4, slots);
|
||||
|
||||
reform();
|
||||
|
||||
tanks[2].unloadTank(5, 6, slots);
|
||||
tanks[3].unloadTank(7, 8, slots);
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
for(int i = 2; i < 4; i++) {
|
||||
if(tanks[i].getFill() > 0) {
|
||||
this.sendFluid(tanks[i], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void reform() {
|
||||
|
||||
Triplet<FluidStack, FluidStack, FluidStack> out = HydrotreatingRecipes.getOutput(tanks[0].getTankType());
|
||||
if(out == null) {
|
||||
tanks[2].setTankType(Fluids.NONE);
|
||||
tanks[3].setTankType(Fluids.NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
tanks[1].setTankType(out.getX().type);
|
||||
tanks[2].setTankType(out.getY().type);
|
||||
tanks[3].setTankType(out.getZ().type);
|
||||
|
||||
if(power < 20_000) return;
|
||||
if(tanks[0].getFill() < 50) return;
|
||||
if(tanks[1].getFill() < out.getX().fill) return;
|
||||
if(slots[10] == null || slots[10].getItem() != ModItems.catalytic_converter) return;
|
||||
|
||||
if(tanks[2].getFill() + out.getY().fill > tanks[2].getMaxFill()) return;
|
||||
if(tanks[3].getFill() + out.getZ().fill > tanks[3].getMaxFill()) return;
|
||||
|
||||
tanks[0].setFill(tanks[0].getFill() - 50);
|
||||
tanks[1].setFill(tanks[1].getFill() - out.getX().fill);
|
||||
tanks[2].setFill(tanks[2].getFill() + out.getY().fill);
|
||||
tanks[3].setFill(tanks[3].getFill() + out.getZ().fill);
|
||||
|
||||
power -= 20_000;
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + 2, yCoord, zCoord + 1, Library.POS_X),
|
||||
new DirPos(xCoord + 2, yCoord, zCoord - 1, Library.POS_X),
|
||||
new DirPos(xCoord - 2, yCoord, zCoord + 1, Library.NEG_X),
|
||||
new DirPos(xCoord - 2, yCoord, zCoord - 1, Library.NEG_X),
|
||||
new DirPos(xCoord + 1, yCoord, zCoord + 2, Library.POS_Z),
|
||||
new DirPos(xCoord - 1, yCoord, zCoord + 2, Library.POS_Z),
|
||||
new DirPos(xCoord + 1, yCoord, zCoord - 2, Library.NEG_Z),
|
||||
new DirPos(xCoord - 1, yCoord, zCoord - 2, Library.NEG_Z)
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
power = nbt.getLong("power");
|
||||
tanks[0].readFromNBT(nbt, "t0");
|
||||
tanks[1].readFromNBT(nbt, "t1");
|
||||
tanks[2].readFromNBT(nbt, "t2");
|
||||
tanks[3].readFromNBT(nbt, "t3");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setLong("power", power);
|
||||
tanks[0].writeToNBT(nbt, "t0");
|
||||
tanks[1].writeToNBT(nbt, "t1");
|
||||
tanks[2].writeToNBT(nbt, "t2");
|
||||
tanks[3].writeToNBT(nbt, "t3");
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 1,
|
||||
yCoord,
|
||||
zCoord - 1,
|
||||
xCoord + 2,
|
||||
yCoord + 7,
|
||||
zCoord + 2
|
||||
);
|
||||
}
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override public long getPower() { return power; }
|
||||
@Override public void setPower(long power) { this.power = power; }
|
||||
@Override public long getMaxPower() { return maxPower; }
|
||||
@Override public FluidTank[] getAllTanks() { return tanks; }
|
||||
@Override public FluidTank[] getSendingTanks() { return new FluidTank[] {tanks[2], tanks[3]}; }
|
||||
@Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {tanks[0], tanks[1]}; }
|
||||
@Override public boolean canConnect(ForgeDirection dir) { return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.DOWN; }
|
||||
@Override public boolean canConnect(FluidType type, ForgeDirection dir) { return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.DOWN; }
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound nbt) {
|
||||
if(tanks[0].getFill() == 0 && tanks[1].getFill() == 0 && tanks[2].getFill() == 0 && tanks[3].getFill() == 0) return;
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
for(int i = 0; i < 4; i++) this.tanks[i].writeToNBT(data, "" + i);
|
||||
nbt.setTag(NBT_PERSISTENT_KEY, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound nbt) {
|
||||
NBTTagCompound data = nbt.getCompoundTag(NBT_PERSISTENT_KEY);
|
||||
for(int i = 0; i < 4; i++) this.tanks[i].readFromNBT(data, "" + i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerMachineHydrotreater(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIMachineHydrotreater(player.inventory, this);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Loading…
x
Reference in New Issue
Block a user