「 PETAL DANCE 」

This commit is contained in:
Boblet 2026-06-30 15:18:41 +02:00
parent a93144f4c0
commit 97b2077038
33 changed files with 208 additions and 82 deletions

View File

@ -29,6 +29,18 @@
* Increased the blast furnace's fuel buffer by 50%, allowing coke blocks to be used * Increased the blast furnace's fuel buffer by 50%, allowing coke blocks to be used
* If an RoR controller tries to parse an integer, but the supplied string represents a decimal, instead of canceling the operation, the system will now interpret decimals and round them to be integers * If an RoR controller tries to parse an integer, but the supplied string represents a decimal, instead of canceling the operation, the system will now interpret decimals and round them to be integers
* This means that the AUTOCAL can now send RoR commands using calculated values directly without the use of `round` or `evalr` * This means that the AUTOCAL can now send RoR commands using calculated values directly without the use of `round` or `evalr`
* Assembly machines now support Redstone-over-Radio
* Active state (0 or 1), progress (0-100) and current recipe (internal name) can now be read
* The recipe can be set using a controller
* Do note that setting a recipe that needs a blueprint without that blueprint will not work
* RoR set recipes cause the assembler to go into low power mode, making it run at only 25% speed (visible through the blue progress bar)
* The speed penalty is removed as soon as a recipe is assigned manually again
* The AUTOCAL's script interpreter now runs MS-ES v1.1 (First Extended Instruction Set)
* Allows the use of a global stack, similar to the buffer which can hold 256 values
* Allows splitting of strings and counting of string fragments
* Adds substring operations
* Polling for receiving only fresh RoR signals
* A command for writing the world time to the buffer, allowing for more precise timers
## Fixed ## Fixed
* Fixed AUTOCAL's number comparison functions not working with variable substitution as advertised * Fixed AUTOCAL's number comparison functions not working with variable substitution as advertised

View File

@ -197,7 +197,11 @@ public class StackCache {
public static long getStackIdentity(Item item, int meta, NBTTagCompound nbt) { public static long getStackIdentity(Item item, int meta, NBTTagCompound nbt) {
if(item == null) return getNullIdentity(); if(item == null) return getNullIdentity();
long identity = Item.getIdFromItem(item) * 27644437; return getStackIdentity(Item.getIdFromItem(item), meta, nbt);
}
public static long getStackIdentity(int item, int meta, NBTTagCompound nbt) {
long identity = item * 27644437;
identity += meta; identity += meta;
identity *= 27644437; identity *= 27644437;
if(nbt != null) identity += nbt.hashCode(); if(nbt != null) identity += nbt.hashCode();

View File

@ -16,10 +16,10 @@ public class SlotPattern extends Slot {
public SlotPattern(IInventory inv, int index, int x, int y) { public SlotPattern(IInventory inv, int index, int x, int y) {
super(inv, index, x, y); super(inv, index, x, y);
} }
public SlotPattern(IInventory inv, int index, int x, int y, boolean allowStackSize) { public SlotPattern allowStackSize() {
super(inv, index, x, y); this.allowStackSize = true;
this.allowStackSize = allowStackSize; return this;
} }
@Override @Override

View File

@ -24,7 +24,7 @@ public class ContainerAutocrafter extends ContainerBase {
this.addSlotToContainer(new SlotPattern(tedf, j + i * 3, 44 + j * 18, 22 + i * 18)); this.addSlotToContainer(new SlotPattern(tedf, j + i * 3, 44 + j * 18, 22 + i * 18));
} }
} }
this.addSlotToContainer(new SlotPattern(tedf, 9, 116, 40, true)); this.addSlotToContainer(new SlotPattern(tedf, 9, 116, 40).allowStackSize());
/* RECIPE */ /* RECIPE */
addSlots(tedf,10, 44, 86, 3, 3); addSlots(tedf,10, 44, 86, 3, 3);

View File

@ -14,7 +14,7 @@ public class ContainerPneumoStorageExporter extends ContainerBase {
super(invPlayer, exporter); super(invPlayer, exporter);
for(int i = 0; i < 9; i++) { for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new SlotPattern(exporter, i, 17 + (i % 3) * 18, 17 + (i / 3) * 18, true)); this.addSlotToContainer(new SlotPattern(exporter, i, 17 + (i % 3) * 18, 17 + (i / 3) * 18).allowStackSize());
} }
addSlots(exporter, 9, 80, 17, 3, 3); addSlots(exporter, 9, 80, 17, 3, 3);

View File

@ -41,7 +41,7 @@ public class GUIFusionTorus extends GuiInfoContainer {
torus.coolantTanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 188, guiTop + 46, 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); torus.coolantTanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 206, guiTop + 46, 16, 52);
FusionRecipe recipe = (FusionRecipe) FusionRecipes.INSTANCE.recipeNameMap.get(this.torus.fusionModule.recipe); FusionRecipe recipe = (FusionRecipe) this.torus.fusionModule.getRecipe();
if(recipe != null) { if(recipe != null) {
drawCustomInfoStat(mouseX, mouseY, guiLeft + 43, guiTop + 115, 18, 18, mouseX, mouseY, EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + BobMathUtil.getShortNumber(torus.klystronEnergy) + "KyU / " + BobMathUtil.getShortNumber(recipe.ignitionTemp) + "KyU"); drawCustomInfoStat(mouseX, mouseY, guiLeft + 43, guiTop + 115, 18, 18, mouseX, mouseY, EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + BobMathUtil.getShortNumber(torus.klystronEnergy) + "KyU / " + BobMathUtil.getShortNumber(recipe.ignitionTemp) + "KyU");
@ -70,7 +70,7 @@ public class GUIFusionTorus extends GuiInfoContainer {
protected void mouseClicked(int x, int y, int button) { protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, 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); if(this.checkClick(x, y, 43, 80, 18, 18)) GUIScreenRecipeSelector.openSelector(FusionRecipes.INSTANCE, torus, torus.fusionModule.getRecipeName(), 0, ItemBlueprints.grabPool(torus.slots[1]), this);
} }
@Override @Override
@ -103,7 +103,7 @@ public class GUIFusionTorus extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 98, guiTop + 91, 0, 250, j, 6); drawTexturedModalRect(guiLeft + 98, guiTop + 91, 0, 250, j, 6);
} }
FusionRecipe recipe = FusionRecipes.INSTANCE.recipeNameMap.get(torus.fusionModule.recipe); FusionRecipe recipe = (FusionRecipe) torus.fusionModule.getRecipe();
// power LED // power LED
if(recipe != null && torus.power >= recipe.power) drawTexturedModalRect(guiLeft + 160, guiTop + 115, 246, 14, 8, 8); if(recipe != null && torus.power >= recipe.power) drawTexturedModalRect(guiLeft + 160, guiTop + 115, 246, 14, 8, 8);

