ForkedEnderTweaker
作者:rebot | 分类:模组
Minecraft 版本: 1.12.2
平台: forge
标签: utility
FET is a fork of the original EnderTweaker by Shadows_of_Fire
An interface between EnderIO and CraftTweaker.
It supports adding and removing recipes for EnderIO machines using ZenScript, enabling hot-reloading (via ZenRecipeReload) for modpack customization.
✨ Key Improvements in this Fork
-
The latest version of EnderIO is supported:
All supported mechanisms work and have been tested with the latest version of 1.12.2 EnderIO (v.5.3.72).
Some mechanisms may also work with older versions of EnderIO (5.3.67 - 5.3.71), but the correct operation is not guaranteed. -
Hot-Reloading: Added the ability to use
/ct reloadand/jeiReloadfor hot-reloading your ZenScripts to apply changes without relaunching the game entirely.
(Note: Requires ZenRecipeReload). -
Improved Logging: Clearer error messages in
crafttweaker.logand the in-game chat to help you debug your scripts.
Supported Machines:
Alloy Smelter •
Combustion Generator •
Enchanter •
SAG Mill •
Slice'n'Splice •
Soul Binder •
The Vat •
Tank
? Documentation
Reloading Feature #### Hot-Reloading To enable script reloading, you must include the `#reloadable` preprocessor at the very first line of your ZenScript file. ```zenscript #reloadable // ...Your imports here... // ...Your script here... ``` Once you have made any changes to your script (added or removed recipes), run the `/ct reload` command to reload your scripts and the `/jeiReload` command to refresh JEI recipes. You can find more useful info about reloading in general on the [ZenUtils wiki](https://github.com/friendlyhj/ZenUtils/wiki/ScriptReloading). --- Alloy Smelter (mods.enderio.AlloySmelter) The Alloy Smelter is a complex mechanism implementing its own melting system that can smelt up to three items at once and combine them into alloys. #### Add Recipe ##### `AlloySmelter.addRecipe(IItemStack output, IItemStack[] inputs, @Optional int energyCost, @Optional xp)` ```zenscript AlloySmelter.addRecipe( , [, ], 2000, 0.5 ); ``` **Parameters:** - `output` ([IItemStack](https://docs.blamejared.com/1.12/en/Vanilla/Items/IItemStack)) - The result of the crafting operation. - `inputs` ([IIngredient[]](https://docs.blamejared.com/1.12/en/Vanilla/Variable_Types/IIngredient)) - The items required to smelt the alloy. - `energyCost` (int, optional) - µI required (Default: 5000). - `xp` (float, optional) - Experience granted (Default: 0.0). #### Remove Recipe _(Note: You cannot remove standard smelting recipes (e.g., `Flour > Bread`) using FET's AlloySmelter class, because those use the vanilla Minecraft Furnace smelting system. For such recipes, use [CraftTweaker's Furnace Handler](https://docs.blamejared.com/1.12/en/Vanilla/Recipes/Furnace/Recipes_Furnace/))._ **Performance Tip:** Because the Alloy Smelter lacks native recipe removal tools, FET rebuilds the entire recipe list during removal. This is an "expensive" operation. If you need to remove **multiple recipes, better to use the multiple removal formats instead** to do it in one pass. ##### 1. Remove by Output ##### `AlloySmelter.removeRecipe(...IItemStack output)` ``` // Remove a single recipe AlloySmelter.removeRecipe(5>23>1>0>2>1>0>0> Combustion Generator (mods.enderio.CombustionGen) Generates µI (Micro Infinity Energy) by burning liquid fuel and using a liquid coolant for cooling. _(Note: This machine acts as a mix-and-match system. Once you register a Fuel, it can be used with **ANY** registered Coolant and vice versa._ The GUI displays values in **t/mB** (Ticks per Millibucket). This represents **Duration**). The logic is based on **Heat Balance**. Burning fuel generates Heat. The Coolant absorbs that Heat. #### Basic understanding of Combustion Generator Mechanics: _(Note: Variables marked as_ _variable_ _are variables you set in your ZenScript script._
_Variables marked as_ **variable** _are derived from EnderIO's source code)._
1. Capacitor & Machine Modifiers
Machine and capacitor tier multipliers can be configured however you want via EnderIO XML recipe configs. All of them have a base value and a scaler type (which declares what the math will do with the base value). For the Combustion Generator, we generally have the following final multipliers: - **Capacitor Quality Multiplier** (**capQuality**):
The basic config declares for Normal and Enhanced Combustion Gens:
``
``
**Formula**: 1.0 + (CapacitorLevel - 1) \* 0.25
- Basic Capacitor (Lvl 1): **1.00**
- Double-Layer Capacitor (Lvl 2): **1.25**
- Octadic Capacitor (Lvl 3): **1.50**
_(Note: For custom capacitors or those from add-ons, you need to use the same scaler and their respective level values)._
- **Machine Quality** (**machineQuality**):
Basic config declares:
``
``
- Combustion Generator: **1.00**
- Enhanced Combustion Generator: `200 * 0.01` = **2.0**
2. Energy Generation (µI/t)
**Formula:** **energyPerTick** = Math.round(powerPerCycle \* **capQuality** \* **machineQuality**)
3. Fuel Duration (t/mB)
Determines how many ticks 1 mB of fuel lasts. Higher capacitor tiers burn fuel faster to maintain higher power output.totalBurnTime= Total ticks per 1000 mB (set in script).- Formula:
ticksPerFuel=Math.max((int)(totalBurnTime/capQuality/ 1000.0F), 1)
4. Coolant Duration (t/mB)
The machine produces heat based on energy generation. - **A. Cooling Capacity (per mB):** How much heat 1 mB of fluid can remove.cooling = (373.25 - Fluid_Temp_K) \* degreesCoolingPerMB
Fluid_Temp_K = the liquid's temperature, which can be found by running the `/ct liquids`command. All registered liquids and their properties will be written to the `crafttweaker.log` file.
- **B. Heat Generated (per Tick):**
Heat per µI Constant: **0.000115**.
toCool = energyPerTick \* machineQuality \* 0.000115
- **C. Final Duration (t/mB):**
ticksPerCoolant = Math.max((int)Math.round(cooling / toCool), 1)
#### Example Calculation (What GUI will show)
// Scenario: You're adding fuel and coolant. For example lets took Hot Coolant and Coolant from IC2 mod:
// Fuel: "Hot Coolant" (Temperature = 1200K), powerPerCycleRF = 100 µI/t, totalBurnTime = 20000.
// Coolant: "Coolant" (Temperature = 300K), degreesCoolingPerMB = 1.0.
//Normal Machine (MQ=1.0) + Basic Capacitor (CQ=1.0)
1. Energy = 1000 \* 1.0 \* 1.0 = 1000.0 µI/t.
2. Ticks per Fuel = 20000 / 1.0 / 1000 = 20.
3. Ticks per Coolant = ((373.25 - 300K) \* 1.0) / (1000.0µI/t \* 1.0 \* 0.000115) = 73.25 / 0.115 = 637 t/mB.
// Case B: Enhanced Machine (MQ=2.0) + Octadic Capacitor (CQ=1.5)
1. Energy = 1000 \* 1.5 \* 2.0 = 3000 µI/t.
2. Ticks per Fuel = 300 \* 2.0 \* 0.000115 = 13.
3. Ticks per Coolant = ((373.25 - 300K) \* 1.0) / (1000.0µI/t \* 2.0 \* 0.000115) = 73.25 / 0.69 = 106 t/mB.
#### Add Fuel
##### `CombustionGen.addFuel(ILiquidStack fluid, int powerPerCycle, int totalBurnTime)`
```zenscript
import mods.enderio.CombustionGen;
CombustionGen.addFuel(
,
100,
20000
);
```
**Parameters:**
- `fluid` ([ILiquidStack](https://docs.blamejared.com/1.12/en/Vanilla/Liquids/ILiquidStack)) - The liquid to burn.
- `powerPerCycle` (int) - Base µI/t (at Basic Capacitor, Normal Machine).
- `totalBurnTime` (int) - Total ticks that 1000 mB (1 Bucket) will burn (at Basic Capacitor).
#### Add Coolant
##### `CombustionGen.addCoolant(ILiquidStack fluid, int powerPerCycle, float degreesCoolingPerMB)`
```zenscript
import mods.enderio.CombustionGen;
CombustionGen.addCoolant(, 1.0);
```
**Parameters:**
- `fluid` ([ILiquidStack](https://docs.blamejared.com/1.12/en/Vanilla/Liquids/ILiquidStack)) - The liquid to burn.
- `degreesCoolingPerMB` (int) - Multiplier.
#### Remove Fluids
##### `CombustionGen.removeFuel(ILiquidStack fluid)`
##### `CombustionGen.removeCoolant(ILiquidStack fluid)`
```zenscript
import mods.enderio.CombustionGen;
CombustionGen.removeFuel();
CombustionGen.removeCoolant();
```
**Parameters:**
- `fluid` ([ILiquidStack](https://docs.blamejared.com/1.12/en/Vanilla/Liquids/ILiquidStack)) - The liquid to remove.
---
Enchanter (mods.enderio.Enchanter)
The Enchanter allows creating Enchanted Books by combining a specific input item with XP levels. It converts physical items and player experience into stored enchantments.
#### Basic understanding of Enchanter Mechanics:
- **The Lapis is Implicit:**
You **do not** need to specify a Lapis as part of your `input`. The machine is hardcoded to always require one in its secondary slot.
Recipes in the Enchanter are defined per Enchantment. The cost of creating a book is dynamic and scales linearly with the Level of the enchantment you select. It is based on the default vanilla XP enchantability and a few scalers.
_(Note: Variables marked as_ _variable_ _are variables you set in your ZenScript script._
_Variables marked as_ **variable** _are derived from EnderIO's source code)._
- **Item Cost:**
A simple calculation: it multiplies the required amount of items per level by the target level.
itemsNeeded = targetLevel \* amountPerLevel
Example: If _amountPerLevel_ is 2, crafting a Level V (5) book requires 10 items.
_(Note: Be careful with the amount of items. If it exceeds the maximum stack size of the required item (e.g., 64 for most resources), higher levels of the enchantment will become uncraftable, even if the maximum possible level for this enchantment is not reached. However, this can also be used as a deliberate limitation.)_
- **XP Cost:**
Depends on the enchantment's native rarity, the _costMultiplier_, and the config's **levelCostFactor** and **baseLevelCost** (Below is pseudocode for easier understanding):
min = Math.max(1,_(Note 1:minEnchantability);
min = min *costMultiplier;
cost = (int)Math.round(min *levelCostFactor);
cost = cost + (int)baseLevelCost;
return cost;
minEnchantability can be found by procceding CraftTweaker's getMinEnchantability(int level) function)._
_(Note 2: A_ _costMultiplier_ _multiplier of 1.0 uses standard EnderIO math. Higher values make the recipe more expensive in levels.
By default_ **levelCostFactor**_= 0.75 and_ **baseLevelCost** _= 2.0)._
#### Example Calculation
```
// Scenario: Making Sharpness V book from Wool.
// Recipe: Input=Red Wool, AmountPerLevel=2, CostMultiplier=1.0.
1. Items Needed = 5 \* 2 = 10 Wool.
2. XP Cost:
min = Sharpness V Ench. (45) \* 1.0 = 45.0
cost = 45.0 \* 0.75 = 34
cost = 34 + 2.0 = 36
```
#### Add Recipe
##### `Enchanter.addRecipe(IEnchantmentDefinition enchantment, IIngredient input, int amountPerLevel, double costMultiplier)`
```zenscript
import mods.enderio.Enchanter;
Enchanter.addRecipe(
,
SAG Mill (mods.enderio.SagMill)
Crushes items to produce dusts and byproducts. This machine is heavily affected by **Grinding Balls**.
_(Note: Variables marked as_ _variable_ _are variables you set in your ZenScript script._
_Variables marked as_ **variable** _are derived from EnderIO's source code)._
- **Bonus Type Behavior:**
How Grinding Balls affect this specific recipe (defined by _bonusType_):
- `NONE` - Grinding balls have no effect.
- `MULTIPLY_OUTPUT` - Ball multiplies the amount of the main output.
- `CHANCE_ONLY` - Ball only boosts the chance of secondary/tertiary output.
#### Add Recipe
##### 1. Using Arrays (Standard)
`SagMill.addRecipe(IItemStack[] outputs, float[] chances, IIngredient input, String bonusType, @Optional int energyCost, @Optional float[] xp);`
```zenscript
import mods.enderio.SagMill;
SagMill.addRecipe(
[, ],
[1.0, 0.2],
,
"CHANCE_ONLY",
2000,
[0.0, 0.1]
);
```
**Parameters:**
- `outputs` ([IItemStack[]](https://docs.blamejared.com/1.12/en/Vanilla/Items/IItemStack)) - Array of result items.
- `chances` (float[]) - Array of probabilities (0.0 to 1.0). Must match `outputs` length.
- `input` ([IIngredient](https://docs.blamejared.com/1.12/en/Vanilla/Items/IIngredient)) - The item to be crushed.
- `bonusType` (String) - See `"Bonus Type Behavior"` above.
- `energyCost` (int, optional) - µI required. Default: 5000.
- `xp` (float[], optional) - XP per item output. Default: 0.
##### 2. Using WeightedStacks
`SagMill.addRecipe(WeightedItemStack[] outputs, IIngredient input, String bonusType, @Optional int energyCost, @Optional float[] xp);`
```zenscript
import mods.enderio.SagMill;
SagMill.addRecipe(
[ % 100, % 50],
,
"MULTIPLY_OUTPUT"
);
```
**Parameters:**
- `outputs` ([WeightedItemStack[]](https://docs.blamejared.com/1.12/en/Vanilla/Items/WeightedItemStack)) - Item + Chance pairs (e.g. ` % 50` for 50%).
- `input`, `bonusType`, `energy`, `xp` - Same as above.
#### Remove Recipe
`SagMill.removeRecipe(IItemStack input);`
```zenscript
import mods.enderio.SagMill;
SagMill.removeRecipe();
```
**Parameters:**
- `input` ([IItemStack]((https://docs.blamejared.com/1.12/en/Vanilla/Items/IItemStack)) - The grinding item to remove.
---
Slice'n'Splice (mods.enderio.SliceNSplice)
The Slice'n'Splice is a machine that combines various items into advanced components like Zombie Electrodes or Z-Logic Controllers. It uniquely requires an Axe and Shears in its tool slots to operate (you don't need to specify them).
**Important Note:** This machine is **slot-strict**. The order of the ingredients in your array directly corresponds to the 6 input slots in the machine. If you need to leave a specific slot empty, you must use `null` in that position of the array. If you want to remain empty trailing slots, you can simply provide a shorter array (e.g., an array of 4 items will fill the first 4 slots and leave the last 2 empty).
#### Add Recipe
##### SliceNSplice.addRecipe(IItemStack output, IIngredient[] inputs, @Optional int energyCost, @Optional float xp)
```zenscript
import mods.enderio.SliceNSplice;
SliceNSplice.addRecipe(
,
[
, null, , // Slots 0, 1, 2
null, , null // Slots 3, 4, 5
],
5000,
0.5
);
```
**Parameters:**
- `output` ([IItemStack](https://docs.blamejared.com/1.12/en/Vanilla/Items/IItemStack)) - The result of the crafting operation.
- `inputs` ([IIngredient[]](https://docs.blamejared.com/1.12/en/Vanilla/Variable_Types/IIngredient)) - An array of up to 6 ingredients representing the machine's slots in order. Use null for empty slots.
- `energyCost` (int, optional) - µI required (Default: 5000).
- `xp` (float, optional) - Experience granted (Default: 0.0).
#### Remove Recipe
##### SliceNSplice.removeRecipe(IItemStack output)
```zenscript
import mods.enderio.SliceNSplice;
SliceNSplice.removeRecipe(
41>
Soul Binder (mods.enderio.SoulBinder)
The Soul Binder is used to bind the soul of a captured mob (from a filled Soul Vial) to a base item, creating a new magical or mechanical component. It consumes both µI (Energy) and player Experience (Levels).
#### Basic understanding of Soul Binder Mechanics:
- **The Soul Vial is Implicit:**
You **do not** need to specify a filled Soul Vial as part of your `input`. The machine is hardcoded to always require one in its secondary slot.
- **Entity Array:**
Instead of defining the exact vial item, you provide an array of `Entity IDs` (e.g., `["minecraft:zombie", "minecraft:skeleton"]`). The recipe will accept a Soul Vial filled with **ANY** of the entities listed in this array.
- **Empty Vial Output:**
The machine automatically returns an empty Soul Vial upon completing the craft. You do not need to script this byproduct.
#### Add Recipe
##### SoulBinder.addRecipe(IItemStack output, IIngredient input, String[] entities, int xp, @Optional int energyCost)
```zenscript
import mods.enderio.SoulBinder;
// Example: Binds either a Zombie or Skeleton soul to a Diamond to create an Emerald.
// Costs 5 XP levels and 100,000 µI.
SoulBinder.addRecipe(
,
,
["minecraft:zombie", "minecraft:skeleton"],
5,
100000
);
```
**Parameters:**
- `output` ([IItemStack](https://docs.blamejared.com/1.12/en/Vanilla/Items/IItemStack)) - The result of the binding operation.
- `input` ([IIngredient[]](https://docs.blamejared.com/1.12/en/Vanilla/Variable_Types/IIngredient)) - The base item that the soul will be bound to.
- `entities` (String[]) - An array of valid entity Resource Locations (e.g., `"minecraft:creeper"`).
- `xp` (int) - The cost in experience **levels**.
- `energyCost` (int, optional) - µI required (Default: 5000).
#### Remove Recipe
##### SoulBinder.removeRecipe(IItemStack output)
```zenscript
import mods.enderio.SoulBinder;
SoulBinder.removeRecipe(
17>
The Vat (mods.enderio.Vat)
The Vat is a fluid brewing machine. It ferments a base input fluid along with two solid ingredients to create a new output fluid (e.g., `Water + Sugar + Apple = Hootch`).
#### Basic understanding of Soul Binder Mechanics:
- **Input Slots:**
The Vat has two distinct item input slots. A recipe must define an ingredient for both slots.
- **Slot Multipliers:**
Each solid input item and input liquid has a specific multiplier. The final amount of both fluids is calculated by the following formulas:
Ingredient Multiplier = slot1Mults * slot2Mults
Input Fluid Volume = Ingredient Multiplier * 1000
Output Fluid Volume = Ingredient Multiplier * inMult * 1000
// Scenario: You're adding a recipe for brewing lava from water. As items you're using Coal + Flint and Steel:
// Input liquid: "Water"; Input Fluid Multiplier = 0.5.
// Left slot items: "Coal", "Charcoal"; Multipliers: [2.0, 1.5];
// Right slot items: "Flint and Steel"; Multipliers: [2.0].
// Coal (2.0) + Flint and Steel (2.0)
1. Ingredient Multiplier = 2.0 \* 2.0 = 4.0
2. Input Fluid Volume = 4.0 \* 1000 = 4000 mB.
3. Output Fluid Volume = 4.0 \* 0.5 \* 1000 = 2000 mB.
// Charcoal (1.5) + Flint and Steel (2.0)
1. Ingredient Multiplier = 1.5 \* 2.0 = 3.0
2. Input Fluid Volume = 3.0 \* 1000 = 3000 mB.
3. Output Fluid Volume = 3.0 \* 0.5 \* 1000 = 1500 mB.
_(Note: Be careful with multipliers - if the final volume of output liquid exceeds the max capacity of the tank, you will not be able to create this recipe.)._
#### Add Recipe
##### Vat.addRecipe(ILiquidStack output, float inMult, ILiquidStack input, IIngredient[] slot1Solids, float[] slot1Mults, IIngredient[] slot2Solids, float[] slot2Mults, @Optional int energyCost)
```zenscript
import mods.enderio.Vat;
Vat.addRecipe(
,
0.5,
,
[, µ1>
The Tank (mods.enderio.Tank)
The Fluid Tank is not only for storage but also functions as a simple processing machine. It can either consume fluids from the tank to modify an item (Filling the item) or extract fluids from an item to fill the tank (Emptying the item).
#### Basic understanding of Tank Mechanics:
_(Note: Variables marked as_ _variable_ _are variables you set in your ZenScript script._
_Variables marked as_ **variable** _are derived from EnderIO's source code)._
- **The fill boolean:**
This parameter dictates the direction of the fluid transfer:
- `true` **(Filling Mode)**: The fluid is consumed from the tank's internal storage to process or fill the input item.
- `false` **(Emptying Mode)**: The fluid is extracted from the input item and added to the tank's internal storage.
- **Optional Output (Item Consumption):**
The `output` item parameter is optional. If you do not provide an output (or pass `null`), the input item will be completely consumed/destroyed during the process.
- **Native Forge Containers Restriction:**
You **cannot** add or remove recipes that use native Forge fluid containers (such as Vanilla Buckets, IC2 Capsules, or Portable Tanks). The EnderIO Tank handles these items automatically via hardcoded Forge mechanics.
#### Add Recipe
##### Tank.addRecipe(boolean fill, IIngredient input, ILiquidStack fluid, @Optional IItemStack output)
```zenscript
import mods.enderio.Tank;
// Example 1 (Filling Mode): Consumes 250mB of Lava from the tank to turn a Sponge into a Wet Sponge.
Tank.addRecipe(true, , * 250, 1>1>
Dumping
You can dump all registered recipes from machines using `/fet dump` command. You can specify the machine from which you want to dump the recipes as a parameter.
Parameters: `[all|alloy|combustion|enchanter|sagmill|slice|soul|tank|vat]`
All recipes will be written to the `latest.log` file.
? Contributing
Contributions are welcome! If you've found a bug, or want to improve existing functionality, feel free to open an issue or a pull request.
To set up the dev environment:
- Clone the repo
- Make sure
JAVA_HOMEpoints to JDK 25 or newer (JDK 8 is used for compilation automatically via Gradle toolchains) - Run
./gradlew runClient— Gradle will download all required dependencies on first launch
请登录后举报
暂无评论,抢个沙发吧~