Skip to content

Commit

Permalink
Edits and new examples (#32)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Deepacat authored Jul 28, 2024
1 parent d44c185 commit 0c6173e
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 4 deletions.
5 changes: 3 additions & 2 deletions docs/Modpacks/Examples/Ore-Processing-Plant.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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)
Expand All @@ -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);
})
```


Expand Down
36 changes: 36 additions & 0 deletions docs/Modpacks/Examples/Parallel-Hatch-Part.md
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions docs/Modpacks/Examples/Reducing-Duration.md
Original file line number Diff line number Diff line change
@@ -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.
23 changes: 23 additions & 0 deletions docs/Modpacks/Examples/Removing-Ore-Piles.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 1 addition & 2 deletions docs/Modpacks/Ore-Generation/01-Customizing-Veins.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0c6173e

Please sign in to comment.