View File

@ -47,8 +47,8 @@ public class GUIMachineAssemblyFactory extends GuiInfoContainer {
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 234, guiTop + 18, 16, 92, assembler.power, assembler.maxPower); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 234, guiTop + 18, 16, 92, assembler.power, assembler.maxPower);
for(int i = 0; i < 4; i++) if(guiLeft + 6 + (i % 2) * 109 <= mouseX && guiLeft + 6 + (i % 2) * 109 + 18 > mouseX && guiTop + 53 + (i / 2) * 56 < mouseY && guiTop + 53 + (i / 2) * 56 + 18 >= mouseY) { for(int i = 0; i < 4; i++) if(guiLeft + 6 + (i % 2) * 109 <= mouseX && guiLeft + 6 + (i % 2) * 109 + 18 > mouseX && guiTop + 53 + (i / 2) * 56 < mouseY && guiTop + 53 + (i / 2) * 56 + 18 >= mouseY) {
if(this.assembler.assemblerModule[i].recipe != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule[i].recipe)) { if(this.assembler.assemblerModule[i].getRecipeName() != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule[i].getRecipeName())) {
GenericRecipe recipe = (GenericRecipe) AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule[i].recipe); GenericRecipe recipe = this.assembler.assemblerModule[i].getRecipe();
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height); GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
} else { } else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY); this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
@ -60,7 +60,7 @@ public class GUIMachineAssemblyFactory extends GuiInfoContainer {
protected void mouseClicked(int x, int y, int button) { protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button); super.mouseClicked(x, y, button);
for(int i = 0; i < 4; i++) if(this.checkClick(x, y, 6 + (i % 2) * 109, 53 + (i / 2) * 56, 18, 18)) GUIScreenRecipeSelector.openSelector(AssemblyMachineRecipes.INSTANCE, assembler, assembler.assemblerModule[i].recipe, i, ItemBlueprints.grabPool(assembler.slots[4 + i * 14]), this); for(int i = 0; i < 4; i++) if(this.checkClick(x, y, 6 + (i % 2) * 109, 53 + (i / 2) * 56, 18, 18)) GUIScreenRecipeSelector.openSelector(AssemblyMachineRecipes.INSTANCE, assembler, assembler.assemblerModule[i].getRecipeName(), i, ItemBlueprints.grabPool(assembler.slots[4 + i * 14]), this);
} }
@Override @Override
@ -87,7 +87,7 @@ public class GUIMachineAssemblyFactory extends GuiInfoContainer {
} }
for(int g = 0; g < 4; g++) { for(int g = 0; g < 4; g++) {
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule[g].recipe); GenericRecipe recipe = assembler.assemblerModule[g].getRecipe();
/// LEFT LED /// LEFT LED
if(assembler.didProcess[g]) { if(assembler.didProcess[g]) {
@ -105,7 +105,7 @@ public class GUIMachineAssemblyFactory extends GuiInfoContainer {
} }
for(int g = 0; g < 4; g++) { for(int g = 0; g < 4; g++) {
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule[g].recipe); GenericRecipe recipe = assembler.assemblerModule[g].getRecipe();
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 7 + (g % 2) * 109, 54 + (g / 2) * 56); this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 7 + (g % 2) * 109, 54 + (g / 2) * 56);

View File

@ -42,8 +42,8 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, assembler.power, assembler.maxPower); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, assembler.power, assembler.maxPower);
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) { if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
if(this.assembler.assemblerModule.recipe != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.recipe)) { if(this.assembler.assemblerModule.getRecipeName() != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.getRecipeName())) {
GenericRecipe recipe = (GenericRecipe) AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule.recipe); GenericRecipe recipe = this.assembler.assemblerModule.getRecipe();
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height); GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
} else { } else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY); this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
@ -55,7 +55,7 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
protected void mouseClicked(int x, int y, int button) { protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button); super.mouseClicked(x, y, button);
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(AssemblyMachineRecipes.INSTANCE, assembler, assembler.assemblerModule.recipe, 0, ItemBlueprints.grabPool(assembler.slots[1]), this); if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(AssemblyMachineRecipes.INSTANCE, assembler, assembler.assemblerModule.getRecipeName(), 0, ItemBlueprints.grabPool(assembler.slots[1]), this);
} }
@Override @Override
@ -77,10 +77,10 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
if(assembler.assemblerModule.progress > 0) { if(assembler.assemblerModule.progress > 0) {
int j = (int) Math.ceil(70 * assembler.assemblerModule.progress); int j = (int) Math.ceil(70 * assembler.assemblerModule.progress);
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16); drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61 + (assembler.assemblerModule.restrictedMode ? 16 : 0), j, 16);
} }
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule.recipe); GenericRecipe recipe = assembler.assemblerModule.getRecipe();
/// LEFT LED /// LEFT LED
if(assembler.didProcess) { if(assembler.didProcess) {

View File

@ -47,8 +47,8 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 224, guiTop + 18, 16, 68, chemplant.power, chemplant.maxPower); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 224, guiTop + 18, 16, 68, chemplant.power, chemplant.maxPower);
for(int i = 0; i < 4; i++) if(guiLeft + 74 <= mouseX && guiLeft + 74 + 18 > mouseX && guiTop + 19 + i * 22 < mouseY && guiTop + 19 + i * 22 + 18 >= mouseY) { for(int i = 0; i < 4; i++) if(guiLeft + 74 <= mouseX && guiLeft + 74 + 18 > mouseX && guiTop + 19 + i * 22 < mouseY && guiTop + 19 + i * 22 + 18 >= mouseY) {
if(this.chemplant.chemplantModule[i].recipe != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule[i].recipe)) { if(this.chemplant.chemplantModule[i].getRecipeName() != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule[i].getRecipeName())) {
GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule[i].recipe); GenericRecipe recipe = this.chemplant.chemplantModule[i].getRecipe();
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height); GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
} else { } else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY); this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
@ -60,7 +60,7 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
protected void mouseClicked(int x, int y, int button) { protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button); super.mouseClicked(x, y, button);
for(int i = 0; i < 4; i++) if(this.checkClick(x, y, 74, 19 + i * 22, 18, 18)) GUIScreenRecipeSelector.openSelector(ChemicalPlantRecipes.INSTANCE, chemplant, chemplant.chemplantModule[i].recipe, i, ItemBlueprints.grabPool(chemplant.slots[4 + i * 7]), this); for(int i = 0; i < 4; i++) if(this.checkClick(x, y, 74, 19 + i * 22, 18, 18)) GUIScreenRecipeSelector.openSelector(ChemicalPlantRecipes.INSTANCE, chemplant, chemplant.chemplantModule[i].getRecipeName(), i, ItemBlueprints.grabPool(chemplant.slots[4 + i * 7]), this);
} }
@Override @Override
@ -87,7 +87,7 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
} }
for(int g = 0; g < 4; g++) { for(int g = 0; g < 4; g++) {
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule[g].recipe); GenericRecipe recipe = chemplant.chemplantModule[g].getRecipe();
/// LEFT LED /// LEFT LED
if(chemplant.didProcess[g]) { if(chemplant.didProcess[g]) {
@ -105,7 +105,7 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
} }
for(int g = 0; g < 4; g++) { // not a great way of doing it but at least we eliminate state leak bullshit for(int g = 0; g < 4; g++) { // not a great way of doing it but at least we eliminate state leak bullshit
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule[g].recipe); GenericRecipe recipe = chemplant.chemplantModule[g].getRecipe();
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 75, 20 + g * 22); this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 75, 20 + g * 22);

