Skip to content

MineTweaker Support

OreCruncher edited this page Jan 9, 2016 · 41 revisions

Thermal Recycling will delay decomposition of Forge registered recipes until the last possible moment prior to the server starting up a World. This is to allow MineTweaker to run it’s scripts and apply whatever recipe tweaks the modpack author had in mind.

The MineTweaker scripts do not have to be on the client for Thermal Recycling to work. Recipe information Thermal Recycling uses is sourced from the server. Displays within the Scrap Assessor and the Thermal Recycler will remain consistent with the server configuration state.

If MineTweaker3 is loaded Thermal Recycler will register with MineTweaker so that scripts can be written to modify item and recipe behavior.

Information on the various constants defined by Thermal Recycling can be found here. Look down in the register() method.

Item Data Registry

The Item Data Registry allows modification of Thermal Recycling item attributes for any given or generic version of an item. Any item can be modified this way without needing to have direct support for a mod by Thermal Recycling.

// Example script for things you can do to modify Thermal Recycling behavior.

import mods.recycling.ItemDataRegistry;

var iron = <minecraft:iron_ingot>;

// Sets the ScrapValue of the specified item.
// SCRAPVALUE_NONE
// SCRAPVALUE_INFERIOR
// SCRAPVALUE_STANDARD
// SCRAPVALUE_SUPERIOR
ItemDataRegistry.setScrapValue(iron, SCRAPVALUE_SUPERIOR);

// Sets the CompostValue of the specified item.
// COMPOSTVALUE_NONE
// COMPOSTBVALUE_GREEN
// COMPOSTVALUE_BROWN
ItemDataRegistry.setCompostIngredient(<minecraft:wheat>, COMPOSTVALUE_GREEN);

// Tells ThermalRecycling to ignore the recipe during the recipe scan phase.
// TRUE: ignore the recipe
// FALSE: include the recipe
//
// Even if a recipe is ignored one can be added using MineTweaker.  This setting affects
// the automated process.
ItemDataRegistry.setIgnoreRecipe(<minecraft:torch>, true);

// Tells ThermalRecycling to scrub this item from recipe output.
// TRUE: scrub from output
// FALSE: keep the item
//
// This affects only the automated process.  The item can still be added manually
// using the MineTweaker system.
ItemDataRegistry.setScrubFromOutput(<minecraft:lava_bucket>, true);

// Tells ThermalRecycling to block the item from being processed in a Thermal
// Recycler.
// TRUE: jam the machine
// FALSE: process
ItemDataRegistry.setBlockedFromScrapping(<minecraft:glass>, true);

Recipe Data Registry

The Recipe Data Registry contains the list of recipes for the Thermal Recycler when the decomposition core is installed.

import mods.recycling.RecipeDataRegistry;
import mods.recycling.ItemDataRegistry;

// Registers a new recipe for the ThermalRecycler.  Rules can be a bit
// complicated:
//
// If it doesn't already exist it is inserted
// If it exists, and the quantity matches, it is ignored
// If it exists, and the quantity is greater, it replaces the existing recipe
RecipeDataRegistry.add(<minecraft:iron_door>, [<minecraft:iron_ingot> * 6]);

// Removes the recipe for the specified item from the list.  Note that it could
// be added back by the Thermal Recycling scan.
RecipeDataRegistry.remove(<minecraft:iron_door>);

// Further examples:

// Sets all wool to a ScrapValue of SUPERIOR
ItemDataRegistry.setScrapValue(<minecraft:wool:*>, SCRAPVALUE_SUPERIOR);

// Except for the black wool - we want that INFERIOR
ItemDataRegistry.setScrapValue(<minecraft:wool:15>, SCRAPVALUE_INFERIOR);

// Strange but true - scrap a stack of logs and receive a bunch of bread
RecipeDataRegistry.add(<minecraft:log:*> * 64, [<minecraft:bread> * 32]);

// Scrap all wool to some string
RecipeDataRegistry.add(<minecraft:wool:*>, [<minecraft:string> * 4]);

// Except for black which can give more
RecipeDataRegistry.add(<minecraft:wool:15>, [<minecraft:string> * 32]);

Extraction Data Registry

The Extraction Data Registry contains the list of recipes that the Thermal Recycler will use when an extraction core is installed.

import mods.recycling.ExtractionDataRegistry;

// Extraction!  If iron ore is extracted there is a 50% chance to give stone.
// The null entry means nothing is given.  Each successive add for an input item
// will add a weight table entry.  If you are not sure what a weight table is
// use the Internet to educate.
ExtractionDataRegistry.add(<minecraft:iron_ore>, null, 1);
ExtractionDataRegistry.add(<minecraft:iron_ore>, <minecraft:stone>, 1);

// Remove the netherrack extraction recipe
ExtractionDataRegistry.remove(<minecraft:netherrack>);

// Extract an iron door to get a pumpkin
ExtractionDataRegistry.add(<minecraft:iron_door>, <minecraft:pumpkin>, 1);

Modify Scrap Extraction Recipes

The built-in extraction recipes for Scrap can be modified or fully replaced.

// Add an item to the extraction recipe for scrap!
// Add Iron Ingot to Inferior...
ExtractionDataRegistry.add(<recycling:RecyclingScrap:0>, <minecraft:iron_ingot>, 100);
// Add Gold Ingot to Standard...
ExtractionDataRegistry.add(<recycling:RecyclingScrap:1>, <minecraft:gold_ingot>, 100);
// Add Nether Start to Superior...
ExtractionDataRegistry.add(<recycling:RecyclingScrap:2>, <minecraft:nether_star>, 100);

If you want to fully replace the extraction recipe you must first remove, and then re-add the weight table items:

// The only extract possible for Inferior Scrap should be an Gold Nugget
// Remove the ENTIRE recipe..
ExtractionDataRegistry.remove(<recycling:RecyclingScrap:0>);
// ...then add back the Gold Nugget
ExtractionDataRegistry.add(<recycling:RecyclingScrap:0>, <minecraft:gold_nugget>, 1);

Notes:

  • Scrap Boxes are handled specially within the mod itself. Just modify the recipe for Scrap and the Scrap Box logic will handle it appropriately.
  • The Scrap Assessor will only show up to 9 of the possible extraction outcomes. It is possible to have more than what is shown.
  • Be mindful of the weights within the corresponding tables. You can see this information by looking at the ThermalRecycling.log file in the /.minecraft directory. At the bottom of the log the known extraction recipes will be listed.

Village Vending Machine Professions

The Vending Profession Registry contains a list of all professions and trade tables that could be used by Thermal Recycling’s village world generation logic when creating a vending machine.

NOTE: Constants for colors can be found here.

import mods.recycling.VendingProfessionRegistry;

// Setup a new village vending trade.  The title that will show will be
// "Vend-O-Soylent", and will be colored black on light blue.  The selection
// will have a weight of 1000 which will cause it to be the most commonly
// selected vending profession.
var id = VendingProfessionRegistry.createProfession("Soylent", COLOR_BLACK, COLOR_LIGHTBLUE, 1000);

// This will setup a single trade.  The trade the player will be asked to give
// 2-4 emeralds, and in exchange they will get 2 Soylent Green. The probably
// of selection for trade is 70% (0.7).
VendingProfessionRegistry.addTrade(id, <minecraft:emerald>, 2, 4, null, 0, 0, <recycling:soylentGreen>, 2, 2, 0.7);

// This will add another trade that will accept 2-4 emeralds and 1 coal in
// exchange for 2 Soylent Yellow.  As with the first there is a 70% chance of
// selection.
VendingProfessionRegistry.addTrade(id, <minecraft:emerald>, 2, 4, <minecraft:coal>, 1, 1, <recycling:soylentYellow>, 2, 2, 0.7);

// Similar to the others, but the player would give 2-4 iron ore in exchange
// for 2 Soylent Red.
VendingProfessionRegistry.addTrade(id, <minecraft:iron_ore>, 2, 4, null, 0, 0, <recycling:soylentRed>, 2, 2, 0.7);

// Add a trade to an existing Vending Profession.  This trade is added to the
// Herder profession.  It allows a player to give 2-4 Soylent Green in exchange
// for 1-2 emeralds.
id = VendingProfessionRegistry.findProfession("msg.VendoFormat.Herder");
VendingProfessionRegistry.addTrade(id, <recycling:soylentGreen>, 2, 4, null, 0, 0, <minecraft:emerald>, 1, 2, 0.7);

Pile of Rubble Loot Table

The Rubble Pile Data Registry facilitates modification of the underlying ChestHook entry for Pile of Rubble.

import mods.recycling.RubblePileDataRegistry;

// Rubble piles!  Remove Soylent Green...
RubblePileDataRegistry.remove(<recycling:soylentGreen>);

// ...and add a stack of diamonds (item, min, max, weight).
RubblePileDataRegistry.add(<minecraft:diamond>, 64, 64, 1000);

Breeding Item Registry

The internal animal breeding tables of Thermal Recycling can be modified.

// Modify some of the breeding items for animals!
import mods.recycling.BreedingItemRegistry;

// Chickens don't get enough Iron in their diets so they can now take Iron Ingots for breeding
BreedingItemRegistry.add("Chicken", <minecraft:iron_ingot>);

// Pigs no longer like the potatoes
BreedingItemRegistry.remove("Pig", <minecraft:potato>);

ScrapBox Use Effect Tables

The ScrapBox Use Effect Tables can be tailored to the theme of a modpack. New items can be added to the existing tables, or a table can be reset and populated.

// Modify the ScrapBox Effect tables
// Clear out existing Inferior table.  Could also manipulate the Standard
// and Superior tables.
ScrapBoxEffectRegistry.reset(SCRAPVALUE_INFERIOR);
// Chance that nothing happens.  Weight at 100.
ScrapBoxEffectRegistry.addNoUseEffect(SCRAPVALUE_INFERIOR, 100);
// Chance get 1-4 coal for the furnace.  Weight at 20.
ScrapBoxEffectRegistry.addDropItemEffect(SCRAPVALUE_INFERIOR, 20, <minecraft:coal>, 4);
// Possible to get 15 experience.  Weight at 20.
ScrapBoxEffectRegistry.addExperienceEffect(SCRAPVALUE_INFERIOR, 20, 15);
// Chance to get a level 8 enchanted book.  Weight at 10.
ScrapBoxEffectRegistry.addEnchantedBookEffect(SCRAPVALUE_INFERIOR, 10, 8);
// Random loot from a blacksmith chest.  Weight at 30.
ScrapBoxEffectRegistry.addChestEffect(SCRAPVALUE_INFERIOR, 30, "villageBlacksmith");
// Potion effects are always fun - 1200 ticks (60 second) duration and
// level 1 (the 0). Weight at 5.
ScrapBoxEffectRegistry.addPotionEffect(SCRAPVALUE_INFERIOR, 5, 1200, 0);
// Small chance at bonus - means extra dips into the table.  Two bites,
// Weight at 5.
ScrapBoxEffectRegistry.addBonusEffect(SCRAPVALUE_INFERIOR, 5, 2);
// Could get lucky and get a mob spawn
ScrapBoxEffectRegistry.addSpawnEntityEffect(SCRAPVALUE_INFERIOR, 10, "Skeleton", 1, null);
// And because we are evil, can get a 1-16 baby zombies.
// Check out the /summon command to get parameters for the last field
ScrapBoxEffectRegistry.addSpawnEntityEffect(SCRAPVALUE_INFERIOR, 50, "Zombie", 16, "{IsBaby:1}");

Known Limitations

  • Thermal Recycling will not detect MineTweaker reload requests. The server has to be restarted so that Thermal Recycling can properly detect the new recipe modifications.
Clone this wiki locally