Merge branch 'HbmMods:master' into rulang121
20
changelog
@ -24,11 +24,27 @@
|
||||
* Added an alternate chemical plant recipe that uses a smaller selection of items and ICs instead of ACs
|
||||
* Flashgold and flashlead are now made in the PUREX instead of the crafting table
|
||||
* The flashgold recipe now yields two billets instead of one
|
||||
* Slightly changed the HSS ingot texture to not look identical to steel except slightly greenish
|
||||
* Slightly changed the HSS ingot and plate textures to not look identical to steel except slightly greenish
|
||||
* The AUTOCAL's buffer is now limited to 256 characters instead of being infinite
|
||||
* 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
|
||||
* This means that the AUTOCAL can now send RoR commands using calculated values directly without the use of `round` or `evalr`
|
||||
* Assembly machines and chemical plants 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
|
||||
* Assembly factories, chemical factories, PUREX and plasma forges can now be read (but not configured) using Redstone-over-Radio
|
||||
* Fusion reactor vessels can now be read and configured using RoR
|
||||
* Unlike assemblers and chemplants, remote recipe configuration does not cause a speed penalty
|
||||
* 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
|
||||
* All RoR values/commands are now case-insensitive
|
||||
|
||||
## Fixed
|
||||
* Fixed AUTOCAL's number comparison functions not working with variable substitution as advertised
|
||||
@ -39,4 +55,4 @@
|
||||
* Fixed some recipes not using ore dict when they should
|
||||
* Fixed `anyBismoid` group not being a proper group, causing other mods' bismuth and arsenic to not be included
|
||||
* Fixed RoR gauge not using SI suffixes on values below 0
|
||||
* Fixed AUTOCAL units not closing their GUI when the unit is destroyed
|
||||
* Fixed AUTOCAL units not closing their GUI when the unit is destroyed
|
||||
|
||||
@ -197,7 +197,11 @@ public class StackCache {
|
||||
|
||||
public static long getStackIdentity(Item item, int meta, NBTTagCompound nbt) {
|
||||
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 *= 27644437;
|
||||
if(nbt != null) identity += nbt.hashCode();
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package api.hbm.redstoneoverradio;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public interface IRORInteractive extends IRORInfo {
|
||||
|
||||
public static String NAME_SEPARATOR = "!";
|
||||
@ -9,7 +11,7 @@ public interface IRORInteractive extends IRORInfo {
|
||||
public static String EX_NAME = "Exception: Multiple Name Separators";
|
||||
public static String EX_FORMAT = "Exception: Parameter in Invalid Format";
|
||||
|
||||
/** Runs a function on the ROR component, usually causing the component to change or do something. Returns are optional. */
|
||||
/** Runs a function on the ROR component, usually causing the component to change or do something. Returns are unused for now. */
|
||||
public String runRORFunction(String name, String[] params);
|
||||
|
||||
/** Extracts the command name from a full command string */
|
||||
@ -18,7 +20,7 @@ public interface IRORInteractive extends IRORInfo {
|
||||
String[] parts = input.split(NAME_SEPARATOR);
|
||||
if(parts.length <= 0 || parts.length > 2) throw new RORFunctionException(EX_NAME);
|
||||
if(parts[0].isEmpty()) throw new RORFunctionException(EX_NULL);
|
||||
return parts[0];
|
||||
return parts[0].toLowerCase(Locale.US);
|
||||
}
|
||||
|
||||
/** Extracts the param list from a full command string */
|
||||
|
||||
@ -16,10 +16,10 @@ public class SlotPattern extends Slot {
|
||||
public SlotPattern(IInventory inv, int index, int x, int y) {
|
||||
super(inv, index, x, y);
|
||||
}
|
||||
|
||||
public SlotPattern(IInventory inv, int index, int x, int y, boolean allowStackSize) {
|
||||
super(inv, index, x, y);
|
||||
this.allowStackSize = allowStackSize;
|
||||
|
||||
public SlotPattern allowStackSize() {
|
||||
this.allowStackSize = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -29,7 +29,7 @@ public class SlotPattern extends Slot {
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
return allowStackSize ? 64 : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -37,7 +37,7 @@ public class SlotPattern extends Slot {
|
||||
if (stack != null) {
|
||||
stack = stack.copy();
|
||||
|
||||
if (!allowStackSize)
|
||||
if(!allowStackSize)
|
||||
stack.stackSize = 1;
|
||||
}
|
||||
super.putStack(stack);
|
||||
|
||||
@ -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, 9, 116, 40, true));
|
||||
this.addSlotToContainer(new SlotPattern(tedf, 9, 116, 40).allowStackSize());
|
||||
|
||||
/* RECIPE */
|
||||
addSlots(tedf,10, 44, 86, 3, 3);
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotPattern;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageExporter;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerPneumoStorageExporter extends ContainerBase {
|
||||
|
||||
public ContainerPneumoStorageExporter(InventoryPlayer invPlayer, TileEntityPneumoStorageExporter exporter) {
|
||||
super(invPlayer, exporter);
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new SlotPattern(exporter, i, 17 + (i % 3) * 18, 17 + (i / 3) * 18).allowStackSize());
|
||||
}
|
||||
|
||||
addSlots(exporter, 9, 80, 17, 3, 3);
|
||||
playerInv(invPlayer, 103);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
|
||||
|
||||
//L/R: 0
|
||||
//M3: 3
|
||||
//SHIFT: 1
|
||||
//DRAG: 5
|
||||
|
||||
if(index < 0 || index >= 9) {
|
||||
return super.slotClick(index, button, mode, player);
|
||||
}
|
||||
|
||||
Slot slot = this.getSlot(index);
|
||||
ItemStack ret = null;
|
||||
ItemStack held = player.inventory.getItemStack();
|
||||
|
||||
if(slot.getHasStack()) ret = slot.getStack().copy();
|
||||
slot.putStack(held);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -41,7 +41,7 @@ public class GUIFusionTorus extends GuiInfoContainer {
|
||||
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);
|
||||
|
||||
FusionRecipe recipe = (FusionRecipe) FusionRecipes.INSTANCE.recipeNameMap.get(this.torus.fusionModule.recipe);
|
||||
FusionRecipe recipe = (FusionRecipe) this.torus.fusionModule.getRecipe();
|
||||
|
||||
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");
|
||||
@ -70,7 +70,7 @@ public class GUIFusionTorus extends GuiInfoContainer {
|
||||
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);
|
||||
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
|
||||
@ -103,7 +103,7 @@ public class GUIFusionTorus extends GuiInfoContainer {
|
||||
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
|
||||
if(recipe != null && torus.power >= recipe.power) drawTexturedModalRect(guiLeft + 160, guiTop + 115, 246, 14, 8, 8);
|
||||
|
||||
@ -47,8 +47,8 @@ public class GUIMachineAssemblyFactory extends GuiInfoContainer {
|
||||
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) {
|
||||
if(this.assembler.assemblerModule[i].recipe != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule[i].recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule[i].recipe);
|
||||
if(this.assembler.assemblerModule[i].getRecipeName() != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule[i].getRecipeName())) {
|
||||
GenericRecipe recipe = this.assembler.assemblerModule[i].getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
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) {
|
||||
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
|
||||
@ -87,7 +87,7 @@ public class GUIMachineAssemblyFactory extends GuiInfoContainer {
|
||||
}
|
||||
|
||||
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
|
||||
if(assembler.didProcess[g]) {
|
||||
@ -105,7 +105,7 @@ public class GUIMachineAssemblyFactory extends GuiInfoContainer {
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@ -42,8 +42,8 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
|
||||
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(this.assembler.assemblerModule.recipe != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule.recipe);
|
||||
if(this.assembler.assemblerModule.getRecipeName() != null && AssemblyMachineRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.getRecipeName())) {
|
||||
GenericRecipe recipe = this.assembler.assemblerModule.getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
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) {
|
||||
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
|
||||
@ -77,10 +77,10 @@ public class GUIMachineAssemblyMachine extends GuiInfoContainer {
|
||||
|
||||
if(assembler.assemblerModule.progress > 0) {
|
||||
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
|
||||
if(assembler.didProcess) {
|
||||
|
||||
@ -47,8 +47,8 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
|
||||
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) {
|
||||
if(this.chemplant.chemplantModule[i].recipe != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule[i].recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule[i].recipe);
|
||||
if(this.chemplant.chemplantModule[i].getRecipeName() != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule[i].getRecipeName())) {
|
||||
GenericRecipe recipe = this.chemplant.chemplantModule[i].getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
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) {
|
||||
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
|
||||
@ -87,7 +87,7 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
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);
|
||||
|
||||
|
||||
@ -43,8 +43,8 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
|
||||
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(this.chemplant.chemplantModule.recipe != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.chemplant.chemplantModule.recipe);
|
||||
if(this.chemplant.chemplantModule.getRecipe() != null && ChemicalPlantRecipes.INSTANCE.recipeNameMap.containsKey(this.chemplant.chemplantModule.getRecipeName())) {
|
||||
GenericRecipe recipe = this.chemplant.chemplantModule.getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
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) {
|
||||
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
|
||||
@ -78,10 +78,10 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
|
||||
|
||||
if(chemplant.chemplantModule.progress > 0) {
|
||||
int j = (int) Math.ceil(70 * chemplant.chemplantModule.progress);
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61, j, 16);
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 126, 176, 61 + (chemplant.chemplantModule.restrictedMode ? 16 : 0), j, 16);
|
||||
}
|
||||
|
||||
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule.recipe);
|
||||
GenericRecipe recipe = chemplant.chemplantModule.getRecipe();
|
||||
|
||||
/// LEFT LED
|
||||
if(chemplant.didProcess) {
|
||||
|
||||
@ -44,8 +44,8 @@ public class GUIMachinePUREX extends GuiInfoContainer {
|
||||
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(this.purex.purexModule.recipe != null && PUREXRecipes.INSTANCE.recipeNameMap.containsKey(this.purex.purexModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) PUREXRecipes.INSTANCE.recipeNameMap.get(this.purex.purexModule.recipe);
|
||||
if(this.purex.purexModule.getRecipe() != null && PUREXRecipes.INSTANCE.recipeNameMap.containsKey(this.purex.purexModule.getRecipe())) {
|
||||
GenericRecipe recipe = this.purex.purexModule.getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
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) {
|
||||
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
|
||||
@ -82,7 +82,7 @@ public class GUIMachinePUREX extends GuiInfoContainer {
|
||||
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
|
||||
if(purex.didProcess) {
|
||||
|
||||
@ -47,15 +47,15 @@ public class GUIMachinePlasmaForge extends GuiInfoContainer {
|
||||
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(this.forge.plasmaModule.recipe != null && PlasmaForgeRecipes.INSTANCE.recipeNameMap.containsKey(this.forge.plasmaModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) PlasmaForgeRecipes.INSTANCE.recipeNameMap.get(this.forge.plasmaModule.recipe);
|
||||
if(this.forge.plasmaModule.getRecipeName() != null && PlasmaForgeRecipes.INSTANCE.recipeNameMap.containsKey(this.forge.plasmaModule.getRecipeName())) {
|
||||
GenericRecipe recipe = this.forge.plasmaModule.getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
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) {
|
||||
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) {
|
||||
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
|
||||
@ -127,7 +127,7 @@ public class GUIMachinePlasmaForge extends GuiInfoContainer {
|
||||
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
|
||||
if(forge.didProcess) {
|
||||
|
||||
@ -42,8 +42,8 @@ public class GUIMachinePrecAss extends GuiInfoContainer {
|
||||
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(this.assembler.assemblerModule.recipe != null && PrecAssRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.recipe)) {
|
||||
GenericRecipe recipe = (GenericRecipe) PrecAssRecipes.INSTANCE.recipeNameMap.get(this.assembler.assemblerModule.recipe);
|
||||
if(this.assembler.assemblerModule.getRecipeName() != null && PrecAssRecipes.INSTANCE.recipeNameMap.containsKey(this.assembler.assemblerModule.getRecipeName())) {
|
||||
GenericRecipe recipe = this.assembler.assemblerModule.getRecipe();
|
||||
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
|
||||
} else {
|
||||
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) {
|
||||
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
|
||||
@ -80,7 +80,7 @@ public class GUIMachinePrecAss extends GuiInfoContainer {
|
||||
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
|
||||
if(assembler.didProcess) {
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageExporter;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageExporter;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIPneumoStorageExporter extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_pneumatic_exporter.png");
|
||||
private TileEntityPneumoStorageExporter importer;
|
||||
|
||||
public GUIPneumoStorageExporter(InventoryPlayer invPlayer, TileEntityPneumoStorageExporter importer) {
|
||||
super(new ContainerPneumoStorageExporter(invPlayer, importer));
|
||||
this.importer = importer;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 185;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float interp) {
|
||||
super.drawScreen(x, y, interp);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
clickSendFlag(importer, x, y, 142, 16, 18, 18, "continuous");
|
||||
clickSendFlag(importer, x, y, 142, 34, 18, 18, "request");
|
||||
clickSendFlag(importer, x, y, 142, 52, 18, 18, "ror");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.importer.hasCustomInventoryName() ? this.importer.getInventoryName() : I18n.format(this.importer.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 5, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(!this.importer.continuousRequest) drawTexturedModalRect(guiLeft + 142, guiTop + 16, xSize, 0, 18, 18);
|
||||
if(!this.importer.rorConfiguredMode) drawTexturedModalRect(guiLeft + 142, guiTop + 52, xSize, 18, 18, 18);
|
||||
if(this.importer.requestMode == importer.MODE_FULL_STACK) drawTexturedModalRect(guiLeft + 142, guiTop + 34, xSize + 18, 0, 18, 18);
|
||||
if(this.importer.requestMode == importer.MODE_FULL_REQUEST) drawTexturedModalRect(guiLeft + 142, guiTop + 34, xSize + 18, 18, 18, 18);
|
||||
}
|
||||
}
|
||||
@ -22,7 +22,7 @@ public class GUIPneumoStorageImporter extends GuiContainer {
|
||||
this.importer = importer;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 186;
|
||||
this.ySize = 185;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -41,8 +41,8 @@ public class CrucibleRecipe extends GenericRecipe {
|
||||
@Override
|
||||
public List<String> print() {
|
||||
List<String> list = new ArrayList();
|
||||
list.add(EnumChatFormatting.YELLOW + this.getLocalizedName());
|
||||
|
||||
header(list);
|
||||
input(list);
|
||||
output(list);
|
||||
|
||||
|
||||
@ -23,8 +23,8 @@ public class PlasmaForgeRecipe extends GenericRecipe {
|
||||
|
||||
public List<String> print() {
|
||||
List<String> list = new ArrayList();
|
||||
list.add(EnumChatFormatting.YELLOW + this.getLocalizedName());
|
||||
|
||||
header(list);
|
||||
autoSwitch(list);
|
||||
duration(list);
|
||||
power(list);
|
||||
|
||||
@ -4,6 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
@ -148,8 +150,8 @@ public class GenericRecipe {
|
||||
|
||||
public List<String> print() {
|
||||
List<String> list = new ArrayList();
|
||||
list.add(EnumChatFormatting.YELLOW + this.getLocalizedName());
|
||||
|
||||
header(list);
|
||||
autoSwitch(list);
|
||||
duration(list);
|
||||
power(list);
|
||||
@ -159,6 +161,11 @@ public class GenericRecipe {
|
||||
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) {
|
||||
if(this.autoSwitchGroup != null) {
|
||||
String[] lines = I18nUtil.resolveKeyArray("autoswitch", I18nUtil.resolveKey(this.autoSwitchGroup));
|
||||
|
||||
@ -48,7 +48,7 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
|
||||
/** Blueprint pool name to list of recipe names that are part of this pool */
|
||||
public static HashMap<String, List<String>> blueprintPools = new HashMap();
|
||||
/** Name to recipe map for all recipes that are part of pools for lookup */
|
||||
public static HashMap<String, GenericRecipe> pooledBlueprints = new HashMap();
|
||||
public static HashMap<String, GenericRecipe> nameToRecipeGlobal = new HashMap();
|
||||
|
||||
/** Groups for auto switch functionality (changes recipe automatically based on first solid input) */
|
||||
public HashMap<String, List<GenericRecipe>> autoSwitchGroups = new HashMap();
|
||||
@ -68,7 +68,6 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
|
||||
blueprintPools.put(pool, list);
|
||||
}
|
||||
list.add(recipe.name);
|
||||
pooledBlueprints.put(recipe.name, recipe);
|
||||
}
|
||||
|
||||
/** Adds a recipe to an auto switch group (recipe can switch based on first solid input) */
|
||||
@ -81,7 +80,7 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
|
||||
|
||||
public static void clearPools() {
|
||||
blueprintPools.clear();
|
||||
pooledBlueprints.clear();
|
||||
nameToRecipeGlobal.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,6 +99,7 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
|
||||
this.recipeOrderedList.add(recipe);
|
||||
if(recipeNameMap.containsKey(recipe.name)) throw new IllegalStateException("Recipe " + recipe.name + " has been registered with a duplicate ID!");
|
||||
this.recipeNameMap.put(recipe.name, recipe);
|
||||
nameToRecipeGlobal.put(recipe.name, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -121,7 +121,7 @@ public class ItemBlueprints extends Item {
|
||||
}
|
||||
|
||||
for(String name : pool) {
|
||||
GenericRecipe recipe = GenericRecipes.pooledBlueprints.get(name);
|
||||
GenericRecipe recipe = GenericRecipes.nameToRecipeGlobal.get(name);
|
||||
if(recipe != null) {
|
||||
list.add(recipe.getLocalizedName());
|
||||
}
|
||||
|
||||
@ -120,6 +120,12 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,11 +25,12 @@ public abstract class ModuleMachineBase {
|
||||
public FluidTank[] inputTanks;
|
||||
public FluidTank[] outputTanks;
|
||||
// running vars
|
||||
public String recipe = "null";
|
||||
protected String recipe = "null";
|
||||
public double progress;
|
||||
// return signals
|
||||
public boolean didProcess = false;
|
||||
public boolean markDirty = false;
|
||||
public boolean restrictedMode = false;
|
||||
|
||||
public ModuleMachineBase(int index, IEnergyHandlerMK2 battery, ItemStack[] slots) {
|
||||
this.index = index;
|
||||
@ -114,6 +115,7 @@ public abstract class ModuleMachineBase {
|
||||
}
|
||||
|
||||
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)));
|
||||
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;
|
||||
}
|
||||
|
||||
public String getRecipeName() {
|
||||
return this.recipe;
|
||||
}
|
||||
|
||||
public GenericRecipe getRecipe() {
|
||||
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 void update(double speed, double power, boolean extraCondition, ItemStack blueprint) {
|
||||
@ -232,21 +243,25 @@ public abstract class ModuleMachineBase {
|
||||
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeDouble(progress);
|
||||
buf.writeBoolean(restrictedMode);
|
||||
ByteBufUtils.writeUTF8String(buf, recipe);
|
||||
}
|
||||
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.progress = buf.readDouble();
|
||||
this.restrictedMode = buf.readBoolean();
|
||||
this.recipe = ByteBufUtils.readUTF8String(buf);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
this.progress = nbt.getDouble("progress" + index);
|
||||
this.recipe = nbt.getString("recipe" + index);
|
||||
this.restrictedMode = nbt.getBoolean("restrictedMode");
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
nbt.setDouble("progress" + index, progress);
|
||||
nbt.setString("recipe" + index, recipe);
|
||||
nbt.setBoolean("restrictedMode", restrictedMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.main.ResourceManager;
|
||||
@ -162,7 +161,7 @@ public class RenderAssemblyFactory extends TileEntitySpecialRenderer implements
|
||||
GL11.glRotated(90, 0, 1, 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) {
|
||||
ItemStack stack = recipe.getIcon();
|
||||
stack.stackSize = 1;
|
||||
|
||||
@ -4,7 +4,6 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.main.ResourceManager;
|
||||
@ -99,7 +98,7 @@ public class RenderAssemblyMachine extends TileEntitySpecialRenderer implements
|
||||
|
||||
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) {
|
||||
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
|
||||
@ -7,7 +7,6 @@ import org.lwjgl.opengl.GL11;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.recipes.ChemicalPlantRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderBase;
|
||||
@ -39,7 +38,7 @@ public class RenderChemicalPlant extends TileEntitySpecialRenderer implements II
|
||||
|
||||
TileEntityMachineChemicalPlant chemplant = (TileEntityMachineChemicalPlant) tileEntity;
|
||||
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);
|
||||
ResourceManager.chemical_plant.renderPart("Base");
|
||||
|
||||
@ -5,7 +5,6 @@ import org.lwjgl.opengl.GL11;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.recipes.PlasmaForgeRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.main.ResourceManager;
|
||||
@ -62,7 +61,7 @@ public class RenderFusionPlasmaForge extends TileEntitySpecialRenderer implement
|
||||
bindTexture(ResourceManager.fusion_plasma_forge_tex);
|
||||
ResourceManager.fusion_plasma_forge.renderPart("Body");
|
||||
|
||||
GenericRecipe recipe = PlasmaForgeRecipes.INSTANCE.recipeNameMap.get(forge.plasmaModule.recipe);
|
||||
GenericRecipe recipe = forge.plasmaModule.getRecipe();
|
||||
|
||||
renderPlasma(forge);
|
||||
renderItem(forge, recipe, interp);
|
||||
|
||||
@ -4,7 +4,6 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.inventory.recipes.PrecAssRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.main.ResourceManager;
|
||||
@ -71,7 +70,7 @@ public class RenderPrecAss extends TileEntitySpecialRenderer implements IItemRen
|
||||
|
||||
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) {
|
||||
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
|
||||
@ -244,8 +244,8 @@ public class TileEntityHeaterOilburner extends TileEntityMachinePolluting implem
|
||||
PREFIX_VALUE + "fuel",
|
||||
PREFIX_VALUE + "burnRate",
|
||||
PREFIX_VALUE + "state",
|
||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "active",
|
||||
PREFIX_FUNCTION + "setBurnRate" + NAME_SEPARATOR + "rate"
|
||||
PREFIX_FUNCTION + "setstate" + NAME_SEPARATOR + "active",
|
||||
PREFIX_FUNCTION + "setburnrate" + NAME_SEPARATOR + "rate"
|
||||
};
|
||||
}
|
||||
|
||||
@ -253,29 +253,23 @@ public class TileEntityHeaterOilburner extends TileEntityMachinePolluting implem
|
||||
public String provideRORValue(String name) {
|
||||
if((PREFIX_VALUE + "heat").equals(name)) return "" + heatEnergy;
|
||||
if((PREFIX_VALUE + "fuel").equals(name)) return "" + tank.getFill();
|
||||
if((PREFIX_VALUE + "burnRate").equals(name)) return "" + setting;
|
||||
if((PREFIX_VALUE + "burnrate").equals(name)) return "" + setting;
|
||||
if((PREFIX_VALUE + "state").equals(name)) return isOn ? "1" : "0";
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if((PREFIX_FUNCTION + "setState").equals(name)) {
|
||||
if((PREFIX_FUNCTION + "setstate").equals(name)) {
|
||||
this.isOn = params[0].equals("1");
|
||||
this.markChanged();
|
||||
return null;
|
||||
}
|
||||
if((PREFIX_FUNCTION + "setBurnRate").equals(name)) {
|
||||
try {
|
||||
int rate = Integer.parseInt(params[0]);
|
||||
if(rate < 1) rate = 1;
|
||||
if(rate > 10) rate = 10;
|
||||
this.setting = rate;
|
||||
this.markChanged();
|
||||
return null;
|
||||
} catch (NumberFormatException e) {
|
||||
return "Invalid number";
|
||||
}
|
||||
if((PREFIX_FUNCTION + "setburnrate").equals(name)) {
|
||||
int rate = IRORInteractive.parseInt(params[0], 1, 10);
|
||||
this.setting = rate;
|
||||
this.markChanged();
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ import com.hbm.inventory.container.ContainerMachineAssemblyFactory;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachineAssemblyFactory;
|
||||
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
@ -33,6 +32,7 @@ import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@ -47,7 +47,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
// TODO: make a base class because 90% of this is just copy pasted from the chemfac
|
||||
@NotableComments
|
||||
public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IProxyDelegateProvider, IConditionalInvAccess {
|
||||
public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IProxyDelegateProvider, IConditionalInvAccess, IRORValueProvider {
|
||||
|
||||
public FluidTank[] allTanks;
|
||||
public FluidTank[] inputTanks;
|
||||
@ -158,7 +158,7 @@ public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase impl
|
||||
|
||||
long nextMaxPower = 0;
|
||||
for(int i = 0; i < 4; i++) {
|
||||
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assemblerModule[i].recipe);
|
||||
GenericRecipe recipe = assemblerModule[i].getRecipe();
|
||||
if(recipe != null) {
|
||||
nextMaxPower += recipe.power * 100;
|
||||
}
|
||||
@ -374,7 +374,7 @@ public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase impl
|
||||
int index = data.getInteger("index");
|
||||
String selection = data.getString("selection");
|
||||
if(index >= 0 && index < 4) {
|
||||
this.assemblerModule[index].recipe = selection;
|
||||
this.assemblerModule[index].setRecipe(selection, false);
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
@ -722,4 +722,34 @@ public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase impl
|
||||
RETIRE, // return to null position for carriage transit
|
||||
WAIT // either waiting for or in the middle of carriage transit
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "progress1",
|
||||
PREFIX_VALUE + "progress2",
|
||||
PREFIX_VALUE + "progress3",
|
||||
PREFIX_VALUE + "progress4",
|
||||
PREFIX_VALUE + "recipe1",
|
||||
PREFIX_VALUE + "recipe2",
|
||||
PREFIX_VALUE + "recipe3",
|
||||
PREFIX_VALUE + "recipe4",
|
||||
PREFIX_VALUE + "anyactive",
|
||||
PREFIX_VALUE + "active1",
|
||||
PREFIX_VALUE + "active2",
|
||||
PREFIX_VALUE + "active3",
|
||||
PREFIX_VALUE + "active4",
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if((PREFIX_VALUE + "anyactive").equals(name)) return "" + ((this.didProcess[0] || this.didProcess[1] || this.didProcess[2] || this.didProcess[3]) ? 1 : 0);
|
||||
for(int i = 0; i < 4; i++) {
|
||||
if((PREFIX_VALUE + "progress" + i).equals(name)) return "" + (int) Math.round(this.assemblerModule[i].progress * 100);
|
||||
if((PREFIX_VALUE + "recipe" + i).equals(name)) return this.assemblerModule[i].getRecipeName();
|
||||
if((PREFIX_VALUE + "active" + i).equals(name)) return "" + (this.didProcess[i] ? 1 : 0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,6 @@ import com.hbm.inventory.container.ContainerMachineAssemblyMachine;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachineAssemblyMachine;
|
||||
import com.hbm.inventory.recipes.AssemblyMachineRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
@ -30,6 +29,8 @@ import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
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.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@ -41,7 +42,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
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 outputTank;
|
||||
@ -88,7 +89,7 @@ public class TileEntityMachineAssemblyMachine extends TileEntityMachineBase impl
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
GenericRecipe recipe = AssemblyMachineRecipes.INSTANCE.recipeNameMap.get(assemblerModule.recipe);
|
||||
GenericRecipe recipe = assemblerModule.getRecipe();
|
||||
if(recipe != null) {
|
||||
this.maxPower = recipe.power * 100;
|
||||
}
|
||||
@ -303,7 +304,7 @@ public class TileEntityMachineAssemblyMachine extends TileEntityMachineBase impl
|
||||
int index = data.getInteger("index");
|
||||
String selection = data.getString("selection");
|
||||
if(index == 0) {
|
||||
this.assemblerModule.recipe = selection;
|
||||
this.assemblerModule.setRecipe(selection, false);
|
||||
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((PREFIX_VALUE + "progress").equals(name)) return "" + (int) Math.round(this.assemblerModule.progress * 100);
|
||||
if((PREFIX_VALUE + "recipe").equals(name)) return this.assemblerModule.getRecipeName();
|
||||
if((PREFIX_VALUE + "active").equals(name)) return "" + (this.didProcess ? 1 : 0);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
|
||||
if((PREFIX_FUNCTION + "setrecipe").equals(name) && params.length == 1) {
|
||||
this.assemblerModule.setRecipe(params[0], true);
|
||||
this.markChanged();
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ import com.hbm.inventory.container.ContainerMachineChemicalFactory;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachineChemicalFactory;
|
||||
import com.hbm.inventory.recipes.ChemicalPlantRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
@ -31,6 +30,7 @@ import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@ -43,7 +43,7 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineChemicalFactory extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IProxyDelegateProvider, IConditionalInvAccess {
|
||||
public class TileEntityMachineChemicalFactory extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IProxyDelegateProvider, IConditionalInvAccess, IRORValueProvider {
|
||||
|
||||
public FluidTank[] allTanks;
|
||||
public FluidTank[] inputTanks;
|
||||
@ -158,7 +158,7 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
|
||||
|
||||
long nextMaxPower = 0;
|
||||
for(int i = 0; i < 4; i++) {
|
||||
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplantModule[i].recipe);
|
||||
GenericRecipe recipe = chemplantModule[i].getRecipe();
|
||||
if(recipe != null) {
|
||||
nextMaxPower += recipe.power * 100;
|
||||
}
|
||||
@ -400,7 +400,7 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
|
||||
int index = data.getInteger("index");
|
||||
String selection = data.getString("selection");
|
||||
if(index >= 0 && index < 4) {
|
||||
this.chemplantModule[index].recipe = selection;
|
||||
this.chemplantModule[index].setRecipe(selection, false);
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
@ -480,4 +480,34 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
|
||||
|
||||
@Override public FluidTank[] getAllTanks() { return TileEntityMachineChemicalFactory.this.getAllTanks(); }
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "progress1",
|
||||
PREFIX_VALUE + "progress2",
|
||||
PREFIX_VALUE + "progress3",
|
||||
PREFIX_VALUE + "progress4",
|
||||
PREFIX_VALUE + "recipe1",
|
||||
PREFIX_VALUE + "recipe2",
|
||||
PREFIX_VALUE + "recipe3",
|
||||
PREFIX_VALUE + "recipe4",
|
||||
PREFIX_VALUE + "anyactive",
|
||||
PREFIX_VALUE + "active1",
|
||||
PREFIX_VALUE + "active2",
|
||||
PREFIX_VALUE + "active3",
|
||||
PREFIX_VALUE + "active4",
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if((PREFIX_VALUE + "anyactive").equals(name)) return "" + ((this.didProcess[0] || this.didProcess[1] || this.didProcess[2] || this.didProcess[3]) ? 1 : 0);
|
||||
for(int i = 0; i < 4; i++) {
|
||||
if((PREFIX_VALUE + "progress" + i).equals(name)) return "" + (int) Math.round(this.chemplantModule[i].progress * 100);
|
||||
if((PREFIX_VALUE + "recipe" + i).equals(name)) return this.chemplantModule[i].getRecipeName();
|
||||
if((PREFIX_VALUE + "active" + i).equals(name)) return "" + (this.didProcess[i] ? 1 : 0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ import com.hbm.inventory.container.ContainerMachineChemicalPlant;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachineChemicalPlant;
|
||||
import com.hbm.inventory.recipes.ChemicalPlantRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
@ -29,6 +28,8 @@ import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
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.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@ -40,7 +41,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider {
|
||||
public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IRORValueProvider, IRORInteractive {
|
||||
|
||||
public FluidTank[] inputTanks;
|
||||
public FluidTank[] outputTanks;
|
||||
@ -86,7 +87,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplantModule.recipe);
|
||||
GenericRecipe recipe = chemplantModule.getRecipe();
|
||||
if(recipe != null) {
|
||||
this.maxPower = recipe.power * 100;
|
||||
}
|
||||
@ -278,7 +279,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
||||
int index = data.getInteger("index");
|
||||
String selection = data.getString("selection");
|
||||
if(index == 0) {
|
||||
this.chemplantModule.recipe = selection;
|
||||
this.chemplantModule.setRecipe(selection, false);
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
@ -326,4 +327,34 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
||||
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||
return upgrades;
|
||||
}
|
||||
|
||||
@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((PREFIX_VALUE + "progress").equals(name)) return "" + (int) Math.round(this.chemplantModule.progress * 100);
|
||||
if((PREFIX_VALUE + "recipe").equals(name)) return this.chemplantModule.getRecipeName();
|
||||
if((PREFIX_VALUE + "active").equals(name)) return "" + (this.didProcess ? 1 : 0);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
|
||||
if((PREFIX_FUNCTION + "setrecipe").equals(name) && params.length == 1) {
|
||||
this.chemplantModule.setRecipe(params[0], true);
|
||||
this.markChanged();
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -484,8 +484,8 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
|
||||
PREFIX_VALUE + "power",
|
||||
PREFIX_VALUE + "fuel",
|
||||
PREFIX_VALUE + "efficiency",
|
||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "state",
|
||||
PREFIX_FUNCTION + "setThrottle" + NAME_SEPARATOR + "throttle"
|
||||
PREFIX_FUNCTION + "setstate" + NAME_SEPARATOR + "state",
|
||||
PREFIX_FUNCTION + "setthrottle" + NAME_SEPARATOR + "throttle"
|
||||
};
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if ((PREFIX_FUNCTION + "setState").equals(name) && params.length > 0) {
|
||||
if ((PREFIX_FUNCTION + "setstate").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int val = Integer.parseInt(params[0]);
|
||||
this.isOn = (val == 1);
|
||||
@ -517,7 +517,7 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
|
||||
} catch (NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
if ((PREFIX_FUNCTION + "setThrottle").equals(name) && params.length > 0) {
|
||||
if ((PREFIX_FUNCTION + "setthrottle").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int val = Integer.parseInt(params[0]);
|
||||
if (val < 0) val = 0;
|
||||
|
||||
@ -10,7 +10,6 @@ import com.hbm.inventory.container.ContainerMachinePUREX;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachinePUREX;
|
||||
import com.hbm.inventory.recipes.PUREXRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
@ -26,6 +25,7 @@ import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@ -37,7 +37,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityMachinePUREX extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider {
|
||||
public class TileEntityMachinePUREX extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IRORValueProvider {
|
||||
|
||||
public FluidTank[] inputTanks;
|
||||
public FluidTank[] outputTanks;
|
||||
@ -80,7 +80,7 @@ public class TileEntityMachinePUREX extends TileEntityMachineBase implements IEn
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
GenericRecipe recipe = PUREXRecipes.INSTANCE.recipeNameMap.get(purexModule.recipe);
|
||||
GenericRecipe recipe = purexModule.getRecipe();
|
||||
if(recipe != null) {
|
||||
this.maxPower = recipe.power * 100;
|
||||
}
|
||||
@ -235,7 +235,7 @@ public class TileEntityMachinePUREX extends TileEntityMachineBase implements IEn
|
||||
int index = data.getInteger("index");
|
||||
String selection = data.getString("selection");
|
||||
if(index == 0) {
|
||||
this.purexModule.recipe = selection;
|
||||
this.purexModule.setRecipe(selection, false);
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
@ -283,4 +283,21 @@ public class TileEntityMachinePUREX extends TileEntityMachineBase implements IEn
|
||||
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||
return upgrades;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "progress",
|
||||
PREFIX_VALUE + "recipe",
|
||||
PREFIX_VALUE + "active",
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if((PREFIX_VALUE + "progress").equals(name)) return "" + (int) Math.round(this.purexModule.progress * 100);
|
||||
if((PREFIX_VALUE + "recipe").equals(name)) return this.purexModule.getRecipeName();
|
||||
if((PREFIX_VALUE + "active").equals(name)) return "" + (this.didProcess ? 1 : 0);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ import com.hbm.inventory.container.ContainerMachinePrecAss;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachinePrecAss;
|
||||
import com.hbm.inventory.recipes.PrecAssRecipes;
|
||||
import com.hbm.inventory.recipes.loader.GenericRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
@ -93,7 +92,7 @@ public class TileEntityMachinePrecAss extends TileEntityMachineBase implements I
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
GenericRecipe recipe = PrecAssRecipes.INSTANCE.recipeNameMap.get(assemblerModule.recipe);
|
||||
GenericRecipe recipe = assemblerModule.getRecipe();
|
||||
if(recipe != null) {
|
||||
this.maxPower = recipe.power * 100;
|
||||
}
|
||||
@ -352,7 +351,7 @@ public class TileEntityMachinePrecAss extends TileEntityMachineBase implements I
|
||||
int index = data.getInteger("index");
|
||||
String selection = data.getString("selection");
|
||||
if(index == 0) {
|
||||
this.assemblerModule.recipe = selection;
|
||||
this.assemblerModule.setRecipe(selection, false);
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@ -737,16 +737,16 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
PREFIX_VALUE + "turbinespeed",
|
||||
PREFIX_VALUE + "output",
|
||||
PREFIX_VALUE + "state",
|
||||
PREFIX_VALUE + "autoMode",
|
||||
PREFIX_VALUE + "automode",
|
||||
PREFIX_VALUE + "temp",
|
||||
PREFIX_VALUE + "power",
|
||||
PREFIX_VALUE + "fuel",
|
||||
PREFIX_VALUE + "lubricant",
|
||||
PREFIX_VALUE + "water",
|
||||
PREFIX_VALUE + "steam",
|
||||
PREFIX_FUNCTION + "setAuto" + NAME_SEPARATOR + "auto",
|
||||
PREFIX_FUNCTION + "setThrottle" + NAME_SEPARATOR + "percent",
|
||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "state"
|
||||
PREFIX_FUNCTION + "setauto" + NAME_SEPARATOR + "auto",
|
||||
PREFIX_FUNCTION + "setthrottle" + NAME_SEPARATOR + "percent",
|
||||
PREFIX_FUNCTION + "setstate" + NAME_SEPARATOR + "state"
|
||||
};
|
||||
}
|
||||
|
||||
@ -756,7 +756,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
if((PREFIX_VALUE + "turbinespeed").equals(name)) return "" + this.rpm;
|
||||
if((PREFIX_VALUE + "output").equals(name)) return "" + (int) (this.instantPowerOutput * 20);
|
||||
if((PREFIX_VALUE + "state").equals(name)) return "" + this.state;
|
||||
if((PREFIX_VALUE + "autoMode").equals(name)) return "" + (this.autoMode ? 1 : 0);
|
||||
if((PREFIX_VALUE + "automode").equals(name)) return "" + (this.autoMode ? 1 : 0);
|
||||
if((PREFIX_VALUE + "temp").equals(name)) return "" + this.temp;
|
||||
if((PREFIX_VALUE + "power").equals(name)) return "" + this.power;
|
||||
if((PREFIX_VALUE + "fuel").equals(name)) return "" + tanks[0].getFill();
|
||||
@ -768,7 +768,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if((PREFIX_FUNCTION + "setAuto").equals(name) && params.length > 0) {
|
||||
if((PREFIX_FUNCTION + "setauto").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int val = Integer.parseInt(params[0]);
|
||||
this.autoMode = (val == 1);
|
||||
@ -776,7 +776,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
} catch(NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
if((PREFIX_FUNCTION + "setThrottle").equals(name) && params.length > 0) {
|
||||
if((PREFIX_FUNCTION + "setthrottle").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int percent = Integer.parseInt(params[0]);
|
||||
if(percent < 0) percent = 0;
|
||||
@ -786,7 +786,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
||||
} catch(NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
if((PREFIX_FUNCTION + "setState").equals(name) && params.length > 0) {
|
||||
if((PREFIX_FUNCTION + "setstate").equals(name) && params.length > 0) {
|
||||
try {
|
||||
int newState = Integer.parseInt(params[0]);
|
||||
if(newState == 1) {
|
||||
|
||||
@ -616,8 +616,8 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
||||
PREFIX_VALUE + "steam",
|
||||
PREFIX_VALUE + "co2",
|
||||
PREFIX_VALUE + "state",
|
||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "active (0 or 1)",
|
||||
PREFIX_FUNCTION + "ventCO2"
|
||||
PREFIX_FUNCTION + "setstate" + NAME_SEPARATOR + "active (0 or 1)",
|
||||
PREFIX_FUNCTION + "ventco2"
|
||||
};
|
||||
}
|
||||
|
||||
@ -634,7 +634,7 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if((PREFIX_FUNCTION + "setState").equals(name) && params.length > 0) {
|
||||
if((PREFIX_FUNCTION + "setstate").equals(name) && params.length > 0) {
|
||||
if(redstonePowered) return null;
|
||||
try {
|
||||
int val = Integer.parseInt(params[0]);
|
||||
@ -643,7 +643,7 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
||||
} catch(NumberFormatException e) {}
|
||||
return null;
|
||||
}
|
||||
if ((PREFIX_FUNCTION + "ventCO2").equals(name)) {
|
||||
if ((PREFIX_FUNCTION + "ventco2").equals(name)) {
|
||||
int fill = this.carbonDioxide.getFill();
|
||||
this.carbonDioxide.setFill(Math.max(fill - 1000, 0));
|
||||
this.markDirty();
|
||||
|
||||
@ -16,7 +16,6 @@ import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachinePlasmaForge;
|
||||
import com.hbm.inventory.recipes.PlasmaForgeRecipe;
|
||||
import com.hbm.inventory.recipes.PlasmaForgeRecipes;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
@ -34,6 +33,7 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@ -45,7 +45,7 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityFusionPlasmaForge extends TileEntityMachineBase implements IFusionPowerReceiver, IEnergyReceiverMK2, IFluidStandardReceiverMK2, IControlReceiver, IGUIProvider {
|
||||
public class TileEntityFusionPlasmaForge extends TileEntityMachineBase implements IFusionPowerReceiver, IEnergyReceiverMK2, IFluidStandardReceiverMK2, IControlReceiver, IGUIProvider, IRORValueProvider {
|
||||
|
||||
public FluidTank inputTank;
|
||||
|
||||
@ -156,7 +156,7 @@ public class TileEntityFusionPlasmaForge extends TileEntityMachineBase implement
|
||||
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
|
||||
|
||||
PlasmaForgeRecipe recipe = (PlasmaForgeRecipe) PlasmaForgeRecipes.INSTANCE.recipeNameMap.get(plasmaModule.recipe);
|
||||
PlasmaForgeRecipe recipe = (PlasmaForgeRecipe) plasmaModule.getRecipe();
|
||||
if(recipe != null) this.maxPower = recipe.power * 100;
|
||||
|
||||
this.maxPower = BobMathUtil.max(this.power, this.maxPower, 100_000);
|
||||
@ -364,7 +364,7 @@ public class TileEntityFusionPlasmaForge extends TileEntityMachineBase implement
|
||||
int index = data.getInteger("index");
|
||||
String selection = data.getString("selection");
|
||||
if(index == 0) {
|
||||
this.plasmaModule.recipe = selection;
|
||||
this.plasmaModule.setRecipe(selection, false);
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
@ -593,4 +593,25 @@ public class TileEntityFusionPlasmaForge extends TileEntityMachineBase implement
|
||||
double[] newPos = positions[rand.nextInt(positions.length)];
|
||||
for(int i = 0; i < newPos.length; i++) arm.targetAngles[i] = newPos[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "progress",
|
||||
PREFIX_VALUE + "recipe",
|
||||
PREFIX_VALUE + "active",
|
||||
PREFIX_VALUE + "booster",
|
||||
PREFIX_VALUE + "plasma",
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
if((PREFIX_VALUE + "progress").equals(name)) return "" + (int) Math.round(this.plasmaModule.progress * 100);
|
||||
if((PREFIX_VALUE + "recipe").equals(name)) return this.plasmaModule.getRecipeName();
|
||||
if((PREFIX_VALUE + "active").equals(name)) return "" + (this.didProcess ? 1 : 0);
|
||||
if((PREFIX_VALUE + "booster").equals(name)) return "" + this.booster;
|
||||
if((PREFIX_VALUE + "plasma").equals(name)) return "" + this.plasmaEnergy;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -46,7 +47,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIProvider, IControlReceiver, SimpleComponent, CompatHandler.OCComponent, IRORValueProvider {
|
||||
public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIProvider, IControlReceiver, SimpleComponent, CompatHandler.OCComponent, IRORValueProvider, IRORInteractive {
|
||||
|
||||
public boolean didProcess = false;
|
||||
|
||||
@ -473,7 +474,7 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
int index = data.getInteger("index");
|
||||
String selection = data.getString("selection");
|
||||
if(index == 0) {
|
||||
this.fusionModule.recipe = selection;
|
||||
this.fusionModule.setRecipe(selection, false);
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
@ -589,7 +590,11 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "plasma",
|
||||
PREFIX_VALUE + "consumption"
|
||||
PREFIX_VALUE + "consumption",
|
||||
PREFIX_VALUE + "progress",
|
||||
PREFIX_VALUE + "recipe",
|
||||
PREFIX_VALUE + "active",
|
||||
PREFIX_VALUE + "temp",
|
||||
};
|
||||
}
|
||||
|
||||
@ -597,6 +602,22 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
||||
public String provideRORValue(String name) {
|
||||
if((PREFIX_VALUE + "plasma").equals(name)) return "" + this.plasmaEnergy;
|
||||
if((PREFIX_VALUE + "consumption").equals(name)) return "" + (int) (this.fuelConsumption * 100);
|
||||
if((PREFIX_VALUE + "progress").equals(name)) return "" + (int) Math.round(this.fusionModule.progress * 100);
|
||||
if((PREFIX_VALUE + "recipe").equals(name)) return this.fusionModule.getRecipeName();
|
||||
if((PREFIX_VALUE + "active").equals(name)) return "" + (this.didProcess ? 1 : 0);
|
||||
if((PREFIX_VALUE + "temp").equals(name)) return "" + (int) this.temperature;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
|
||||
if((PREFIX_FUNCTION + "setrecipe").equals(name) && params.length == 1) {
|
||||
this.fusionModule.setRecipe(params[0], false);
|
||||
this.markChanged();
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ public class TileEntityFluidCounterValve extends TileEntityPipeBaseNT implements
|
||||
PREFIX_VALUE + "value",
|
||||
PREFIX_VALUE + "state",
|
||||
PREFIX_FUNCTION + "reset",
|
||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "state",
|
||||
PREFIX_FUNCTION + "setstate" + NAME_SEPARATOR + "state",
|
||||
};
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ public class TileEntityFluidCounterValve extends TileEntityPipeBaseNT implements
|
||||
if(name.equals(PREFIX_FUNCTION + "reset")) {
|
||||
counter = 0;
|
||||
markDirty();
|
||||
} else if(name.equals(PREFIX_FUNCTION + "setState")) {
|
||||
} else if(name.equals(PREFIX_FUNCTION + "setstate")) {
|
||||
setState(IRORInteractive.parseInt(params[0], 0, 1));
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.hbm.tileentity.network;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.BufferUtil;
|
||||
@ -44,7 +46,7 @@ public class TileEntityRadioTorchReader extends TileEntityLoadedBase implements
|
||||
if(channel == null || channel.isEmpty()) continue;
|
||||
if(name == null || name.isEmpty()) continue;
|
||||
|
||||
String value = prov.provideRORValue(IRORValueProvider.PREFIX_VALUE + name);
|
||||
String value = prov.provideRORValue(IRORValueProvider.PREFIX_VALUE + name.toLowerCase(Locale.US));
|
||||
if(value == null) continue;
|
||||
|
||||
if(polling || !value.equals(previous)) {
|
||||
|
||||
@ -1,12 +1,24 @@
|
||||
package com.hbm.tileentity.network.pneumatic;
|
||||
|
||||
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.container.ContainerPneumoStorageExporter;
|
||||
import com.hbm.inventory.gui.GUIPneumoStorageExporter;
|
||||
import com.hbm.tileentity.network.RTTYSystem;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
|
||||
import api.hbm.ntl.StackCache;
|
||||
import api.hbm.ntl.StackCache.CacheSlot;
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineBase implements IRORInteractive {
|
||||
public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineBase implements IRORInteractive, IControlReceiver {
|
||||
|
||||
/** If requests should be pulled repeatedly every tick */
|
||||
public boolean continuousRequest = false;
|
||||
@ -14,6 +26,11 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
|
||||
public boolean rorConfiguredMode = false;
|
||||
/** What strategy to use for handling request filters */
|
||||
public int requestMode = 0;
|
||||
/** Item ID and meta pairs with amount for RoR controlled filters */
|
||||
public short[][] rorFilters = new short[9][3];
|
||||
/** Delay for non-forced (i.e. continuous request) grabs, if not successful */
|
||||
public int slotDelay[] = new int[9];
|
||||
public static final int SLOT_DELAY = 10;
|
||||
|
||||
/** 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;
|
||||
@ -34,16 +51,217 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
if(slotDelay[i] > 0) slotDelay[i]--;
|
||||
}
|
||||
|
||||
if(continuousRequest) {
|
||||
this.doRequest(false);
|
||||
}
|
||||
|
||||
this.networkPackNT(15);
|
||||
}
|
||||
}
|
||||
|
||||
public void doRequest(boolean force) {
|
||||
|
||||
if(this.requestMode != MODE_FULL_REQUEST) {
|
||||
// handle all filters individually
|
||||
for(int i = 0; i < 9; i++) if(!requestSlot(i, force)) this.slotDelay[i] = SLOT_DELAY;
|
||||
} else {
|
||||
|
||||
// check filter delay if forced pulls aren't active
|
||||
if(!force) for(int i = 0; i < 9; i++) {
|
||||
short[] filter = this.getFilter(i);
|
||||
if(filter != null && slotDelay[i] > 0) return;
|
||||
}
|
||||
|
||||
// check if filter demands are met and space is free
|
||||
for(int i = 0; i < 9; i++) {
|
||||
short[] filter = this.getFilter(i);
|
||||
if(filter == null) continue;
|
||||
|
||||
int itemId = filter[0];
|
||||
Item item = Item.getItemById(itemId);
|
||||
int meta = filter[1];
|
||||
int requestSize = filter[2];
|
||||
|
||||
int existingSize = 0;
|
||||
ItemStack existingStack = slots[i];
|
||||
|
||||
if(existingStack != null) {
|
||||
if(existingStack.getItem() == item && existingStack.getItemDamage() == meta && !existingStack.hasTagCompound()) {
|
||||
existingSize = existingStack.stackSize;
|
||||
} else {
|
||||
this.slotDelay[i] = SLOT_DELAY;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack newStack = new ItemStack(item, 1, meta);
|
||||
int capacityLeft = newStack.getMaxStackSize() - existingSize;
|
||||
|
||||
if(capacityLeft < requestSize || getAvailability(itemId, meta) < requestSize) {
|
||||
this.slotDelay[i] = SLOT_DELAY;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// everything is good, pull items. continues should not happen, but are in place nonetheless
|
||||
for(int i = 0; i < 9; i++) {
|
||||
short[] filter = this.getFilter(i);
|
||||
if(filter == null) continue;
|
||||
|
||||
int itemId = filter[0];
|
||||
Item item = Item.getItemById(itemId);
|
||||
int meta = filter[1];
|
||||
int requestSize = filter[2];
|
||||
|
||||
int existingSize = 0;
|
||||
ItemStack existingStack = slots[i];
|
||||
if(existingStack != null) existingSize = existingStack.stackSize;
|
||||
|
||||
ItemStack newStack = new ItemStack(item, 1, meta);
|
||||
|
||||
long hash = StackCache.getStackIdentity(itemId, meta, null);
|
||||
if(hash == this.cache.getNullIdentity()) continue; // safeguard
|
||||
|
||||
CacheSlot cacheSlot = this.cache.cacheSlots.get(hash);
|
||||
if(cacheSlot == null) continue; // safeguard
|
||||
|
||||
slots[i] = newStack;
|
||||
slots[i].stackSize = existingSize + (int) this.cache.consumeItemsAndReturnQuantity(newStack, requestSize);
|
||||
}
|
||||
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns false if the slot delay should be reset (unsuccessful) or true of not (successful or delay still active) */
|
||||
public boolean requestSlot(int slot, boolean force) {
|
||||
|
||||
if(!force && slotDelay[slot] > 0) return true;
|
||||
if(this.cache == null || this.cache.hasExpired) return false;
|
||||
|
||||
short[] filter = this.getFilter(slot);
|
||||
if(filter == null) return false;
|
||||
|
||||
int itemId = filter[0];
|
||||
Item item = Item.getItemById(itemId);
|
||||
int meta = filter[1];
|
||||
int requestSize = filter[2];
|
||||
|
||||
int existingSize = 0;
|
||||
ItemStack existingStack = slots[slot];
|
||||
|
||||
if(existingStack != null) {
|
||||
if(existingStack.getItem() == item && existingStack.getItemDamage() == meta && !existingStack.hasTagCompound()) {
|
||||
existingSize = existingStack.stackSize;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack newStack = new ItemStack(item, 1, meta);
|
||||
int capacityLeft = newStack.getMaxStackSize() - existingSize;
|
||||
|
||||
// any non-AMAP mode will fail if it can't insert that much before we even check availability from the pneumo sys
|
||||
if(capacityLeft < requestSize && this.requestMode != MODE_AS_MUCH_AS_POSSIBLE) return false;
|
||||
long hash = StackCache.getStackIdentity(itemId, meta, null);
|
||||
if(hash == this.cache.getNullIdentity()) return false;
|
||||
|
||||
CacheSlot cacheSlot = this.cache.cacheSlots.get(hash);
|
||||
if(cacheSlot == null) return false;
|
||||
|
||||
// any non-AMAP mode will fail if the system doesn't have the requested amount
|
||||
if(cacheSlot.stacksize < requestSize && this.requestMode != MODE_AS_MUCH_AS_POSSIBLE) return false;
|
||||
if(cacheSlot.stacksize <= 0) return false;
|
||||
|
||||
int toPull = (int) BobMathUtil.min(requestSize, cacheSlot.stacksize, capacityLeft);
|
||||
slots[slot] = newStack;
|
||||
slots[slot].stackSize = existingSize + (int) this.cache.consumeItemsAndReturnQuantity(newStack, toPull);
|
||||
this.markChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Returns item id, meta and request size for the given filter. Returns null if no filter is specified */
|
||||
public short[] getFilter(int slot) {
|
||||
if(rorConfiguredMode) {
|
||||
if(Item.getItemById(rorFilters[slot][0]) == null) return null;
|
||||
return rorFilters[slot];
|
||||
} else {
|
||||
if(slots[slot] != null) {
|
||||
ItemStack stack = slots[slot];
|
||||
return new short[] {(short) Item.getIdFromItem(stack.getItem()), (short) stack.getItemDamage(), (short) stack.stackSize};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
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 public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; }
|
||||
@Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; }
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeBoolean(continuousRequest);
|
||||
buf.writeBoolean(rorConfiguredMode);
|
||||
buf.writeByte((byte) requestMode);
|
||||
for(int i = 0; i < 9; i++) {
|
||||
buf.writeShort(rorFilters[i][0]);
|
||||
buf.writeShort(rorFilters[i][1]);
|
||||
buf.writeShort(rorFilters[i][2]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.continuousRequest = buf.readBoolean();
|
||||
this.rorConfiguredMode = buf.readBoolean();
|
||||
this.requestMode = buf.readByte();
|
||||
for(int i = 0; i < 9; i++) {
|
||||
rorFilters[i][0] = buf.readShort();
|
||||
rorFilters[i][1] = buf.readShort();
|
||||
rorFilters[i][2] = buf.readShort();
|
||||
}
|
||||
}
|
||||
|
||||
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerPneumoStorageExporter(player.inventory, this); }
|
||||
@Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIPneumoStorageExporter(player.inventory, this); }
|
||||
|
||||
@Override public boolean hasPermission(EntityPlayer player) { return this.isUseableByPlayer(player); }
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
if(data.hasKey("continuous")) {
|
||||
this.continuousRequest = !this.continuousRequest;
|
||||
}
|
||||
if(data.hasKey("request")) {
|
||||
this.requestMode++;
|
||||
if(this.requestMode >= 3) this.requestMode = 0;
|
||||
}
|
||||
if(data.hasKey("ror")) {
|
||||
this.rorConfiguredMode = !this.rorConfiguredMode;
|
||||
}
|
||||
this.markChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
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 + "requestslot" + NAME_SEPARATOR + "slot",
|
||||
PREFIX_FUNCTION + "checkavailability" + NAME_SEPARATOR + "itemid" + PARAM_SEPARATOR + "itemmeta" + PARAM_SEPARATOR + "returnchannel",
|
||||
@ -52,6 +270,47 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
|
||||
if((PREFIX_FUNCTION + "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((PREFIX_FUNCTION + "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((PREFIX_FUNCTION + "request").equals(name)) {
|
||||
this.doRequest(true);
|
||||
return null;
|
||||
}
|
||||
|
||||
if((PREFIX_FUNCTION + "requestslot").equals(name) && params.length == 1) {
|
||||
int slot = IRORInteractive.parseInt(params[0], 1, 9) - 1;
|
||||
if(!this.requestSlot(slot, true)) this.slotDelay[slot] = SLOT_DELAY;
|
||||
return null;
|
||||
}
|
||||
|
||||
if((PREFIX_FUNCTION + "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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,13 +96,13 @@ public abstract class TileEntityTurretBaseArtillery extends TileEntityTurretBase
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_FUNCTION + "setActive" + NAME_SEPARATOR + "active (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetPlayers" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetAnimals" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetMobs" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetMachines" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "addWhitelist" + NAME_SEPARATOR + "name",
|
||||
PREFIX_FUNCTION + "removeWhitelist" + NAME_SEPARATOR + "name",
|
||||
PREFIX_FUNCTION + "setactive" + NAME_SEPARATOR + "active (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetplayers" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetanimals" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetmobs" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetmachines" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "addwhitelist" + NAME_SEPARATOR + "name",
|
||||
PREFIX_FUNCTION + "removewhitelist" + NAME_SEPARATOR + "name",
|
||||
PREFIX_FUNCTION + "enqueue" + NAME_SEPARATOR + "x" + PARAM_SEPARATOR + "y" + PARAM_SEPARATOR + "z",
|
||||
};
|
||||
}
|
||||
|
||||
@ -1062,40 +1062,40 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_FUNCTION + "setActive" + NAME_SEPARATOR + "active (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetPlayers" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetAnimals" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetMobs" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetMachines" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "addWhitelist" + NAME_SEPARATOR + "name",
|
||||
PREFIX_FUNCTION + "removeWhitelist" + NAME_SEPARATOR + "name",
|
||||
PREFIX_FUNCTION + "setactive" + NAME_SEPARATOR + "active (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetplayers" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetanimals" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetmobs" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "targetmachines" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||
PREFIX_FUNCTION + "addwhitelist" + NAME_SEPARATOR + "name",
|
||||
PREFIX_FUNCTION + "removewhitelist" + NAME_SEPARATOR + "name",
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
if((PREFIX_FUNCTION + "setActive").equals(name) && params.length > 0) {
|
||||
if((PREFIX_FUNCTION + "setactive").equals(name) && params.length > 0) {
|
||||
try { this.isOn = (Integer.parseInt(params[0]) == 1); this.markChanged(); } catch(NumberFormatException e) {}
|
||||
}
|
||||
if((PREFIX_FUNCTION + "targetPlayers").equals(name) && params.length > 0) {
|
||||
if((PREFIX_FUNCTION + "targetplayers").equals(name) && params.length > 0) {
|
||||
try { this.targetPlayers = (Integer.parseInt(params[0]) == 1); this.markChanged(); } catch(NumberFormatException e) {}
|
||||
}
|
||||
if((PREFIX_FUNCTION + "targetAnimals").equals(name) && params.length > 0) {
|
||||
if((PREFIX_FUNCTION + "targetanimals").equals(name) && params.length > 0) {
|
||||
try { this.targetAnimals = (Integer.parseInt(params[0]) == 1); this.markChanged(); } catch(NumberFormatException e) {}
|
||||
}
|
||||
if((PREFIX_FUNCTION + "targetMobs").equals(name) && params.length > 0) {
|
||||
if((PREFIX_FUNCTION + "targetmobs").equals(name) && params.length > 0) {
|
||||
try { this.targetMobs = (Integer.parseInt(params[0]) == 1); this.markChanged(); } catch(NumberFormatException e) {}
|
||||
}
|
||||
if((PREFIX_FUNCTION + "targetMachines").equals(name) && params.length > 0) {
|
||||
if((PREFIX_FUNCTION + "targetmachines").equals(name) && params.length > 0) {
|
||||
try { this.targetMachines = (Integer.parseInt(params[0]) == 1); this.markChanged(); } catch(NumberFormatException e) {}
|
||||
}
|
||||
if((PREFIX_FUNCTION + "addWhitelist").equals(name) && params.length > 0) {
|
||||
if((PREFIX_FUNCTION + "addwhitelist").equals(name) && params.length > 0) {
|
||||
String playerName = params[0];
|
||||
List<String> whitelist = this.getWhitelist();
|
||||
if(!whitelist.contains(playerName)) this.addName(playerName);
|
||||
this.markChanged();
|
||||
}
|
||||
if((PREFIX_FUNCTION + "removeWhitelist").equals(name) && params.length > 0) {
|
||||
if((PREFIX_FUNCTION + "removewhitelist").equals(name) && params.length > 0) {
|
||||
String playerName = params[0];
|
||||
List<String> whitelist = this.getWhitelist();
|
||||
if(whitelist.contains(playerName)) this.removeName(whitelist.indexOf(playerName));
|
||||
|
||||
|
After Width: | Height: | Size: 359 B |
|
After Width: | Height: | Size: 502 B |
|
Before Width: | Height: | Size: 417 B After Width: | Height: | Size: 500 B |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 312 B |