View File

@ -43,8 +43,8 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, chemplant.power, chemplant.maxPower); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, chemplant.power, chemplant.maxPower);
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) { if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
if(this.chemplant.chemplantModule.recipe != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule.recipe)) { if(this.chemplant.chemplantModule.getRecipe() != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule.getRecipeName())) {
GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule.recipe); GenericRecipe recipe = this.chemplant.chemplantModule.getRecipe();
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height); GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
} else { } else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY); this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
@ -56,7 +56,7 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
protected void mouseClicked(int x, int y, int button) { protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button); super.mouseClicked(x, y, button);
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(ChemicalPlantRecipes.INSTANCE, chemplant, chemplant.chemplantModule.recipe, 0, ItemBlueprints.grabPool(chemplant.slots[1]), this); if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(ChemicalPlantRecipes.INSTANCE, chemplant, chemplant.chemplantModule.getRecipeName(), 0, ItemBlueprints.grabPool(chemplant.slots[1]), this);
} }
@Override @Override
@ -81,7 +81,7 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16); drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16);
} }
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule.recipe); GenericRecipe recipe = chemplant.chemplantModule.getRecipe();
/// LEFT LED /// LEFT LED
if(chemplant.didProcess) { if(chemplant.didProcess) {

View File

@ -44,8 +44,8 @@ public class GUIMachinePUREX extends GuiInfoContainer {
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, purex.power, purex.maxPower); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, purex.power, purex.maxPower);
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) { if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
if(this.purex.purexModule.recipe != null && PUREXRecipes.INSTANCE.recipeNameMap.containsKey(this.purex.purexModule.recipe)) { if(this.purex.purexModule.getRecipe() != null && PUREXRecipes.INSTANCE.recipeNameMap.containsKey(this.purex.purexModule.getRecipe())) {
GenericRecipe recipe = (GenericRecipe) PUREXRecipes.INSTANCE.recipeNameMap.get(this.purex.purexModule.recipe); GenericRecipe recipe = this.purex.purexModule.getRecipe();
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height); GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
} else { } else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY); this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
@ -57,7 +57,7 @@ public class GUIMachinePUREX extends GuiInfoContainer {
protected void mouseClicked(int x, int y, int button) { protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button); super.mouseClicked(x, y, button);
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(PUREXRecipes.INSTANCE, purex, purex.purexModule.recipe, 0, ItemBlueprints.grabPool(purex.slots[1]), this); if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(PUREXRecipes.INSTANCE, purex, purex.purexModule.getRecipeName(), 0, ItemBlueprints.grabPool(purex.slots[1]), this);
} }
@Override @Override
@ -82,7 +82,7 @@ public class GUIMachinePUREX extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16); drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16);
} }
GenericRecipe recipe = PUREXRecipes.INSTANCE.recipeNameMap.get(purex.purexModule.recipe); GenericRecipe recipe = purex.purexModule.getRecipe();
/// LEFT LED /// LEFT LED
if(purex.didProcess) { if(purex.didProcess) {

View File

@ -47,15 +47,15 @@ public class GUIMachinePlasmaForge extends GuiInfoContainer {
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 62, forge.power, forge.maxPower); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 62, forge.power, forge.maxPower);
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 80 < mouseY && guiTop + 80 + 18 >= mouseY) { if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 80 < mouseY && guiTop + 80 + 18 >= mouseY) {
if(this.forge.plasmaModule.recipe != null && PlasmaForgeRecipes.INSTANCE.recipeNameMap.containsKey(this.forge.plasmaModule.recipe)) { if(this.forge.plasmaModule.getRecipeName() != null && PlasmaForgeRecipes.INSTANCE.recipeNameMap.containsKey(this.forge.plasmaModule.getRecipeName())) {
GenericRecipe recipe = (GenericRecipe) PlasmaForgeRecipes.INSTANCE.recipeNameMap.get(this.forge.plasmaModule.recipe); GenericRecipe recipe = this.forge.plasmaModule.getRecipe();
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height); GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
} else { } else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY); this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
} }
} }
PlasmaForgeRecipe recipe = (PlasmaForgeRecipe) PlasmaForgeRecipes.INSTANCE.recipeNameMap.get(forge.plasmaModule.recipe); PlasmaForgeRecipe recipe = (PlasmaForgeRecipe) forge.plasmaModule.getRecipe();
if(recipe != null) { if(recipe != null) {
drawCustomInfoStat(mouseX, mouseY, guiLeft + 25, guiTop + 115, 18, 18, mouseX, mouseY, EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + BobMathUtil.getShortNumber(forge.plasmaEnergySync) + "TU / " + BobMathUtil.getShortNumber(recipe.ignitionTemp) + "TU"); drawCustomInfoStat(mouseX, mouseY, guiLeft + 25, guiTop + 115, 18, 18, mouseX, mouseY, EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + BobMathUtil.getShortNumber(forge.plasmaEnergySync) + "TU / " + BobMathUtil.getShortNumber(recipe.ignitionTemp) + "TU");
@ -102,7 +102,7 @@ public class GUIMachinePlasmaForge extends GuiInfoContainer {
protected void mouseClicked(int x, int y, int button) { protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button); super.mouseClicked(x, y, button);
if(this.checkClick(x, y, 7, 80, 18, 18)) GUIScreenRecipeSelector.openSelector(PlasmaForgeRecipes.INSTANCE, forge, forge.plasmaModule.recipe, 0, ItemBlueprints.grabPool(forge.slots[1]), this); if(this.checkClick(x, y, 7, 80, 18, 18)) GUIScreenRecipeSelector.openSelector(PlasmaForgeRecipes.INSTANCE, forge, forge.plasmaModule.getRecipeName(), 0, ItemBlueprints.grabPool(forge.slots[1]), this);
} }
@Override @Override
@ -127,7 +127,7 @@ public class GUIMachinePlasmaForge extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 62, guiTop + 81, 176, 62, j, 16); drawTexturedModalRect(guiLeft + 62, guiTop + 81, 176, 62, j, 16);
} }
PlasmaForgeRecipe recipe = (PlasmaForgeRecipe) PlasmaForgeRecipes.INSTANCE.recipeNameMap.get(forge.plasmaModule.recipe); PlasmaForgeRecipe recipe = (PlasmaForgeRecipe) forge.plasmaModule.getRecipe();
/// LEFT LED /// LEFT LED
if(forge.didProcess) { if(forge.didProcess) {

View File

@ -42,8 +42,8 @@ public class GUIMachinePrecAss extends GuiInfoContainer {
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, assembler.power, assembler.maxPower); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 61, assembler.power, assembler.maxPower);
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) { if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 125 < mouseY && guiTop + 125 + 18 >= mouseY) {
if(this.assembler.assemblerModule.recipe != null && PrecAssRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.recipe)) { if(this.assembler.assemblerModule.getRecipeName() != null && PrecAssRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.getRecipeName())) {
GenericRecipe recipe = (GenericRecipe) PrecAssRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule.recipe); GenericRecipe recipe = this.assembler.assemblerModule.getRecipe();
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height); GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
} else { } else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY); this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
@ -55,7 +55,7 @@ public class GUIMachinePrecAss extends GuiInfoContainer {
protected void mouseClicked(int x, int y, int button) { protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button); super.mouseClicked(x, y, button);
if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(PrecAssRecipes.INSTANCE, assembler, assembler.assemblerModule.recipe, 0, ItemBlueprints.grabPool(assembler.slots[1]), this); if(this.checkClick(x, y, 7, 125, 18, 18)) GUIScreenRecipeSelector.openSelector(PrecAssRecipes.INSTANCE, assembler, assembler.assemblerModule.getRecipeName(), 0, ItemBlueprints.grabPool(assembler.slots[1]), this);
} }
@Override @Override
@ -80,7 +80,7 @@ public class GUIMachinePrecAss extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16); drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16);
} }
GenericRecipe recipe = PrecAssRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule.recipe); GenericRecipe recipe = assembler.assemblerModule.getRecipe();
/// LEFT LED /// LEFT LED
if(assembler.didProcess) { if(assembler.didProcess) {

View File

@ -41,8 +41,8 @@ public class CrucibleRecipe extends GenericRecipe {
@Override @Override
public List<String> print() { public List<String> print() {
List<String> list = new ArrayList(); List<String> list = new ArrayList();
list.add(EnumChatFormatting.YELLOW + this.getLocalizedName());
header(list);
input(list); input(list);
output(list); output(list);

View File

@ -23,8 +23,8 @@ public class PlasmaForgeRecipe extends GenericRecipe {
public List<String> print() { public List<String> print() {
List<String> list = new ArrayList(); List<String> list = new ArrayList();
list.add(EnumChatFormatting.YELLOW + this.getLocalizedName());
header(list);
autoSwitch(list); autoSwitch(list);
duration(list); duration(list);
power(list); power(list);

View File

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.lwjgl.input.Keyboard;
import com.hbm.config.GeneralConfig; import com.hbm.config.GeneralConfig;
import com.hbm.inventory.FluidStack; import com.hbm.inventory.FluidStack;
import com.hbm.inventory.RecipesCommon.AStack; import com.hbm.inventory.RecipesCommon.AStack;
@ -148,8 +150,8 @@ public class GenericRecipe {
public List<String> print() { public List<String> print() {
List<String> list = new ArrayList(); List<String> list = new ArrayList();
list.add(EnumChatFormatting.YELLOW + this.getLocalizedName());
header(list);
autoSwitch(list); autoSwitch(list);
duration(list); duration(list);
power(list); power(list);
@ -159,6 +161,11 @@ public class GenericRecipe {
return list; return list;
} }
protected void header(List<String> list) {
list.add(EnumChatFormatting.YELLOW + this.getLocalizedName());
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) list.add(EnumChatFormatting.DARK_GRAY + "Internal: " + this.getInternalName());
}
protected void autoSwitch(List<String> list) { protected void autoSwitch(List<String> list) {
if(this.autoSwitchGroup != null) { if(this.autoSwitchGroup != null) {
String[] lines = I18nUtil.resolveKeyArray("autoswitch", I18nUtil.resolveKey(this.autoSwitchGroup)); String[] lines = I18nUtil.resolveKeyArray("autoswitch", I18nUtil.resolveKey(this.autoSwitchGroup));

View File

@ -120,6 +120,12 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
return EnumStatementReturn.OK; return EnumStatementReturn.OK;
} }
// writes the total world time to the buffer
if(lower.equals("worldtime")) {
ctx.writeBuffer("" + ctx.world.getTotalWorldTime());
return EnumStatementReturn.OK;
}
return super.eval(ctx, line); return super.eval(ctx, line);
} }
} }

View File

@ -25,11 +25,12 @@ public abstract class ModuleMachineBase {
public FluidTank[] inputTanks; public FluidTank[] inputTanks;
public FluidTank[] outputTanks; public FluidTank[] outputTanks;
// running vars // running vars
public String recipe = "null"; protected String recipe = "null";
public double progress; public double progress;
// return signals // return signals
public boolean didProcess = false; public boolean didProcess = false;
public boolean markDirty = false; public boolean markDirty = false;
public boolean restrictedMode = false;
public ModuleMachineBase(int index, IEnergyHandlerMK2 battery, ItemStack[] slots) { public ModuleMachineBase(int index, IEnergyHandlerMK2 battery, ItemStack[] slots) {
this.index = index; this.index = index;
@ -114,6 +115,7 @@ public abstract class ModuleMachineBase {
} }
public void process(GenericRecipe recipe, double speed, double power) { public void process(GenericRecipe recipe, double speed, double power) {
if(this.restrictedMode) speed *= 0.25; // RoR controlled machines have a speed penalty
this.battery.setPower(this.battery.getPower() - (power == 1 ? recipe.power : (long) (recipe.power * 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 double step = Math.min(speed / recipe.duration, 1D); // can't do more than one recipe per tick, might look into that later
@ -167,11 +169,20 @@ public abstract class ModuleMachineBase {
this.markDirty = true; this.markDirty = true;
} }
public String getRecipeName() {
return this.recipe;
}
public GenericRecipe getRecipe() { public GenericRecipe getRecipe() {
return (GenericRecipe) getRecipeSet().recipeNameMap.get(this.recipe); return (GenericRecipe) getRecipeSet().recipeNameMap.get(this.recipe);
} }
public void setRecipe(String name, boolean ror) {
this.recipe = name;
this.restrictedMode = ror;
}
public abstract GenericRecipes getRecipeSet(); public abstract GenericRecipes getRecipeSet();
public void update(double speed, double power, boolean extraCondition, ItemStack blueprint) { public void update(double speed, double power, boolean extraCondition, ItemStack blueprint) {
@ -232,21 +243,25 @@ public abstract class ModuleMachineBase {
public void serialize(ByteBuf buf) { public void serialize(ByteBuf buf) {
buf.writeDouble(progress); buf.writeDouble(progress);
buf.writeBoolean(restrictedMode);
ByteBufUtils.writeUTF8String(buf, recipe); ByteBufUtils.writeUTF8String(buf, recipe);
} }
public void deserialize(ByteBuf buf) { public void deserialize(ByteBuf buf) {
this.progress = buf.readDouble(); this.progress = buf.readDouble();
this.restrictedMode = buf.readBoolean();
this.recipe = ByteBufUtils.readUTF8String(buf); this.recipe = ByteBufUtils.readUTF8String(buf);
} }
public void readFromNBT(NBTTagCompound nbt) { public void readFromNBT(NBTTagCompound nbt) {
this.progress = nbt.getDouble("progress" + index); this.progress = nbt.getDouble("progress" + index);
this.recipe = nbt.getString("recipe" + index); this.recipe = nbt.getString("recipe" + index);
this.restrictedMode = nbt.getBoolean("restrictedMode");
} }
public void writeToNBT(NBTTagCompound nbt) { public void writeToNBT(NBTTagCompound nbt) {
nbt.setDouble("progress" + index, progress); nbt.setDouble("progress" + index, progress);
nbt.setString("recipe" + index, recipe); nbt.setString("recipe" + index, recipe);
nbt.setBoolean("restrictedMode", restrictedMode);
} }
} }

View File

@ -4,7 +4,6 @@ import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe; import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
@ -162,7 +161,7 @@ public class RenderAssemblyFactory extends TileEntitySpecialRenderer implements
GL11.glRotated(90, 0, 1, 0); GL11.glRotated(90, 0, 1, 0);
GL11.glTranslated(0, 1.0625, 0); GL11.glTranslated(0, 1.0625, 0);
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assemfac.assemblerModule[i].recipe); GenericRecipe recipe = assemfac.assemblerModule[i].getRecipe();
if(recipe != null) { if(recipe != null) {
ItemStack stack = recipe.getIcon(); ItemStack stack = recipe.getIcon();
stack.stackSize = 1; stack.stackSize = 1;

View File

@ -4,7 +4,6 @@ import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe; import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
@ -99,7 +98,7 @@ public class RenderAssemblyMachine extends TileEntitySpecialRenderer implements
GL11.glShadeModel(GL11.GL_FLAT); GL11.glShadeModel(GL11.GL_FLAT);
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule.recipe); GenericRecipe recipe = assembler.assemblerModule.getRecipe();
if(recipe != null && MainRegistry.proxy.me().getDistanceSq(tileEntity.xCoord + 0.5, tileEntity.yCoord + 1, tileEntity.zCoord + 0.5) < 35 * 35) { if(recipe != null && MainRegistry.proxy.me().getDistanceSq(tileEntity.xCoord + 0.5, tileEntity.yCoord + 1, tileEntity.zCoord + 0.5) < 35 * 35) {
GL11.glRotated(90, 0, 1, 0); GL11.glRotated(90, 0, 1, 0);

View File

@ -7,7 +7,6 @@ import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.FluidStack; import com.hbm.inventory.FluidStack;
import com.hbm.inventory.recipes.ChemicalPlantRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe; import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.item.ItemRenderBase; import com.hbm.render.item.ItemRenderBase;
@ -39,7 +38,7 @@ public class RenderChemicalPlant extends TileEntitySpecialRenderer implements II
TileEntityMachineChemicalPlant chemplant = (TileEntityMachineChemicalPlant) tileEntity; TileEntityMachineChemicalPlant chemplant = (TileEntityMachineChemicalPlant) tileEntity;
float anim = chemplant.prevAnim + (chemplant.anim - chemplant.prevAnim) * interp; float anim = chemplant.prevAnim + (chemplant.anim - chemplant.prevAnim) * interp;
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule.recipe); GenericRecipe recipe = chemplant.chemplantModule.getRecipe();
bindTexture(ResourceManager.chemical_plant_tex); bindTexture(ResourceManager.chemical_plant_tex);
ResourceManager.chemical_plant.renderPart("Base"); ResourceManager.chemical_plant.renderPart("Base");

View File

@ -5,7 +5,6 @@ import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.recipes.PlasmaForgeRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe; import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
@ -62,7 +61,7 @@ public class RenderFusionPlasmaForge extends TileEntitySpecialRenderer implement
bindTexture(ResourceManager.fusion_plasma_forge_tex); bindTexture(ResourceManager.fusion_plasma_forge_tex);
ResourceManager.fusion_plasma_forge.renderPart("Body"); ResourceManager.fusion_plasma_forge.renderPart("Body");
GenericRecipe recipe = PlasmaForgeRecipes.INSTANCE.recipeNameMap.get(forge.plasmaModule.recipe); GenericRecipe recipe = forge.plasmaModule.getRecipe();
renderPlasma(forge); renderPlasma(forge);
renderItem(forge, recipe, interp); renderItem(forge, recipe, interp);

View File

@ -4,7 +4,6 @@ import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.recipes.PrecAssRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe; import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
@ -71,7 +70,7 @@ public class RenderPrecAss extends TileEntitySpecialRenderer implements IItemRen
GL11.glShadeModel(GL11.GL_FLAT); GL11.glShadeModel(GL11.GL_FLAT);
GenericRecipe recipe = PrecAssRecipes.INSTANCE.recipeNameMap.get(assembler.assemblerModule.recipe); GenericRecipe recipe = assembler.assemblerModule.getRecipe();
if(recipe != null && MainRegistry.proxy.me().getDistanceSq(tileEntity.xCoord + 0.5, tileEntity.yCoord + 1, tileEntity.zCoord + 0.5) < 35 * 35) { if(recipe != null && MainRegistry.proxy.me().getDistanceSq(tileEntity.xCoord + 0.5, tileEntity.yCoord + 1, tileEntity.zCoord + 0.5) < 35 * 35) {
GL11.glRotated(90, 0, 1, 0); GL11.glRotated(90, 0, 1, 0);

View File

@ -12,7 +12,6 @@ import com.hbm.inventory.container.ContainerMachineAssemblyFactory;
import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineAssemblyFactory; import com.hbm.inventory.gui.GUIMachineAssemblyFactory;
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe; import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade;
@ -158,7 +157,7 @@ public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase impl
long nextMaxPower = 0; long nextMaxPower = 0;
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assemblerModule[i].recipe); GenericRecipe recipe = assemblerModule[i].getRecipe();
if(recipe != null) { if(recipe != null) {
nextMaxPower += recipe.power * 100; nextMaxPower += recipe.power * 100;
} }
@ -374,7 +373,7 @@ public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase impl
int index = data.getInteger("index"); int index = data.getInteger("index");
String selection = data.getString("selection"); String selection = data.getString("selection");
if(index >= 0 && index < 4) { if(index >= 0 && index < 4) {
this.assemblerModule[index].recipe = selection; this.assemblerModule[index].setRecipe(selection, false);
this.markChanged(); this.markChanged();
} }
} }

View File

@ -11,7 +11,6 @@ import com.hbm.inventory.container.ContainerMachineAssemblyMachine;
import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineAssemblyMachine; import com.hbm.inventory.gui.GUIMachineAssemblyMachine;
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe; import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade;
@ -30,6 +29,8 @@ import com.hbm.util.i18n.I18nUtil;
import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.energymk2.IEnergyReceiverMK2;
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2; import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
import api.hbm.redstoneoverradio.IRORInteractive;
import api.hbm.redstoneoverradio.IRORValueProvider;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
@ -41,7 +42,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
public class TileEntityMachineAssemblyMachine extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider { public class TileEntityMachineAssemblyMachine extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IRORValueProvider, IRORInteractive {
public FluidTank inputTank; public FluidTank inputTank;
public FluidTank outputTank; public FluidTank outputTank;
@ -88,7 +89,7 @@ public class TileEntityMachineAssemblyMachine extends TileEntityMachineBase impl
if(!worldObj.isRemote) { if(!worldObj.isRemote) {
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assemblerModule.recipe); GenericRecipe recipe = assemblerModule.getRecipe();
if(recipe != null) { if(recipe != null) {
this.maxPower = recipe.power * 100; this.maxPower = recipe.power * 100;
} }
@ -303,7 +304,7 @@ public class TileEntityMachineAssemblyMachine extends TileEntityMachineBase impl
int index = data.getInteger("index"); int index = data.getInteger("index");
String selection = data.getString("selection"); String selection = data.getString("selection");
if(index == 0) { if(index == 0) {
this.assemblerModule.recipe = selection; this.assemblerModule.setRecipe(selection, false);
this.markChanged(); this.markChanged();
} }
} }
@ -482,4 +483,34 @@ public class TileEntityMachineAssemblyMachine extends TileEntityMachineBase impl
}; };
} }
} }
@Override
public String[] getFunctionInfo() {
return new String[] {
PREFIX_VALUE + "progress",
PREFIX_VALUE + "recipe",
PREFIX_VALUE + "active",
PREFIX_FUNCTION + "setrecipe" + NAME_SEPARATOR + "name",
};
}
@Override
public String provideRORValue(String name) {
if("progress".equals(name)) return "" + (int) Math.round(this.assemblerModule.progress * 100);
if("recipe".equals(name)) return this.assemblerModule.getRecipeName();
if("active".equals(name)) return "" + (this.didProcess ? 1 : 0);
return null;
}
@Override
public String runRORFunction(String name, String[] params) {
if("setrecipe".equals(name) && params.length == 1) {
this.assemblerModule.setRecipe(params[0], true);
this.markChanged();
return null;
}
return null;
}
} }

View File

@ -10,7 +10,6 @@ import com.hbm.inventory.container.ContainerMachineChemicalFactory;
import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineChemicalFactory; import com.hbm.inventory.gui.GUIMachineChemicalFactory;
import com.hbm.inventory.recipes.ChemicalPlantRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe; import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade;
@ -158,7 +157,7 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
long nextMaxPower = 0; long nextMaxPower = 0;
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplantModule[i].recipe); GenericRecipe recipe = chemplantModule[i].getRecipe();
if(recipe != null) { if(recipe != null) {
nextMaxPower += recipe.power * 100; nextMaxPower += recipe.power * 100;
} }
@ -400,7 +399,7 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
int index = data.getInteger("index"); int index = data.getInteger("index");
String selection = data.getString("selection"); String selection = data.getString("selection");
if(index >= 0 && index < 4) { if(index >= 0 && index < 4) {
this.chemplantModule[index].recipe = selection; this.chemplantModule[index].setRecipe(selection, false);
this.markChanged(); this.markChanged();
} }
} }

View File

@ -10,7 +10,6 @@ import com.hbm.inventory.container.ContainerMachineChemicalPlant;
import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineChemicalPlant; import com.hbm.inventory.gui.GUIMachineChemicalPlant;
import com.hbm.inventory.recipes.ChemicalPlantRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe; import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade;
@ -86,7 +85,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
if(!worldObj.isRemote) { if(!worldObj.isRemote) {
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplantModule.recipe); GenericRecipe recipe = chemplantModule.getRecipe();
if(recipe != null) { if(recipe != null) {
this.maxPower = recipe.power * 100; this.maxPower = recipe.power * 100;
} }
@ -278,7 +277,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
int index = data.getInteger("index"); int index = data.getInteger("index");
String selection = data.getString("selection"); String selection = data.getString("selection");
if(index == 0) { if(index == 0) {
this.chemplantModule.recipe = selection; this.chemplantModule.setRecipe(selection, false);
this.markChanged(); this.markChanged();
} }
} }

View File

@ -10,7 +10,6 @@ import com.hbm.inventory.container.ContainerMachinePUREX;
import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachinePUREX; import com.hbm.inventory.gui.GUIMachinePUREX;
import com.hbm.inventory.recipes.PUREXRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe; import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade;
@ -80,7 +79,7 @@ public class TileEntityMachinePUREX extends TileEntityMachineBase implements IEn
if(!worldObj.isRemote) { if(!worldObj.isRemote) {
GenericRecipe recipe = PUREXRecipes.INSTANCE.recipeNameMap.get(purexModule.recipe); GenericRecipe recipe = purexModule.getRecipe();
if(recipe != null) { if(recipe != null) {
this.maxPower = recipe.power * 100; this.maxPower = recipe.power * 100;
} }
@ -235,7 +234,7 @@ public class TileEntityMachinePUREX extends TileEntityMachineBase implements IEn
int index = data.getInteger("index"); int index = data.getInteger("index");
String selection = data.getString("selection"); String selection = data.getString("selection");
if(index == 0) { if(index == 0) {
this.purexModule.recipe = selection; this.purexModule.setRecipe(selection, false);
this.markChanged(); this.markChanged();
} }
} }

View File

@ -10,7 +10,6 @@ import com.hbm.inventory.container.ContainerMachinePrecAss;
import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachinePrecAss; import com.hbm.inventory.gui.GUIMachinePrecAss;
import com.hbm.inventory.recipes.PrecAssRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe; import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade;
@ -93,7 +92,7 @@ public class TileEntityMachinePrecAss extends TileEntityMachineBase implements I
if(!worldObj.isRemote) { if(!worldObj.isRemote) {
GenericRecipe recipe = PrecAssRecipes.INSTANCE.recipeNameMap.get(assemblerModule.recipe); GenericRecipe recipe = assemblerModule.getRecipe();
if(recipe != null) { if(recipe != null) {
this.maxPower = recipe.power * 100; this.maxPower = recipe.power * 100;
} }
@ -352,7 +351,7 @@ public class TileEntityMachinePrecAss extends TileEntityMachineBase implements I
int index = data.getInteger("index"); int index = data.getInteger("index");
String selection = data.getString("selection"); String selection = data.getString("selection");
if(index == 0) { if(index == 0) {
this.assemblerModule.recipe = selection; this.assemblerModule.setRecipe(selection, false);
this.markChanged(); this.markChanged();
} }
} }

View File

@ -16,7 +16,6 @@ import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachinePlasmaForge; import com.hbm.inventory.gui.GUIMachinePlasmaForge;
import com.hbm.inventory.recipes.PlasmaForgeRecipe; import com.hbm.inventory.recipes.PlasmaForgeRecipe;
import com.hbm.inventory.recipes.PlasmaForgeRecipes;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.lib.Library; import com.hbm.lib.Library;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
@ -156,7 +155,7 @@ public class TileEntityFusionPlasmaForge extends TileEntityMachineBase implement
if(receiverNode != null && receiverNode.hasValidNet()) receiverNode.net.addReceiver(this); if(receiverNode != null && receiverNode.hasValidNet()) receiverNode.net.addReceiver(this);
if(providerNode != null && providerNode.hasValidNet()) providerNode.net.addProvider(this); // technically unused, but good to have when we do something else with the plasma nets if(providerNode != null && providerNode.hasValidNet()) providerNode.net.addProvider(this); // technically unused, but good to have when we do something else with the plasma nets
PlasmaForgeRecipe recipe = (PlasmaForgeRecipe) PlasmaForgeRecipes.INSTANCE.recipeNameMap.get(plasmaModule.recipe); PlasmaForgeRecipe recipe = (PlasmaForgeRecipe) plasmaModule.getRecipe();
if(recipe != null) this.maxPower = recipe.power * 100; if(recipe != null) this.maxPower = recipe.power * 100;
this.maxPower = BobMathUtil.max(this.power, this.maxPower, 100_000); this.maxPower = BobMathUtil.max(this.power, this.maxPower, 100_000);
@ -364,7 +363,7 @@ public class TileEntityFusionPlasmaForge extends TileEntityMachineBase implement
int index = data.getInteger("index"); int index = data.getInteger("index");
String selection = data.getString("selection"); String selection = data.getString("selection");
if(index == 0) { if(index == 0) {
this.plasmaModule.recipe = selection; this.plasmaModule.setRecipe(selection, false);
this.markChanged(); this.markChanged();
} }
} }

View File

@ -473,7 +473,7 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
int index = data.getInteger("index"); int index = data.getInteger("index");
String selection = data.getString("selection"); String selection = data.getString("selection");
if(index == 0) { if(index == 0) {
this.fusionModule.recipe = selection; this.fusionModule.setRecipe(selection, false);
this.markChanged(); this.markChanged();
} }
} }

