more arc furnace crap

This commit is contained in:
Bob 2024-05-19 23:43:31 +02:00
parent af53a9b09f
commit d6a364515e
19 changed files with 255 additions and 21 deletions

View File

@ -5,10 +5,12 @@
* Sellafite diamond ore now shreds into diamond gravel
* ICF vessel blocks now use half as much fullerite as before
* ICF capacitor and turbocharger blocks are now quite a bit cheaper
* Nerfed MEP, it only outputs 75% the heat it used to per outgoing flux and its self-ignition rate has been reduced from 20 flux to 2.5
* MEP is no longer self-igniting
## Fixed
* Fixed missing localization for meteorite ores and the new crucible materials
* Removed the starmetal crystallization recipe, despite starmetal ore no longer existing
* Fixed the ICF structure block detection being incorrect, omitting some parts
* Fixed armor mods adding health showing only half as much as they actually do
* Fixed RBMK fuel xenon burn function being described wrong
* When converting ComparableStacks to ItemStacks, there is now a check that replaces null items with the nothing placeholder, fixing crashes caused by incorrect recipe configuration

View File

@ -2,6 +2,7 @@ package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.handler.MultiblockHandlerXR;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityMachineArcFurnaceLarge;
import net.minecraft.block.material.Material;
@ -19,6 +20,7 @@ public class MachineArcFurnaceLarge extends BlockDummyable {
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12) return new TileEntityMachineArcFurnaceLarge();
if(meta >= 6) return new TileEntityProxyCombo().inventory().power();
return null;
}
@ -32,18 +34,29 @@ public class MachineArcFurnaceLarge extends BlockDummyable {
return 2;
}
@Override
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {4, 0, 3, -2, 1, 1}, this, dir);
}
@Override
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
if(!super.checkRequirement(world, x, y, z, dir, o)) return false;
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y, z + dir.offsetZ * o, new int[] {4, 0, 3, -2, 1, 1}, x, y, z, dir)) return false;
return true;
}
@Override
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y, z + dir.offsetZ * o, new int[] {4, 0, 3, -2, 1, 1}, this, dir);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
x += dir.offsetX * o;
z += dir.offsetZ * o;
this.makeExtra(world, x + dir.offsetX * 2 + rot.offsetX, y, z + dir.offsetZ * 2 + rot.offsetZ);
this.makeExtra(world, x + dir.offsetX * 2 - rot.offsetX, y, z + dir.offsetZ * 2 - rot.offsetZ);
this.makeExtra(world, x + rot.offsetX * 2 + dir.offsetX, y, z + rot.offsetZ * 2 + dir.offsetZ);
this.makeExtra(world, x + rot.offsetX * 2 - dir.offsetX, y, z + rot.offsetZ * 2 - dir.offsetZ);
this.makeExtra(world, x - rot.offsetX * 2 + dir.offsetX, y, z - rot.offsetZ * 2 + dir.offsetZ);
this.makeExtra(world, x - rot.offsetX * 2 - dir.offsetX, y, z - rot.offsetZ * 2 - dir.offsetZ);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {

View File

@ -156,7 +156,7 @@ public class RecipesCommon {
}
public ItemStack toStack() {
return new ItemStack(item, stacksize, meta);
return new ItemStack(item == null ? ModItems.nothing : item, stacksize, meta);
}
public String[] getDictKeys() {

View File

@ -21,4 +21,13 @@ public class SlotNonRetarded extends Slot {
public boolean isItemValid(ItemStack stack) {
return inventory.isItemValidForSlot(this.slotNumber, stack);
}
/**
* Because if slots have higher stacksizes than the maximum allowed by the tile, the display just stops working.
* Why was that necessary? Sure it's not intended but falsifying information isn't very cool.
*/
@Override
public int getSlotStackLimit() {
return Math.max(this.inventory.getInventoryStackLimit(), this.getHasStack() ? this.getStack().stackSize : 1);
}
}

View File

@ -23,7 +23,7 @@ public class ContainerMachineArcFurnaceLarge extends Container {
//Upgrade
this.addSlotToContainer(new Slot(tile, 4, 152, 108));
//Inputs
for(int i = 0; i < 4; i++) for(int j = 0; j < 5; j++) this.addSlotToContainer(new Slot(tile, 5 + j + i * 5, 44 + j * 18, 54 + i * 18));
for(int i = 0; i < 4; i++) for(int j = 0; j < 5; j++) this.addSlotToContainer(new SlotNonRetarded(tile, 5 + j + i * 5, 44 + j * 18, 54 + i * 18));
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {

View File

@ -46,5 +46,8 @@ public class GUIMachineArcFurnaceLarge extends GuiInfoContainer {
int p = (int) (arc.power * 70 / arc.maxPower);
drawTexturedModalRect(guiLeft + 8, guiTop + 106 - p, 176, 70 - p, 7, p);
int o = (int) (arc.progress * 70);
drawTexturedModalRect(guiLeft + 17, guiTop + 106 - o, 183, 70 - o, 7, o);
}
}

View File

@ -2,11 +2,13 @@ package com.hbm.inventory.recipes;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map.Entry;
import static com.hbm.inventory.OreDictManager.*;
import com.google.gson.JsonElement;
import com.google.gson.stream.JsonWriter;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.inventory.material.MaterialShapes;
import com.hbm.inventory.material.Mats;
@ -30,6 +32,22 @@ public class ArcFurnaceRecipes extends SerializableRecipe {
recipes.put(new OreDictStack(FIBER.ingot()), new ArcFurnaceRecipe().solid(new ItemStack(ModItems.nugget_silicon, 4)) .fluid(new MaterialStack(Mats.MAT_SILICON, MaterialShapes.INGOT.q(1, 2))));
recipes.put(new OreDictStack(FIBER.block()), new ArcFurnaceRecipe().solid(new ItemStack(ModItems.nugget_silicon, 40)) .fluid(new MaterialStack(Mats.MAT_SILICON, MaterialShapes.INGOT.q(9, 2))));
}
public static ArcFurnaceRecipe getOutput(ItemStack stack) {
if(stack == null || stack.getItem() == null) return null;
ComparableStack comp = new ComparableStack(stack).makeSingular();
if(recipes.containsKey(comp))
return recipes.get(comp);
for(Entry<AStack, ArcFurnaceRecipe> entry : recipes.entrySet()) {
if(entry.getKey().isApplicable(stack)) return entry.getValue();
}
return null;
}
@Override
public String getFileName() {

View File

@ -1153,14 +1153,11 @@ public class AssemblerRecipes extends SerializableRecipe {
}, 200);
makeRecipe(new ComparableStack(ModBlocks.machine_radiolysis), new AStack[] {
!exp ? new OreDictStack(STEEL.ingot(), 12) : new OreDictStack(STEEL.heavyComp()),
new OreDictStack(ANY_RESISTANTALLOY.ingot(), 4),
new OreDictStack(DURA.ingot(), 10),
new OreDictStack(RUBBER.ingot(), 4),
new OreDictStack(RUBBER.ingot(), 8),
new OreDictStack(PB.plate528(), 12),
new OreDictStack(CU.plateCast(), 4),
new ComparableStack(ModItems.thermo_element, 10),
new ComparableStack(ModItems.wire_red_copper, 8),
new ComparableStack(ModItems.thermo_element, 8),
new ComparableStack(ModItems.tank_steel, 3)
}, 200);
@ -1273,6 +1270,8 @@ public class AssemblerRecipes extends SerializableRecipe {
AStack[] input = this.readAStackArray(obj.get("input").getAsJsonArray());
int duration = obj.get("duration").getAsInt();
if(output == null || output.getItem() == ModItems.nothing) return;
if(obj.has("folders")) {
JsonArray array = obj.get("folders").getAsJsonArray();
List<Item> items = new ArrayList();

View File

@ -3644,9 +3644,8 @@ public class ModItems {
.setUnlocalizedName("rbmk_fuel_lep").setTextureName(RefStrings.MODID + ":rbmk_fuel_lep");
rbmk_fuel_mep = (ItemRBMKRod) new ItemRBMKRod(rbmk_pellet_mep)
.setYield(100000000D)
.setStats(35, 2.5)
.setStats(35)
.setFunction(EnumBurnFunc.SQUARE_ROOT)
.setHeat(0.75D)
.setMeltingPoint(2744)
.setUnlocalizedName("rbmk_fuel_mep").setTextureName(RefStrings.MODID + ":rbmk_fuel_mep");
rbmk_fuel_hep239 = (ItemRBMKRod) new ItemRBMKRod(rbmk_pellet_hep239)
@ -4444,8 +4443,8 @@ public class ModItems {
acetylene_torch = new ItemBlowtorch().setUnlocalizedName("acetylene_torch");
boltgun = new ItemBoltgun().setUnlocalizedName("boltgun");
overfuse = new ItemCustomLore().setUnlocalizedName("overfuse").setMaxStackSize(1).setFull3D().setTextureName(RefStrings.MODID + ":overfuse");
arc_electrode = new ItemCustomLore().setUnlocalizedName("arc_electrode").setMaxDamage(250).setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setFull3D().setTextureName(RefStrings.MODID + ":arc_electrode");
arc_electrode_burnt = new Item().setUnlocalizedName("arc_electrode_burnt").setMaxStackSize(1).setFull3D().setTextureName(RefStrings.MODID + ":arc_electrode_burnt");
arc_electrode = new ItemArcElectrode().setUnlocalizedName("arc_electrode").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":arc_electrode");
arc_electrode_burnt = new ItemArcElectrodeBurnt().setUnlocalizedName("arc_electrode_burnt").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":arc_electrode_burnt");
arc_electrode_desh = new ItemCustomLore().setUnlocalizedName("arc_electrode_desh").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setFull3D().setTextureName(RefStrings.MODID + ":arc_electrode_desh");
ams_focus_blank = new Item().setUnlocalizedName("ams_focus_blank").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":ams_focus_blank");

View File

@ -0,0 +1,48 @@
package com.hbm.items.machine;
import com.hbm.items.ItemEnumMulti;
import com.hbm.util.EnumUtil;
import net.minecraft.item.ItemStack;
public class ItemArcElectrode extends ItemEnumMulti {
public ItemArcElectrode() {
super(EnumElectrodeType.class, true, true);
this.setFull3D();
this.setMaxStackSize(1);
}
public static int getDurability(ItemStack stack) {
if(!stack.hasTagCompound()) return 0;
return stack.stackTagCompound.getInteger("durability");
}
public static int getMaxtDurability(ItemStack stack) {
EnumElectrodeType num = EnumUtil.grabEnumSafely(EnumElectrodeType.class, stack.getItemDamage());
return num.durability;
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
return getDurabilityForDisplay(stack) > 0D;
}
@Override
public double getDurabilityForDisplay(ItemStack stack) {
return (double) getDurability(stack) / (double) getMaxtDurability(stack);
}
public static enum EnumElectrodeType {
GRAPHITE( 10),
LANTHANIUM( 50),
DESH( 250),
SATURNITE( 500);
public int durability;
private EnumElectrodeType(int dura) {
this.durability = dura;
}
}
}

View File

@ -0,0 +1,12 @@
package com.hbm.items.machine;
import com.hbm.items.ItemEnumMulti;
import com.hbm.items.machine.ItemArcElectrode.EnumElectrodeType;
public class ItemArcElectrodeBurnt extends ItemEnumMulti {
public ItemArcElectrodeBurnt() {
super(EnumElectrodeType.class, true, true);
this.setFull3D();
}
}

View File

@ -374,7 +374,7 @@ public class ItemRBMKRod extends Item {
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmx.fluxFunc", EnumChatFormatting.WHITE + getFuncDescription(stack)));
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmx.funcType", this.function.title));
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmx.xenonGen", EnumChatFormatting.WHITE + "x * " + xGen));
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmx.xenonBurn", EnumChatFormatting.WHITE + "* " + xBurn));
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmx.xenonBurn", EnumChatFormatting.WHITE + "/ " + xBurn));
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("trait.rbmx.heat", heat + "°C"));
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("trait.rbmx.diffusion", diffusion + "¹/²"));
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("trait.rbmx.skinTemp", ((int)(getHullHeat(stack) * 10D) / 10D) + "m"));
@ -394,7 +394,7 @@ public class ItemRBMKRod extends Item {
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmk.fluxFunc", EnumChatFormatting.WHITE + getFuncDescription(stack)));
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmk.funcType", this.function.title));
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmk.xenonGen", EnumChatFormatting.WHITE + "x * " + xGen));
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmk.xenonBurn", EnumChatFormatting.WHITE + "* " + xBurn));
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.rbmk.xenonBurn", EnumChatFormatting.WHITE + "/ " + xBurn));
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("trait.rbmk.heat", heat + "°C"));
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("trait.rbmk.diffusion", diffusion + "¹/²"));
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("trait.rbmk.skinTemp", ((int)(getHullHeat(stack) * 10D) / 10D) + "°C"));

View File

@ -313,7 +313,7 @@ public class TileMappings {
put(TileEntityElectrolyser.class, "tileentity_electrolyser");
put(TileEntityMachineMixer.class, "tileentity_mixer");
put(TileEntityMachineArcWelder.class, "tileentity_arc_welder");
put(TileEntityMachineArcFurnace.class, "tileentity_arc_furnace");
put(TileEntityMachineArcFurnaceLarge.class, "tileentity_arc_furnace_large");
put(TileEntitySteamEngine.class, "tileentity_steam_engine");
put(TileEntityMachineTurbine.class, "tileentity_turbine");

View File

@ -6,17 +6,25 @@ import java.util.List;
import com.hbm.inventory.container.ContainerMachineArcFurnaceLarge;
import com.hbm.inventory.gui.GUIMachineArcFurnaceLarge;
import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.inventory.recipes.ArcFurnaceRecipes;
import com.hbm.inventory.recipes.ArcFurnaceRecipes.ArcFurnaceRecipe;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energymk2.IEnergyReceiverMK2;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
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.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase implements IEnergyReceiverMK2, IGUIProvider {
@ -24,8 +32,11 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl
public static final long maxPower = 10_000_000;
public boolean liquidMode = false;
public float progress;
public float lid;
public float prevLid;
public int approachNum;
public float syncLid;
public List<MaterialStack> liquids = new ArrayList();
@ -38,9 +49,129 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl
return "container.machineArcFurnaceLarge";
}
@Override
public int getInventoryStackLimit() {
return 1;
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
this.power = Library.chargeTEFromItems(slots, 3, power, maxPower);
for(DirPos pos : getConPos()) this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
if(power > 0) {
boolean ingredients = this.hasIngredients();
boolean electrodes = this.hasElectrodes();
if(ingredients && electrodes) {
if(lid > 0) {
lid -= 1F/60F;
if(lid < 0) lid = 0;
this.progress = 0;
} else {
this.progress += 1F/100F;
if(this.progress >= 1F) {
this.process();
this.progress = 0;
}
}
} else {
this.progress = 0;
if(lid < 1) {
lid += 1F/60F;
if(lid > 1) lid = 1;
}
}
}
this.networkPackNT(150);
} else {
this.prevLid = this.lid;
if(this.approachNum > 0) {
this.lid = this.lid + ((this.syncLid - this.lid) / (float) this.approachNum);
--this.approachNum;
} else {
this.lid = this.syncLid;
}
}
}
public void process() {
for(int i = 5; i < 25; i++) {
if(slots[i] == null) continue;
ArcFurnaceRecipe recipe = ArcFurnaceRecipes.getOutput(slots[i]);
if(!liquidMode && recipe.solidOutput != null) {
slots[i] = recipe.solidOutput.copy();
}
}
}
public boolean hasIngredients() {
for(int i = 5; i < 25; i++) {
if(slots[i] == null) continue;
ArcFurnaceRecipe recipe = ArcFurnaceRecipes.getOutput(slots[i]);
if(recipe == null) continue;
if(liquidMode && recipe.fluidOutput != null) return true;
if(!liquidMode && recipe.solidOutput != null) return true;
}
return false;
}
public boolean hasElectrodes() {
for(int i = 0; i < 3; i++) {
if(slots[i] == null || slots[i].getItem() != ModItems.arc_electrode) return false;
}
return true;
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack) {
if(slot < 3) return stack.getItem() == ModItems.arc_electrode;
if(slot > 4) return lid > 0;
return false;
}
protected DirPos[] getConPos() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
return new DirPos[] {
new DirPos(xCoord + dir.offsetX * 3 + rot.offsetX, yCoord, zCoord + dir.offsetZ * 3 + rot.offsetZ, dir),
new DirPos(xCoord + dir.offsetX * 3 - rot.offsetX, yCoord, zCoord + dir.offsetZ * 3 - rot.offsetZ, dir),
new DirPos(xCoord + rot.offsetX * 3 + dir.offsetX, yCoord, zCoord + rot.offsetZ * 3 + dir.offsetZ, rot),
new DirPos(xCoord + rot.offsetX * 3 - dir.offsetX, yCoord, zCoord + rot.offsetZ * 3 - dir.offsetZ, rot),
new DirPos(xCoord - rot.offsetX * 3 + dir.offsetX, yCoord, zCoord - rot.offsetZ * 3 + dir.offsetZ, rot.getOpposite()),
new DirPos(xCoord - rot.offsetX * 3 - dir.offsetX, yCoord, zCoord - rot.offsetZ * 3 - dir.offsetZ, rot.getOpposite())
};
}
@Override
public void serialize(ByteBuf buf) {
super.serialize(buf);
buf.writeLong(power);
buf.writeFloat(progress);
buf.writeFloat(lid);
}
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
this.power = buf.readLong();
this.progress = buf.readFloat();
this.syncLid = buf.readFloat();
this.approachNum = 2;
}
@Override

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B