From 0c6173ec39473dd83541d8432192dca8e14634ed Mon Sep 17 00:00:00 2001 From: Deepa <52133154+Deepacat@users.noreply.github.com> Date: Sun, 28 Jul 2024 01:10:52 -0500 Subject: [PATCH] Edits and new examples (#32) * Fixed issues in proc plant * fixed extra curly bracket * Parallel hatch example * Renamed parallel hatch file * Added removing ore piles example * Reducing machines duration example --- .../Modpacks/Examples/Ore-Processing-Plant.md | 5 +-- docs/Modpacks/Examples/Parallel-Hatch-Part.md | 36 +++++++++++++++++++ docs/Modpacks/Examples/Reducing-Duration.md | 27 ++++++++++++++ docs/Modpacks/Examples/Removing-Ore-Piles.md | 23 ++++++++++++ .../Ore-Generation/01-Customizing-Veins.md | 3 +- 5 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 docs/Modpacks/Examples/Parallel-Hatch-Part.md create mode 100644 docs/Modpacks/Examples/Reducing-Duration.md create mode 100644 docs/Modpacks/Examples/Removing-Ore-Piles.md diff --git a/docs/Modpacks/Examples/Ore-Processing-Plant.md b/docs/Modpacks/Examples/Ore-Processing-Plant.md index c5f941d..2e83c04 100644 --- a/docs/Modpacks/Examples/Ore-Processing-Plant.md +++ b/docs/Modpacks/Examples/Ore-Processing-Plant.md @@ -8,7 +8,7 @@ title: "Ore Processing Plant" ## Recipe Type -```js title="alternator_recipe_type.js" +```js title="ore_processing_plant.js" GTCEuStartupEvents.registry('gtceu:recipe_type', event => { event.create('ore_processing_plant') .category('ore_processing_plant') @@ -21,7 +21,7 @@ GTCEuStartupEvents.registry('gtceu:recipe_type', event => { ## Multiblock -```js title="alternator_multiblock.js" +```js title="ore_processing_plant.js" GTCEuStartupEvents.registry('gtceu:machine', event => { event.create('ore_processing_plant', 'multiblock') .rotationState(RotationState.NON_Y_AXIS) @@ -48,6 +48,7 @@ GTCEuStartupEvents.registry('gtceu:machine', event => { .build()) .workableCasingRenderer("gtceu:block/casings/solid/machine_casing_robust_tungstensteel", "gtceu:block/multiblock/primitive_blast_furnace", false); + }) ``` diff --git a/docs/Modpacks/Examples/Parallel-Hatch-Part.md b/docs/Modpacks/Examples/Parallel-Hatch-Part.md new file mode 100644 index 0000000..c27987f --- /dev/null +++ b/docs/Modpacks/Examples/Parallel-Hatch-Part.md @@ -0,0 +1,36 @@ +--- +title: "Custom Parallel Hatch" +--- + + +# Custom Parallel Hatch Multi-Part (By Sparked) + +## Parallel Hatch + +```js title="extra_parallel_hatch.js" + +const $ParallelHatchPartMachine = Java.loadClass( + 'com.gregtechceu.gtceu.common.machine.multiblock.part.ParallelHatchPartMachine' +) // (1) + +GTCEuStartupEvents.registry('gtceu:machine', event => { // (2) + event.create( + "uhv_parallel_hatch", // (3) + "custom", + (holder, tier) => { + return new $ParallelHatchPartMachine(holder, tier); + }, + GTValues.UHV // (4) + ) + .abilities(PartAbility.PARALLEL_HATCH) // (5) + .workableTieredHullRenderer(GTCEu.id("block/machines/parallel_hatch_mk4")) // (6) +}) +``` + +1. Loading the java class that is required to build the parallel hatch multi part +2. Using the GT registry event to register the multi part, which is part of machine registry +3. The ID for the new parallel hatch +4. The tier used for the parallel hatch +5. Specifying the multipart to use parallel hatch ability +6. The texture to use for the multipart, this example just uses the t4 texture as a placeholder + You can look at gtm's assets to see the animations and textures to edit \ No newline at end of file diff --git a/docs/Modpacks/Examples/Reducing-Duration.md b/docs/Modpacks/Examples/Reducing-Duration.md new file mode 100644 index 0000000..37eaf83 --- /dev/null +++ b/docs/Modpacks/Examples/Reducing-Duration.md @@ -0,0 +1,27 @@ +--- +title: "Machines Duration Reduction" +--- + + +# Reducing Duration Of All Machine Recipes + +## Reducing Script + +```js title="Reduce_Duration.js" +ServerEvents.recipes(event => { + event.forEachRecipe({ mod: 'gtceu' }, recipe => { // (1) + try { // (2) + var newDuration = recipe.get("duration") // (3) + recipe.set("duration", newDuration/10) // (4) + } catch (err) { // (5) + console.log(recipe.id + " has no duration field, skipped.") + } + }) +}) +``` + +1. A function to run code for every recipe in gregtech. +2. Uses a try to avoid using recipes that don't have a duration, like crafting. +3. Gets a variable of the duration current duration to change. +4. Edits the recipes duration to a tenth of the old recipes duration. +5. Catches the error if the recipe has no duration and logs it. \ No newline at end of file diff --git a/docs/Modpacks/Examples/Removing-Ore-Piles.md b/docs/Modpacks/Examples/Removing-Ore-Piles.md new file mode 100644 index 0000000..c1658ba --- /dev/null +++ b/docs/Modpacks/Examples/Removing-Ore-Piles.md @@ -0,0 +1,23 @@ +--- +title: "Removing Surface Ore Indicators" +--- + + +# Removing Surface Ore Indicators + +## Removal Script + +```js title="remove_piles.js" +GTCEuServerEvents.oreVeins(event => { + event.modifyAll((veinId, vein) => { + vein.surfaceIndicatorGenerator(indicator => indicator + .block(Block.getBlock("minecraft:air")) // (1) + .placement("above") + .density(0.4) // Unsure if this matters + .radius(5) // Unsure if this matters + ) + }) +}) +``` + +1. Replacing where a ore pile would be with an air block, essentially removing it. \ No newline at end of file diff --git a/docs/Modpacks/Ore-Generation/01-Customizing-Veins.md b/docs/Modpacks/Ore-Generation/01-Customizing-Veins.md index 6fb1b96..a216bf6 100644 --- a/docs/Modpacks/Ore-Generation/01-Customizing-Veins.md +++ b/docs/Modpacks/Ore-Generation/01-Customizing-Veins.md @@ -68,8 +68,7 @@ GTCEuServerEvents.oreVeins(event => { max_inclusive: { absolute: 20 } - } - }) + }) ``` 11. See [Generators](./02-Generators.md#vein-generators) for a list of available generators. 12. See [Generators](./02-Generators.md#indicator-generators) for a list of available generators.