View File

@ -4,7 +4,9 @@ package com.hbm.tileentity.network.pneumatic;
import com.hbm.interfaces.IControlReceiver; import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.container.ContainerPneumoStorageExporter; import com.hbm.inventory.container.ContainerPneumoStorageExporter;
import com.hbm.inventory.gui.GUIPneumoStorageExporter; import com.hbm.inventory.gui.GUIPneumoStorageExporter;
import com.hbm.tileentity.network.RTTYSystem;
import api.hbm.ntl.StackCache.CacheSlot;
import api.hbm.redstoneoverradio.IRORInteractive; import api.hbm.redstoneoverradio.IRORInteractive;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -20,8 +22,8 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
public boolean rorConfiguredMode = false; public boolean rorConfiguredMode = false;
/** What strategy to use for handling request filters */ /** What strategy to use for handling request filters */
public int requestMode = 0; public int requestMode = 0;
/** Item ID and meta pairs for RoR controlled filters */ /** Item ID and meta pairs with amount for RoR controlled filters */
public short[][] rorFilters = new short[9][2]; public short[][] rorFilters = new short[9][3];
/** Each slot individually tries to pull as much as it can of the configured item */ /** Each slot individually tries to pull as much as it can of the configured item */
public static final int MODE_AS_MUCH_AS_POSSIBLE = 0; public static final int MODE_AS_MUCH_AS_POSSIBLE = 0;
@ -47,6 +49,23 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
this.networkPackNT(15); this.networkPackNT(15);
} }
} }
public void doRequest(boolean force) {
}
public void requestSlot(int slot, boolean force) {
}
public long getAvailability(int item, int meta) {
if(this.cache == null || this.cache.hasExpired) return 0;
long hash = this.cache.getStackIdentity(item, meta, null);
if(hash == this.cache.getNullIdentity()) return 0;
CacheSlot slot = this.cache.cacheSlots.get(hash);
if(slot == null) return 0;
return slot.stacksize;
}
@Override @Override
public void serialize(ByteBuf buf) { public void serialize(ByteBuf buf) {
@ -57,6 +76,7 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
for(int i = 0; i < 9; i++) { for(int i = 0; i < 9; i++) {
buf.writeShort(rorFilters[i][0]); buf.writeShort(rorFilters[i][0]);
buf.writeShort(rorFilters[i][1]); buf.writeShort(rorFilters[i][1]);
buf.writeShort(rorFilters[i][2]);
} }
} }
@ -69,6 +89,7 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
for(int i = 0; i < 9; i++) { for(int i = 0; i < 9; i++) {
rorFilters[i][0] = buf.readShort(); rorFilters[i][0] = buf.readShort();
rorFilters[i][1] = buf.readShort(); rorFilters[i][1] = buf.readShort();
rorFilters[i][2] = buf.readShort();
} }
} }
@ -96,7 +117,7 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
public String[] getFunctionInfo() { public String[] getFunctionInfo() {
return new String[] { return new String[] {
PREFIX_FUNCTION + "setfilter" + NAME_SEPARATOR + "slot" + PARAM_SEPARATOR + "itemid" + PARAM_SEPARATOR + "itemmeta" + PARAM_SEPARATOR + "amount", PREFIX_FUNCTION + "setfilter" + NAME_SEPARATOR + "slot" + PARAM_SEPARATOR + "itemid" + PARAM_SEPARATOR + "itemmeta" + PARAM_SEPARATOR + "amount",
PREFIX_FUNCTION + "setcontinuous" + NAME_SEPARATOR + "slot" + PARAM_SEPARATOR + "itemid" + PARAM_SEPARATOR + "itemmeta" + PARAM_SEPARATOR + "amount", PREFIX_FUNCTION + "setcontinuous" + NAME_SEPARATOR + "on/off",
PREFIX_FUNCTION + "request", PREFIX_FUNCTION + "request",
PREFIX_FUNCTION + "requestslot" + NAME_SEPARATOR + "slot", PREFIX_FUNCTION + "requestslot" + NAME_SEPARATOR + "slot",
PREFIX_FUNCTION + "checkavailability" + NAME_SEPARATOR + "itemid" + PARAM_SEPARATOR + "itemmeta" + PARAM_SEPARATOR + "returnchannel", PREFIX_FUNCTION + "checkavailability" + NAME_SEPARATOR + "itemid" + PARAM_SEPARATOR + "itemmeta" + PARAM_SEPARATOR + "returnchannel",
@ -105,6 +126,47 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
@Override @Override
public String runRORFunction(String name, String[] params) { public String runRORFunction(String name, String[] params) {
if("setfilter".equals(name) && params.length == 4) {
int slot = IRORInteractive.parseInt(params[0], 1, 9) - 1;
int itemId = IRORInteractive.parseInt(params[1], 0, Short.MAX_VALUE);
int meta = IRORInteractive.parseInt(params[2], 0, Short.MAX_VALUE);
int amount = IRORInteractive.parseInt(params[3], 1, 64);
this.rorFilters[slot][0] = (short) itemId;
this.rorFilters[slot][1] = (short) meta;
this.rorFilters[slot][2] = (short) amount;
this.markChanged();
return null;
}
if("setcontinuous".equals(name) && params.length == 1) {
if("on".equals(params[0])) this.continuousRequest = true;
if("off".equals(params[0])) this.continuousRequest = false;
this.markChanged();
return null;
}
if("request".equals(name)) {
this.doRequest(true);
return null;
}
if("requestslot".equals(name) && params.length == 1) {
int slot = IRORInteractive.parseInt(params[0], 1, 9) - 1;
this.requestSlot(slot, true);
return null;
}
if("checkavailability".equals(name) && params.length == 3) {
int itemId = IRORInteractive.parseInt(params[0], 0, Short.MAX_VALUE);
int meta = IRORInteractive.parseInt(params[1], 0, Short.MAX_VALUE);
String ret = params[2];
long availability = this.getAvailability(itemId, meta);
RTTYSystem.broadcast(worldObj, ret, availability + "");
return null;
}
return null; return null;
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB