just fucking nodespace everything at this point

This commit is contained in:
Bob 2025-11-16 22:58:50 +01:00
parent 1cb8ca18cf
commit 732f6552b6
30 changed files with 3793 additions and 3460 deletions

View File

@ -47,6 +47,9 @@
* ROR controller torches can now set the threshold of particle accelerator dipoles
* Removed the legacy recipes from the terra drills
* Slag can now be cast into ingots
* Re-solidifcation of bedrock ore crumbs now requires ore slop instead of nitric acid
* Due to ore slop being only obtainable from processing raw bedrock ore, this places a hard cap on how many times a single ore can be re-solidified out of crumbs
* This approach means that crumb yields don't have to be nerfed, and prevents that issue from popping up again should there ever be a new, more efficient processing path
## Fixed
* Fixed arc furnace only allowing electrodes to be inserted when the lid is down instead of up

View File

@ -10,6 +10,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@Deprecated
public class ContainerAssemfac extends Container {
private TileEntityMachineAssemfac assemfac;

View File

@ -10,6 +10,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@Deprecated
public class ContainerChemfac extends Container {
private TileEntityMachineChemfac chemfac;

View File

@ -13,6 +13,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@Deprecated
public class ContainerMachineAssembler extends Container {
private TileEntityMachineAssembler assembler;

View File

@ -1,5 +1,6 @@
package com.hbm.inventory.container;
import com.hbm.interfaces.NotableComments;
import com.hbm.inventory.SlotCraftingOutput;
import com.hbm.inventory.SlotTakeOnly;
import com.hbm.items.ModItems;
@ -14,9 +15,11 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@Deprecated
@NotableComments
public class ContainerMachineChemplant extends Container {
private TileEntityMachineChemplant nukeBoy;
private TileEntityMachineChemplant nukeBoy; // still uses ancient copy pasted field names - lmfao
public ContainerMachineChemplant(InventoryPlayer invPlayer, TileEntityMachineChemplant tedf) {
nukeBoy = tedf;

View File

@ -12,6 +12,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.util.ResourceLocation;
@Deprecated
public class GUIAssemfac extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_assemfac.png");

View File

@ -12,6 +12,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.util.ResourceLocation;
@Deprecated
public class GUIChemfac extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_chemfac.png");

View File

@ -1,10 +1,14 @@
package com.hbm.inventory.gui;
import com.hbm.inventory.container.ContainerFusionTorus;
import com.hbm.inventory.recipes.FusionRecipe;
import com.hbm.inventory.recipes.FusionRecipes;
import com.hbm.items.machine.ItemBlueprints;
import com.hbm.lib.RefStrings;
import com.hbm.render.util.GaugeUtil;
import com.hbm.tileentity.machine.fusion.TileEntityFusionTorus;
import com.hbm.util.BobMathUtil;
import com.hbm.util.i18n.I18nUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
@ -26,11 +30,32 @@ public class GUIFusionTorus extends GuiInfoContainer {
}
@Override
public void drawScreen(int x, int y, float interp) {
super.drawScreen(x, y, interp);
public void drawScreen(int mouseX, int mouseY, float interp) {
super.drawScreen(mouseX, mouseY, interp);
torus.tanks[0].renderTankInfo(this, x, y, guiLeft + 188, guiTop + 46, 16, 52);
torus.tanks[1].renderTankInfo(this, x, y, guiLeft + 206, guiTop + 46, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 18, 16, 62, torus.power, torus.getMaxPower());
torus.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 44, guiTop + 18, 16, 52);
torus.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 62, guiTop + 18, 16, 52);
torus.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 18, 16, 52);
torus.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 52);
torus.coolantTanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 188, guiTop + 46, 16, 52);
torus.coolantTanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 206, guiTop + 46, 16, 52);
if(guiLeft + 43 <= mouseX && guiLeft + 43 + 18 > mouseX && guiTop + 80 < mouseY && guiTop + 80 + 18 >= mouseY) {
if(this.torus.fusionModule.recipe != null && FusionRecipes.INSTANCE.recipeNameMap.containsKey(this.torus.fusionModule.recipe)) {
FusionRecipe recipe = (FusionRecipe) FusionRecipes.INSTANCE.recipeNameMap.get(this.torus.fusionModule.recipe);
this.func_146283_a(recipe.print(), mouseX, mouseY);
} else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
}
}
}
@Override
protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button);
if(this.checkClick(x, y, 43, 80, 18, 18)) GUIScreenRecipeSelector.openSelector(FusionRecipes.INSTANCE, torus, torus.fusionModule.recipe, 0, ItemBlueprints.grabPool(torus.slots[1]), this);
}
@Override
@ -50,17 +75,42 @@ public class GUIFusionTorus extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
// power LED
drawTexturedModalRect(guiLeft + 160, guiTop + 115, 246, 14, 8, 8);
// coolant LED
drawTexturedModalRect(guiLeft + 170, guiTop + 115, 246, 14, 8, 8);
// plasma LED
drawTexturedModalRect(guiLeft + 180, guiTop + 115, 246, 14, 8, 8);
int p = (int) (torus.power * 62 / torus.getMaxPower());
drawTexturedModalRect(guiLeft + 8, guiTop + 80 - p, 230, 62 - p, 16, p);
// recipe LED
drawTexturedModalRect(guiLeft + 87, guiTop + 76, 249, 0, 3, 6);
// progress LED
drawTexturedModalRect(guiLeft + 92, guiTop + 76, 249, 0, 3, 6);
if(torus.fusionModule.progress > 0) {
int j = (int) Math.ceil(70 * torus.fusionModule.progress);
drawTexturedModalRect(guiLeft + 98, guiTop + 81, 0, 244, j, 6);
}
if(torus.fusionModule.bonus > 0) {
int j = (int) Math.min(Math.ceil(70 * torus.fusionModule.bonus), 70);
drawTexturedModalRect(guiLeft + 98, guiTop + 91, 0, 250, j, 6);
}
FusionRecipe recipe = FusionRecipes.INSTANCE.recipeNameMap.get(torus.fusionModule.recipe);
// power LED
if(recipe != null && torus.power >= recipe.power) drawTexturedModalRect(guiLeft + 160, guiTop + 115, 246, 14, 8, 8);
// coolant LED
int heat = (int) Math.ceil(torus.temperature);
if(heat <= 123) drawTexturedModalRect(guiLeft + 170, guiTop + 115, 246, 14, 8, 8);
// plasma LED
if(torus.didProcess) drawTexturedModalRect(guiLeft + 180, guiTop + 115, 246, 14, 8, 8);
/// LEFT LED
if(torus.didProcess) {
drawTexturedModalRect(guiLeft + 87, guiTop + 76, 249, 0, 3, 6);
} else if(recipe != null) {
drawTexturedModalRect(guiLeft + 87, guiTop + 76, 246, 0, 3, 6);
}
/// RIGHT LED
if(torus.didProcess) {
drawTexturedModalRect(guiLeft + 92, guiTop + 76, 249, 0, 3, 6);
} else if(recipe != null && torus.power >= torus.power) {
drawTexturedModalRect(guiLeft + 92, guiTop + 76, 246, 0, 3, 6);
}
double gauge = BobMathUtil.sps((Minecraft.getMinecraft().theWorld.getTotalWorldTime() + interp) * 0.25) / 2 + 0.5D;
@ -71,8 +121,17 @@ public class GUIFusionTorus extends GuiInfoContainer {
// fuel consumption
GaugeUtil.drawSmoothGauge(guiLeft + 124, guiTop + 124, this.zLevel, gauge, 5, 2, 1, 0xA00000);
// recipe selector
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 44, 81);
// fluids
torus.tanks[0].renderTank(guiLeft + 44, guiTop + 70, this.zLevel, 16, 52);
torus.tanks[1].renderTank(guiLeft + 62, guiTop + 70, this.zLevel, 16, 52);
torus.tanks[2].renderTank(guiLeft + 80, guiTop + 70, this.zLevel, 16, 52);
torus.tanks[3].renderTank(guiLeft + 152, guiTop + 70, this.zLevel, 16, 52);
// coolant
torus.tanks[0].renderTank(guiLeft + 188, guiTop + 98, this.zLevel, 16, 52);
torus.tanks[1].renderTank(guiLeft + 206, guiTop + 98, this.zLevel, 16, 52);
torus.coolantTanks[0].renderTank(guiLeft + 188, guiTop + 98, this.zLevel, 16, 52);
torus.coolantTanks[1].renderTank(guiLeft + 206, guiTop + 98, this.zLevel, 16, 52);
}
}

View File

@ -13,6 +13,7 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
@Deprecated
public class GUIMachineAssembler extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_assembler.png");

View File

@ -13,6 +13,7 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
@Deprecated
public class GUIMachineChemplant extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_chemplant.png");

View File

@ -29,8 +29,8 @@ public class GUIPADetector extends GuiInfoContainer {
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
source.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 36, 16, 52);
source.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 36, 16, 52);
source.coolantTanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 36, 16, 52);
source.coolantTanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 36, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 18, 16, 52, source.power, source.getMaxPower());
}
@ -60,7 +60,7 @@ public class GUIPADetector extends GuiInfoContainer {
if(heat <= 123) drawTexturedModalRect(guiLeft + 44, guiTop + 18, 176, 8, 8, 8);
if(source.power >= source.usage) drawTexturedModalRect(guiLeft + 44, guiTop + 43, 176, 8, 8, 8);
source.tanks[0].renderTank(guiLeft + 134, guiTop + 88, this.zLevel, 16, 52);
source.tanks[1].renderTank(guiLeft + 152, guiTop + 88, this.zLevel, 16, 52);
source.coolantTanks[0].renderTank(guiLeft + 134, guiTop + 88, this.zLevel, 16, 52);
source.coolantTanks[1].renderTank(guiLeft + 152, guiTop + 88, this.zLevel, 16, 52);
}
}

View File

@ -56,8 +56,8 @@ public class GUIPADipole extends GuiInfoContainer {
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
dipole.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 36, 16, 52);
dipole.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 36, 16, 52);
dipole.coolantTanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 36, 16, 52);
dipole.coolantTanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 36, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 18, 16, 52, dipole.power, dipole.getMaxPower());
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 62, guiTop + 29, 12, 12, mouseX, mouseY, EnumChatFormatting.BLUE + "Player orientation", EnumChatFormatting.RED + "Output orientation:", dipole.ditToForgeDir(dipole.dirLower).name());
@ -142,8 +142,8 @@ public class GUIPADipole extends GuiInfoContainer {
this.threshold.drawTextBox();
dipole.tanks[0].renderTank(guiLeft + 134, guiTop + 88, this.zLevel, 16, 52);
dipole.tanks[1].renderTank(guiLeft + 152, guiTop + 88, this.zLevel, 16, 52);
dipole.coolantTanks[0].renderTank(guiLeft + 134, guiTop + 88, this.zLevel, 16, 52);
dipole.coolantTanks[1].renderTank(guiLeft + 152, guiTop + 88, this.zLevel, 16, 52);
}
public void addLine(Tessellator tess, int x, int y, int color, Vec3NT vec, float yaw) {

View File

@ -30,8 +30,8 @@ public class GUIPAQuadrupole extends GuiInfoContainer {
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
quadrupole.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 36, 16, 52);
quadrupole.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 36, 16, 52);
quadrupole.coolantTanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 36, 16, 52);
quadrupole.coolantTanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 36, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 18, 16, 52, quadrupole.power, quadrupole.getMaxPower());
}
@ -62,7 +62,7 @@ public class GUIPAQuadrupole extends GuiInfoContainer {
if(quadrupole.slots[1] != null && quadrupole.slots[1].getItem() == ModItems.pa_coil) drawTexturedModalRect(guiLeft + 85, guiTop + 64, 176, 8, 8, 8);
if(quadrupole.power >= quadrupole.usage) drawTexturedModalRect(guiLeft + 65, guiTop + 64, 176, 8, 8, 8);
quadrupole.tanks[0].renderTank(guiLeft + 116, guiTop + 88, this.zLevel, 16, 52);
quadrupole.tanks[1].renderTank(guiLeft + 134, guiTop + 88, this.zLevel, 16, 52);
quadrupole.coolantTanks[0].renderTank(guiLeft + 116, guiTop + 88, this.zLevel, 16, 52);
quadrupole.coolantTanks[1].renderTank(guiLeft + 134, guiTop + 88, this.zLevel, 16, 52);
}
}

View File

@ -29,8 +29,8 @@ public class GUIPARFC extends GuiInfoContainer {
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
quadrupole.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 89, guiTop + 36, 16, 52);
quadrupole.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 107, guiTop + 36, 16, 52);
quadrupole.coolantTanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 89, guiTop + 36, 16, 52);
quadrupole.coolantTanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 107, guiTop + 36, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 53, guiTop + 18, 16, 52, quadrupole.power, quadrupole.getMaxPower());
}
@ -53,7 +53,7 @@ public class GUIPARFC extends GuiInfoContainer {
int j = (int) (quadrupole.power * 52 / quadrupole.getMaxPower());
drawTexturedModalRect(guiLeft + 53, guiTop + 70 - j, 184, 52 - j, 16, j);
quadrupole.tanks[0].renderTank(guiLeft + 89, guiTop + 88, this.zLevel, 16, 52);
quadrupole.tanks[1].renderTank(guiLeft + 107, guiTop + 88, this.zLevel, 16, 52);
quadrupole.coolantTanks[0].renderTank(guiLeft + 89, guiTop + 88, this.zLevel, 16, 52);
quadrupole.coolantTanks[1].renderTank(guiLeft + 107, guiTop + 88, this.zLevel, 16, 52);
}
}

View File

@ -38,8 +38,8 @@ public class GUIPASource extends GuiInfoContainer {
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
source.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 36, 16, 52);
source.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 36, 16, 52);
source.coolantTanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 36, 16, 52);
source.coolantTanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 36, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 18, 16, 52, source.power, source.getMaxPower());
List<String> info = new ArrayList();
@ -100,7 +100,7 @@ public class GUIPASource extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 45, guiTop + 73, 176, 52, 68, 14);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
source.tanks[0].renderTank(guiLeft + 134, guiTop + 88, this.zLevel, 16, 52);
source.tanks[1].renderTank(guiLeft + 152, guiTop + 88, this.zLevel, 16, 52);
source.coolantTanks[0].renderTank(guiLeft + 134, guiTop + 88, this.zLevel, 16, 52);
source.coolantTanks[1].renderTank(guiLeft + 152, guiTop + 88, this.zLevel, 16, 52);
}
}

View File

@ -201,7 +201,7 @@ public class CrystallizerRecipes extends SerializableRecipe {
registerRecipe(new ComparableStack(ItemBedrockOreNew.make(BedrockOreGrade.PRIMARY_RAD, type)), new CrystallizerRecipe(ItemBedrockOreNew.make(BedrockOreGrade.PRIMARY_SECOND, type), bedrock), secondary);
registerRecipe(new ComparableStack(ItemBedrockOreNew.make(BedrockOreGrade.PRIMARY_NORAD, type)), new CrystallizerRecipe(ItemBedrockOreNew.make(BedrockOreGrade.PRIMARY_SECOND, type), bedrock), secondary);
registerRecipe(new ComparableStack(ItemBedrockOreNew.make(BedrockOreGrade.CRUMBS, type)), new CrystallizerRecipe(ItemBedrockOreNew.make(BedrockOreGrade.BASE, type), bedrock).setReq(64), new FluidStack(Fluids.NITRIC_ACID, 1000));
registerRecipe(new ComparableStack(ItemBedrockOreNew.make(BedrockOreGrade.CRUMBS, type)), new CrystallizerRecipe(ItemBedrockOreNew.make(BedrockOreGrade.BASE, type), bedrock).setReq(64), new FluidStack(Fluids.SLOP, 1000));
}
FluidStack[] dyes = new FluidStack[] {new FluidStack(Fluids.WOODOIL, 100), new FluidStack(Fluids.FISHOIL, 100), new FluidStack(Fluids.LIGHTOIL, 100)};

View File

@ -90,6 +90,7 @@ public abstract class SerializableRecipe {
recipeHandlers.add(AssemblyMachineRecipes.INSTANCE);
recipeHandlers.add(ChemicalPlantRecipes.INSTANCE);
recipeHandlers.add(PUREXRecipes.INSTANCE);
recipeHandlers.add(FusionRecipes.INSTANCE);
recipeHandlers.add(new MatDistribution());
recipeHandlers.add(new CustomMachineRecipes());

View File

@ -37,7 +37,7 @@ public class ItemFluidIDMulti extends Item implements IItemFluidIdentifier, IIte
for(int i = 1; i < order.length; ++i) {
if(!order[i].hasNoID()) {
ItemStack id = new ItemStack(item, 1, order[i].getID());
setType(id, Fluids.fromID(i), true);
setType(id, order[i], true);
list.add(id);
}
}

View File

@ -77,6 +77,12 @@ public abstract class ModuleMachineBase {
}
}
return canFitOutput(recipe);
}
/** Whether the machine can hold the output produced by the recipe */
protected boolean canFitOutput(GenericRecipe recipe) {
if(recipe.outputItem != null) {
for(int i = 0; i < Math.min(recipe.outputItem.length, outputSlots.length); i++) {
ItemStack stack = slots[outputSlots[i]];
@ -107,45 +113,53 @@ public abstract class ModuleMachineBase {
this.progress += step;
if(this.progress >= 1D) {
consumeInput(recipe);
produceItem(recipe);
if(recipe.inputItem != null) {
for(int i = 0; i < Math.min(recipe.inputItem.length, inputSlots.length); i++) {
slots[inputSlots[i]].stackSize -= recipe.inputItem[i].stacksize;
if(slots[inputSlots[i]].stackSize <= 0) slots[inputSlots[i]] = null;
}
}
if(recipe.inputFluid != null) {
for(int i = 0; i < Math.min(recipe.inputFluid.length, inputTanks.length); i++) {
inputTanks[i].setFill(inputTanks[i].getFill() - recipe.inputFluid[i].fill);
}
}
if(recipe.outputItem != null) {
for(int i = 0; i < Math.min(recipe.outputItem.length, outputSlots.length); i++) {
ItemStack collapse = recipe.outputItem[i].collapse();
if(slots[outputSlots[i]] == null) {
slots[outputSlots[i]] = collapse;
} else {
if(collapse != null) slots[outputSlots[i]].stackSize += collapse.stackSize; // we can do this because we've already established that the result slot is not null if it's a single output
}
}
}
if(recipe.outputFluid != null) {
for(int i = 0; i < Math.min(recipe.outputFluid.length, outputTanks.length); i++) {
outputTanks[i].setFill(outputTanks[i].getFill() + recipe.outputFluid[i].fill);
}
}
this.markDirty = true;
if(this.canProcess(recipe, speed, power))
this.progress -= 1D;
else
this.progress = 0D;
if(this.canProcess(recipe, speed, power)) this.progress -= 1D;
else this.progress = 0D;
}
}
/** Part 1 of the process completion, uses up input */
protected void consumeInput(GenericRecipe recipe) {
if(recipe.inputItem != null) {
for(int i = 0; i < Math.min(recipe.inputItem.length, inputSlots.length); i++) {
slots[inputSlots[i]].stackSize -= recipe.inputItem[i].stacksize;
if(slots[inputSlots[i]].stackSize <= 0) slots[inputSlots[i]] = null;
}
}
if(recipe.inputFluid != null) {
for(int i = 0; i < Math.min(recipe.inputFluid.length, inputTanks.length); i++) {
inputTanks[i].setFill(inputTanks[i].getFill() - recipe.inputFluid[i].fill);
}
}
}
/** Part 2 of the process completion, generated output */
protected void produceItem(GenericRecipe recipe) {
if(recipe.outputItem != null) {
for(int i = 0; i < Math.min(recipe.outputItem.length, outputSlots.length); i++) {
ItemStack collapse = recipe.outputItem[i].collapse();
if(slots[outputSlots[i]] == null) {
slots[outputSlots[i]] = collapse;
} else {
if(collapse != null) slots[outputSlots[i]].stackSize += collapse.stackSize; // we can do this because we've already established that the result slot is not null if it's a single output
}
}
}
if(recipe.outputFluid != null) {
for(int i = 0; i < Math.min(recipe.outputFluid.length, outputTanks.length); i++) {
outputTanks[i].setFill(outputTanks[i].getFill() + recipe.outputFluid[i].fill);
}
}
this.markDirty = true;
}
public GenericRecipe getRecipe() {
return (GenericRecipe) getRecipeSet().recipeNameMap.get(this.recipe);

View File

@ -2,12 +2,16 @@ package com.hbm.module.machine;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.recipes.FusionRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.inventory.recipes.loader.GenericRecipes;
import api.hbm.energymk2.IEnergyHandlerMK2;
import net.minecraft.item.ItemStack;
public class ModuleMachineFusion extends ModuleMachineBase {
public double bonusSpeed = 0D;
public double bonus;
public ModuleMachineFusion(int index, IEnergyHandlerMK2 battery, ItemStack[] slots) {
super(index, battery, slots);
@ -25,4 +29,31 @@ public class ModuleMachineFusion extends ModuleMachineBase {
public ModuleMachineFusion itemOutput(int slot) { outputSlots[0] = slot; return this; }
public ModuleMachineFusion fluidInput(FluidTank a, FluidTank b, FluidTank c) { inputTanks[0] = a; inputTanks[1] = b; inputTanks[2] = c; return this; }
public ModuleMachineFusion fluidOutput(FluidTank a) { outputTanks[0] = a; return this; }
// setup needs to run before update, used to keep track of things that ModuleMachineBase doesn't handle
public void preUpdate(double bonusSpeed) {
this.bonusSpeed = bonusSpeed;
}
@Override
public void process(GenericRecipe recipe, double speed, double power) {
this.battery.setPower(this.battery.getPower() - (power == 1 ? recipe.power : (long) (recipe.power * power)));
double step = Math.min(speed / recipe.duration, 1D); // can't do more than one recipe per tick, might look into that later
this.progress += step;
this.bonus += step * this.bonusSpeed;
this.bonus = Math.min(this.bonus, 1.5D); // bonus might not be used immediately in rare circumstances, allow 50% buffer
if(this.progress >= 1D) {
consumeInput(recipe);
produceItem(recipe);
if(this.canProcess(recipe, speed, power)) this.progress -= 1D;
else this.progress = 0D;
}
if(this.bonus >= 1D && this.canFitOutput(recipe)) {
produceItem(recipe);
this.bonus -= 1D;
}
}
}

View File

@ -13,7 +13,7 @@ import net.minecraft.nbt.NBTTagCompound;
public abstract class TileEntityCooledBase extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2 {
public FluidTank[] tanks;
public FluidTank[] coolantTanks; // originally just named "tanks" which would confuse the fuck out of me when working with child classes
public long power;
@ -26,9 +26,9 @@ public abstract class TileEntityCooledBase extends TileEntityMachineBase impleme
public TileEntityCooledBase(int slotCount) {
super(slotCount);
tanks = new FluidTank[2];
tanks[0] = new FluidTank(Fluids.PERFLUOROMETHYL_COLD, 4_000);
tanks[1] = new FluidTank(Fluids.PERFLUOROMETHYL, 4_000);
coolantTanks = new FluidTank[2];
coolantTanks[0] = new FluidTank(Fluids.PERFLUOROMETHYL_COLD, 4_000);
coolantTanks[1] = new FluidTank(Fluids.PERFLUOROMETHYL, 4_000);
}
@Override
@ -38,8 +38,8 @@ public abstract class TileEntityCooledBase extends TileEntityMachineBase impleme
for(DirPos pos : this.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.tryProvide(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.trySubscribe(coolantTanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.tryProvide(coolantTanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
this.temperature += this.temp_passive_heating;
@ -47,12 +47,12 @@ public abstract class TileEntityCooledBase extends TileEntityMachineBase impleme
if(this.temperature > this.temperature_target) {
int cyclesTemp = (int) Math.ceil((Math.min(this.temperature - temperature_target, temp_change_max)) / temp_change_per_mb);
int cyclesCool = tanks[0].getFill();
int cyclesHot = tanks[1].getMaxFill() - tanks[1].getFill();
int cyclesCool = coolantTanks[0].getFill();
int cyclesHot = coolantTanks[1].getMaxFill() - coolantTanks[1].getFill();
int cycles = BobMathUtil.min(cyclesTemp, cyclesCool, cyclesHot);
tanks[0].setFill(tanks[0].getFill() - cycles);
tanks[1].setFill(tanks[1].getFill() + cycles);
coolantTanks[0].setFill(coolantTanks[0].getFill() - cycles);
coolantTanks[1].setFill(coolantTanks[1].getFill() + cycles);
this.temperature -= this.temp_change_per_mb * cycles;
}
@ -69,8 +69,8 @@ public abstract class TileEntityCooledBase extends TileEntityMachineBase impleme
@Override
public void serialize(ByteBuf buf) {
super.serialize(buf);
tanks[0].serialize(buf);
tanks[1].serialize(buf);
coolantTanks[0].serialize(buf);
coolantTanks[1].serialize(buf);
buf.writeFloat(temperature);
buf.writeLong(power);
}
@ -78,8 +78,8 @@ public abstract class TileEntityCooledBase extends TileEntityMachineBase impleme
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
tanks[0].deserialize(buf);
tanks[1].deserialize(buf);
coolantTanks[0].deserialize(buf);
coolantTanks[1].deserialize(buf);
this.temperature = buf.readFloat();
this.power = buf.readLong();
}
@ -88,8 +88,8 @@ public abstract class TileEntityCooledBase extends TileEntityMachineBase impleme
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
tanks[0].readFromNBT(nbt, "t0");
tanks[1].readFromNBT(nbt, "t1");
coolantTanks[0].readFromNBT(nbt, "t0");
coolantTanks[1].readFromNBT(nbt, "t1");
this.temperature = nbt.getFloat("temperature");
this.power = nbt.getLong("power");
}
@ -98,8 +98,8 @@ public abstract class TileEntityCooledBase extends TileEntityMachineBase impleme
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
tanks[0].writeToNBT(nbt, "t0");
tanks[1].writeToNBT(nbt, "t1");
coolantTanks[0].writeToNBT(nbt, "t0");
coolantTanks[1].writeToNBT(nbt, "t1");
nbt.setFloat("temperature", temperature);
nbt.setLong("power", power);
}
@ -107,7 +107,7 @@ public abstract class TileEntityCooledBase extends TileEntityMachineBase impleme
@Override public long getPower() { return this.power; }
@Override public void setPower(long power) { this.power = power; }
@Override public FluidTank[] getSendingTanks() { return new FluidTank[] {tanks[1]}; }
@Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {tanks[0]}; }
@Override public FluidTank[] getAllTanks() { return tanks; }
@Override public FluidTank[] getSendingTanks() { return new FluidTank[] {coolantTanks[1]}; }
@Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {coolantTanks[0]}; }
@Override public FluidTank[] getAllTanks() { return coolantTanks; }
}

View File

@ -1,12 +1,55 @@
package com.hbm.tileentity.machine.fusion;
import java.util.Map.Entry;
import com.hbm.uninos.GenNode;
import com.hbm.uninos.UniNodespace;
import com.hbm.uninos.networkproviders.KlystronNetwork;
import com.hbm.uninos.networkproviders.KlystronNetworkProvider;
import com.hbm.util.fauxpointtwelve.BlockPos;
import com.hbm.util.fauxpointtwelve.DirPos;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityFusionKlystron extends TileEntity {
protected GenNode klystronNode;
@Override
public void updateEntity() {
super.updateEntity();
if(!worldObj.isRemote) {
if(klystronNode == null || klystronNode.expired) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10).getOpposite();
klystronNode = UniNodespace.getNode(worldObj, xCoord + dir.offsetX * 4, yCoord + 2, zCoord + dir.offsetZ * 4, KlystronNetworkProvider.THE_PROVIDER);
if(klystronNode == null) {
klystronNode = new GenNode(KlystronNetworkProvider.THE_PROVIDER,
new BlockPos(xCoord + dir.offsetX * 4, yCoord + 2, zCoord + dir.offsetZ * 4))
.setConnections(new DirPos(xCoord + dir.offsetX * 5, yCoord + 2, zCoord + dir.offsetZ * 5, dir));
UniNodespace.createNode(worldObj, klystronNode);
}
if(klystronNode.net != null) klystronNode.net.addProvider(this);
}
if(klystronNode != null && klystronNode.net != null) {
KlystronNetwork net = (KlystronNetwork) klystronNode.net;
if(!net.receiverEntries.isEmpty()) {
//worldObj.func_147480_a(xCoord, yCoord, zCoord, false);
}
}
}
}
AxisAlignedBB bb = null;
@Override

View File

@ -1,12 +1,21 @@
package com.hbm.tileentity.machine.fusion;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.container.ContainerFusionTorus;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIFusionTorus;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.module.machine.ModuleMachineFusion;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.machine.albion.TileEntityCooledBase;
import com.hbm.uninos.GenNode;
import com.hbm.uninos.INetworkProvider;
import com.hbm.uninos.UniNodespace;
import com.hbm.uninos.networkproviders.KlystronNetworkProvider;
import com.hbm.uninos.networkproviders.PlasmaNetworkProvider;
import com.hbm.util.fauxpointtwelve.BlockPos;
import com.hbm.util.fauxpointtwelve.DirPos;
import cpw.mods.fml.relauncher.Side;
@ -14,27 +23,38 @@ import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIProvider {
public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIProvider, IControlReceiver {
public FluidTank[] torusTanks;
public boolean didProcess = false;
public FluidTank[] tanks;
public ModuleMachineFusion fusionModule;
protected GenNode[] klystronNodes;
protected GenNode[] plasmaNodes;
public TileEntityFusionTorus() {
super(3);
this.torusTanks = new FluidTank[4];
this.torusTanks[0] = new FluidTank(Fluids.NONE, 4_000);
this.torusTanks[1] = new FluidTank(Fluids.NONE, 4_000);
this.torusTanks[2] = new FluidTank(Fluids.NONE, 4_000);
this.torusTanks[3] = new FluidTank(Fluids.NONE, 4_000);
klystronNodes = new GenNode[4];
plasmaNodes = new GenNode[4];
this.tanks = new FluidTank[4];
this.tanks[0] = new FluidTank(Fluids.NONE, 4_000);
this.tanks[1] = new FluidTank(Fluids.NONE, 4_000);
this.tanks[2] = new FluidTank(Fluids.NONE, 4_000);
this.tanks[3] = new FluidTank(Fluids.NONE, 4_000);
this.fusionModule = new ModuleMachineFusion(0, this, slots)
.fluidInput(torusTanks[0], torusTanks[1], torusTanks[2])
.fluidOutput(torusTanks[3])
.fluidInput(tanks[0], tanks[1], tanks[2])
.fluidOutput(tanks[3])
.itemOutput(2);
}
@ -46,18 +66,74 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
@Override
public void updateEntity() {
super.updateEntity();
if(!worldObj.isRemote) {
for(int i = 0; i < 4; i++) {
if(klystronNodes[i] == null || klystronNodes[i].expired) klystronNodes[i] = createNode(KlystronNetworkProvider.THE_PROVIDER, ForgeDirection.getOrientation(i + 2));
if(plasmaNodes[i] == null || plasmaNodes[i].expired) plasmaNodes[i] = createNode(PlasmaNetworkProvider.THE_PROVIDER, ForgeDirection.getOrientation(i + 2));
if(klystronNodes[i].net != null) klystronNodes[i].net.addReceiver(this);
if(plasmaNodes[i].net != null) plasmaNodes[i].net.addProvider(this);
}
this.power = Library.chargeTEFromItems(slots, 0, power, this.getMaxPower());
this.fusionModule.update(1D, 1D, true, slots[1]);
this.didProcess = this.fusionModule.didProcess;
if(this.fusionModule.markDirty) this.markDirty();
this.networkPackNT(150);
}
}
public GenNode createNode(INetworkProvider provider, ForgeDirection dir) {
GenNode node = UniNodespace.getNode(worldObj, xCoord + dir.offsetX * 7, yCoord + 2, zCoord + dir.offsetZ * 7, provider);
if(node != null) return node;
node = new GenNode(provider,
new BlockPos(xCoord + dir.offsetX * 7, yCoord + 2, zCoord + dir.offsetZ * 7))
.setConnections(new DirPos(xCoord + dir.offsetX * 8, yCoord + 2, zCoord + dir.offsetZ * 8, dir));
UniNodespace.createNode(worldObj, node);
return node;
}
@Override
public void serialize(ByteBuf buf) {
super.serialize(buf);
buf.writeBoolean(this.didProcess);
this.fusionModule.serialize(buf);
for(int i = 0; i < 4; i++) this.tanks[i].serialize(buf);
}
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
this.didProcess = buf.readBoolean();
this.fusionModule.deserialize(buf);
for(int i = 0; i < 4; i++) this.tanks[i].deserialize(buf);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
for(int i = 0; i < 4; i++) this.tanks[i].readFromNBT(nbt, "t" + i);
this.power = nbt.getLong("power");
this.fusionModule.readFromNBT(nbt);
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
for(int i = 0; i < 4; i++) this.tanks[i].writeToNBT(nbt, "t" + i);
nbt.setLong("power", power);
this.fusionModule.writeToNBT(nbt);
}
@Override
@ -76,6 +152,23 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
return new DirPos[0]; // TBI
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack) {
if(slot == 0) return true; // battery
if(slot == 1 && stack.getItem() == ModItems.blueprints) return true;
return false;
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return i == 2;
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return new int[] {2};
}
AxisAlignedBB bb = null;
@Override
@ -110,4 +203,27 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIFusionTorus(player.inventory, this);
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) return false;
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 32 * 32;
}
@Override
public boolean hasPermission(EntityPlayer player) {
return this.isUseableByPlayer(player);
}
@Override
public void receiveControl(NBTTagCompound data) {
if(data.hasKey("index") && data.hasKey("selection")) {
int index = data.getInteger("index");
String selection = data.getString("selection");
if(index == 0) {
this.fusionModule.recipe = selection;
this.markChanged();
}
}
}
}

View File

@ -0,0 +1,9 @@
package com.hbm.uninos.networkproviders;
import com.hbm.uninos.NodeNet;
public class KlystronNetwork extends NodeNet {
@Override
public void update() { }
}

View File

@ -0,0 +1,13 @@
package com.hbm.uninos.networkproviders;
import com.hbm.uninos.INetworkProvider;
public class KlystronNetworkProvider implements INetworkProvider<KlystronNetwork> {
public static KlystronNetworkProvider THE_PROVIDER = new KlystronNetworkProvider();
@Override
public KlystronNetwork provideNetwork() {
return new KlystronNetwork();
}
}

View File

@ -0,0 +1,9 @@
package com.hbm.uninos.networkproviders;
import com.hbm.uninos.NodeNet;
public class PlasmaNetwork extends NodeNet {
@Override
public void update() { }
}

View File

@ -0,0 +1,13 @@
package com.hbm.uninos.networkproviders;
import com.hbm.uninos.INetworkProvider;
public class PlasmaNetworkProvider implements INetworkProvider<PlasmaNetwork> {
public static PlasmaNetworkProvider THE_PROVIDER = new PlasmaNetworkProvider();
@Override
public PlasmaNetwork provideNetwork() {
return new PlasmaNetwork();
}
}

View File

@ -1273,6 +1273,8 @@ general.na=N/A
gui.recipe.duration=Duration
gui.recipe.consumption=Consumption
gui.recipe.fusionIn=Klystron Input Energy
gui.recipe.fusionOut=Plasma Output Energy
gui.recipe.input=Input
gui.recipe.output=Output
gui.recipe.atPressure=at

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB