diff --git a/changelog b/changelog index 0e1a5cf5a..9ca5b6b0c 100644 --- a/changelog +++ b/changelog @@ -29,13 +29,14 @@ * 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 now support Redstone-over-Radio +* 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 -* The AUTOCAL's script interpreter now runs MS-ES v1.1 (First Extended Instruction Set) +* Assembly recipes and chemical factories can now be read (but not configured) using Redstone-over-Radio +* The factories 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 diff --git a/src/main/java/com/hbm/inventory/gui/GUIMachineChemicalPlant.java b/src/main/java/com/hbm/inventory/gui/GUIMachineChemicalPlant.java index 0f42776f1..018e780f0 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIMachineChemicalPlant.java +++ b/src/main/java/com/hbm/inventory/gui/GUIMachineChemicalPlant.java @@ -78,7 +78,7 @@ 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 = chemplant.chemplantModule.getRecipe(); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyFactory.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyFactory.java index 2324ba300..e171deb1a 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyFactory.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyFactory.java @@ -32,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; @@ -46,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; @@ -721,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("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(("progress" + i).equals(name)) return "" + (int) Math.round(this.assemblerModule[i].progress * 100); + if(("recipe" + i).equals(name)) return this.assemblerModule[i].getRecipeName(); + if(("active" + i).equals(name)) return "" + (this.didProcess[i] ? 1 : 0); + } + return null; + } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java index 2f1c80eb4..2042d0615 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java @@ -30,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; @@ -42,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; @@ -479,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("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(("progress" + i).equals(name)) return "" + (int) Math.round(this.chemplantModule[i].progress * 100); + if(("recipe" + i).equals(name)) return this.chemplantModule[i].getRecipeName(); + if(("active" + i).equals(name)) return "" + (this.didProcess[i] ? 1 : 0); + } + return null; + } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java index 50e779f1c..d40881054 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java @@ -28,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; @@ -39,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; @@ -325,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("progress".equals(name)) return "" + (int) Math.round(this.chemplantModule.progress * 100); + if("recipe".equals(name)) return this.chemplantModule.getRecipeName(); + if("active".equals(name)) return "" + (this.didProcess ? 1 : 0); + return null; + } + + @Override + public String runRORFunction(String name, String[] params) { + + if("setrecipe".equals(name) && params.length == 1) { + this.chemplantModule.setRecipe(params[0], true); + this.markChanged(); + return null; + } + + return null; + } }