Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
9504b0c
spoilage lols (idk maybe works)
TarLaboratories Sep 6, 2025
ec7e1af
yay it works
TarLaboratories Sep 7, 2025
7c0c129
tooltip and bar
TarLaboratories Sep 7, 2025
d0d8903
bar color and different spoilage timer stacking
TarLaboratories Sep 7, 2025
8b1a927
made mv sodium battery not spoil into dirt lols
TarLaboratories Sep 7, 2025
134112c
Merge branch '1.20.1' into tar/spoilage
TarLaboratories Sep 7, 2025
5971ae6
idk
TarLaboratories Sep 7, 2025
98e51a1
im so dumb i wrote the wrong thing in the isSameItemSameTags function…
TarLaboratories Sep 7, 2025
40dc1e2
formatting
TarLaboratories Sep 7, 2025
7b3b983
additional check before averaging
TarLaboratories Sep 7, 2025
a6f8257
keep spoiling progress between recipe inputs and outputs
TarLaboratories Sep 7, 2025
004a07c
added an option to make a recipe output a fully fresh product regardl…
TarLaboratories Sep 7, 2025
ad443b0
fixes
TarLaboratories Sep 7, 2025
408cb2b
oops left mv battery spoilable
TarLaboratories Sep 7, 2025
14a282f
april fools :)
TarLaboratories Sep 7, 2025
328fe42
Merge branch '1.20.1' into tar/spoilage
TarLaboratories Sep 8, 2025
0eb0a6c
made SpoilableBehaviour more flexible
TarLaboratories Sep 8, 2025
acad6e6
added the ability to attach SpoilableBehaviour to any item
TarLaboratories Sep 8, 2025
0729962
trollololol
TarLaboratories Sep 8, 2025
522aac6
oops forgot to disable trollololol
TarLaboratories Sep 8, 2025
c386643
more functionality for pack devs ig :)
TarLaboratories Sep 9, 2025
613e25b
pass item into DEFAULT_SPOIL_BEHAVIOR function
TarLaboratories Sep 9, 2025
d5fe816
added API to allow things like spoilage to be made with addons
TarLaboratories Sep 9, 2025
2079298
added event when registering a machine
TarLaboratories Sep 9, 2025
da8354f
made spoilage transfer use the newly created API
TarLaboratories Sep 9, 2025
e46f6ae
oops
TarLaboratories Sep 9, 2025
fc1ded7
update item when it's dropped
TarLaboratories Sep 9, 2025
8ce3db2
update when crafted
TarLaboratories Sep 9, 2025
dcca631
corrected handling of recursive spoiling
TarLaboratories Sep 9, 2025
35b553f
but what if dirt spoils into dirt
TarLaboratories Sep 9, 2025
584afb2
fixes and TESTS
TarLaboratories Sep 9, 2025
8689cda
even more tests
TarLaboratories Sep 9, 2025
b70546c
Merge branch '1.20.1' into tar/spoilage
TarLaboratories Sep 9, 2025
2eb1331
moved unsafe cast from NotifiableItemStackHandler to ISpoilableItem
TarLaboratories Sep 9, 2025
6e8c071
filtering test
TarLaboratories Sep 11, 2025
ffa3c85
another test (also made items not spoil in phantom slots)
TarLaboratories Sep 11, 2025
380afc1
Merge branch '1.20.1' into tar/spoilage
TarLaboratories Sep 12, 2025
ef7b6a3
formatting
TarLaboratories Sep 12, 2025
aed4046
made filtering work correctly when comparing by nbt
TarLaboratories Sep 12, 2025
1dff6f2
moved getSpoilable to ISpoilableItem
TarLaboratories Sep 12, 2025
a8b95bf
technically gotta call onAttached when attaching
TarLaboratories Sep 12, 2025
980e9a2
docs
TarLaboratories Sep 12, 2025
b3329cc
more docs
TarLaboratories Sep 13, 2025
64117bb
even more docs
TarLaboratories Sep 13, 2025
e768a8b
docs fixes
TarLaboratories Sep 13, 2025
952db7a
Merge branch '1.20.1' into tar/spoilage
TarLaboratories Sep 13, 2025
b66c5dc
indentation fixes
TarLaboratories Sep 13, 2025
41eede9
Merge remote-tracking branch 'origin/tar/spoilage' into tar/spoilage
TarLaboratories Sep 13, 2025
4a9b23f
docs improvements
TarLaboratories Sep 13, 2025
8c5b2f7
make event work (i think)
TarLaboratories Oct 3, 2025
2bca07b
Merge branch '1.20.1' into tar/spoilage
TarLaboratories Oct 3, 2025
b1528d7
oops
TarLaboratories Oct 3, 2025
ed73f74
Merge remote-tracking branch 'origin/tar/spoilage' into tar/spoilage
TarLaboratories Oct 3, 2025
146c44b
revert
TarLaboratories Oct 3, 2025
591c3cd
fix event listener and rename some things
TarLaboratories Oct 23, 2025
3f2d79a
yay event works
TarLaboratories Oct 24, 2025
7f63650
generalized itemOutputModifier to allow all types of outputs
TarLaboratories Oct 24, 2025
93970c9
added @NonExtendable
TarLaboratories Oct 24, 2025
3756999
suggested change
TarLaboratories Oct 24, 2025
8a3af97
remove unused shadow
TarLaboratories Oct 24, 2025
1b5537d
spoilage is a capability now (need to update docs later)
TarLaboratories Oct 26, 2025
b45a610
addGenericListener
TarLaboratories Oct 26, 2025
3d82800
remove direct mixin call from ISpoilableItem
TarLaboratories Oct 26, 2025
4520b6d
move some methods to SpoilableItemStack
TarLaboratories Oct 27, 2025
c589cc0
reinit capabilities when setting item
TarLaboratories Oct 27, 2025
4419ebf
spotless
TarLaboratories Oct 27, 2025
a1d5c3a
fix warnings in mixin
TarLaboratories Oct 27, 2025
2c8b23c
modify javadoc in ISpoilableItem to talk about it being a capability
TarLaboratories Oct 27, 2025
1c2330e
update docs to show correct examples with capabilities
TarLaboratories Oct 27, 2025
3c680c1
replace whatever that was with MinecraftForge.EVENT_BUS
TarLaboratories Oct 27, 2025
80eb37e
spotless
TarLaboratories Oct 27, 2025
6511937
replace deprecated method
TarLaboratories Oct 27, 2025
a5e52ee
fix
TarLaboratories Oct 27, 2025
87edfe2
rename event
TarLaboratories Oct 28, 2025
0874922
apply suggestions
TarLaboratories Nov 17, 2025
bca2eb6
remove unsafe cast and rename ISpoilableItemStackMixin
TarLaboratories Nov 17, 2025
fb372b6
start names of mixin methods with gtceu$
TarLaboratories Nov 17, 2025
3ed8432
move suppressWarnings
TarLaboratories Nov 17, 2025
a08edb5
readd unsafe cast cause doesn't compile
TarLaboratories Nov 17, 2025
22520ba
revert interfaces.json change
TarLaboratories Nov 17, 2025
9d5fda4
Merge branch '1.20.1' into tar/spoilage
TarLaboratories Nov 17, 2025
1789629
Replace ldlib sync data system with new data sync system (#3491)
gustovafing Dec 23, 2025
1838e5d
Fix sync lists being immutable (#4371)
gustovafing Dec 25, 2025
85351e8
spoiling into entities
TarLaboratories Dec 28, 2025
4fdeabd
this is probably compatible with most blocks
TarLaboratories Dec 29, 2025
4f0bb95
docs
TarLaboratories Dec 29, 2025
4dd7b51
more docs
TarLaboratories Dec 30, 2025
32aadd6
more tests
TarLaboratories Dec 30, 2025
591b30c
Merge branch '1.20.1-v8.0.0' into tar/spoilage
TarLaboratories Dec 30, 2025
69d0c90
revert random capes change
TarLaboratories Dec 30, 2025
9d29eab
docs and stuff
TarLaboratories Dec 30, 2025
7a18e5b
i love javadocs
TarLaboratories Dec 31, 2025
d8f673e
formatting
TarLaboratories Dec 31, 2025
3093483
move most logic from mixin to capability
TarLaboratories Dec 31, 2025
245e5d8
more tests
TarLaboratories Jan 1, 2026
839f7d8
even more tests
TarLaboratories Jan 1, 2026
66642a7
make filtering test not ignore nbt
TarLaboratories Jan 2, 2026
907092c
Merge branch '1.20.1-v8.0.0' into tar/spoilage
TarLaboratories Jan 6, 2026
48fd9e6
fix filtering test
TarLaboratories Jan 6, 2026
a00c4b8
make docs more clear
TarLaboratories Jan 6, 2026
00df74e
add method to multiblock builder too
TarLaboratories Jan 6, 2026
0c2460c
changed around SpoilContext so that it is serializable
TarLaboratories Jan 6, 2026
6f7a2f5
machine modification event docs (literally just 10 lines)
TarLaboratories Jan 6, 2026
57bb7de
smol fix
TarLaboratories Jan 6, 2026
24eb54b
cleaned up the mixin a bit
TarLaboratories Jan 7, 2026
87c39bf
no more injecting into getItem :)
TarLaboratories Jan 7, 2026
9582b98
cleanup
TarLaboratories Jan 7, 2026
52842c7
Revert "cleanup"
TarLaboratories Jan 7, 2026
d5c0ba3
Revert "no more injecting into getItem :)"
TarLaboratories Jan 7, 2026
a822798
serialize consumedInputs
TarLaboratories Jan 7, 2026
708ff90
early return in modifier
TarLaboratories Jan 7, 2026
0b3491a
Merge branch '1.20.1-v8.0.0' into tar/spoilage
TarLaboratories Jan 8, 2026
53546f0
spotless and fixes
TarLaboratories Jan 8, 2026
753ddb8
fix test
TarLaboratories Jan 8, 2026
fc6c329
finally get rid of mixin into isSameItemSameTags :)
TarLaboratories Jan 9, 2026
15ebf16
Merge remote-tracking branch 'origin/1.20.1-v8.0.0' into tar/spoilage
TarLaboratories Jan 9, 2026
a3ab5af
tweak docs a bit
TarLaboratories Jan 9, 2026
c42406a
remap = false
TarLaboratories Jan 9, 2026
a66163c
remove filtering test and spotless
TarLaboratories Jan 9, 2026
a6b0f99
Merge branch '1.20.1-v8.0.0' into tar/spoilage
TarLaboratories Feb 2, 2026
f53f994
fix stuff after merge
TarLaboratories Feb 2, 2026
87a3027
fix test
TarLaboratories Feb 11, 2026
d11727c
Merge branch '1.20.1-v8.0.0' into tar/spoilage
TarLaboratories Feb 11, 2026
421979e
Merge branch '1.20.1' into tar/spoilage
TarLaboratories Feb 17, 2026
2fcbf3b
idk
TarLaboratories Feb 18, 2026
83f8bd7
Merge remote-tracking branch 'origin/tar/spoilage' into tar/spoilage
TarLaboratories Feb 18, 2026
fe29b92
revert merge
TarLaboratories Feb 18, 2026
750a9c6
Revert "revert merge"
TarLaboratories Feb 19, 2026
747de50
Revert "Merge remote-tracking branch 'origin/tar/spoilage' into tar/s…
TarLaboratories Feb 19, 2026
d191497
Reapply "Merge remote-tracking branch 'origin/tar/spoilage' into tar/…
TarLaboratories Feb 19, 2026
4ab7ef6
fix stuff
TarLaboratories Feb 19, 2026
841919c
spotless
TarLaboratories Feb 19, 2026
dac6a5b
Merge branch '1.20.1' into tar/spoilage
TarLaboratories Feb 23, 2026
e234cd2
fixes after merge
TarLaboratories Feb 23, 2026
d359fe9
spotless
TarLaboratories Feb 23, 2026
1a09825
refactor spoilage to use capability nbt
TarLaboratories Feb 25, 2026
46312ad
move SpoilableBehaviour to common/item/behaviour
TarLaboratories Feb 26, 2026
c845d3e
add a bit of javadocs
TarLaboratories Feb 26, 2026
e8097de
make a singular way to make an item spoilable
TarLaboratories Feb 26, 2026
4e1eb50
update docs to reflect that
TarLaboratories Feb 26, 2026
c2f5f1b
remove unnecessary annotation
TarLaboratories Feb 26, 2026
5ecb776
Merge branch '1.20.1' into tar/spoilage
TarLaboratories Mar 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/content/Modpacks/Other-Topics/Machine-Modification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Machine Modification
---

# Machine Modification
If you want to modify an existing machine's definition, you can do so using the
`GTCEuStartupEvents.machineModification` event. It is fired right before a machine gets registered, so that
its builder is still accessible through the `event.getBuilder()` method. For examples of methods that machine builders
have, see [Custom Machines](Custom-Machines.md).
For a full list of methods, see [source](https://github.com/GregTechCEu/GregTech-Modern/blob/1.20.1/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java).
158 changes: 158 additions & 0 deletions docs/content/Modpacks/Other-Topics/Spoilage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
title: Spoilage
---

**Spoilage** is a mechanic that allows items to *spoil*.<br>
Spoilable items spoil based on the amount of ticks that passed from their creation,
or, more specifically, from one of these events (due to Minecraft's limitations):

- The item was in an `IItemHandler` that is a capability of a `BlockEntity` that had `Level#getBlockEntity` called
- The item was crafted in a GregTech recipe
- The item was crafted in a crafting table
- The item was in a player's inventory for at least 1 tick
- The item was dropped
- `SpoilUtils.update(ItemStack, SpoilContext)` was called

If you want to make an item spoil, you need to attack the `ISpoilableItem` capability to it.
Please note that the spoilage timer still decrements even if the stack is in an unloaded chunk.

### SpoilContext
A `SpoilContext` is an object that represents the environment in which an item spoils.
It may represent:

- Nothing (all values are null, obtained by just calling the constructor without arguments)
- A block (contains `Level` and `BlockPos`)
- A block and an item handler (contains `Level`, `BlockPos`, `IItemHandler` and the number of the slot in that `IItemHandler`, that may be `-1`)
- An entity, usually a player (contains `Entity` and the number of the slot in that entity's inventory, that may be `-1`)

This info is used to spawn entities when the item spoils, or do something more complex.
The `SpoilableBehavior.builder()` can accept a function as a `result`, so you can do whatever you want there :)

### SpoilableBehavior
`SpoilableBehavior` is a helper class used to make items spoilable.

`SpoilableBehavior.builder()` is a convenient way to create a `SpoilableBehavior`, currently it has the following methods:

- `.ticks(long)`
used to specify ticks until spoiled
- `.ticks(Function<ItemStack, Long>)`
used to specify a ticks until spoiled value that may depend on the stack itself, for example having more items in the stack may make it spoil slower
- `.result(ItemLike)`
used to specify the resulting item
- `.result(ItemStack)`
used to specify the resulting stack (may be with NBT, but not count)
- `.result(Function<ItemStack, ItemStack>)`
used to specify the resulting stack that may depend on the original stack
- `.result(EntityType<? extends Mob>)`
used to specify the mob into which the item will spoil (it can still spoil into an item as well, but the item has to be specified first)
- `.result(Supplier<? extends EntityType<? extends Mob>>`
same as `.result(EntityType<? extends Mob>)`, exists for convenience
- `.result(SpoilResultProvider)`
used to specify a result function ((`ItemStack`, `SpoilContext`, `simulate`) -> `ItemStack`) for custom spoiling logic
- `.multiplyResult(int)`
multiply all previously specified results (spoil into multiple items, spawn multiple mobs, etc.)
- `.tooltip(Component)`
used to specify things to show in `Spoils into: ...` in the tooltip
- `.tooltip(Function<ItemStack, Component>)`
same as `.tooltip(Component)`, but can depend on the stack

To attach a `SpoilableBehavior` to an item, you can use the `attachTo(ItemLike)` method.
It can be chained if you want to make multiple items spoil using the same behavior.

### SpoilUtils
`SpoilUtils` is a utility class with some static methods for updating items and blocks:

- `update`
makes an item start spoiling with the specified `SpoilContext`
- `updateBlock`
updates all items in any found `IItemHandler` capabilities of the specified block,
the `SpoilContext` is generated automatically

!!! example
```java
public class Example {

// Make diamonds spoil into dirt and a dragon in 100 seconds, apples into jigsaws in 35 seconds
public static void attachSpoilables() {
SpoilageBehaviour.builder()
.ticks(20*100)
.result(Items.DIRT)
.result(EntityType.ENDER_DRAGON)
.build().attachTo(Items.DIAMOND);
SpoilableBehaviour.builder()
.ticks(20*35)
.result(Items.JIGSAW)
.build().attachTo(Items.APPLE);
}

public void getAndSetValuesAndStuff(ItemStack stack) {
ISpoilableItem spoilable = GTCapabilityHelper.getSpoilable(stack);
// If spoilable is null, it means the stack cannot spoil
if (spoilable != null) {
// Get amount of ticks until a completely fresh stack spoils
long totalTicks = spoilable.getSpoilTicks(stack);
// Get amount of ticks until this stack spoils (may be more than the previous value in some cases)
long ticksRemaining = spoilable.getTicksUntilSpoiled(stack);
// Get the stack this stack spoils into
ItemStack spoilResult = spoilable.spoilResult(stack);
// Get whether this stack should START spoiling
boolean shouldStartSpoiling = spoilable.shouldSpoil(stack);
// Get the amount of ticks until this stack spoils (may be more than spoilable.getSpoilTicks(stack))
spoilable.setTicksUntilSpoiled(stack, 12345);
// Freeze the spoiling progress of this stack
spoilable.freezeSpoiling(stack);
// Unfreeze the spoiling progress of this stack
spoilable.unfreezeSpoiling(stack);
}
}

public void makeStackStartSpoiling(ItemStack stack, Level level, BlockPos pos) {
// If for some reason the stack still hasn't started spoiling, you can start the spoiling progress using this
// That may happen if it is the result of a non-GT recipe and not a crafting result for example
SpoilUtils.update(stack, new SpoilContext(level, pos));
}

public void disableFrozenAndNonFrozenEquality() {
// If you want the player to have frozen stacks in their inventory, do this
// A side effect of this is that filtering by ticks remaining until spoiled will no longer work
SpoilUtils.FROZEN_EQUALITY = false;
}
}
```

!!! warning "Items may spoil in other mods' filters (even if they are phantom slots)."

### Frozen stacks

To freeze a stack's spoiling progress, you can use `spoilable.freezeSpoiling(stack)`, and `spoilable.unfreezeSpoiling(stack)`
to unfreeze. A frozen stack's freshness will never be changed unless `spoilable.setTicksUntilSpoiled(stack, value)` is called.
Currently, a stack is frozen only if it is in a phantom slot (in a GregTech filter).
!!! warning "`ItemHandlerHelper.canItemStacksStack` behaviour is completely different for spoilables"

`ItemHandlerHelper.canItemStacksStack` returns `true` if:

- Both items are not frozen and:
- They are the same item
- They have the same NBT
- **Their ticks until spoiling are averaged before the equality check**
- One of the items is frozen and:
- They are the same item
- They have the same non-spoilage-related NBT
- **One of them MAY be not frozen, and they will still be equal if `ISpoilableItem.FROZEN_EQUALITY` is `true`**
- **Their ticks until spoiling are NOT modified in any way in this method**

!!! info "The following only applies if `ISpoilableItem.FROZEN_EQUALITY` is `true`:"
That means that frozen and non-frozen spoilables may stack, this is done mostly to make filtering by remaining ticks possible.
**Please prevent the player from having direct access to frozen stacks, as they could use them to bypass the spoiling system entirely.**

### Spoilables in recipes

If a GT recipe that does not have spoilable ingredients outputs a spoilable, it is outputted at full freshness.
If a GT recipe that has spoilable ingredients outputs a spoilable, it outputs it at the freshness level equal to the average
freshness of the ingredients. This can be overridden by setting `keepSpoilingProgress` (a parameter of the GTRecipe) to `false`.
<br><br>
Results of crafts in a crafting table are always outputted fully fresh.

!!! note

Items will spoil in machine inputs, and there's no way to automatically remove items from inputs.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ to distinguish them from other recipes in the same machine with similar ingredie
running or all at once at recipe start/end. Set to true with `.perTick(true)` to make the recipe builder consider
any following input/output calls as per-tick. Remember to set the value to false with `.perTick(false)` after the
calls you intend to be per-tick, to prevent behaviour you don't want!

- `.keepSpoilingProgress()`:
If set to true, spoilable outputs' freshness will depend on the recipe's inputs' freshness (default).<br>
If set to false, spoilable outputs of this recipe will always be crafted completely fresh.

### The Research System

Expand Down
10 changes: 10 additions & 0 deletions src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,7 @@
"config.gtceu.option.allowDrumsInputFluidsFromOutputSide": "ǝpıSʇndʇnOɯoɹℲspınןℲʇnduIsɯnɹᗡʍoןןɐ",
"config.gtceu.option.allowedImageDomains": "suıɐɯoᗡǝbɐɯIpǝʍoןןɐ",
"config.gtceu.option.animationTime": "ǝɯı⟘uoıʇɐɯıuɐ",
"config.gtceu.option.aprilFoolsMode": "ǝpoWsןooℲןıɹdɐ",
"config.gtceu.option.arcRecyclingYield": "pןǝıʎbuıןɔʎɔǝᴚɔɹɐ",
"config.gtceu.option.armorHud": "pnHɹoɯɹɐ",
"config.gtceu.option.batchDuration": "uoıʇɐɹnᗡɥɔʇɐq",
Expand Down Expand Up @@ -3863,13 +3864,22 @@
"gtceu.tool_action.wrench.set_facing": "buıɔɐℲ ʇǝs oʇ ɥɔuǝɹM ǝs∩8§",
"gtceu.tooltip.computer_monitor_config": "ɐʇɐp uoıʇɐɹnbıɟuoɔ ɹǝʌoɔ ɹoʇıuoɯ ɹǝʇndɯoɔ buıɹoʇS",
"gtceu.tooltip.computer_monitor_data": "%s :ɐʇɐp buıɹoʇS",
"gtceu.tooltip.creation_tick": "%d ʞɔıʇ pןɹoʍɹǝʌo uo pǝʇɐǝɹƆ",
"gtceu.tooltip.fluid_pipe_hold_shift": "oɟuI ʇuǝɯuıɐʇuoƆ pınןℲ ʍoɥs oʇ ⟘ℲIHS pןoHㄥ§",
"gtceu.tooltip.hold_ctrl": "oɟuı ǝɹoɯ ɹoɟ Ꞁᴚ⟘Ɔ pןoHㄥ§",
"gtceu.tooltip.hold_shift": "oɟuı ǝɹoɯ ɹoɟ ⟘ℲIHS pןoHㄥ§",
"gtceu.tooltip.item_handler_data": "%s :ɐʇɐp ɹǝןpuɐH",
"gtceu.tooltip.item_handler_source": "%s :ǝɔɹnos ɹǝןpuɐH",
"gtceu.tooltip.location": ")%d '%d '%d( %s :uoıʇɐɔoꞀ",
"gtceu.tooltip.location_entity": "%s :ʎʇıʇuƎ",
"gtceu.tooltip.location_slot": "%s :ʇoןS",
"gtceu.tooltip.player_bind": "%s :ɹǝʎɐןd oʇ punoᗺ",
"gtceu.tooltip.potion.each": "ɹ§buıuǝddɐɥ ɟo ǝɔuɐɥɔㄥ§ %s%% ɹ§ɐ ɥʇıʍ sʞɔıʇㄥ§ %s ɹ§ɹoɟㄥ§ %s %s",
"gtceu.tooltip.potion.header": ":sʇɔǝɟɟǝ suıɐʇuoƆ9§",
"gtceu.tooltip.proxy_bind": "%s %s %s ʇɐ ɹǝɟɟnᗺ uɹǝʇʇɐԀ ɐ oʇ buıpuıᗺɟ§",
"gtceu.tooltip.spoil_time_remaining": "%s :sןıods ןıʇun ǝɯı⟘",
"gtceu.tooltip.spoil_time_total": "%s :ǝɯıʇ ןıods ןɐʇo⟘",
"gtceu.tooltip.spoils_into": "%s :oʇuı sןıodS",
"gtceu.tooltip.status.trinary.false": "ǝsןɐℲ",
"gtceu.tooltip.status.trinary.true": "ǝnɹ⟘",
"gtceu.tooltip.status.trinary.unknown": "uʍouʞu∩",
Expand Down
10 changes: 10 additions & 0 deletions src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,7 @@
"config.gtceu.option.allowDrumsInputFluidsFromOutputSide": "allowDrumsInputFluidsFromOutputSide",
"config.gtceu.option.allowedImageDomains": "allowedImageDomains",
"config.gtceu.option.animationTime": "animationTime",
"config.gtceu.option.aprilFoolsMode": "aprilFoolsMode",
"config.gtceu.option.arcRecyclingYield": "arcRecyclingYield",
"config.gtceu.option.armorHud": "armorHud",
"config.gtceu.option.batchDuration": "batchDuration",
Expand Down Expand Up @@ -3863,13 +3864,22 @@
"gtceu.tool_action.wrench.set_facing": "§8Use Wrench to set Facing",
"gtceu.tooltip.computer_monitor_config": "Storing computer monitor cover configuration data",
"gtceu.tooltip.computer_monitor_data": "Storing data: %s",
"gtceu.tooltip.creation_tick": "Created on overworld tick %d",
"gtceu.tooltip.fluid_pipe_hold_shift": "§7Hold SHIFT to show Fluid Containment Info",
"gtceu.tooltip.hold_ctrl": "§7Hold CTRL for more info",
"gtceu.tooltip.hold_shift": "§7Hold SHIFT for more info",
"gtceu.tooltip.item_handler_data": "Handler data: %s",
"gtceu.tooltip.item_handler_source": "Handler source: %s",
"gtceu.tooltip.location": "Location: %s (%d, %d, %d)",
"gtceu.tooltip.location_entity": "Entity: %s",
"gtceu.tooltip.location_slot": "Slot: %s",
"gtceu.tooltip.player_bind": "Bound to player: %s",
"gtceu.tooltip.potion.each": "%s %s §7for§r %s §7ticks with a§r %s%% §7chance of happening§r",
"gtceu.tooltip.potion.header": "§6Contains effects:",
"gtceu.tooltip.proxy_bind": "§fBinding to a Pattern Buffer at %s %s %s",
"gtceu.tooltip.spoil_time_remaining": "Time until spoils: %s",
"gtceu.tooltip.spoil_time_total": "Total spoil time: %s",
"gtceu.tooltip.spoils_into": "Spoils into: %s",
"gtceu.tooltip.status.trinary.false": "False",
"gtceu.tooltip.status.trinary.true": "True",
"gtceu.tooltip.status.trinary.unknown": "Unknown",
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/gregtechceu/gtceu/api/GTValues.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.gregtechceu.gtceu.api;

import com.gregtechceu.gtceu.config.ConfigHolder;

import net.minecraft.util.RandomSource;

import java.time.LocalDate;
Expand Down Expand Up @@ -272,6 +274,7 @@ public static int[] tiersBetween(int minInclusive, int maxInclusive) {
0x7EC3C4, 0x7EB07E, 0xBF74C0, 0x0B5CFE, 0x914E91, 0x488748, 0x8C0000, 0x2828F5 };

// Main colour for each tier
@SuppressWarnings("DataFlowIssue")
public static final int[] VCM = new int[] {
DARK_GRAY.getColor(),
GRAY.getColor(),
Expand Down Expand Up @@ -308,6 +311,7 @@ public static int[] tiersBetween(int minInclusive, int maxInclusive) {
public static boolean HT = false;

public static BooleanSupplier FOOLS = () -> {
if (ConfigHolder.INSTANCE != null && ConfigHolder.INSTANCE.client.aprilFoolsMode) return true;
var now = LocalDate.now();
return now.getMonth() == Month.APRIL && now.getDayOfMonth() == 1;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.api.capability;

import com.gregtechceu.gtceu.api.item.component.ISpoilableItem;
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMaintenanceMachine;

import net.minecraftforge.common.capabilities.Capability;
Expand Down Expand Up @@ -32,6 +33,8 @@ public class GTCapability {
.get(new CapabilityToken<>() {});
public static final Capability<IMonitorComponent> CAPABILITY_MONITOR_COMPONENT = CapabilityManager
.get(new CapabilityToken<>() {});
public static final Capability<ISpoilableItem> CAPABILITY_SPOILABLE_ITEM = CapabilityManager
.get(new CapabilityToken<>() {});

public static final Capability<IMedicalConditionTracker> CAPABILITY_MEDICAL_CONDITION_TRACKER = CapabilityManager
.get(new CapabilityToken<>() {});
Expand All @@ -51,5 +54,6 @@ public static void register(RegisterCapabilitiesEvent event) {
event.register(IMedicalConditionTracker.class);
event.register(IHazardParticleContainer.class);
event.register(IMonitorComponent.class);
event.register(ISpoilableItem.class);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.api.capability;

import com.gregtechceu.gtceu.api.item.component.ISpoilableItem;
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMaintenanceMachine;

import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -126,4 +127,9 @@ private static <T> T getBlockEntityCapability(Capability<T> capability, Level le
public static IMedicalConditionTracker getMedicalConditionTracker(@NotNull Entity entity) {
return entity.getCapability(GTCapability.CAPABILITY_MEDICAL_CONDITION_TRACKER, null).resolve().orElse(null);
}

@Nullable
public static ISpoilableItem getSpoilable(ItemStack stack) {
return stack.getCapability(GTCapability.CAPABILITY_SPOILABLE_ITEM).resolve().orElse(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public abstract class RecipeCapability<T> {
public static final Codec<Map<RecipeCapability<?>, List<Content>>> CODEC = new DispatchedMapCodec<>(
RecipeCapability.DIRECT_CODEC,
RecipeCapability::contentCodec);
public static final Codec<Map<RecipeCapability<?>, List<?>>> INGREDIENT_CODEC = new DispatchedMapCodec<>(
RecipeCapability.DIRECT_CODEC,
RecipeCapability::ingredientCodec);
public static final Comparator<RecipeCapability<?>> COMPARATOR = Comparator.comparingInt(o -> o.sortIndex);

public final String name;
Expand All @@ -59,6 +62,10 @@ public static Codec<List<Content>> contentCodec(RecipeCapability<?> capability)
return Content.codec(capability).listOf();
}

public static <T> Codec<List<T>> ingredientCodec(RecipeCapability<T> capability) {
return Content.ingredientCodec(capability).listOf();
}

public Tag contentToNbt(Object value) {
return this.serializer.toNbt(this.of(value));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public FilterHandler(ISyncManaged container) {
this.container = container;
}

protected abstract F loadFilter(ItemStack filterItem);
public abstract F loadFilter(ItemStack filterItem);

protected abstract F getEmptyFilter();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static FilterHandler<ItemStack, ItemFilter> item(ISyncManaged container) {
return new FilterHandler<>(container) {

@Override
protected ItemFilter loadFilter(ItemStack filterItem) {
public ItemFilter loadFilter(ItemStack filterItem) {
return ItemFilter.loadFilter(filterItem);
}

Expand All @@ -31,7 +31,7 @@ static FilterHandler<FluidStack, FluidFilter> fluid(ISyncManaged container) {
return new FilterHandler<>(container) {

@Override
protected FluidFilter loadFilter(ItemStack filterItem) {
public FluidFilter loadFilter(ItemStack filterItem) {
return FluidFilter.loadFilter(filterItem);
}

Expand Down
Loading