mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
Redstone 3.0 + 1.0 Thrice Upon A Time
This commit is contained in:
parent
2cef5bf006
commit
1c46bfed92
@ -24,7 +24,7 @@
|
|||||||
* Added an alternate chemical plant recipe that uses a smaller selection of items and ICs instead of ACs
|
* 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
|
* Flashgold and flashlead are now made in the PUREX instead of the crafting table
|
||||||
* The flashgold recipe now yields two billets instead of one
|
* 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
|
* 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
|
* Increased the blast furnace's fuel buffer by 50%, allowing coke blocks to be used
|
||||||
* If an RoR controller tries to parse an integer, but the supplied string represents a decimal, instead of canceling the operation, the system will now interpret decimals and round them to be integers
|
* If an RoR controller tries to parse an integer, but the supplied string represents a decimal, instead of canceling the operation, the system will now interpret decimals and round them to be integers
|
||||||
@ -35,13 +35,16 @@
|
|||||||
* Do note that setting a recipe that needs a blueprint without that blueprint will not work
|
* 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)
|
* 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 speed penalty is removed as soon as a recipe is assigned manually again
|
||||||
* Assembly recipes and chemical factories can now be read (but not configured) using Redstone-over-Radio
|
* Assembly factories, chemical factories, PUREX and plasma forges 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)
|
* 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 the use of a global stack, similar to the buffer which can hold 256 values
|
||||||
* Allows splitting of strings and counting of string fragments
|
* Allows splitting of strings and counting of string fragments
|
||||||
* Adds substring operations
|
* Adds substring operations
|
||||||
* Polling for receiving only fresh RoR signals
|
* Polling for receiving only fresh RoR signals
|
||||||
* A command for writing the world time to the buffer, allowing for more precise timers
|
* 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
|
||||||
* Fixed AUTOCAL's number comparison functions not working with variable substitution as advertised
|
* Fixed AUTOCAL's number comparison functions not working with variable substitution as advertised
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package api.hbm.redstoneoverradio;
|
package api.hbm.redstoneoverradio;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public interface IRORInteractive extends IRORInfo {
|
public interface IRORInteractive extends IRORInfo {
|
||||||
|
|
||||||
public static String NAME_SEPARATOR = "!";
|
public static String NAME_SEPARATOR = "!";
|
||||||
@ -18,7 +20,7 @@ public interface IRORInteractive extends IRORInfo {
|
|||||||
String[] parts = input.split(NAME_SEPARATOR);
|
String[] parts = input.split(NAME_SEPARATOR);
|
||||||
if(parts.length <= 0 || parts.length > 2) throw new RORFunctionException(EX_NAME);
|
if(parts.length <= 0 || parts.length > 2) throw new RORFunctionException(EX_NAME);
|
||||||
if(parts[0].isEmpty()) throw new RORFunctionException(EX_NULL);
|
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 */
|
/** Extracts the param list from a full command string */
|
||||||
|
|||||||
@ -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 */
|
/** Blueprint pool name to list of recipe names that are part of this pool */
|
||||||
public static HashMap<String, List<String>> blueprintPools = new HashMap();
|
public static HashMap<String, List<String>> blueprintPools = new HashMap();
|
||||||
/** Name to recipe map for all recipes that are part of pools for lookup */
|
/** 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) */
|
/** Groups for auto switch functionality (changes recipe automatically based on first solid input) */
|
||||||
public HashMap<String, List<GenericRecipe>> autoSwitchGroups = new HashMap();
|
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);
|
blueprintPools.put(pool, list);
|
||||||
}
|
}
|
||||||
list.add(recipe.name);
|
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) */
|
/** 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() {
|
public static void clearPools() {
|
||||||
blueprintPools.clear();
|
blueprintPools.clear();
|
||||||
pooledBlueprints.clear();
|
nameToRecipeGlobal.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -100,6 +99,7 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
|
|||||||
this.recipeOrderedList.add(recipe);
|
this.recipeOrderedList.add(recipe);
|
||||||
if(recipeNameMap.containsKey(recipe.name)) throw new IllegalStateException("Recipe " + recipe.name + " has been registered with a duplicate ID!");
|
if(recipeNameMap.containsKey(recipe.name)) throw new IllegalStateException("Recipe " + recipe.name + " has been registered with a duplicate ID!");
|
||||||
this.recipeNameMap.put(recipe.name, recipe);
|
this.recipeNameMap.put(recipe.name, recipe);
|
||||||
|
nameToRecipeGlobal.put(recipe.name, recipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -121,7 +121,7 @@ public class ItemBlueprints extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(String name : pool) {
|
for(String name : pool) {
|
||||||
GenericRecipe recipe = GenericRecipes.pooledBlueprints.get(name);
|
GenericRecipe recipe = GenericRecipes.nameToRecipeGlobal.get(name);
|
||||||
if(recipe != null) {
|
if(recipe != null) {
|
||||||
list.add(recipe.getLocalizedName());
|
list.add(recipe.getLocalizedName());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -244,8 +244,8 @@ public class TileEntityHeaterOilburner extends TileEntityMachinePolluting implem
|
|||||||
PREFIX_VALUE + "fuel",
|
PREFIX_VALUE + "fuel",
|
||||||
PREFIX_VALUE + "burnRate",
|
PREFIX_VALUE + "burnRate",
|
||||||
PREFIX_VALUE + "state",
|
PREFIX_VALUE + "state",
|
||||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "active",
|
PREFIX_FUNCTION + "setstate" + NAME_SEPARATOR + "active",
|
||||||
PREFIX_FUNCTION + "setBurnRate" + NAME_SEPARATOR + "rate"
|
PREFIX_FUNCTION + "setburnrate" + NAME_SEPARATOR + "rate"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,29 +253,23 @@ public class TileEntityHeaterOilburner extends TileEntityMachinePolluting implem
|
|||||||
public String provideRORValue(String name) {
|
public String provideRORValue(String name) {
|
||||||
if((PREFIX_VALUE + "heat").equals(name)) return "" + heatEnergy;
|
if((PREFIX_VALUE + "heat").equals(name)) return "" + heatEnergy;
|
||||||
if((PREFIX_VALUE + "fuel").equals(name)) return "" + tank.getFill();
|
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";
|
if((PREFIX_VALUE + "state").equals(name)) return isOn ? "1" : "0";
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String runRORFunction(String name, String[] params) {
|
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.isOn = params[0].equals("1");
|
||||||
this.markChanged();
|
this.markChanged();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if((PREFIX_FUNCTION + "setBurnRate").equals(name)) {
|
if((PREFIX_FUNCTION + "setburnrate").equals(name)) {
|
||||||
try {
|
int rate = IRORInteractive.parseInt(params[0], 1, 10);
|
||||||
int rate = Integer.parseInt(params[0]);
|
|
||||||
if(rate < 1) rate = 1;
|
|
||||||
if(rate > 10) rate = 10;
|
|
||||||
this.setting = rate;
|
this.setting = rate;
|
||||||
this.markChanged();
|
this.markChanged();
|
||||||
return null;
|
return null;
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return "Invalid number";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -744,11 +744,11 @@ public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String provideRORValue(String name) {
|
public String provideRORValue(String name) {
|
||||||
if("anyactive".equals(name)) return "" + ((this.didProcess[0] || this.didProcess[1] || this.didProcess[2] || this.didProcess[3]) ? 1 : 0);
|
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++) {
|
for(int i = 0; i < 4; i++) {
|
||||||
if(("progress" + i).equals(name)) return "" + (int) Math.round(this.assemblerModule[i].progress * 100);
|
if((PREFIX_VALUE + "progress" + i).equals(name)) return "" + (int) Math.round(this.assemblerModule[i].progress * 100);
|
||||||
if(("recipe" + i).equals(name)) return this.assemblerModule[i].getRecipeName();
|
if((PREFIX_VALUE + "recipe" + i).equals(name)) return this.assemblerModule[i].getRecipeName();
|
||||||
if(("active" + i).equals(name)) return "" + (this.didProcess[i] ? 1 : 0);
|
if((PREFIX_VALUE + "active" + i).equals(name)) return "" + (this.didProcess[i] ? 1 : 0);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -496,16 +496,16 @@ public class TileEntityMachineAssemblyMachine extends TileEntityMachineBase impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String provideRORValue(String name) {
|
public String provideRORValue(String name) {
|
||||||
if("progress".equals(name)) return "" + (int) Math.round(this.assemblerModule.progress * 100);
|
if((PREFIX_VALUE + "progress").equals(name)) return "" + (int) Math.round(this.assemblerModule.progress * 100);
|
||||||
if("recipe".equals(name)) return this.assemblerModule.getRecipeName();
|
if((PREFIX_VALUE + "recipe").equals(name)) return this.assemblerModule.getRecipeName();
|
||||||
if("active".equals(name)) return "" + (this.didProcess ? 1 : 0);
|
if((PREFIX_VALUE + "active").equals(name)) return "" + (this.didProcess ? 1 : 0);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String runRORFunction(String name, String[] params) {
|
public String runRORFunction(String name, String[] params) {
|
||||||
|
|
||||||
if("setrecipe".equals(name) && params.length == 1) {
|
if((PREFIX_FUNCTION + "setrecipe").equals(name) && params.length == 1) {
|
||||||
this.assemblerModule.setRecipe(params[0], true);
|
this.assemblerModule.setRecipe(params[0], true);
|
||||||
this.markChanged();
|
this.markChanged();
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -502,11 +502,11 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String provideRORValue(String name) {
|
public String provideRORValue(String name) {
|
||||||
if("anyactive".equals(name)) return "" + ((this.didProcess[0] || this.didProcess[1] || this.didProcess[2] || this.didProcess[3]) ? 1 : 0);
|
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++) {
|
for(int i = 0; i < 4; i++) {
|
||||||
if(("progress" + i).equals(name)) return "" + (int) Math.round(this.chemplantModule[i].progress * 100);
|
if((PREFIX_VALUE + "progress" + i).equals(name)) return "" + (int) Math.round(this.chemplantModule[i].progress * 100);
|
||||||
if(("recipe" + i).equals(name)) return this.chemplantModule[i].getRecipeName();
|
if((PREFIX_VALUE + "recipe" + i).equals(name)) return this.chemplantModule[i].getRecipeName();
|
||||||
if(("active" + i).equals(name)) return "" + (this.didProcess[i] ? 1 : 0);
|
if((PREFIX_VALUE + "active" + i).equals(name)) return "" + (this.didProcess[i] ? 1 : 0);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -340,16 +340,16 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String provideRORValue(String name) {
|
public String provideRORValue(String name) {
|
||||||
if("progress".equals(name)) return "" + (int) Math.round(this.chemplantModule.progress * 100);
|
if((PREFIX_VALUE + "progress").equals(name)) return "" + (int) Math.round(this.chemplantModule.progress * 100);
|
||||||
if("recipe".equals(name)) return this.chemplantModule.getRecipeName();
|
if((PREFIX_VALUE + "recipe").equals(name)) return this.chemplantModule.getRecipeName();
|
||||||
if("active".equals(name)) return "" + (this.didProcess ? 1 : 0);
|
if((PREFIX_VALUE + "active").equals(name)) return "" + (this.didProcess ? 1 : 0);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String runRORFunction(String name, String[] params) {
|
public String runRORFunction(String name, String[] params) {
|
||||||
|
|
||||||
if("setrecipe".equals(name) && params.length == 1) {
|
if((PREFIX_FUNCTION + "setrecipe").equals(name) && params.length == 1) {
|
||||||
this.chemplantModule.setRecipe(params[0], true);
|
this.chemplantModule.setRecipe(params[0], true);
|
||||||
this.markChanged();
|
this.markChanged();
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -484,8 +484,8 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
|
|||||||
PREFIX_VALUE + "power",
|
PREFIX_VALUE + "power",
|
||||||
PREFIX_VALUE + "fuel",
|
PREFIX_VALUE + "fuel",
|
||||||
PREFIX_VALUE + "efficiency",
|
PREFIX_VALUE + "efficiency",
|
||||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "state",
|
PREFIX_FUNCTION + "setstate" + NAME_SEPARATOR + "state",
|
||||||
PREFIX_FUNCTION + "setThrottle" + NAME_SEPARATOR + "throttle"
|
PREFIX_FUNCTION + "setthrottle" + NAME_SEPARATOR + "throttle"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,7 +509,7 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String runRORFunction(String name, String[] params) {
|
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 {
|
try {
|
||||||
int val = Integer.parseInt(params[0]);
|
int val = Integer.parseInt(params[0]);
|
||||||
this.isOn = (val == 1);
|
this.isOn = (val == 1);
|
||||||
@ -517,7 +517,7 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
|
|||||||
} catch (NumberFormatException e) {}
|
} catch (NumberFormatException e) {}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ((PREFIX_FUNCTION + "setThrottle").equals(name) && params.length > 0) {
|
if ((PREFIX_FUNCTION + "setthrottle").equals(name) && params.length > 0) {
|
||||||
try {
|
try {
|
||||||
int val = Integer.parseInt(params[0]);
|
int val = Integer.parseInt(params[0]);
|
||||||
if (val < 0) val = 0;
|
if (val < 0) val = 0;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import com.hbm.util.i18n.I18nUtil;
|
|||||||
|
|
||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||||
|
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
@ -36,7 +37,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class 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[] inputTanks;
|
||||||
public FluidTank[] outputTanks;
|
public FluidTank[] outputTanks;
|
||||||
@ -282,4 +283,21 @@ public class TileEntityMachinePUREX extends TileEntityMachineBase implements IEn
|
|||||||
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||||
return upgrades;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -737,16 +737,16 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
|||||||
PREFIX_VALUE + "turbinespeed",
|
PREFIX_VALUE + "turbinespeed",
|
||||||
PREFIX_VALUE + "output",
|
PREFIX_VALUE + "output",
|
||||||
PREFIX_VALUE + "state",
|
PREFIX_VALUE + "state",
|
||||||
PREFIX_VALUE + "autoMode",
|
PREFIX_VALUE + "automode",
|
||||||
PREFIX_VALUE + "temp",
|
PREFIX_VALUE + "temp",
|
||||||
PREFIX_VALUE + "power",
|
PREFIX_VALUE + "power",
|
||||||
PREFIX_VALUE + "fuel",
|
PREFIX_VALUE + "fuel",
|
||||||
PREFIX_VALUE + "lubricant",
|
PREFIX_VALUE + "lubricant",
|
||||||
PREFIX_VALUE + "water",
|
PREFIX_VALUE + "water",
|
||||||
PREFIX_VALUE + "steam",
|
PREFIX_VALUE + "steam",
|
||||||
PREFIX_FUNCTION + "setAuto" + NAME_SEPARATOR + "auto",
|
PREFIX_FUNCTION + "setauto" + NAME_SEPARATOR + "auto",
|
||||||
PREFIX_FUNCTION + "setThrottle" + NAME_SEPARATOR + "percent",
|
PREFIX_FUNCTION + "setthrottle" + NAME_SEPARATOR + "percent",
|
||||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "state"
|
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 + "turbinespeed").equals(name)) return "" + this.rpm;
|
||||||
if((PREFIX_VALUE + "output").equals(name)) return "" + (int) (this.instantPowerOutput * 20);
|
if((PREFIX_VALUE + "output").equals(name)) return "" + (int) (this.instantPowerOutput * 20);
|
||||||
if((PREFIX_VALUE + "state").equals(name)) return "" + this.state;
|
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 + "temp").equals(name)) return "" + this.temp;
|
||||||
if((PREFIX_VALUE + "power").equals(name)) return "" + this.power;
|
if((PREFIX_VALUE + "power").equals(name)) return "" + this.power;
|
||||||
if((PREFIX_VALUE + "fuel").equals(name)) return "" + tanks[0].getFill();
|
if((PREFIX_VALUE + "fuel").equals(name)) return "" + tanks[0].getFill();
|
||||||
@ -768,7 +768,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String runRORFunction(String name, String[] params) {
|
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 {
|
try {
|
||||||
int val = Integer.parseInt(params[0]);
|
int val = Integer.parseInt(params[0]);
|
||||||
this.autoMode = (val == 1);
|
this.autoMode = (val == 1);
|
||||||
@ -776,7 +776,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
|||||||
} catch(NumberFormatException e) {}
|
} catch(NumberFormatException e) {}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if((PREFIX_FUNCTION + "setThrottle").equals(name) && params.length > 0) {
|
if((PREFIX_FUNCTION + "setthrottle").equals(name) && params.length > 0) {
|
||||||
try {
|
try {
|
||||||
int percent = Integer.parseInt(params[0]);
|
int percent = Integer.parseInt(params[0]);
|
||||||
if(percent < 0) percent = 0;
|
if(percent < 0) percent = 0;
|
||||||
@ -786,7 +786,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
|
|||||||
} catch(NumberFormatException e) {}
|
} catch(NumberFormatException e) {}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if((PREFIX_FUNCTION + "setState").equals(name) && params.length > 0) {
|
if((PREFIX_FUNCTION + "setstate").equals(name) && params.length > 0) {
|
||||||
try {
|
try {
|
||||||
int newState = Integer.parseInt(params[0]);
|
int newState = Integer.parseInt(params[0]);
|
||||||
if(newState == 1) {
|
if(newState == 1) {
|
||||||
|
|||||||
@ -616,8 +616,8 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
|||||||
PREFIX_VALUE + "steam",
|
PREFIX_VALUE + "steam",
|
||||||
PREFIX_VALUE + "co2",
|
PREFIX_VALUE + "co2",
|
||||||
PREFIX_VALUE + "state",
|
PREFIX_VALUE + "state",
|
||||||
PREFIX_FUNCTION + "setState" + NAME_SEPARATOR + "active (0 or 1)",
|
PREFIX_FUNCTION + "setstate" + NAME_SEPARATOR + "active (0 or 1)",
|
||||||
PREFIX_FUNCTION + "ventCO2"
|
PREFIX_FUNCTION + "ventco2"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,7 +634,7 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String runRORFunction(String name, String[] params) {
|
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;
|
if(redstonePowered) return null;
|
||||||
try {
|
try {
|
||||||
int val = Integer.parseInt(params[0]);
|
int val = Integer.parseInt(params[0]);
|
||||||
@ -643,7 +643,7 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
|||||||
} catch(NumberFormatException e) {}
|
} catch(NumberFormatException e) {}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ((PREFIX_FUNCTION + "ventCO2").equals(name)) {
|
if ((PREFIX_FUNCTION + "ventco2").equals(name)) {
|
||||||
int fill = this.carbonDioxide.getFill();
|
int fill = this.carbonDioxide.getFill();
|
||||||
this.carbonDioxide.setFill(Math.max(fill - 1000, 0));
|
this.carbonDioxide.setFill(Math.max(fill - 1000, 0));
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
|
|||||||
@ -33,6 +33,7 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
|||||||
|
|
||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
|
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
|
||||||
|
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
@ -44,7 +45,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
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;
|
public FluidTank inputTank;
|
||||||
|
|
||||||
@ -592,4 +593,25 @@ public class TileEntityFusionPlasmaForge extends TileEntityMachineBase implement
|
|||||||
double[] newPos = positions[rand.nextInt(positions.length)];
|
double[] newPos = positions[rand.nextInt(positions.length)];
|
||||||
for(int i = 0; i < newPos.length; i++) arm.targetAngles[i] = newPos[i];
|
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.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@ -46,7 +47,7 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
@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;
|
public boolean didProcess = false;
|
||||||
|
|
||||||
@ -589,7 +590,11 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
|||||||
public String[] getFunctionInfo() {
|
public String[] getFunctionInfo() {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
PREFIX_VALUE + "plasma",
|
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) {
|
public String provideRORValue(String name) {
|
||||||
if((PREFIX_VALUE + "plasma").equals(name)) return "" + this.plasmaEnergy;
|
if((PREFIX_VALUE + "plasma").equals(name)) return "" + this.plasmaEnergy;
|
||||||
if((PREFIX_VALUE + "consumption").equals(name)) return "" + (int) (this.fuelConsumption * 100);
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,7 +140,7 @@ public class TileEntityFluidCounterValve extends TileEntityPipeBaseNT implements
|
|||||||
PREFIX_VALUE + "value",
|
PREFIX_VALUE + "value",
|
||||||
PREFIX_VALUE + "state",
|
PREFIX_VALUE + "state",
|
||||||
PREFIX_FUNCTION + "reset",
|
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")) {
|
if(name.equals(PREFIX_FUNCTION + "reset")) {
|
||||||
counter = 0;
|
counter = 0;
|
||||||
markDirty();
|
markDirty();
|
||||||
} else if(name.equals(PREFIX_FUNCTION + "setState")) {
|
} else if(name.equals(PREFIX_FUNCTION + "setstate")) {
|
||||||
setState(IRORInteractive.parseInt(params[0], 0, 1));
|
setState(IRORInteractive.parseInt(params[0], 0, 1));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.hbm.tileentity.network;
|
package com.hbm.tileentity.network;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||||
import com.hbm.util.BufferUtil;
|
import com.hbm.util.BufferUtil;
|
||||||
@ -44,7 +46,7 @@ public class TileEntityRadioTorchReader extends TileEntityLoadedBase implements
|
|||||||
if(channel == null || channel.isEmpty()) continue;
|
if(channel == null || channel.isEmpty()) continue;
|
||||||
if(name == null || name.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(value == null) continue;
|
||||||
|
|
||||||
if(polling || !value.equals(previous)) {
|
if(polling || !value.equals(previous)) {
|
||||||
|
|||||||
@ -5,12 +5,16 @@ import com.hbm.interfaces.IControlReceiver;
|
|||||||
import com.hbm.inventory.container.ContainerPneumoStorageExporter;
|
import com.hbm.inventory.container.ContainerPneumoStorageExporter;
|
||||||
import com.hbm.inventory.gui.GUIPneumoStorageExporter;
|
import com.hbm.inventory.gui.GUIPneumoStorageExporter;
|
||||||
import com.hbm.tileentity.network.RTTYSystem;
|
import com.hbm.tileentity.network.RTTYSystem;
|
||||||
|
import com.hbm.util.BobMathUtil;
|
||||||
|
|
||||||
|
import api.hbm.ntl.StackCache;
|
||||||
import api.hbm.ntl.StackCache.CacheSlot;
|
import api.hbm.ntl.StackCache.CacheSlot;
|
||||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@ -24,6 +28,9 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
|
|||||||
public int requestMode = 0;
|
public int requestMode = 0;
|
||||||
/** Item ID and meta pairs with amount for RoR controlled filters */
|
/** Item ID and meta pairs with amount for RoR controlled filters */
|
||||||
public short[][] rorFilters = new short[9][3];
|
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 */
|
/** Each slot individually tries to pull as much as it can of the configured item */
|
||||||
public static final int MODE_AS_MUCH_AS_POSSIBLE = 0;
|
public static final int MODE_AS_MUCH_AS_POSSIBLE = 0;
|
||||||
@ -46,16 +53,153 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
|
|||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
|
for(int i = 0; i < 9; i++) {
|
||||||
|
if(slotDelay[i] > 0) slotDelay[i]--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(continuousRequest) {
|
||||||
|
this.doRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
this.networkPackNT(15);
|
this.networkPackNT(15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doRequest(boolean force) {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requestSlot(int slot, boolean force) {
|
// 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) {
|
public long getAvailability(int item, int meta) {
|
||||||
@ -127,7 +271,7 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
|
|||||||
@Override
|
@Override
|
||||||
public String runRORFunction(String name, String[] params) {
|
public String runRORFunction(String name, String[] params) {
|
||||||
|
|
||||||
if("setfilter".equals(name) && params.length == 4) {
|
if((PREFIX_FUNCTION + "setfilter").equals(name) && params.length == 4) {
|
||||||
int slot = IRORInteractive.parseInt(params[0], 1, 9) - 1;
|
int slot = IRORInteractive.parseInt(params[0], 1, 9) - 1;
|
||||||
int itemId = IRORInteractive.parseInt(params[1], 0, Short.MAX_VALUE);
|
int itemId = IRORInteractive.parseInt(params[1], 0, Short.MAX_VALUE);
|
||||||
int meta = IRORInteractive.parseInt(params[2], 0, Short.MAX_VALUE);
|
int meta = IRORInteractive.parseInt(params[2], 0, Short.MAX_VALUE);
|
||||||
@ -140,25 +284,25 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if("setcontinuous".equals(name) && params.length == 1) {
|
if((PREFIX_FUNCTION + "setcontinuous").equals(name) && params.length == 1) {
|
||||||
if("on".equals(params[0])) this.continuousRequest = true;
|
if("on".equals(params[0])) this.continuousRequest = true;
|
||||||
if("off".equals(params[0])) this.continuousRequest = false;
|
if("off".equals(params[0])) this.continuousRequest = false;
|
||||||
this.markChanged();
|
this.markChanged();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if("request".equals(name)) {
|
if((PREFIX_FUNCTION + "request").equals(name)) {
|
||||||
this.doRequest(true);
|
this.doRequest(true);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if("requestslot".equals(name) && params.length == 1) {
|
if((PREFIX_FUNCTION + "requestslot").equals(name) && params.length == 1) {
|
||||||
int slot = IRORInteractive.parseInt(params[0], 1, 9) - 1;
|
int slot = IRORInteractive.parseInt(params[0], 1, 9) - 1;
|
||||||
this.requestSlot(slot, true);
|
if(!this.requestSlot(slot, true)) this.slotDelay[slot] = SLOT_DELAY;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if("checkavailability".equals(name) && params.length == 3) {
|
if((PREFIX_FUNCTION + "checkavailability").equals(name) && params.length == 3) {
|
||||||
int itemId = IRORInteractive.parseInt(params[0], 0, Short.MAX_VALUE);
|
int itemId = IRORInteractive.parseInt(params[0], 0, Short.MAX_VALUE);
|
||||||
int meta = IRORInteractive.parseInt(params[1], 0, Short.MAX_VALUE);
|
int meta = IRORInteractive.parseInt(params[1], 0, Short.MAX_VALUE);
|
||||||
String ret = params[2];
|
String ret = params[2];
|
||||||
|
|||||||
@ -96,13 +96,13 @@ public abstract class TileEntityTurretBaseArtillery extends TileEntityTurretBase
|
|||||||
@Override
|
@Override
|
||||||
public String[] getFunctionInfo() {
|
public String[] getFunctionInfo() {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
PREFIX_FUNCTION + "setActive" + NAME_SEPARATOR + "active (0 or 1)",
|
PREFIX_FUNCTION + "setactive" + NAME_SEPARATOR + "active (0 or 1)",
|
||||||
PREFIX_FUNCTION + "targetPlayers" + NAME_SEPARATOR + "enabled (0 or 1)",
|
PREFIX_FUNCTION + "targetplayers" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||||
PREFIX_FUNCTION + "targetAnimals" + 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 + "targetmobs" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||||
PREFIX_FUNCTION + "targetMachines" + NAME_SEPARATOR + "enabled (0 or 1)",
|
PREFIX_FUNCTION + "targetmachines" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||||
PREFIX_FUNCTION + "addWhitelist" + NAME_SEPARATOR + "name",
|
PREFIX_FUNCTION + "addwhitelist" + NAME_SEPARATOR + "name",
|
||||||
PREFIX_FUNCTION + "removeWhitelist" + NAME_SEPARATOR + "name",
|
PREFIX_FUNCTION + "removewhitelist" + NAME_SEPARATOR + "name",
|
||||||
PREFIX_FUNCTION + "enqueue" + NAME_SEPARATOR + "x" + PARAM_SEPARATOR + "y" + PARAM_SEPARATOR + "z",
|
PREFIX_FUNCTION + "enqueue" + NAME_SEPARATOR + "x" + PARAM_SEPARATOR + "y" + PARAM_SEPARATOR + "z",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1062,40 +1062,40 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
|||||||
@Override
|
@Override
|
||||||
public String[] getFunctionInfo() {
|
public String[] getFunctionInfo() {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
PREFIX_FUNCTION + "setActive" + NAME_SEPARATOR + "active (0 or 1)",
|
PREFIX_FUNCTION + "setactive" + NAME_SEPARATOR + "active (0 or 1)",
|
||||||
PREFIX_FUNCTION + "targetPlayers" + NAME_SEPARATOR + "enabled (0 or 1)",
|
PREFIX_FUNCTION + "targetplayers" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||||
PREFIX_FUNCTION + "targetAnimals" + 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 + "targetmobs" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||||
PREFIX_FUNCTION + "targetMachines" + NAME_SEPARATOR + "enabled (0 or 1)",
|
PREFIX_FUNCTION + "targetmachines" + NAME_SEPARATOR + "enabled (0 or 1)",
|
||||||
PREFIX_FUNCTION + "addWhitelist" + NAME_SEPARATOR + "name",
|
PREFIX_FUNCTION + "addwhitelist" + NAME_SEPARATOR + "name",
|
||||||
PREFIX_FUNCTION + "removeWhitelist" + NAME_SEPARATOR + "name",
|
PREFIX_FUNCTION + "removewhitelist" + NAME_SEPARATOR + "name",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String runRORFunction(String name, String[] params) {
|
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) {}
|
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) {}
|
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) {}
|
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) {}
|
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) {}
|
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];
|
String playerName = params[0];
|
||||||
List<String> whitelist = this.getWhitelist();
|
List<String> whitelist = this.getWhitelist();
|
||||||
if(!whitelist.contains(playerName)) this.addName(playerName);
|
if(!whitelist.contains(playerName)) this.addName(playerName);
|
||||||
this.markChanged();
|
this.markChanged();
|
||||||
}
|
}
|
||||||
if((PREFIX_FUNCTION + "removeWhitelist").equals(name) && params.length > 0) {
|
if((PREFIX_FUNCTION + "removewhitelist").equals(name) && params.length > 0) {
|
||||||
String playerName = params[0];
|
String playerName = params[0];
|
||||||
List<String> whitelist = this.getWhitelist();
|
List<String> whitelist = this.getWhitelist();
|
||||||
if(whitelist.contains(playerName)) this.removeName(whitelist.indexOf(playerName));
|
if(whitelist.contains(playerName)) this.removeName(whitelist.indexOf(playerName));
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 312 B |
Loading…
x
Reference in New Issue
Block a user