combination oven

This commit is contained in:
Bob 2022-12-08 22:56:20 +01:00
parent 7a92f88338
commit 0b6d457525
23 changed files with 946 additions and 19 deletions

View File

@ -658,6 +658,7 @@ public class ModBlocks {
public static Block furnace_iron;
public static Block furnace_steel;
public static Block furnace_combination;
public static Block machine_stirling;
public static Block machine_stirling_steel;
public static Block machine_sawmill;
@ -1853,6 +1854,7 @@ public class ModBlocks {
furnace_iron = new FurnaceIron().setBlockName("furnace_iron").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_aluminium");
furnace_steel = new FurnaceSteel().setBlockName("furnace_steel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
furnace_combination = new FurnaceCombination().setBlockName("furnace_combination").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":brick_light_alt");
machine_stirling = new MachineStirling().setBlockName("machine_stirling").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_stirling_steel = new MachineStirling().setBlockName("machine_stirling_steel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_sawmill = new MachineSawmill().setBlockName("machine_sawmill").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
@ -3047,6 +3049,7 @@ public class ModBlocks {
register(heater_heatex);
register(furnace_iron);
register(furnace_steel);
register(furnace_combination);
register(machine_stirling);
register(machine_stirling_steel);
register(machine_sawmill);

View File

@ -0,0 +1,48 @@
package com.hbm.blocks.machine;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityFurnaceCombination;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class FurnaceCombination extends BlockDummyable implements ITooltipProvider {
public FurnaceCombination() {
super(Material.rock);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12)
return new TileEntityFurnaceCombination();
return new TileEntityProxyCombo().inventory().fluid();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
return this.standardOpenBehavior(world, x, y, z, player, 0);
}
@Override
public int[] getDimensions() {
return new int[] {1, 0, 1, 1, 1, 1};
}
@Override
public int getOffset() {
return 1;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
this.addStandardInfo(stack, player, list, ext);
}
}

View File

@ -57,11 +57,13 @@ public class EntityChemical extends EntityThrowableNT {
public EntityChemical(World world) {
super(world);
this.ignoreFrustumCheck = true;
this.isImmuneToFire = true;
}
public EntityChemical(World world, EntityLivingBase thrower) {
super(world, thrower);
this.ignoreFrustumCheck = true;
this.isImmuneToFire = true;
}
@Override

View File

@ -0,0 +1,16 @@
package com.hbm.handler.nei;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.recipes.CombinationRecipes;
public class CombinationHandler extends NEIUniversalHandler {
public CombinationHandler() {
super("Combination Furnace", ModBlocks.furnace_combination, CombinationRecipes.getRecipes());
}
@Override
public String getKey() {
return "ntmCombination";
}
}

View File

@ -0,0 +1,72 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.inventory.SlotSmelting;
import com.hbm.tileentity.machine.TileEntityFurnaceCombination;
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 ContainerFurnaceCombo extends Container {
protected TileEntityFurnaceCombination furnace;
public ContainerFurnaceCombo(InventoryPlayer invPlayer, TileEntityFurnaceCombination furnace) {
this.furnace = furnace;
//input
this.addSlotToContainer(new Slot(furnace, 0, 26, 36));
//output
this.addSlotToContainer(new SlotSmelting(invPlayer.player, furnace, 1, 89, 36));
this.addSlotToContainer(new Slot(furnace, 2, 136, 18));
this.addSlotToContainer(new SlotMachineOutput(furnace, 3, 136, 54));
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, 104 + i * 18));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 162));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
ItemStack stack = null;
Slot slot = (Slot) this.inventorySlots.get(index);
if(slot != null && slot.getHasStack()) {
ItemStack originalStack = slot.getStack();
stack = originalStack.copy();
if(index <= 3) {
if(!this.mergeItemStack(originalStack, 4, this.inventorySlots.size(), true)) {
return null;
}
slot.onSlotChange(originalStack, stack);
} else if(!this.mergeItemStack(originalStack, 0, 1, false)) {
return null;
}
if(originalStack.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
}
return stack;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return furnace.isUseableByPlayer(player);
}
}

View File

@ -33,8 +33,14 @@ public class FluidTank {
FluidType type;
int fluid;
int maxFluid;
public int index;
public int index = 0;
public FluidTank(FluidType type, int maxFluid) {
this.type = type;
this.maxFluid = maxFluid;
}
@Deprecated // indices are no longer needed
public FluidTank(FluidType type, int maxFluid, int index) {
this.type = type;
this.maxFluid = maxFluid;

View File

@ -146,11 +146,11 @@ public class GUIAnvil extends GuiContainer {
return;
}
if(guiLeft + 97 <= x && guiLeft + 97 + 18 > x && guiTop + 107 < y && guiTop + 107 + 18 >= y) {
/*if(guiLeft + 97 <= x && guiLeft + 97 + 18 > x && guiTop + 107 < y && guiTop + 107 + 18 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
search(this.search.getText());
return;
}
}*/
for(int i = index * 2; i < index * 2 + 10; i++) {
@ -322,9 +322,9 @@ public class GUIAnvil extends GuiContainer {
if(guiLeft + 52 <= mX && guiLeft + 52 + 18 > mX && guiTop + 53 < mY && guiTop + 53 + 18 >= mY) {
drawTexturedModalRect(guiLeft + 52, guiTop + 53, 176, 150, 18, 18);
}
if(guiLeft + 97 <= mX && guiLeft + 97 + 18 > mX && guiTop + 107 < mY && guiTop + 107 + 18 >= mY) {
/*if(guiLeft + 97 <= mX && guiLeft + 97 + 18 > mX && guiTop + 107 < mY && guiTop + 107 + 18 >= mY) {
drawTexturedModalRect(guiLeft + 97, guiTop + 107, 176, 168, 18, 18);
}
}*/
for(int i = index * 2; i < index * 2 + 10; i++) {
if(i >= recipes.size())
@ -363,13 +363,9 @@ public class GUIAnvil extends GuiContainer {
@Override
protected void keyTyped(char c, int key) {
if(!this.search.textboxKeyTyped(c, key)) {
if(key == 28) {
this.search.setFocused(false);
search(this.search.getText());
}
if(this.search.textboxKeyTyped(c, key)) {
search(this.search.getText());
} else {
super.keyTyped(c, key);
}
}

View File

@ -0,0 +1,59 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerFurnaceCombo;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityFurnaceCombination;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIFurnaceCombo extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_furnace_combination.png");
private TileEntityFurnaceCombination furnace;
public GUIFurnaceCombo(InventoryPlayer invPlayer, TileEntityFurnaceCombination tedf) {
super(new ContainerFurnaceCombo(invPlayer, tedf));
furnace = tedf;
this.xSize = 176;
this.ySize = 186;
}
@Override
public void drawScreen(int x, int y, float interp) {
super.drawScreen(x, y, interp);
furnace.tank.renderTankInfo(this, x, y, guiLeft + 118, guiTop + 18, 16, 52);
this.drawCustomInfoStat(x, y, guiLeft + 44, guiTop + 36, 39, 7, x, y, new String[] { String.format("%,d", furnace.progress) + " / " + String.format("%,d", furnace.processTime) + "TU" });
this.drawCustomInfoStat(x, y, guiLeft + 44, guiTop + 45, 39, 7, x, y, new String[] { String.format("%,d", furnace.heat) + " / " + String.format("%,d", furnace.maxHeat) + "TU" });
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.furnace.hasCustomInventoryName() ? this.furnace.getInventoryName() : I18n.format(this.furnace.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float interp, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int p = furnace.progress * 38 / furnace.processTime;
drawTexturedModalRect(guiLeft + 45, guiTop + 37, 176, 0, p, 5);
int h = furnace.heat * 37 / furnace.maxHeat;
drawTexturedModalRect(guiLeft + 45, guiTop + 46, 176, 5, h, 5);
furnace.tank.renderTank(guiLeft + 118, guiTop + 70, this.zLevel, 16, 52);
}
}

View File

@ -0,0 +1,88 @@
package com.hbm.inventory.recipes;
import java.util.HashMap;
import java.util.Map.Entry;
import static com.hbm.inventory.OreDictManager.*;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.OreDictManager.DictFrame;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ItemEnums.EnumCokeType;
import com.hbm.items.ItemEnums.EnumTarType;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemFluidIcon;
import com.hbm.util.Tuple.Pair;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class CombinationRecipes {
private static HashMap<Object, Pair<ItemStack, FluidStack>> recipes = new HashMap();
public static void register() {
recipes.put(COAL.gem(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), new FluidStack(Fluids.COALOIL, 50)));
recipes.put(COAL.dust(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), new FluidStack(Fluids.COALOIL, 50)));
recipes.put(LIGNITE.gem(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), new FluidStack(Fluids.COALOIL, 50)));
recipes.put(LIGNITE.dust(), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), new FluidStack(Fluids.COALOIL, 50)));
recipes.put(new ComparableStack(ModItems.briquette_lignite), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), new FluidStack(Fluids.COALOIL, 50)));
recipes.put(CINNABAR.crystal(), new Pair(new ItemStack(ModItems.sulfur), new FluidStack(Fluids.MERCURY, 100)));
recipes.put(KEY_LOG, new Pair(new ItemStack(Items.coal, 1 ,1), new FluidStack(Fluids.HEATINGOIL, 10)));
recipes.put(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.PETROLEUM), null));
recipes.put(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRACK), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.PETROLEUM), null));
recipes.put(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.COAL), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), null));
}
public static Pair<ItemStack, FluidStack> getOutput(ItemStack stack) {
if(stack == null || stack.getItem() == null)
return null;
ComparableStack comp = new ComparableStack(stack.getItem(), 1, stack.getItemDamage());
if(recipes.containsKey(comp)) {
Pair<ItemStack, FluidStack> out = recipes.get(comp);
return new Pair(out.getKey() == null ? null : out.getKey().copy(), out.getValue());
}
String[] dictKeys = comp.getDictKeys();
for(String key : dictKeys) {
if(recipes.containsKey(key)) {
Pair<ItemStack, FluidStack> out = recipes.get(key);
return new Pair(out.getKey() == null ? null : out.getKey().copy(), out.getValue());
}
}
return null;
}
public static HashMap getRecipes() {
HashMap<Object, Object[]> recipes = new HashMap<Object, Object[]>();
for(Entry<Object, Pair<ItemStack, FluidStack>> entry : CombinationRecipes.recipes.entrySet()) {
Object key = entry.getKey();
Pair<ItemStack, FluidStack> val = entry.getValue();
Object o = key instanceof String ? new OreDictStack((String) key) : key;
if(val.getKey() != null && val.getValue() != null) {
recipes.put(o, new ItemStack[] {val.getKey(), ItemFluidIcon.make(val.getValue())});
} else if(val.getKey() != null) {
recipes.put(o, new ItemStack[] {val.getKey()});
} else if(val.getValue() != null) {
recipes.put(o, new ItemStack[] {ItemFluidIcon.make(val.getValue())});
}
}
return recipes;
}
}

View File

@ -248,6 +248,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityElectrolyser.class, new RenderElectrolyser());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFurnaceIron.class, new RenderFurnaceIron());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFurnaceSteel.class, new RenderFurnaceSteel());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFurnaceCombination.class, new RenderFurnaceCombination());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHeaterFirebox.class, new RenderFirebox());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHeaterOven.class, new RenderHeatingOven());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHeaterOilburner.class, new RenderOilburner());

View File

@ -783,6 +783,7 @@ public class MainRegistry {
RefineryRecipes.registerCracking();
RadiolysisRecipes.registerRadiolysis();
GasCentrifugeRecipes.register();
CombinationRecipes.register();
//the good stuff
SerializableRecipe.registerAllHandlers();

View File

@ -63,6 +63,7 @@ public class NEIConfig implements IConfigureNEI {
registerHandler(new CrackingHandler());
registerHandler(new FractioningHandler());
registerHandler(new BoilingHandler());
registerHandler(new CombinationHandler());
//Some things are even beyond my control...or are they?
API.hideItem(ItemBattery.getEmptyBattery(ModItems.memory));

View File

@ -74,6 +74,7 @@ public class ResourceManager {
//Furnaces
public static final IModelCustom furnace_iron = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/furnace_iron.obj"));
public static final IModelCustom furnace_steel = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/furnace_steel.obj"));
public static final IModelCustom combination_oven = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/combination_oven.obj"));
//Landmines
public static final IModelCustom mine_ap = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/mine_ap.obj"));
@ -407,6 +408,7 @@ public class ResourceManager {
//Furnaces
public static final ResourceLocation furnace_iron_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/furnace_iron.png");
public static final ResourceLocation furnace_steel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/furnace_steel.png");
public static final ResourceLocation combination_oven_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/combination_oven.png");
//Oil Pumps
public static final ResourceLocation derrick_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/derrick.png");

View File

@ -17,7 +17,7 @@ import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class ParticleRBMKFlame extends EntityFX {
private static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/particle/rbmk_fire.png");
public static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/particle/rbmk_fire.png");
private TextureManager theRenderEngine;
public ParticleRBMKFlame(TextureManager texman, World world, double x, double y, double z, int maxAge) {

View File

@ -0,0 +1,107 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ModBlocks;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import com.hbm.render.item.ItemRenderBase;
import com.hbm.tileentity.machine.TileEntityFurnaceCombination;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
public class RenderFurnaceCombination extends TileEntitySpecialRenderer implements IItemRendererProvider {
public static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/particle/rbmk_fire.png");
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
bindTexture(ResourceManager.combination_oven_tex);
ResourceManager.combination_oven.renderAll();
TileEntityFurnaceCombination furnace = (TileEntityFurnaceCombination) tileEntity;
if(furnace.wasOn) {
bindTexture(texture);
GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glAlphaFunc(GL11.GL_GEQUAL, 0);
GL11.glDepthMask(false);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
RenderHelper.disableStandardItemLighting();
int texIndex = (int) (furnace.getWorldObj().getTotalWorldTime() / 2 % 14);
float f0 = 1F / 14F;
float uMin = texIndex % 5 * f0;
float uMax = uMin + f0;
float vMin = 0;
float vMax = 1;
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.setNormal(0.0F, 1.0F, 0.0F);
tess.setBrightness(240);
tess.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glTranslated(0, 1.75, 0);
GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
double scaleH = 1;
double scaleV = 3;
tess.addVertexWithUV(-scaleH, 0, 0, uMax, vMax);
tess.addVertexWithUV(-scaleH, scaleV, 0, uMax, vMin);
tess.addVertexWithUV(scaleH, scaleV, 0, uMin, vMin);
tess.addVertexWithUV(scaleH, 0, 0, uMin, vMax);
tess.draw();
//GL11.glPolygonOffset(0.0F, 0.0F);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glDepthMask(true);
GL11.glPopMatrix();
RenderHelper.enableStandardItemLighting();
}
GL11.glPopMatrix();
}
@Override
public Item getItemForRenderer() {
return Item.getItemFromBlock(ModBlocks.furnace_combination);
}
@Override
public IItemRenderer getRenderer() {
return new ItemRenderBase( ) {
public void renderInventory() {
GL11.glTranslated(0, -1.5, 0);
GL11.glScaled(3.25, 3.25, 3.25);
}
public void renderCommon() {
bindTexture(ResourceManager.combination_oven_tex);
ResourceManager.combination_oven.renderAll();
}};
}
}

View File

@ -37,7 +37,7 @@ public abstract class RenderTurretBase extends TileEntitySpecialRenderer {
private void checkPlug(World world, int x, int y, int z, boolean power, boolean fluid, FluidType type, int ox, int oz, int rot, ForgeDirection dir) {
if((power && Library.canConnect(world, x, y, z, dir)) || (fluid && Library.checkFluidConnectables(world, x, y, z, type))) {
if((power && Library.canConnect(world, x, y, z, dir)) || (fluid && Library.checkFluidConnectables(world, x, y, z, type)) || (fluid && Library.canConnectFluid(world, x, y, z, dir, type))) {
GL11.glPushMatrix();
GL11.glRotated(rot, 0, 1, 0);

View File

@ -241,6 +241,7 @@ public class TileMappings {
put(TileEntityHeaterHeatex.class, "tileentity_heater_heatex");
put(TileEntityFurnaceIron.class, "tileentity_furnace_iron");
put(TileEntityFurnaceSteel.class, "tileentity_furnace_steel");
put(TileEntityFurnaceCombination.class, "tileentity_combination_oven");
put(TileEntityStirling.class, "tileentity_stirling");
put(TileEntitySawmill.class, "tileentity_sawmill");
put(TileEntityCrucible.class, "tileentity_crucible");

View File

@ -0,0 +1,250 @@
package com.hbm.tileentity.machine;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.container.ContainerFurnaceCombo;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIFurnaceCombo;
import com.hbm.inventory.recipes.CombinationRecipes;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.Tuple.Pair;
import api.hbm.fluid.IFluidStandardSender;
import api.hbm.tile.IHeatSource;
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.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityFurnaceCombination extends TileEntityMachineBase implements IFluidStandardSender, IGUIProvider {
public boolean wasOn;
public int progress;
public static int processTime = 20_000;
public int heat;
public static int maxHeat = 100_000;
public static double diffusion = 0.25D;
public FluidTank tank;
public TileEntityFurnaceCombination() {
super(4);
this.tank = new FluidTank(Fluids.NONE, 24_000);
}
@Override
public String getName() {
return "container.furnaceCombination";
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
this.tryPullHeat();
if(this.worldObj.getTotalWorldTime() % 20 == 0) {
for(int i = 2; i < 6; i++) {
ForgeDirection dir = ForgeDirection.getOrientation(i);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
for(int y = yCoord; y <= yCoord + 1; y++) {
for(int j = -1; j <= 1; j++) {
if(tank.getFill() > 0) this.sendFluid(tank.getTankType(), worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * j, y, zCoord + dir.offsetZ * 2 + rot.offsetZ * j, dir);
}
}
}
for(int x = xCoord - 1; x <= xCoord + 1; x++) {
for(int z = zCoord - 1; z <= zCoord + 1; z++) {
if(tank.getFill() > 0) this.sendFluid(tank.getTankType(), worldObj, x, yCoord + 2, z, ForgeDirection.UP);
}
}
}
this.wasOn = false;
tank.unloadTank(2, 3, slots);
if(canSmelt()) {
int burn = heat / 100;
if(burn > 0) {
this.wasOn = true;
this.progress += burn;
this.heat -= burn;
if(progress >= processTime) {
this.markChanged();
progress -= this.processTime;
Pair<ItemStack, FluidStack> pair = CombinationRecipes.getOutput(slots[0]);
ItemStack out = pair.getKey();
FluidStack fluid = pair.getValue();
if(out != null) {
if(slots[1] == null) {
slots[1] = out.copy();
} else {
slots[1].stackSize += out.stackSize;
}
}
if(fluid != null) {
if(tank.getTankType() != fluid.type) {
tank.setTankType(fluid.type);
}
tank.setFill(tank.getFill() + fluid.fill);
}
this.decrStackSize(0, 1);
}
}
} else {
this.progress = 0;
}
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("wasOn", this.wasOn);
data.setInteger("heat", this.heat);
data.setInteger("progress", this.progress);
tank.writeToNBT(data, "t");
this.networkPack(data, 50);
} else {
if(this.wasOn && worldObj.rand.nextInt(15) == 0) {
worldObj.spawnParticle("lava", xCoord + 0.5 + worldObj.rand.nextGaussian() * 0.5, yCoord + 2, zCoord + 0.5 + worldObj.rand.nextGaussian() * 0.5, 0, 0, 0);
}
}
}
public boolean canSmelt() {
if(slots[0] == null) return false;
Pair<ItemStack, FluidStack> pair = CombinationRecipes.getOutput(slots[0]);
if(pair == null) return false;
ItemStack out = pair.getKey();
FluidStack fluid = pair.getValue();
if(out != null) {
if(slots[1] != null) {
if(!out.isItemEqual(slots[1])) return false;
if(out.stackSize + slots[1].stackSize > slots[1].getMaxStackSize()) return false;
}
}
if(fluid != null) {
if(tank.getTankType() != fluid.type && tank.getFill() > 0) return false;
if(tank.getTankType() == fluid.type && tank.getFill() + fluid.fill > tank.getMaxFill()) return false;
}
return true;
}
@Override
public void networkUnpack(NBTTagCompound nbt) {
this.wasOn = nbt.getBoolean("wasOn");
this.heat = nbt.getInteger("heat");
this.progress = nbt.getInteger("progress");
this.tank.readFromNBT(nbt, "t");
}
protected void tryPullHeat() {
if(this.heat >= this.maxHeat) return;
TileEntity con = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
if(con instanceof IHeatSource) {
IHeatSource source = (IHeatSource) con;
int diff = source.getHeatStored() - this.heat;
if(diff == 0) {
return;
}
if(diff > 0) {
diff = (int) Math.ceil(diff * diffusion);
source.useUpHeat(diff);
this.heat += diff;
if(this.heat > this.maxHeat)
this.heat = this.maxHeat;
return;
}
}
this.heat = Math.max(this.heat - Math.max(this.heat / 1000, 1), 0);
}
@Override
public int[] getAccessibleSlotsFromSide(int meta) {
return new int[] { 0, 1 };
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
return i == 0 && CombinationRecipes.getOutput(itemStack) != null;
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return i == 1;
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerFurnaceCombo(player.inventory, this);
}
@Override
@SideOnly(Side.CLIENT)
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIFurnaceCombo(player.inventory, this);
}
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) {
bb = AxisAlignedBB.getBoundingBox(
xCoord - 1,
yCoord,
zCoord - 1,
xCoord + 2,
yCoord + 2.125,
zCoord + 2
);
}
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[] {tank};
}
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] {tank};
}
}

View File

@ -69,7 +69,7 @@ public class TileEntitySawmill extends TileEntityMachineBase {
slots[1] = result;
if(result.getItem() != ModItems.powder_sawdust) {
float chance = result.getItem() == Items.stick ? 0.05F : 0.5F;
float chance = result.getItem() == Items.stick ? 0.1F : 0.5F;
if(worldObj.rand.nextFloat() < chance) {
slots[2] = new ItemStack(ModItems.powder_sawdust);
}
@ -258,6 +258,10 @@ public class TileEntitySawmill extends TileEntityMachineBase {
return new ItemStack(Items.stick, 4);
}
if(names.contains("treeSapling")) {
return new ItemStack(Items.stick, 1);
}
return null;
}

View File

@ -21,7 +21,6 @@ import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
@ -45,13 +44,17 @@ public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase impl
public void updateEntity() {
if(!worldObj.isRemote) {
this.worldObj.theProfiler.startSection("catalyticCracker_setup_tanks");
setupTanks();
this.worldObj.theProfiler.endStartSection("catalyticCracker_update_connections");
updateConnections();
this.worldObj.theProfiler.endStartSection("catalyticCracker_do_recipe");
if(worldObj.getTotalWorldTime() % 20 == 0)
crack();
this.worldObj.theProfiler.endStartSection("catalyticCracker_send_fluid");
if(worldObj.getTotalWorldTime() % 10 == 0) {
fillFluidInit(tanks[2].getTankType());
fillFluidInit(tanks[3].getTankType());
@ -70,6 +73,7 @@ public class TileEntityMachineCatalyticCracker extends TileEntityLoadedBase impl
INBTPacketReceiver.networkPack(this, data, 50);
}
this.worldObj.theProfiler.endSection();
}
}

View File

@ -0,0 +1,266 @@
# Blender v2.79 (sub 0) OBJ File: 'combination_oven.blend'
# www.blender.org
o Plane
v 0.750000 2.125000 -0.750000
v 0.750000 2.125000 0.750000
v -0.750000 2.125000 0.750000
v -0.750000 2.125000 -0.750000
v -1.500000 0.000000 1.500000
v 1.500000 0.000000 1.500000
v -1.500000 0.000000 -1.500000
v 1.500000 0.000000 -1.500000
v -1.500000 0.125000 -1.500000
v -1.500000 0.125000 1.500000
v 1.500000 0.125000 1.500000
v 1.500000 0.125000 -1.500000
v -1.375000 0.125000 -1.375000
v -1.375000 0.125000 1.375000
v 1.375000 0.125000 1.375000
v 1.375000 0.125000 -1.375000
v -1.375000 0.875000 -1.375000
v -1.375000 0.875000 1.375000
v 1.375000 0.875000 1.375000
v 1.375000 0.875000 -1.375000
v -1.000000 1.625000 -1.000000
v -1.000000 1.625000 1.000000
v 1.000000 1.625000 1.000000
v 1.000000 1.625000 -1.000000
v -1.000000 2.125000 -1.000000
v -1.000000 2.125000 1.000000
v 1.000000 2.125000 1.000000
v 1.000000 2.125000 -1.000000
v 0.750000 1.625000 -0.750000
v -0.750000 1.625000 -0.750000
v 0.750000 1.625000 0.750000
v -0.750000 1.625000 0.750000
v -0.500000 0.000000 0.500000
v 0.500000 0.000000 0.500000
v -0.500000 0.000000 -0.500000
v 0.500000 0.000000 -0.500000
v -0.500000 0.062500 -0.500000
v -0.500000 0.062500 0.500000
v 0.500000 0.062500 0.500000
v 0.500000 0.062500 -0.500000
v -0.437500 0.062500 -0.437500
v -0.437500 0.062500 0.437500
v 0.437500 0.062500 0.437500
v 0.437500 0.062500 -0.437500
v -0.437500 0.000000 -0.437500
v -0.437500 0.000000 0.437500
v 0.437500 0.000000 0.437500
v 0.437500 0.000000 -0.437500
vt 0.000000 0.489796
vt 0.347826 0.326531
vt 0.521739 0.489796
vt 0.521739 1.000000
vt 0.500000 0.530612
vt 0.521739 0.510204
vt 0.000000 0.510204
vt 0.521739 0.489796
vt 0.000000 0.510204
vt 0.000000 0.489796
vt 0.521739 0.489796
vt 0.000000 0.510204
vt 0.000000 0.489796
vt 0.521739 0.489796
vt 0.000000 0.510204
vt 0.000000 0.489796
vt 1.000000 0.000000
vt 0.521739 0.122449
vt 0.521739 0.000000
vt 0.021739 0.979592
vt 0.000000 1.000000
vt 0.021739 0.530612
vt 0.500000 0.979592
vt 1.000000 0.122449
vt 0.586957 0.244898
vt 0.521739 0.122449
vt 1.000000 -0.000000
vt 0.521739 -0.000000
vt 1.000000 0.000000
vt 0.521739 0.122449
vt 0.521739 0.000000
vt 1.000000 0.000000
vt 0.521739 0.122449
vt 0.521739 0.000000
vt 0.934783 0.244898
vt 0.586957 0.326531
vt 0.586957 0.244898
vt 1.000000 0.122449
vt 0.586957 0.244898
vt 1.000000 0.122449
vt 1.000000 0.122449
vt 0.586957 0.244898
vt 0.934783 0.326531
vt 0.630435 0.367347
vt 0.586957 0.326531
vt 0.934783 0.244898
vt 0.586957 0.326531
vt 0.934783 0.244898
vt 0.934783 0.244898
vt 0.586957 0.326531
vt 0.891304 0.653061
vt 0.630435 0.734694
vt 0.630435 0.653061
vt 0.586957 0.653061
vt 0.891304 0.612245
vt 0.934783 0.653061
vt 0.891304 0.367347
vt 0.630435 0.612245
vt 0.630435 0.979592
vt 0.891304 0.734694
vt 0.891304 0.979592
vt 0.891304 0.653061
vt 0.630435 0.734694
vt 0.630435 0.653061
vt 0.891304 0.653061
vt 0.630435 0.734694
vt 0.630435 0.653061
vt 0.891304 0.653061
vt 0.630435 0.734694
vt 0.630435 0.653061
vt 0.369565 0.714286
vt 0.358696 0.551020
vt 0.369565 0.551020
vt 0.000000 0.000000
vt 0.173913 0.326531
vt 0.521739 0.000000
vt 0.173913 0.163265
vt 0.347826 0.163265
vt 0.163043 0.551020
vt 0.173913 0.704082
vt 0.163043 0.714286
vt 0.152174 0.551020
vt 0.152174 0.714286
vt 0.173913 0.734694
vt 0.347826 0.724490
vt 0.347826 0.734694
vt 0.347826 0.530612
vt 0.173913 0.540816
vt 0.173913 0.530612
vt 0.184783 0.714286
vt 0.336957 0.704082
vt 0.336957 0.714286
vt 0.173913 0.724490
vt 0.347826 0.540816
vt 0.184783 0.551020
vt 0.358696 0.714286
vt 0.347826 0.561224
vt 0.336957 0.561224
vt 0.184783 0.704082
vt 0.184783 0.561224
vt 0.336957 0.551020
vt 0.347826 0.704082
vt 0.173913 0.561224
vt 0.521739 0.510204
vt 0.521739 0.510204
vt 0.521739 0.510204
vt 0.934783 0.326531
vt 0.934783 0.326531
vt 0.934783 0.326531
vt 0.891304 0.734694
vt 0.891304 0.734694
vt 0.891304 0.734694
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 0.0000 0.0000 1.0000
vn 0.8944 0.4472 0.0000
vn -0.8944 0.4472 0.0000
vn 0.0000 0.4472 -0.8944
vn 0.0000 0.4472 0.8944
s off
f 6/1/1 36/2/1 8/3/1
f 9/4/2 16/5/2 12/6/2
f 8/3/3 11/7/3 6/1/3
f 5/8/4 9/9/4 7/10/4
f 7/11/5 12/12/5 8/13/5
f 6/14/6 10/15/6 5/16/6
f 15/17/6 18/18/6 14/19/6
f 11/7/2 14/20/2 10/21/2
f 12/6/2 15/22/2 11/7/2
f 10/21/2 13/23/2 9/4/2
f 20/24/7 23/25/7 19/26/7
f 16/27/3 19/26/3 15/28/3
f 14/29/4 17/30/4 13/31/4
f 13/32/5 20/33/5 16/34/5
f 21/35/5 28/36/5 24/37/5
f 18/38/8 21/39/8 17/30/8
f 17/40/9 24/37/9 20/33/9
f 19/41/10 22/42/10 18/18/10
f 28/43/2 2/44/2 27/45/2
f 23/46/6 26/47/6 22/42/6
f 24/48/3 27/45/3 23/25/3
f 22/49/4 25/50/4 21/39/4
f 2/51/5 32/52/5 3/53/5
f 26/54/2 4/55/2 25/56/2
f 25/56/2 1/57/2 28/43/2
f 27/45/2 3/58/2 26/54/2
f 32/59/2 29/60/2 30/61/2
f 4/62/6 29/63/6 1/64/6
f 3/65/3 30/66/3 4/67/3
f 1/68/4 31/69/4 2/70/4
f 36/71/6 37/72/6 35/73/6
f 5/74/1 34/75/1 6/1/1
f 7/76/1 33/77/1 5/74/1
f 8/3/1 35/78/1 7/76/1
f 38/79/1 43/80/1 39/81/1
f 33/82/5 39/81/5 34/83/5
f 34/84/4 40/85/4 36/86/4
f 35/87/3 38/88/3 33/89/3
f 43/90/3 48/91/3 44/92/3
f 39/93/1 44/92/1 40/85/1
f 37/94/1 42/95/1 38/88/1
f 40/96/1 41/97/1 37/72/1
f 45/98/1 47/99/1 46/100/1
f 41/101/4 46/100/4 42/95/4
f 44/102/5 45/98/5 41/97/5
f 42/103/6 47/99/6 43/80/6
f 6/1/1 34/75/1 36/2/1
f 9/4/2 13/23/2 16/5/2
f 8/3/3 12/6/3 11/7/3
f 5/8/4 10/104/4 9/9/4
f 7/11/5 9/105/5 12/12/5
f 6/14/6 11/106/6 10/15/6
f 15/17/6 19/41/6 18/18/6
f 11/7/2 15/22/2 14/20/2
f 12/6/2 16/5/2 15/22/2
f 10/21/2 14/20/2 13/23/2
f 20/24/7 24/48/7 23/25/7
f 16/27/3 20/24/3 19/26/3
f 14/29/4 18/38/4 17/30/4
f 13/32/5 17/40/5 20/33/5
f 21/35/5 25/107/5 28/36/5
f 18/38/8 22/49/8 21/39/8
f 17/40/9 21/35/9 24/37/9
f 19/41/10 23/46/10 22/42/10
f 28/43/2 1/57/2 2/44/2
f 23/46/6 27/108/6 26/47/6
f 24/48/3 28/43/3 27/45/3
f 22/49/4 26/109/4 25/50/4
f 2/51/5 31/110/5 32/52/5
f 26/54/2 3/58/2 4/55/2
f 25/56/2 4/55/2 1/57/2
f 27/45/2 2/44/2 3/58/2
f 32/59/2 31/69/2 29/60/2
f 4/62/6 30/111/6 29/63/6
f 3/65/3 32/112/3 30/66/3
f 1/68/4 29/60/4 31/69/4
f 36/71/6 40/96/6 37/72/6
f 5/74/1 33/77/1 34/75/1
f 7/76/1 35/78/1 33/77/1
f 8/3/1 36/2/1 35/78/1
f 38/79/1 42/103/1 43/80/1
f 33/82/5 38/79/5 39/81/5
f 34/84/4 39/93/4 40/85/4
f 35/87/3 37/94/3 38/88/3
f 43/90/3 47/99/3 48/91/3
f 39/93/1 43/90/1 44/92/1
f 37/94/1 41/101/1 42/95/1
f 40/96/1 44/102/1 41/97/1
f 45/98/1 48/91/1 47/99/1
f 41/101/4 45/98/4 46/100/4
f 44/102/5 48/91/5 45/98/5
f 42/103/6 46/100/6 47/99/6

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB