diff --git a/.github/actions/build_setup/action.yml b/.github/actions/build_setup/action.yml index 00d312ece4..40e38cd7df 100644 --- a/.github/actions/build_setup/action.yml +++ b/.github/actions/build_setup/action.yml @@ -31,7 +31,6 @@ runs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 with: - gradle-home-cache-cleanup: true cache-write-only: ${{ inputs.update-cache }} generate-job-summary: false gradle-home-cache-includes: | diff --git a/settings.gradle b/settings.gradle index bb51069f6e..f708b7a5ba 100644 --- a/settings.gradle +++ b/settings.gradle @@ -54,7 +54,7 @@ dependencyResolutionManagement { def vineFlowerVersion = "1.+" def macheteVersion = "1.+" def configurationVersion = "2.2.0" - def ldLibVersion = "1.0.27.b" + def ldLibVersion = "1.0.28.a" def mixinextrasVersion = "0.2.0" def shimmerVersion = "0.2.4" def lombokPluginVersion = "8.7.1" diff --git a/src/generated/resources/assets/gtceu/lang/en_ud.json b/src/generated/resources/assets/gtceu/lang/en_ud.json index add14c8f1b..f0ccff0fc4 100644 --- a/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -2586,6 +2586,8 @@ "enchantment.gtceu.disjunction.desc": "˙sqoɯ pǝʇɐןǝɹ-ɹǝpuƎ oʇ ssǝuʍoןS puɐ ssǝuʞɐǝM sǝıןddⱯ", "enchantment.gtceu.hard_hammer.desc": "˙ɹǝɯɯɐH ɥɔǝ⟘bǝɹ⅁ ɐ ɥʇıʍ pǝuıɯ ǝɹǝʍ ʎǝɥʇ ɟı sɐ sʞɔoןq sʞɐǝɹᗺ", "enchantment.hard_hammer": "buıɹǝɯɯɐH", + "entity.gtceu.boat": "ʇɐoᗺ", + "entity.gtceu.chest_boat": "ʇɐoᗺ ʇsǝɥƆ", "entity.gtceu.dynamite": "ǝʇıɯɐuʎᗡ", "entity.gtceu.industrial_tnt": "⟘N⟘ ןɐıɹʇsnpuI", "entity.gtceu.powderbarrel": "ןǝɹɹɐqɹǝpʍoԀ", @@ -4716,6 +4718,8 @@ "item.gtceu.rotor_casting_mold.tooltip": "sɹoʇoᴚ buıʞɐɯ ɹoɟ pןoWㄥ§", "item.gtceu.rotor_extruder_mold": ")ɹoʇoᴚ( pןoW ɹǝpnɹʇxƎ", "item.gtceu.rotor_extruder_mold.tooltip": "sɹoʇoᴚ buıʞɐɯ ɹoɟ ǝdɐɥS ɹǝpnɹʇxƎㄥ§", + "item.gtceu.rubber_boat": "ʇɐoᗺ ɹǝqqnᴚ", + "item.gtceu.rubber_chest_boat": "ʇsǝɥƆ ɥʇıʍ ʇɐoᗺ ɹǝqqnᴚ", "item.gtceu.rubber_gloves": "sǝʌoן⅁ ɹǝqqnᴚ", "item.gtceu.salt_dust": "ʇןɐS", "item.gtceu.saw_extruder_mold.tooltip": "sʍɐS buıʞɐɯ ɹoɟ ǝdɐɥS ɹǝpnɹʇxƎㄥ§", @@ -4928,7 +4932,9 @@ "item.gtceu.tool.wrench.tooltip": "sǝuıɥɔɐW ǝןʇuɐɯsıp oʇ ʞɔıןɔ ʇɟǝן pןoH8§", "item.gtceu.transistor": "ɹoʇsısuɐɹ⟘", "item.gtceu.transistor.tooltip": "ʇuǝuodɯoƆ ɔıuoɹʇɔǝןƎ ɔısɐᗺㄥ§", + "item.gtceu.treated_wood_boat": "ʇɐoᗺ pooM pǝʇɐǝɹ⟘", "item.gtceu.treated_wood_bolt": "ʞɔıʇS pooM pǝʇɐǝɹ⟘ ʇɹoɥS", + "item.gtceu.treated_wood_chest_boat": "ʇsǝɥƆ ɥʇıʍ ʇɐoᗺ pooM pǝʇɐǝɹ⟘", "item.gtceu.treated_wood_dust": "dןnԀ pooM pǝʇɐǝɹ⟘", "item.gtceu.treated_wood_plate": "ʞuɐןԀ pooM pǝʇɐǝɹ⟘", "item.gtceu.treated_wood_rod": "ʞɔıʇS pooM pǝʇɐǝɹ⟘", diff --git a/src/generated/resources/assets/gtceu/lang/en_us.json b/src/generated/resources/assets/gtceu/lang/en_us.json index 7c1eb46ed9..08b1471817 100644 --- a/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/src/generated/resources/assets/gtceu/lang/en_us.json @@ -2586,6 +2586,8 @@ "enchantment.gtceu.disjunction.desc": "Applies Weakness and Slowness to Ender-related mobs.", "enchantment.gtceu.hard_hammer.desc": "Breaks blocks as if they were mined with a GregTech Hammer.", "enchantment.hard_hammer": "Hammering", + "entity.gtceu.boat": "Boat", + "entity.gtceu.chest_boat": "Chest Boat", "entity.gtceu.dynamite": "Dynamite", "entity.gtceu.industrial_tnt": "Industrial TNT", "entity.gtceu.powderbarrel": "Powderbarrel", @@ -4716,6 +4718,8 @@ "item.gtceu.rotor_casting_mold.tooltip": "§7Mold for making Rotors", "item.gtceu.rotor_extruder_mold": "Extruder Mold (Rotor)", "item.gtceu.rotor_extruder_mold.tooltip": "§7Extruder Shape for making Rotors", + "item.gtceu.rubber_boat": "Rubber Boat", + "item.gtceu.rubber_chest_boat": "Rubber Boat with Chest", "item.gtceu.rubber_gloves": "Rubber Gloves", "item.gtceu.salt_dust": "Salt", "item.gtceu.saw_extruder_mold.tooltip": "§7Extruder Shape for making Saws", @@ -4928,7 +4932,9 @@ "item.gtceu.tool.wrench.tooltip": "§8Hold left click to dismantle Machines", "item.gtceu.transistor": "Transistor", "item.gtceu.transistor.tooltip": "§7Basic Electronic Component", + "item.gtceu.treated_wood_boat": "Treated Wood Boat", "item.gtceu.treated_wood_bolt": "Short Treated Wood Stick", + "item.gtceu.treated_wood_chest_boat": "Treated Wood Boat with Chest", "item.gtceu.treated_wood_dust": "Treated Wood Pulp", "item.gtceu.treated_wood_plate": "Treated Wood Plank", "item.gtceu.treated_wood_rod": "Treated Wood Stick", diff --git a/src/generated/resources/assets/gtceu/models/block/empty_tier_i_battery.json b/src/generated/resources/assets/gtceu/models/block/empty_tier_i_battery.json index 8d725b683a..97b55dd87d 100644 --- a/src/generated/resources/assets/gtceu/models/block/empty_tier_i_battery.json +++ b/src/generated/resources/assets/gtceu/models/block/empty_tier_i_battery.json @@ -2,7 +2,7 @@ "parent": "minecraft:block/cube_bottom_top", "textures": { "bottom": "gtceu:block/casings/battery/empty_tier_i/top", - "side": "gtceu:block/casings/battery/empty_tier_i/top", - "top": "gtceu:block/casings/battery/empty_tier_i/side" + "side": "gtceu:block/casings/battery/empty_tier_i/side", + "top": "gtceu:block/casings/battery/empty_tier_i/top" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/empty_tier_ii_battery.json b/src/generated/resources/assets/gtceu/models/block/empty_tier_ii_battery.json index cb5bae8d09..496b354670 100644 --- a/src/generated/resources/assets/gtceu/models/block/empty_tier_ii_battery.json +++ b/src/generated/resources/assets/gtceu/models/block/empty_tier_ii_battery.json @@ -2,7 +2,7 @@ "parent": "minecraft:block/cube_bottom_top", "textures": { "bottom": "gtceu:block/casings/battery/empty_tier_ii/top", - "side": "gtceu:block/casings/battery/empty_tier_ii/top", - "top": "gtceu:block/casings/battery/empty_tier_ii/side" + "side": "gtceu:block/casings/battery/empty_tier_ii/side", + "top": "gtceu:block/casings/battery/empty_tier_ii/top" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/empty_tier_iii_battery.json b/src/generated/resources/assets/gtceu/models/block/empty_tier_iii_battery.json index b300ceaac7..21d890afc3 100644 --- a/src/generated/resources/assets/gtceu/models/block/empty_tier_iii_battery.json +++ b/src/generated/resources/assets/gtceu/models/block/empty_tier_iii_battery.json @@ -2,7 +2,7 @@ "parent": "minecraft:block/cube_bottom_top", "textures": { "bottom": "gtceu:block/casings/battery/empty_tier_iii/top", - "side": "gtceu:block/casings/battery/empty_tier_iii/top", - "top": "gtceu:block/casings/battery/empty_tier_iii/side" + "side": "gtceu:block/casings/battery/empty_tier_iii/side", + "top": "gtceu:block/casings/battery/empty_tier_iii/top" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/ev_lapotronic_battery.json b/src/generated/resources/assets/gtceu/models/block/ev_lapotronic_battery.json index 4849880502..af181216b9 100644 --- a/src/generated/resources/assets/gtceu/models/block/ev_lapotronic_battery.json +++ b/src/generated/resources/assets/gtceu/models/block/ev_lapotronic_battery.json @@ -2,7 +2,7 @@ "parent": "minecraft:block/cube_bottom_top", "textures": { "bottom": "gtceu:block/casings/battery/ev_lapotronic/top", - "side": "gtceu:block/casings/battery/ev_lapotronic/top", - "top": "gtceu:block/casings/battery/ev_lapotronic/side" + "side": "gtceu:block/casings/battery/ev_lapotronic/side", + "top": "gtceu:block/casings/battery/ev_lapotronic/top" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/industrial_tnt.json b/src/generated/resources/assets/gtceu/models/block/industrial_tnt.json index 21734bfa6a..3711dcc37e 100644 --- a/src/generated/resources/assets/gtceu/models/block/industrial_tnt.json +++ b/src/generated/resources/assets/gtceu/models/block/industrial_tnt.json @@ -2,7 +2,7 @@ "parent": "minecraft:block/cube_bottom_top", "textures": { "bottom": "minecraft:block/tnt_bottom", - "side": "gtceu:block/industrial_tnt_side", + "side": "gtceu:block/misc/industrial_tnt_side", "top": "minecraft:block/tnt_top" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/iv_lapotronic_battery.json b/src/generated/resources/assets/gtceu/models/block/iv_lapotronic_battery.json index 37e72e0f79..eeccabf47d 100644 --- a/src/generated/resources/assets/gtceu/models/block/iv_lapotronic_battery.json +++ b/src/generated/resources/assets/gtceu/models/block/iv_lapotronic_battery.json @@ -2,7 +2,7 @@ "parent": "minecraft:block/cube_bottom_top", "textures": { "bottom": "gtceu:block/casings/battery/iv_lapotronic/top", - "side": "gtceu:block/casings/battery/iv_lapotronic/top", - "top": "gtceu:block/casings/battery/iv_lapotronic/side" + "side": "gtceu:block/casings/battery/iv_lapotronic/side", + "top": "gtceu:block/casings/battery/iv_lapotronic/top" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/luv_lapotronic_battery.json b/src/generated/resources/assets/gtceu/models/block/luv_lapotronic_battery.json index 41e5dbcee4..5d01dec145 100644 --- a/src/generated/resources/assets/gtceu/models/block/luv_lapotronic_battery.json +++ b/src/generated/resources/assets/gtceu/models/block/luv_lapotronic_battery.json @@ -2,7 +2,7 @@ "parent": "minecraft:block/cube_bottom_top", "textures": { "bottom": "gtceu:block/casings/battery/luv_lapotronic/top", - "side": "gtceu:block/casings/battery/luv_lapotronic/top", - "top": "gtceu:block/casings/battery/luv_lapotronic/side" + "side": "gtceu:block/casings/battery/luv_lapotronic/side", + "top": "gtceu:block/casings/battery/luv_lapotronic/top" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/uhv_ultimate_battery.json b/src/generated/resources/assets/gtceu/models/block/uhv_ultimate_battery.json index c92f74c787..0abbfc3ec7 100644 --- a/src/generated/resources/assets/gtceu/models/block/uhv_ultimate_battery.json +++ b/src/generated/resources/assets/gtceu/models/block/uhv_ultimate_battery.json @@ -2,7 +2,7 @@ "parent": "minecraft:block/cube_bottom_top", "textures": { "bottom": "gtceu:block/casings/battery/uhv_ultimate/top", - "side": "gtceu:block/casings/battery/uhv_ultimate/top", - "top": "gtceu:block/casings/battery/uhv_ultimate/side" + "side": "gtceu:block/casings/battery/uhv_ultimate/side", + "top": "gtceu:block/casings/battery/uhv_ultimate/top" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/uv_lapotronic_battery.json b/src/generated/resources/assets/gtceu/models/block/uv_lapotronic_battery.json index 5bf09d6c21..399f927a2c 100644 --- a/src/generated/resources/assets/gtceu/models/block/uv_lapotronic_battery.json +++ b/src/generated/resources/assets/gtceu/models/block/uv_lapotronic_battery.json @@ -2,7 +2,7 @@ "parent": "minecraft:block/cube_bottom_top", "textures": { "bottom": "gtceu:block/casings/battery/uv_lapotronic/top", - "side": "gtceu:block/casings/battery/uv_lapotronic/top", - "top": "gtceu:block/casings/battery/uv_lapotronic/side" + "side": "gtceu:block/casings/battery/uv_lapotronic/side", + "top": "gtceu:block/casings/battery/uv_lapotronic/top" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/block/zpm_lapotronic_battery.json b/src/generated/resources/assets/gtceu/models/block/zpm_lapotronic_battery.json index f7203c0069..46c8402bcc 100644 --- a/src/generated/resources/assets/gtceu/models/block/zpm_lapotronic_battery.json +++ b/src/generated/resources/assets/gtceu/models/block/zpm_lapotronic_battery.json @@ -2,7 +2,7 @@ "parent": "minecraft:block/cube_bottom_top", "textures": { "bottom": "gtceu:block/casings/battery/zpm_lapotronic/top", - "side": "gtceu:block/casings/battery/zpm_lapotronic/top", - "top": "gtceu:block/casings/battery/zpm_lapotronic/side" + "side": "gtceu:block/casings/battery/zpm_lapotronic/side", + "top": "gtceu:block/casings/battery/zpm_lapotronic/top" } } \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/rubber_boat.json b/src/generated/resources/assets/gtceu/models/item/rubber_boat.json new file mode 100644 index 0000000000..1298fccf6d --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/rubber_boat.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/rubber_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/rubber_chest_boat.json b/src/generated/resources/assets/gtceu/models/item/rubber_chest_boat.json new file mode 100644 index 0000000000..69a0964968 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/rubber_chest_boat.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/rubber_chest_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/treated_wood_boat.json b/src/generated/resources/assets/gtceu/models/item/treated_wood_boat.json new file mode 100644 index 0000000000..2ad82d61dc --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/treated_wood_boat.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/treated_wood_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/treated_wood_chest_boat.json b/src/generated/resources/assets/gtceu/models/item/treated_wood_chest_boat.json new file mode 100644 index 0000000000..c24d335945 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/treated_wood_chest_boat.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/treated_wood_chest_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/logs_that_burn.json b/src/generated/resources/data/minecraft/tags/blocks/logs_that_burn.json index 0e9a2d0809..39f4a40dc7 100644 --- a/src/generated/resources/data/minecraft/tags/blocks/logs_that_burn.json +++ b/src/generated/resources/data/minecraft/tags/blocks/logs_that_burn.json @@ -1,5 +1,8 @@ { "values": [ - "gtceu:rubber_log" + "gtceu:rubber_log", + "gtceu:stripped_rubber_log", + "gtceu:rubber_wood", + "gtceu:stripped_rubber_wood" ] -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java b/src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java index fa95834d05..7aa4eb4571 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java +++ b/src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java @@ -66,11 +66,6 @@ default void registerCovers() {} */ default void registerRecipeCapabilities() {} - /** - * Call init on your custom Recipe Conditions here - */ - default void registerRecipeConditions() {} - /** * Call init on your custom IWorldGenLayer class(es) here */ diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java index d4765d7750..556a62d972 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java @@ -16,7 +16,7 @@ import com.gregtechceu.gtceu.api.recipe.lookup.*; import com.gregtechceu.gtceu.api.recipe.modifier.ParallelLogic; import com.gregtechceu.gtceu.api.recipe.ui.GTRecipeTypeUI; -import com.gregtechceu.gtceu.common.recipe.ResearchCondition; +import com.gregtechceu.gtceu.common.recipe.condition.ResearchCondition; import com.gregtechceu.gtceu.common.valueprovider.AddedFloat; import com.gregtechceu.gtceu.common.valueprovider.CastedFloat; import com.gregtechceu.gtceu.common.valueprovider.FlooredInt; diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java index 27b38b8fdc..5d585562d2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.capability.recipe; +import com.gregtechceu.gtceu.api.codec.DispatchedMapCodec; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.content.Content; @@ -8,6 +9,7 @@ import com.gregtechceu.gtceu.api.recipe.lookup.AbstractMapIngredient; import com.gregtechceu.gtceu.api.recipe.modifier.ParallelLogic; import com.gregtechceu.gtceu.api.recipe.ui.GTRecipeTypeUI; +import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -15,6 +17,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; +import com.mojang.serialization.Codec; import io.netty.buffer.Unpooled; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; @@ -29,6 +32,10 @@ */ public abstract class RecipeCapability { + public static final Codec> DIRECT_CODEC = GTRegistries.RECIPE_CAPABILITIES.codec(); + public static final Codec, List>> CODEC = new DispatchedMapCodec<>( + RecipeCapability.DIRECT_CODEC, + RecipeCapability::contentCodec); public static final Comparator> COMPARATOR = Comparator.comparingInt(o -> o.sortIndex); public final String name; @@ -46,6 +53,10 @@ protected RecipeCapability(String name, int color, boolean doRenderSlot, int sor this.serializer = serializer; } + public static Codec> contentCodec(RecipeCapability capability) { + return Content.codec(capability).listOf(); + } + /** * deep copy of this content. recipe need it for searching and such things */ diff --git a/src/main/java/com/gregtechceu/gtceu/api/codec/DispatchedMapCodec.java b/src/main/java/com/gregtechceu/gtceu/api/codec/DispatchedMapCodec.java new file mode 100644 index 0000000000..f5e2b7b968 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/codec/DispatchedMapCodec.java @@ -0,0 +1,79 @@ +package com.gregtechceu.gtceu.api.codec; + +import com.gregtechceu.gtceu.GTCEu; + +import com.google.common.collect.ImmutableMap; +import com.mojang.datafixers.util.Pair; +import com.mojang.datafixers.util.Unit; +import com.mojang.serialization.*; +import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; + +import java.util.Map; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Stream; + +public record DispatchedMapCodec( + Codec keyCodec, + Function> valueCodecFunction) + implements Codec> { + + @Override + public DataResult encode(final Map input, final DynamicOps ops, final T prefix) { + final RecordBuilder mapBuilder = ops.mapBuilder(); + for (final Map.Entry entry : input.entrySet()) { + mapBuilder.add(keyCodec.encodeStart(ops, entry.getKey()), + encodeValue(valueCodecFunction.apply(entry.getKey()), entry.getValue(), ops)); + } + return mapBuilder.build(prefix); + } + + @SuppressWarnings("unchecked") + private DataResult encodeValue(final Codec codec, final V input, final DynamicOps ops) { + return codec.encodeStart(ops, (V2) input); + } + + @Override + public DataResult, T>> decode(final DynamicOps ops, final T input) { + return ops.getMap(input).flatMap(map -> { + final Map entries = new Object2ObjectArrayMap<>(); + final Stream.Builder> failed = Stream.builder(); + + final DataResult finalResult = map.entries().reduce( + DataResult.success(Unit.INSTANCE, Lifecycle.stable()), + (result, entry) -> parseEntry(result, ops, entry, entries, failed), + (r1, r2) -> r1.apply2stable((u1, u2) -> u1, r2)); + + final Pair, T> pair = Pair.of(ImmutableMap.copyOf(entries), input); + final T errors = ops.createMap(failed.build()); + + return finalResult.map(ignored -> pair).setPartial(pair) + .mapError(error -> error + " missed input: " + errors); + }); + } + + private DataResult parseEntry(final DataResult result, final DynamicOps ops, + final Pair input, final Map entries, + final Stream.Builder> failed) { + final DataResult keyResult = keyCodec.parse(ops, input.getFirst()); + final DataResult valueResult = keyResult.map(valueCodecFunction) + .flatMap(valueCodec -> valueCodec.parse(ops, input.getSecond()).map(Function.identity())); + final DataResult> entryResult = keyResult.apply2stable(Pair::of, valueResult); + + final Optional> entry = entryResult.resultOrPartial(GTCEu.LOGGER::error); + if (entry.isPresent()) { + final K key = entry.get().getFirst(); + final V value = entry.get().getSecond(); + if (entries.putIfAbsent(key, value) != null) { + failed.add(input); + return result.apply2stable((u, p) -> u, + DataResult.error(() -> "Duplicate entry for key: '" + key + "'")); + } + } + if (entryResult.error().isPresent()) { + failed.add(input); + } + + return result.apply2stable((u, p) -> u, entryResult); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/medicalcondition/MedicalCondition.java b/src/main/java/com/gregtechceu/gtceu/api/data/medicalcondition/MedicalCondition.java index e4e2d34289..0bd126827a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/medicalcondition/MedicalCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/medicalcondition/MedicalCondition.java @@ -10,6 +10,7 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.level.Level; +import com.mojang.serialization.Codec; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; @@ -22,7 +23,10 @@ public class MedicalCondition { public static final Map CONDITIONS = new HashMap<>(); + public static final Codec CODEC = Codec.STRING.xmap(MedicalCondition.CONDITIONS::get, + MedicalCondition::getName); + @Getter public final String name; public final int color; public final float maxProgression; // amount of seconds until maximum progression is reached diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/GuiTextures.java b/src/main/java/com/gregtechceu/gtceu/api/gui/GuiTextures.java index 6f6402b627..6e8e97cec2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/GuiTextures.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/GuiTextures.java @@ -49,11 +49,11 @@ public class GuiTextures { public static final ResourceTexture TOOL_DISABLE_AUTO_OUTPUT = new ResourceTexture( "gtceu:textures/gui/overlay/tool_disable_auto_output.png"); public static final ResourceTexture TOOL_SWITCH_CONVERTER_NATIVE = new ResourceTexture( - "gtceu:textures/gui/overlay/tool_wire_block.png"); // switch to tool_switch_converter_native once that gets - // made + "gtceu:textures/gui/overlay/tool_wire_block.png"); // todo switch to tool_switch_converter_native once that + // gets made public static final ResourceTexture TOOL_SWITCH_CONVERTER_EU = new ResourceTexture( - "gtceu:textures/gui/overlay/tool_wire_connect.png"); // switch to tool_switch_converter_eu once that gets - // made + "gtceu:textures/gui/overlay/tool_wire_connect.png"); // todo switch to tool_switch_converter_eu once that + // gets made // BASE TEXTURES public static final ResourceBorderTexture BACKGROUND = new ResourceBorderTexture( diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostFluidTarget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostFluidTarget.java index df01f582a8..baeaaeb6f0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostFluidTarget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostFluidTarget.java @@ -70,6 +70,10 @@ default Object convertIngredient(Object ingredient) { ingredient = fluid == null ? FluidStack.EMPTY : new FluidStack(fluid, (int) fluidEmiStack.getAmount(), fluidEmiStack.getNbt()); } + + if (LDLib.isJeiLoaded() && ingredient instanceof net.minecraftforge.fluids.FluidStack fluidStack) { + ingredient = FluidStack.create(fluidStack.getFluid(), fluidStack.getAmount(), fluidStack.getTag()); + } return ingredient; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostItemTarget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostItemTarget.java index d9f99b71ad..28593addd8 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostItemTarget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/misc/IGhostItemTarget.java @@ -12,6 +12,7 @@ import com.google.common.collect.Lists; import dev.emi.emi.api.stack.EmiStack; +import mezz.jei.api.ingredients.ITypedIngredient; import org.jetbrains.annotations.NotNull; import java.util.Collections; @@ -53,10 +54,15 @@ public void accept(@NotNull Object ingredient) { default Object convertIngredient(Object ingredient) { if (LDLib.isEmiLoaded() && ingredient instanceof EmiStack itemEmiStack) { Item item = itemEmiStack.getKeyOfType(Item.class); - ingredient = item == null ? null : new ItemStack(item, (int) itemEmiStack.getAmount()); - if (ingredient instanceof ItemStack itemStack) { + ItemStack itemStack = item == null ? ItemStack.EMPTY : new ItemStack(item, (int) itemEmiStack.getAmount()); + if (!itemStack.isEmpty()) { itemStack.setTag(itemEmiStack.getNbt()); } + ingredient = itemStack; + } + + if (LDLib.isJeiLoaded() && ingredient instanceof ITypedIngredient itemJeiStack) { + return itemJeiStack.getItemStack().orElse(ItemStack.EMPTY); } return ingredient; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java index 6d0c1b4937..b241dc872b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java @@ -87,6 +87,7 @@ protected PatternPreviewWidget(MultiblockMachineDefinition controllerDefinition) .setXBarStyle(GuiTextures.SLIDER_BACKGROUND, GuiTextures.BUTTON) .setScrollable(true) .setDraggable(true); + scrollableWidgetGroup.setScrollWheelDirection(DraggableScrollableWidgetGroup.ScrollWheelDirection.HORIZONTAL); scrollableWidgetGroup.setScrollYOffset(0); addWidget(scrollableWidgetGroup); @@ -181,7 +182,7 @@ public void setPage(int index) { setupScene(pattern); if (slotWidgets != null) { for (SlotWidget slotWidget : slotWidgets) { - removeWidget(slotWidget); + scrollableWidgetGroup.removeWidget(slotWidget); } } slotWidgets = new SlotWidget[Math.min(pattern.parts.size(), 18)]; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java index ec740d2946..4380abd2fb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java @@ -646,7 +646,7 @@ public boolean canConnectRedstone(Direction side) { // ****** Capability ********// ////////////////////////////////////// - protected Predicate getItemCapFilter(@Nullable Direction side) { + public Predicate getItemCapFilter(@Nullable Direction side) { if (side != null) { var cover = getCoverContainer().getCoverAtSide(side); if (cover instanceof ItemFilterCover filterCover) { @@ -656,7 +656,7 @@ protected Predicate getItemCapFilter(@Nullable Direction side) { return item -> true; } - protected Predicate getFluidCapFilter(@Nullable Direction side) { + public Predicate getFluidCapFilter(@Nullable Direction side) { if (side != null) { var cover = getCoverContainer().getCoverAtSide(side); if (cover instanceof FluidFilterCover filterCover) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/CleanroomType.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/CleanroomType.java index 831398f019..0768944289 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/CleanroomType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/CleanroomType.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.machine.multiblock; +import com.mojang.serialization.Codec; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -16,6 +17,8 @@ public class CleanroomType { public static final CleanroomType STERILE_CLEANROOM = new CleanroomType("sterile_cleanroom", "gtceu.recipe.cleanroom_sterile.display_name"); + public static final Codec CODEC = Codec.STRING.xmap(CLEANROOM_TYPES::get, CleanroomType::getName); + private final String name; private final String translationKey; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SimpleSteamMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SimpleSteamMachine.java index 2339c3a563..18fec5a333 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SimpleSteamMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SimpleSteamMachine.java @@ -18,7 +18,7 @@ import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.api.recipe.logic.OCParams; import com.gregtechceu.gtceu.api.recipe.logic.OCResult; -import com.gregtechceu.gtceu.common.recipe.VentCondition; +import com.gregtechceu.gtceu.common.recipe.condition.VentCondition; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java index 739d0ecabe..d48bfa1c87 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java @@ -225,7 +225,8 @@ public void exportToNearby(@NotNull Direction... facings) { var level = getMachine().getLevel(); var pos = getMachine().getPos(); for (Direction facing : facings) { - ItemTransferHelper.exportToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), + ItemTransferHelper.exportToTarget(this, Integer.MAX_VALUE, getMachine().getItemCapFilter(facing), level, + pos.relative(facing), facing.getOpposite()); } } @@ -234,7 +235,8 @@ public void importFromNearby(@NotNull Direction... facings) { var level = getMachine().getLevel(); var pos = getMachine().getPos(); for (Direction facing : facings) { - ItemTransferHelper.importToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), + ItemTransferHelper.importToTarget(this, Integer.MAX_VALUE, getMachine().getItemCapFilter(facing), level, + pos.relative(facing), facing.getOpposite()); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java index bddbcd3714..e9f18c0ab2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.capability.recipe.*; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; @@ -20,6 +21,7 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -39,7 +41,8 @@ public class GTRecipe implements net.minecraft.world.item.crafting.Recipe, List> inputs; public final Map, List> outputs; public final Map, List> tickInputs; @@ -63,7 +66,26 @@ public class GTRecipe implements net.minecraft.world.item.crafting.Recipe, List> inputs, + Map, List> outputs, + Map, List> tickInputs, + Map, List> tickOutputs, + Map, ChanceLogic> inputChanceLogics, + Map, ChanceLogic> outputChanceLogics, + Map, ChanceLogic> tickInputChanceLogics, + Map, ChanceLogic> tickOutputChanceLogics, + List conditions, + List ingredientActions, + @NotNull CompoundTag data, + int duration, + boolean isFuel) { + this(recipeType, null, inputs, outputs, tickInputs, tickOutputs, + inputChanceLogics, outputChanceLogics, tickInputChanceLogics, tickOutputChanceLogics, + conditions, ingredientActions, data, duration, isFuel); + } + + public GTRecipe(GTRecipeType recipeType, + @Nullable ResourceLocation id, Map, List> inputs, Map, List> outputs, Map, List> tickInputs, @@ -308,7 +330,7 @@ public void handlePost(Map, List> contents, IRecipe public ActionResult checkConditions(@NotNull RecipeLogic recipeLogic) { if (conditions.isEmpty()) return ActionResult.SUCCESS; - Map> or = new HashMap<>(); + Map, List> or = new HashMap<>(); for (RecipeCondition condition : conditions) { if (condition.isOr()) { or.computeIfAbsent(condition.getType(), type -> new ArrayList<>()).add(condition); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeSerializer.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeSerializer.java index 3db8b37185..1450800669 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeSerializer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeSerializer.java @@ -5,20 +5,24 @@ import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.gregtechceu.gtceu.common.recipe.ResearchCondition; +import com.gregtechceu.gtceu.common.recipe.condition.ResearchCondition; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.GsonHelper; +import net.minecraft.util.ExtraCodecs; import net.minecraft.util.Tuple; import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraftforge.common.crafting.CraftingHelper; import com.google.gson.JsonArray; import com.google.gson.JsonElement; +import com.google.gson.JsonNull; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.Dynamic; +import com.mojang.serialization.JsonOps; +import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.latvian.mods.kubejs.recipe.ingredientaction.IngredientAction; import org.jetbrains.annotations.NotNull; @@ -31,6 +35,8 @@ */ public class GTRecipeSerializer implements RecipeSerializer { + public static final Codec CODEC = makeCodec(GTCEu.isKubeJSLoaded()); + public static final GTRecipeSerializer SERIALIZER = new GTRecipeSerializer(); public Map, List> capabilitiesFromJson(JsonObject json) { @@ -60,61 +66,9 @@ public Map, ChanceLogic> chanceLogicsFromJson(JsonObject jso @Override public @NotNull GTRecipe fromJson(@NotNull ResourceLocation id, @NotNull JsonObject json) { - String recipeType = GsonHelper.getAsString(json, "type"); - int duration = json.has("duration") ? GsonHelper.getAsInt(json, "duration") : 100; - CompoundTag data = new CompoundTag(); - if (json.has("data")) - data = CraftingHelper.getNBT(json.get("data")); - Map, List> inputs = capabilitiesFromJson( - json.has("inputs") ? json.getAsJsonObject("inputs") : new JsonObject()); - Map, List> tickInputs = capabilitiesFromJson( - json.has("tickInputs") ? json.getAsJsonObject("tickInputs") : new JsonObject()); - Map, List> outputs = capabilitiesFromJson( - json.has("outputs") ? json.getAsJsonObject("outputs") : new JsonObject()); - Map, List> tickOutputs = capabilitiesFromJson( - json.has("tickOutputs") ? json.getAsJsonObject("tickOutputs") : new JsonObject()); - - Map, ChanceLogic> inputChanceLogics = chanceLogicsFromJson( - json.has("inputChanceLogics") ? - json.getAsJsonObject("inputChanceLogics") : - new JsonObject()); - Map, ChanceLogic> tickInputChanceLogics = chanceLogicsFromJson( - json.has("tickInputChanceLogics") ? - json.getAsJsonObject("tickInputChanceLogics") : - new JsonObject()); - Map, ChanceLogic> outputChanceLogics = chanceLogicsFromJson( - json.has("outputChanceLogics") ? - json.getAsJsonObject("outputChanceLogics") : - new JsonObject()); - Map, ChanceLogic> tickOutputChanceLogics = chanceLogicsFromJson( - json.has("tickOutputChanceLogics") ? - json.getAsJsonObject("tickOutputChanceLogics") : - new JsonObject()); - List conditions = new ArrayList<>(); - JsonArray conditionsJson = json.has("recipeConditions") ? json.getAsJsonArray("recipeConditions") : - new JsonArray(); - for (JsonElement jsonElement : conditionsJson) { - if (jsonElement instanceof JsonObject jsonObject) { - var conditionKey = GsonHelper.getAsString(jsonObject, "type", ""); - var clazz = GTRegistries.RECIPE_CONDITIONS.get(conditionKey); - if (clazz != null) { - RecipeCondition condition = RecipeCondition.create(clazz); - if (condition != null) { - conditions.add(condition - .deserialize(GsonHelper.getAsJsonObject(jsonObject, "data", new JsonObject()))); - } - } - } - } - List ingredientActions = new ArrayList<>(); - if (GTCEu.isKubeJSLoaded()) { - ingredientActions = KJSCallWrapper.getIngredientActions(json); - } - boolean isFuel = GsonHelper.getAsBoolean(json, "isFuel", false); - return new GTRecipe((GTRecipeType) BuiltInRegistries.RECIPE_TYPE.get(new ResourceLocation(recipeType)), id, - inputs, outputs, tickInputs, tickOutputs, - inputChanceLogics, outputChanceLogics, tickInputChanceLogics, tickOutputChanceLogics, - conditions, ingredientActions, data, duration, isFuel); + GTRecipe recipe = CODEC.parse(JsonOps.INSTANCE, json).getOrThrow(false, GTCEu.LOGGER::error); + recipe.setId(id); + return recipe; } public static Tuple, List> entryReader(FriendlyByteBuf buf) { @@ -131,12 +85,12 @@ public static void entryWriter(FriendlyByteBuf buf, Map.Entry makeCodec(boolean isKubeLoaded) { + // @formatter:off + if (!isKubeLoaded) { + return RecordCodecBuilder.create(instance -> instance.group( + GTRegistries.RECIPE_TYPES.codec().fieldOf("type").forGetter(val -> val.recipeType), + RecipeCapability.CODEC.optionalFieldOf("inputs", Map.of()).forGetter(val -> val.inputs), + RecipeCapability.CODEC.optionalFieldOf("outputs", Map.of()).forGetter(val -> val.outputs), + RecipeCapability.CODEC.optionalFieldOf("tickInputs", Map.of()).forGetter(val -> val.tickInputs), + RecipeCapability.CODEC.optionalFieldOf("tickOutputs", Map.of()).forGetter(val -> val.tickOutputs), + Codec.unboundedMap(RecipeCapability.DIRECT_CODEC, GTRegistries.CHANCE_LOGICS.codec()) + .optionalFieldOf("inputChanceLogics", Map.of()).forGetter(val -> val.inputChanceLogics), + Codec.unboundedMap(RecipeCapability.DIRECT_CODEC, GTRegistries.CHANCE_LOGICS.codec()) + .optionalFieldOf("outputChanceLogics", Map.of()).forGetter(val -> val.outputChanceLogics), + Codec.unboundedMap(RecipeCapability.DIRECT_CODEC, GTRegistries.CHANCE_LOGICS.codec()) + .optionalFieldOf("tickInputChanceLogics", Map.of()).forGetter(val -> val.tickInputChanceLogics), + Codec.unboundedMap(RecipeCapability.DIRECT_CODEC, GTRegistries.CHANCE_LOGICS.codec()) + .optionalFieldOf("tickOutputChanceLogics", Map.of()).forGetter(val -> val.tickOutputChanceLogics), + RecipeCondition.CODEC.listOf().optionalFieldOf("recipeConditions", List.of()).forGetter(val -> val.conditions), + CompoundTag.CODEC.optionalFieldOf("data", new CompoundTag()).forGetter(val -> val.data), + ExtraCodecs.NON_NEGATIVE_INT.fieldOf("duration").forGetter(val -> val.duration), + Codec.BOOL.optionalFieldOf("isFuel", false).forGetter(val -> val.isFuel)) + .apply(instance, (type, + inputs, outputs, tickInputs, tickOutputs, + inputChanceLogics, outputChanceLogics, tickInputChanceLogics, tickOutputChanceLogics, + conditions, data, duration, isFuel) -> + new GTRecipe(type, inputs, outputs, tickInputs, tickOutputs, + inputChanceLogics, outputChanceLogics, tickInputChanceLogics, tickOutputChanceLogics, + conditions, List.of(), data, duration, isFuel))); + } else { + return RecordCodecBuilder.create(instance -> instance.group( + GTRegistries.RECIPE_TYPES.codec().fieldOf("type").forGetter(val -> val.recipeType), + RecipeCapability.CODEC.optionalFieldOf("inputs", Map.of()).forGetter(val -> val.inputs), + RecipeCapability.CODEC.optionalFieldOf("outputs", Map.of()).forGetter(val -> val.outputs), + RecipeCapability.CODEC.optionalFieldOf("tickInputs", Map.of()).forGetter(val -> val.tickInputs), + RecipeCapability.CODEC.optionalFieldOf("tickOutputs", Map.of()).forGetter(val -> val.tickOutputs), + Codec.unboundedMap(RecipeCapability.DIRECT_CODEC, GTRegistries.CHANCE_LOGICS.codec()) + .optionalFieldOf("inputChanceLogics", Map.of()).forGetter(val -> val.inputChanceLogics), + Codec.unboundedMap(RecipeCapability.DIRECT_CODEC, GTRegistries.CHANCE_LOGICS.codec()) + .optionalFieldOf("outputChanceLogics", Map.of()).forGetter(val -> val.outputChanceLogics), + Codec.unboundedMap(RecipeCapability.DIRECT_CODEC, GTRegistries.CHANCE_LOGICS.codec()) + .optionalFieldOf("tickInputChanceLogics", Map.of()).forGetter(val -> val.tickInputChanceLogics), + Codec.unboundedMap(RecipeCapability.DIRECT_CODEC, GTRegistries.CHANCE_LOGICS.codec()) + .optionalFieldOf("tickOutputChanceLogics", Map.of()).forGetter(val -> val.tickOutputChanceLogics), + RecipeCondition.CODEC.listOf().optionalFieldOf("recipeConditions", List.of()).forGetter(val -> val.conditions), + KJSCallWrapper.INGREDIENT_ACTION_CODEC.optionalFieldOf("kubejs:actions", List.of()).forGetter(val -> (List) val.ingredientActions), + CompoundTag.CODEC.optionalFieldOf("data", new CompoundTag()).forGetter(val -> val.data), + ExtraCodecs.NON_NEGATIVE_INT.fieldOf("duration").forGetter(val -> val.duration), + Codec.BOOL.optionalFieldOf("isFuel", false).forGetter(val -> val.isFuel)) + .apply(instance, GTRecipe::new)); + } + // @formatter:on + } + public static class KJSCallWrapper { + public static final Codec> INGREDIENT_ACTION_CODEC = Codec.PASSTHROUGH.xmap( + dynamic -> { + JsonElement json = dynamic.convert(JsonOps.INSTANCE).getValue(); + return IngredientAction.parseList(json); + }, + list -> new Dynamic<>(JsonOps.INSTANCE, JsonNull.INSTANCE)); + public static List getIngredientActions(JsonObject json) { return IngredientAction.parseList(json.get("kubejs:actions")); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeCondition.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeCondition.java index ca9a5a8285..5a0b7c052b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeCondition.java @@ -1,7 +1,8 @@ package com.gregtechceu.gtceu.api.recipe; -import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; +import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; @@ -11,30 +12,43 @@ import net.minecraft.util.GsonHelper; import com.google.gson.JsonObject; +import com.mojang.datafixers.Products; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * @author KilaBash * @date 2022/05/27 * @implNote RecipeCondition, global conditions */ +@Accessors(chain = true) public abstract class RecipeCondition { - @Nullable - public static RecipeCondition create(Class clazz) { - if (clazz == null) return null; - try { - return clazz.newInstance(); - } catch (Exception ignored) { - GTCEu.LOGGER.error("condition {} has no NonArgsConstructor", clazz); - return null; - } + public static final Codec CODEC = GTRegistries.RECIPE_CONDITIONS.codec() + .dispatch(RecipeCondition::getType, RecipeConditionType::getCodec); + + public static < + RC extends RecipeCondition> Products.P1, Boolean> isReverse(RecordCodecBuilder.Instance instance) { + return instance.group(Codec.BOOL.fieldOf("reverse").forGetter(val -> val.isReverse)); } + @Getter + @Setter protected boolean isReverse; - public abstract String getType(); + public RecipeCondition() { + this(false); + } + + public RecipeCondition(boolean isReverse) { + this.isReverse = isReverse; + } + + public abstract RecipeConditionType getType(); public String getTranslationKey() { return "gtceu.recipe.condition." + getType(); @@ -49,19 +63,10 @@ public IGuiTexture getValidTexture() { 0.5f); } - public boolean isReverse() { - return isReverse; - } - public boolean isOr() { return false; } - public RecipeCondition setReverse(boolean reverse) { - isReverse = reverse; - return this; - } - public abstract Component getTooltips(); public abstract boolean test(@NotNull GTRecipe recipe, @NotNull RecipeLogic recipeLogic); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ResearchData.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ResearchData.java index 1515e446ee..9bc4045050 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ResearchData.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ResearchData.java @@ -7,20 +7,24 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; import com.mojang.serialization.JsonOps; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.AllArgsConstructor; import lombok.Getter; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; -import java.util.Collection; import java.util.Iterator; import java.util.List; @AllArgsConstructor public final class ResearchData implements Iterable { - private final Collection entries; + public static final Codec CODEC = ResearchEntry.CODEC.listOf().xmap(ResearchData::new, + data -> data.entries); + + private final List entries; public ResearchData() { entries = new ArrayList<>(); @@ -74,6 +78,11 @@ public void toNetwork(FriendlyByteBuf buf) { */ public static final class ResearchEntry { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + Codec.STRING.fieldOf("researchId").forGetter(val -> val.researchId), + ItemStack.CODEC.fieldOf("dataItem").forGetter(val -> val.dataItem)) + .apply(instance, ResearchEntry::new)); + @NotNull @Getter private final String researchId; diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/condition/RecipeConditionType.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/condition/RecipeConditionType.java new file mode 100644 index 0000000000..b73f764b78 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/condition/RecipeConditionType.java @@ -0,0 +1,21 @@ +package com.gregtechceu.gtceu.api.recipe.condition; + +import com.gregtechceu.gtceu.api.recipe.RecipeCondition; + +import com.mojang.serialization.Codec; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +public class RecipeConditionType { + + public final ConditionFactory factory; + @Getter + public final Codec codec; + + @FunctionalInterface + public interface ConditionFactory { + + T createDefault(); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java index 4ae0183f9f..59ddbd82ef 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java @@ -12,10 +12,13 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.util.ExtraCodecs; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.Getter; import org.jetbrains.annotations.Nullable; @@ -37,8 +40,22 @@ public Content(Object content, int chance, int maxChance, int tierChanceBoost, @ this.chance = chance; this.maxChance = maxChance; this.tierChanceBoost = fixBoost(tierChanceBoost); - this.slotName = slotName; - this.uiName = uiName; + this.slotName = slotName == null || slotName.isEmpty() ? null : slotName; + this.uiName = uiName == null || uiName.isEmpty() ? null : uiName; + } + + public static Codec codec(RecipeCapability capability) { + return RecordCodecBuilder.create(instance -> instance.group( + capability.serializer.codec().fieldOf("content").forGetter(val -> capability.of(val.content)), + ExtraCodecs.NON_NEGATIVE_INT.optionalFieldOf("chance", ChanceLogic.getMaxChancedValue()) + .forGetter(val -> val.chance), + ExtraCodecs.NON_NEGATIVE_INT.optionalFieldOf("maxChance", ChanceLogic.getMaxChancedValue()) + .forGetter(val -> val.maxChance), + ExtraCodecs.NON_NEGATIVE_INT.optionalFieldOf("tierChanceBoost", 0) + .forGetter(val -> val.tierChanceBoost), + Codec.STRING.optionalFieldOf("slotName", "").forGetter(val -> val.slotName != null ? val.slotName : ""), + Codec.STRING.optionalFieldOf("uiName", "").forGetter(val -> val.uiName != null ? val.uiName : "")) + .apply(instance, Content::new)); } public Content copy(RecipeCapability capability, @Nullable ContentModifier modifier) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java index 0fd6c8770b..5a145a06f4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java @@ -1,25 +1,33 @@ package com.gregtechceu.gtceu.api.recipe.content; +import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.lowdragmc.lowdraglib.LDLib; +import com.lowdragmc.lowdraglib.Platform; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.RegistryOps; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; import com.mojang.serialization.JsonOps; public interface IContentSerializer { default void toNetwork(FriendlyByteBuf buf, T content) { - buf.writeUtf(LDLib.GSON.toJson(toJson(content))); + RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, Platform.getFrozenRegistry()); + buf.writeUtf(codec().encodeStart(ops, content).getOrThrow(false, GTCEu.LOGGER::error).toString()); } default T fromNetwork(FriendlyByteBuf buf) { - return fromJson(LDLib.GSON.fromJson(buf.readUtf(), JsonElement.class)); + RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, Platform.getFrozenRegistry()); + return codec().parse(ops, LDLib.GSON.fromJson(buf.readUtf(), JsonElement.class)).getOrThrow(false, + GTCEu.LOGGER::error); } T fromJson(JsonElement json); @@ -63,6 +71,18 @@ default Content fromNetworkContent(FriendlyByteBuf buf) { return new Content(inner, chance, maxChance, tierChanceBoost, slotName, uiName); } + Codec codec(); + + default T fromJson(JsonElement json, HolderLookup.Provider provider) { + RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, provider); + return codec().parse(ops, json).getOrThrow(false, GTCEu.LOGGER::error); + } + + default JsonElement toJson(T content, HolderLookup.Provider provider) { + RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, provider); + return codec().encodeStart(ops, content).getOrThrow(false, GTCEu.LOGGER::error); + } + @SuppressWarnings("unchecked") default JsonElement toJsonContent(Content content) { JsonObject json = new JsonObject(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBigInteger.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBigInteger.java index 2367a59fd5..acda029381 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBigInteger.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBigInteger.java @@ -4,6 +4,9 @@ import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import com.mojang.serialization.Lifecycle; import java.math.BigInteger; @@ -14,6 +17,14 @@ */ public class SerializerBigInteger implements IContentSerializer { + public static final Codec CODEC = Codec.STRING.comapFlatMap(str -> { + try { + return DataResult.success(new BigInteger(str), Lifecycle.stable()); + } catch (Exception e) { + return DataResult.error(e::getMessage, Lifecycle.stable()); + } + }, BigInteger::toString); + public static SerializerBigInteger INSTANCE = new SerializerBigInteger(); private SerializerBigInteger() {} @@ -54,4 +65,9 @@ public BigInteger of(Object o) { public BigInteger defaultValue() { return BigInteger.ZERO; } + + @Override + public Codec codec() { + return CODEC; + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBlockState.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBlockState.java index c6dcada1e5..6ca7efee8f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBlockState.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBlockState.java @@ -14,6 +14,7 @@ import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; import com.google.gson.JsonNull; +import com.mojang.serialization.Codec; import com.mojang.serialization.JsonOps; import java.util.Map; @@ -86,4 +87,9 @@ public BlockState of(Object o) { public BlockState defaultValue() { return Blocks.AIR.defaultBlockState(); } + + @Override + public Codec codec() { + return BlockState.CODEC; + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerDouble.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerDouble.java index 92c1a85b5c..9b71b5c440 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerDouble.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerDouble.java @@ -4,6 +4,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; +import com.mojang.serialization.Codec; import org.apache.commons.lang3.math.NumberUtils; public class SerializerDouble implements IContentSerializer { @@ -48,4 +49,9 @@ public Double of(Object o) { public Double defaultValue() { return 0d; } + + @Override + public Codec codec() { + return Codec.DOUBLE; + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFloat.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFloat.java index ad1aebc444..2399ad1014 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFloat.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFloat.java @@ -4,6 +4,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; +import com.mojang.serialization.Codec; import org.apache.commons.lang3.math.NumberUtils; public class SerializerFloat implements IContentSerializer { @@ -48,4 +49,9 @@ public Float of(Object o) { public Float defaultValue() { return 0f; } + + @Override + public Codec codec() { + return Codec.FLOAT; + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFluidIngredient.java index 222784afab..5a2b5379fa 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFluidIngredient.java @@ -6,6 +6,7 @@ import net.minecraftforge.fluids.FluidStack; import com.google.gson.JsonElement; +import com.mojang.serialization.Codec; public class SerializerFluidIngredient implements IContentSerializer { @@ -48,4 +49,9 @@ public FluidIngredient of(Object o) { public FluidIngredient defaultValue() { return FluidIngredient.EMPTY; } + + @Override + public Codec codec() { + return FluidIngredient.CODEC; + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerIngredient.java index 62a4bdbc74..5a876ed9f9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerIngredient.java @@ -9,9 +9,16 @@ import net.minecraft.world.level.ItemLike; import com.google.gson.JsonElement; +import com.mojang.serialization.Codec; +import com.mojang.serialization.Dynamic; +import com.mojang.serialization.JsonOps; public class SerializerIngredient implements IContentSerializer { + public static final Codec CODEC = Codec.PASSTHROUGH.xmap( + dynamic -> Ingredient.fromJson(dynamic.convert(JsonOps.INSTANCE).getValue()), + ingredient -> new Dynamic<>(JsonOps.INSTANCE, ingredient.toJson())); + public static SerializerIngredient INSTANCE = new SerializerIngredient(); private SerializerIngredient() {} @@ -55,4 +62,9 @@ public Ingredient of(Object o) { public Ingredient defaultValue() { return Ingredient.EMPTY; } + + @Override + public Codec codec() { + return CODEC; + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerInteger.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerInteger.java index fcee352cf1..ebab0c336b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerInteger.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerInteger.java @@ -4,6 +4,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; +import com.mojang.serialization.Codec; import org.apache.commons.lang3.math.NumberUtils; public class SerializerInteger implements IContentSerializer { @@ -48,4 +49,9 @@ public Integer of(Object o) { public Integer defaultValue() { return 0; } + + @Override + public Codec codec() { + return Codec.INT; + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerLong.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerLong.java index 561b7d4ec8..3336e22a7e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerLong.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerLong.java @@ -4,6 +4,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; +import com.mojang.serialization.Codec; import org.apache.commons.lang3.math.NumberUtils; /** @@ -53,4 +54,9 @@ public Long of(Object o) { public Long defaultValue() { return 0L; } + + @Override + public Codec codec() { + return Codec.LONG; + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/FluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/FluidIngredient.java index 2e683082a9..2d998ab95e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/FluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/FluidIngredient.java @@ -15,6 +15,9 @@ import com.google.common.collect.Lists; import com.google.gson.*; +import com.mojang.serialization.Codec; +import com.mojang.serialization.Dynamic; +import com.mojang.serialization.JsonOps; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import lombok.Getter; import org.jetbrains.annotations.Nullable; @@ -26,6 +29,10 @@ public class FluidIngredient implements Predicate { + public static final Codec CODEC = Codec.PASSTHROUGH.xmap( + dynamic -> FluidIngredient.fromJson(dynamic.convert(JsonOps.INSTANCE).getValue()), + ingredient -> new Dynamic<>(JsonOps.INSTANCE, ingredient.toJson())); + public static final FluidIngredient EMPTY = new FluidIngredient(Stream.empty(), 0, null); public FluidIngredient.Value[] values; @Nullable diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ParallelLogic.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ParallelLogic.java index ca54364215..017778e95c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ParallelLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ParallelLogic.java @@ -124,14 +124,14 @@ public static int limitByOutputMerging(@NotNull GTRecipe recipe, @NotNull IRecip // If we are voiding items, reset the item limit to the maximum number of parallels if (voiding) { if (modifiedParallelAmounts.containsKey(cap)) { - modifiedParallelAmounts.put(cap, modifiedParallelAmounts.getInt(cap) + parallelAmount); + modifiedParallelAmounts.put(cap, Math.min(modifiedParallelAmounts.getInt(cap), parallelAmount)); } else { modifiedParallelAmounts.put(cap, parallelAmount); } } else { if (modifiedParallelAmounts.containsKey(cap)) { - modifiedParallelAmounts.put(cap, modifiedParallelAmounts.getInt(cap) + - cap.limitParallel(recipe, holder, parallelAmount)); + modifiedParallelAmounts.put(cap, Math.min(modifiedParallelAmounts.getInt(cap), + cap.limitParallel(recipe, holder, parallelAmount))); } else { modifiedParallelAmounts.put(cap, cap.limitParallel(recipe, holder, parallelAmount)); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java b/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java index ebd9e80b9d..570ed47518 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java @@ -10,8 +10,8 @@ import com.gregtechceu.gtceu.api.data.worldgen.bedrockore.BedrockOreDefinition; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; -import com.gregtechceu.gtceu.api.recipe.RecipeCondition; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; import com.gregtechceu.gtceu.api.registry.registrate.CompassNode; import com.gregtechceu.gtceu.api.registry.registrate.CompassSection; import com.gregtechceu.gtceu.api.sound.SoundEntry; @@ -52,7 +52,7 @@ public final class GTRegistries { public static final GTRegistry.RL MACHINES = new GTRegistry.RL<>(GTCEu.id("machine")); public static final GTRegistry.String> RECIPE_CAPABILITIES = new GTRegistry.String<>( GTCEu.id("recipe_capability")); - public static final GTRegistry.String> RECIPE_CONDITIONS = new GTRegistry.String<>( + public static final GTRegistry.String> RECIPE_CONDITIONS = new GTRegistry.String<>( GTCEu.id("recipe_condition")); public static final GTRegistry.String CHANCE_LOGICS = new GTRegistry.String<>( GTCEu.id("chance_logic")); diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistry.java b/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistry.java index 3e042c3118..2b00d1fe95 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistry.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistry.java @@ -86,7 +86,7 @@ private boolean checkActiveModContainerIsGregtech() { container.getModId().equals("minecraft")); // check for minecraft modid in case of datagen or a mishap } - public void register(K key, V value) { + public T register(K key, T value) { if (frozen) { throw new IllegalStateException("[register] registry %s has been frozen".formatted(registryName)); } @@ -95,24 +95,27 @@ public void register(K key, V value) { "[register] registry %s contains key %s already".formatted(registryName, key)); } registry.put(key, value); + return value; } @Nullable - public V replace(K key, V value) { + public T replace(K key, T value) { if (frozen) { throw new IllegalStateException("[replace] registry %s has been frozen".formatted(registryName)); } if (!containKey(key)) { GTCEu.LOGGER.warn("[replace] couldn't find key %s in registry %s".formatted(registryName, key)); } - return registry.put(key, value); + registry.put(key, value); + return value; } - public V registerOrOverride(K key, V value) { + public T registerOrOverride(K key, T value) { if (frozen) { throw new IllegalStateException("[register] registry %s has been frozen".formatted(registryName)); } - return registry.put(key, value); + registry.put(key, value); + return value; } @NotNull diff --git a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java index c1f7f35e7e..336acbcfc7 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java @@ -8,22 +8,27 @@ import com.gregtechceu.gtceu.api.gui.compass.GTRecipeViewCreator; import com.gregtechceu.gtceu.api.gui.compass.MultiblockAction; import com.gregtechceu.gtceu.client.particle.HazardParticle; +import com.gregtechceu.gtceu.client.renderer.entity.GTBoatRenderer; import com.gregtechceu.gtceu.client.renderer.entity.GTExplosiveRenderer; import com.gregtechceu.gtceu.common.CommonProxy; import com.gregtechceu.gtceu.common.data.GTBlockEntities; import com.gregtechceu.gtceu.common.data.GTEntityTypes; import com.gregtechceu.gtceu.common.data.GTParticleTypes; +import com.gregtechceu.gtceu.common.entity.GTBoat; import com.gregtechceu.gtceu.utils.input.KeyBind; import com.lowdragmc.lowdraglib.gui.compass.CompassManager; import com.lowdragmc.lowdraglib.gui.compass.component.RecipeComponent; +import net.minecraft.client.model.BoatModel; +import net.minecraft.client.model.ChestBoatModel; import net.minecraft.client.renderer.blockentity.HangingSignRenderer; import net.minecraft.client.renderer.blockentity.SignRenderer; import net.minecraft.client.renderer.entity.ThrownItemRenderer; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.client.event.RegisterGuiOverlaysEvent; import net.minecraftforge.client.event.RegisterKeyMappingsEvent; @@ -64,6 +69,15 @@ public void onRegisterEntityRenderers(EntityRenderersEvent.RegisterRenderers eve event.registerBlockEntityRenderer(GTBlockEntities.GT_SIGN.get(), SignRenderer::new); event.registerBlockEntityRenderer(GTBlockEntities.GT_HANGING_SIGN.get(), HangingSignRenderer::new); + + event.registerEntityRenderer(GTEntityTypes.BOAT.get(), c -> new GTBoatRenderer(c, false)); + event.registerEntityRenderer(GTEntityTypes.CHEST_BOAT.get(), c -> new GTBoatRenderer(c, true)); + + for (var type : GTBoat.BoatType.values()) { + ForgeHooksClient.registerLayerDefinition(GTBoatRenderer.getBoatModelName(type), BoatModel::createBodyModel); + ForgeHooksClient.registerLayerDefinition(GTBoatRenderer.getChestBoatModelName(type), + ChestBoatModel::createBodyModel); + } } @SubscribeEvent diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/entity/GTBoatRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/entity/GTBoatRenderer.java new file mode 100644 index 0000000000..f5b3d71d55 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/entity/GTBoatRenderer.java @@ -0,0 +1,60 @@ +package com.gregtechceu.gtceu.client.renderer.entity; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.common.entity.GTBoat; +import com.gregtechceu.gtceu.common.entity.GTChestBoat; + +import net.minecraft.client.model.BoatModel; +import net.minecraft.client.model.ChestBoatModel; +import net.minecraft.client.model.ListModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.renderer.entity.BoatRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.vehicle.Boat; + +import com.google.common.collect.ImmutableMap; +import com.mojang.datafixers.util.Pair; + +import java.util.Map; +import java.util.stream.Stream; + +public class GTBoatRenderer extends BoatRenderer { + + private final Map>> boats; + + public GTBoatRenderer(EntityRendererProvider.Context context, boolean chestBoat) { + super(context, chestBoat); + boats = Stream.of(GTBoat.BoatType.values()).collect(ImmutableMap.toImmutableMap(k -> k, + (m) -> Pair.of(new ResourceLocation(GTCEu.MOD_ID, + getTextureLocation(m, chestBoat)), createBoatModel(context, m, chestBoat)))); + } + + @Override + public Pair> getModelWithLocation(Boat boat) { + if (boat instanceof GTChestBoat gtcb) { + return this.boats.get(gtcb.getBoatType()); + } else + return this.boats.get(((GTBoat) boat).getBoatType()); + } + + private static String getTextureLocation(GTBoat.BoatType type, boolean chest) { + return chest ? "textures/entity/boat/" + type.getName() + "_chest_boat.png" : + "textures/entity/boat/" + type.getName() + "_boat.png"; + } + + private BoatModel createBoatModel(EntityRendererProvider.Context context, GTBoat.BoatType type, boolean chest) { + ModelLayerLocation modelLoc = chest ? getChestBoatModelName(type) : getBoatModelName(type); + ModelPart part = context.bakeLayer(modelLoc); + return chest ? new ChestBoatModel(part) : new BoatModel(part); + } + + public static ModelLayerLocation getChestBoatModelName(GTBoat.BoatType type) { + return new ModelLayerLocation(new ResourceLocation(GTCEu.MOD_ID, "chest_boat/" + type.getName()), "main"); + } + + public static ModelLayerLocation getBoatModelName(GTBoat.BoatType type) { + return new ModelLayerLocation(new ResourceLocation(GTCEu.MOD_ID, "boat/" + type.getName()), "main"); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java index f6e82919bc..c123384a66 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java @@ -980,7 +980,7 @@ private static BlockEntry createFireboxCasing(BoilerFireboxType typ .properties(p -> p.mapColor(MapColor.FIRE).instabreak().sound(SoundType.GRASS).ignitedByLava()) .tag(BlockTags.MINEABLE_WITH_AXE) .blockstate((ctx, prov) -> prov.simpleBlock(ctx.get(), prov.models().cubeBottomTop(ctx.getName(), - prov.blockTexture(ctx.get()).withSuffix("_side"), + GTCEu.id("block/misc/industrial_tnt_side"), new ResourceLocation("minecraft", "block/tnt_bottom"), new ResourceLocation("minecraft", "block/tnt_top")))) .simpleItem() @@ -1073,8 +1073,10 @@ public static ItemColor leavesItemColor() { .initialProperties(() -> Blocks.STRIPPED_SPRUCE_LOG) .lang("Stripped Rubber Log") .blockstate((ctx, provider) -> provider.logBlock(ctx.get())) - .tag(BlockTags.MINEABLE_WITH_AXE) - .simpleItem() + .tag(BlockTags.LOGS_THAT_BURN, BlockTags.MINEABLE_WITH_AXE) + .item() + .tag(ItemTags.LOGS_THAT_BURN) + .build() .register(); public static final BlockEntry RUBBER_WOOD = REGISTRATE .block("rubber_wood", RotatedPillarBlock::new) @@ -1082,8 +1084,10 @@ public static ItemColor leavesItemColor() { .lang("Rubber Wood") .blockstate((ctx, provider) -> provider.axisBlock(ctx.get(), provider.blockTexture(GTBlocks.RUBBER_LOG.get()), provider.blockTexture(GTBlocks.RUBBER_LOG.get()))) - .tag(BlockTags.MINEABLE_WITH_AXE) - .simpleItem() + .tag(BlockTags.LOGS_THAT_BURN, BlockTags.MINEABLE_WITH_AXE) + .item() + .tag(ItemTags.LOGS_THAT_BURN) + .build() .register(); public static final BlockEntry STRIPPED_RUBBER_WOOD = REGISTRATE .block("stripped_rubber_wood", RotatedPillarBlock::new) @@ -1091,8 +1095,10 @@ public static ItemColor leavesItemColor() { .lang("Stripped Rubber Wood") .blockstate((ctx, provider) -> provider.axisBlock(ctx.get(), provider.blockTexture(ctx.get()), provider.blockTexture(ctx.get()))) - .tag(BlockTags.MINEABLE_WITH_AXE) - .simpleItem() + .tag(BlockTags.LOGS_THAT_BURN, BlockTags.MINEABLE_WITH_AXE) + .item() + .tag(ItemTags.LOGS_THAT_BURN) + .build() .register(); public static final BlockEntry RUBBER_PLANK = REGISTRATE @@ -1298,6 +1304,7 @@ public static ItemColor leavesItemColor() { .tag(ItemTags.WOODEN_FENCES) .build() .register(); + public static final BlockEntry TREATED_WOOD_SIGN = REGISTRATE .block("treated_wood_sign", (p) -> new GTStandingSignBlock(p, TREATED_WOOD_TYPE)) .initialProperties(() -> Blocks.SPRUCE_SIGN) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTEntityTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTEntityTypes.java index 13a09ffdcf..5a7d473cce 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTEntityTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTEntityTypes.java @@ -1,8 +1,6 @@ package com.gregtechceu.gtceu.common.data; -import com.gregtechceu.gtceu.common.entity.DynamiteEntity; -import com.gregtechceu.gtceu.common.entity.IndustrialTNTEntity; -import com.gregtechceu.gtceu.common.entity.PowderbarrelEntity; +import com.gregtechceu.gtceu.common.entity.*; import net.minecraft.tags.EntityTypeTags; import net.minecraft.world.entity.MobCategory; @@ -32,5 +30,17 @@ public class GTEntityTypes { .properties(builder -> builder.sized(0.98F, 0.98F).fireImmune().clientTrackingRange(10).updateInterval(10)) .register(); + public static final EntityEntry BOAT = REGISTRATE + .entity("boat", GTBoat::new, MobCategory.MISC) + .lang("Boat") + .properties(builder -> builder.sized(1.375f, 0.5625f).clientTrackingRange(10)) + .register(); + + public static final EntityEntry CHEST_BOAT = REGISTRATE + .entity("chest_boat", GTChestBoat::new, MobCategory.MISC) + .lang("Chest Boat") + .properties(builder -> builder.sized(1.375f, 0.5625f).clientTrackingRange(10)) + .register(); + public static void init() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java index 9e264e4437..e9972a71e9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java @@ -31,6 +31,7 @@ import com.gregtechceu.gtceu.api.registry.registrate.CompassSection; import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; import com.gregtechceu.gtceu.common.data.materials.GTFoods; +import com.gregtechceu.gtceu.common.entity.GTBoat; import com.gregtechceu.gtceu.common.item.*; import com.gregtechceu.gtceu.common.item.armor.*; import com.gregtechceu.gtceu.common.item.tool.behavior.LighterBehavior; @@ -2693,6 +2694,27 @@ public Component getItemName(ItemStack stack) { public static ItemEntry BLACKLIGHT = REGISTRATE.item("blacklight", Item::new) .onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry RUBBER_BOAT = REGISTRATE + .item("rubber_boat", p -> new GTBoatItem(false, GTBoat.BoatType.RUBBER, new Item.Properties())) + .lang("Rubber Boat") + .register(); + + public static ItemEntry TREATED_WOOD_BOAT = REGISTRATE + .item("treated_wood_boat", p -> new GTBoatItem(false, GTBoat.BoatType.TREATED_WOOD, new Item.Properties())) + .lang("Treated Wood Boat") + .register(); + + public static ItemEntry RUBBER_CHEST_BOAT = REGISTRATE + .item("rubber_chest_boat", p -> new GTBoatItem(true, GTBoat.BoatType.RUBBER, new Item.Properties())) + .lang("Rubber Boat with Chest") + .register(); + + public static ItemEntry TREATED_WOOD_CHEST_BOAT = REGISTRATE + .item("treated_wood_chest_boat", + p -> new GTBoatItem(true, GTBoat.BoatType.TREATED_WOOD, new Item.Properties())) + .lang("Treated Wood Boat with Chest") + .register(); + public static void init() { generateMaterialItems(); generateTools(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java index 224eaf27af..1119778619 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java @@ -123,6 +123,7 @@ public static void init() { ingot.setIgnored(Iron, Items.IRON_INGOT); ingot.setIgnored(Gold, Items.GOLD_INGOT); ingot.setIgnored(Copper, Items.COPPER_INGOT); + ingot.setIgnored(Brick, Items.BRICK); ingot.setIgnored(Wax, Items.HONEYCOMB); nugget.setIgnored(Gold, Items.GOLD_NUGGET); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTModels.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTModels.java index e4b2e48589..49cd489948 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTModels.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTModels.java @@ -256,9 +256,9 @@ public static NonNullBiConsumer, RegistrateB IBatteryData batteryData) { return (ctx, prov) -> { prov.simpleBlock(ctx.getEntry(), prov.models().cubeBottomTop(name, + GTCEu.id("block/casings/battery/" + batteryData.getBatteryName() + "/side"), GTCEu.id("block/casings/battery/" + batteryData.getBatteryName() + "/top"), - GTCEu.id("block/casings/battery/" + batteryData.getBatteryName() + "/top"), - GTCEu.id("block/casings/battery/" + batteryData.getBatteryName() + "/side"))); + GTCEu.id("block/casings/battery/" + batteryData.getBatteryName() + "/top"))); }; } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeConditions.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeConditions.java index b417b96201..0851426579 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeConditions.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeConditions.java @@ -2,11 +2,9 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTCEuAPI; -import com.gregtechceu.gtceu.api.addon.AddonFinder; -import com.gregtechceu.gtceu.api.addon.IGTAddon; -import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.gregtechceu.gtceu.common.recipe.*; +import com.gregtechceu.gtceu.common.recipe.condition.*; import net.minecraftforge.fml.ModLoader; @@ -17,31 +15,53 @@ */ public final class GTRecipeConditions { + static { + GTRegistries.RECIPE_CONDITIONS.unfreeze(); + } + private GTRecipeConditions() {} - public static void init() { - GTRegistries.RECIPE_CONDITIONS.unfreeze(); + public static final RecipeConditionType BIOME = GTRegistries.RECIPE_CONDITIONS.register("biome", + new RecipeConditionType<>(BiomeCondition::new, BiomeCondition.CODEC)); + public static final RecipeConditionType DIMENSION = GTRegistries.RECIPE_CONDITIONS + .register("dimension", new RecipeConditionType<>(DimensionCondition::new, DimensionCondition.CODEC)); + public static final RecipeConditionType POSITION_Y = GTRegistries.RECIPE_CONDITIONS + .register("pos_y", new RecipeConditionType<>(PositionYCondition::new, PositionYCondition.CODEC)); + public static final RecipeConditionType RAINING = GTRegistries.RECIPE_CONDITIONS.register("rain", + new RecipeConditionType<>(RainingCondition::new, RainingCondition.CODEC)); + public static final RecipeConditionType ROCK_BREAKER = GTRegistries.RECIPE_CONDITIONS + .register("rock_breaker", new RecipeConditionType<>(RockBreakerCondition::new, RockBreakerCondition.CODEC)); + public static final RecipeConditionType ADJACENT_BLOCK = GTRegistries.RECIPE_CONDITIONS + .register("adjacent_block", + new RecipeConditionType<>(AdjacentBlockCondition::new, AdjacentBlockCondition.CODEC)); + public static final RecipeConditionType THUNDER = GTRegistries.RECIPE_CONDITIONS + .register("thunder", new RecipeConditionType<>(ThunderCondition::new, ThunderCondition.CODEC)); + public static final RecipeConditionType VENT = GTRegistries.RECIPE_CONDITIONS.register("steam_vent", + new RecipeConditionType<>(VentCondition::new, VentCondition.CODEC)); + public static final RecipeConditionType CLEANROOM = GTRegistries.RECIPE_CONDITIONS + .register("cleanroom", new RecipeConditionType<>(CleanroomCondition::new, CleanroomCondition.CODEC)); + public static final RecipeConditionType EU_TO_START = GTRegistries.RECIPE_CONDITIONS + .register("eu_to_start", new RecipeConditionType<>(EUToStartCondition::new, EUToStartCondition.CODEC)); + public static final RecipeConditionType RESEARCH = GTRegistries.RECIPE_CONDITIONS + .register("research", new RecipeConditionType<>(ResearchCondition::new, ResearchCondition.CODEC)); + public static final RecipeConditionType ENVIRONMENTAL_HAZARD = GTRegistries.RECIPE_CONDITIONS + .register("environmental_hazard", + new RecipeConditionType<>(EnvironmentalHazardCondition::new, EnvironmentalHazardCondition.CODEC)); + public static final RecipeConditionType RPM; - GTRegistries.RECIPE_CONDITIONS.register(BiomeCondition.INSTANCE.getType(), BiomeCondition.class); - GTRegistries.RECIPE_CONDITIONS.register(DimensionCondition.INSTANCE.getType(), DimensionCondition.class); - GTRegistries.RECIPE_CONDITIONS.register(PositionYCondition.INSTANCE.getType(), PositionYCondition.class); - GTRegistries.RECIPE_CONDITIONS.register(RainingCondition.INSTANCE.getType(), RainingCondition.class); - GTRegistries.RECIPE_CONDITIONS.register(RockBreakerCondition.INSTANCE.getType(), RockBreakerCondition.class); - GTRegistries.RECIPE_CONDITIONS.register(AdjacentBlockCondition.INSTANCE.getType(), - AdjacentBlockCondition.class); - GTRegistries.RECIPE_CONDITIONS.register(ThunderCondition.INSTANCE.getType(), ThunderCondition.class); - GTRegistries.RECIPE_CONDITIONS.register(VentCondition.INSTANCE.getType(), VentCondition.class); - GTRegistries.RECIPE_CONDITIONS.register(CleanroomCondition.INSTANCE.getType(), CleanroomCondition.class); - GTRegistries.RECIPE_CONDITIONS.register(ResearchCondition.INSTANCE.getType(), ResearchCondition.class); - GTRegistries.RECIPE_CONDITIONS.register(EnvironmentalHazardCondition.INSTANCE.getType(), - EnvironmentalHazardCondition.class); + static { if (GTCEu.isCreateLoaded()) { - GTRegistries.RECIPE_CONDITIONS.register(RPMCondition.INSTANCE.getType(), RPMCondition.class); + RPM = GTRegistries.RECIPE_CONDITIONS.register("rpm", + new RecipeConditionType<>(RPMCondition::new, RPMCondition.CODEC)); + } else { + RPM = null; } + } - AddonFinder.getAddons().forEach(IGTAddon::registerRecipeConditions); + public static void init() { + // noinspection unchecked ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.RECIPE_CONDITIONS, - (Class>) RecipeCondition.class.getClass())); + (Class>) (Class) RecipeConditionType.class)); GTRegistries.RECIPE_CONDITIONS.freeze(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java index a5c70bb03b..b45518ef15 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java @@ -18,8 +18,8 @@ import com.gregtechceu.gtceu.api.transfer.fluid.CustomFluidTank; import com.gregtechceu.gtceu.common.machine.trait.customlogic.CannerLogic; import com.gregtechceu.gtceu.common.machine.trait.customlogic.FormingPressLogic; -import com.gregtechceu.gtceu.common.recipe.RPMCondition; -import com.gregtechceu.gtceu.common.recipe.RockBreakerCondition; +import com.gregtechceu.gtceu.common.recipe.condition.RPMCondition; +import com.gregtechceu.gtceu.common.recipe.condition.RockBreakerCondition; import com.gregtechceu.gtceu.data.recipe.RecipeHelper; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; import com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo; diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTSyncedFieldAccessors.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTSyncedFieldAccessors.java index 973d815c42..ebe7a4f95e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTSyncedFieldAccessors.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTSyncedFieldAccessors.java @@ -1,8 +1,9 @@ package com.gregtechceu.gtceu.common.data; import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.syncdata.FluidStackPayload; -import com.gregtechceu.gtceu.syncdata.GTRecipeAccessor; +import com.gregtechceu.gtceu.syncdata.GTRecipePayload; import com.gregtechceu.gtceu.syncdata.GTRecipeTypeAccessor; import com.gregtechceu.gtceu.syncdata.MaterialPayload; @@ -20,14 +21,13 @@ */ public class GTSyncedFieldAccessors { - public static final IAccessor GT_RECIPE_ACCESSOR = new GTRecipeAccessor(); public static final IAccessor GT_RECIPE_TYPE_ACCESSOR = new GTRecipeTypeAccessor(); public static void init() { - register(FriendlyBufPayload.class, FriendlyBufPayload::new, GT_RECIPE_ACCESSOR, 1000); register(FriendlyBufPayload.class, FriendlyBufPayload::new, GT_RECIPE_TYPE_ACCESSOR, 1000); registerSimple(MaterialPayload.class, MaterialPayload::new, Material.class, 1); registerSimple(FluidStackPayload.class, FluidStackPayload::new, FluidStack.class, -1); + registerSimple(GTRecipePayload.class, GTRecipePayload::new, GTRecipe.class, 100); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/entity/GTBoat.java b/src/main/java/com/gregtechceu/gtceu/common/entity/GTBoat.java new file mode 100644 index 0000000000..6986a26b67 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/entity/GTBoat.java @@ -0,0 +1,123 @@ +package com.gregtechceu.gtceu.common.entity; + +import com.gregtechceu.gtceu.common.data.GTBlocks; +import com.gregtechceu.gtceu.common.data.GTEntityTypes; +import com.gregtechceu.gtceu.common.data.GTItems; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; + +import org.jetbrains.annotations.Nullable; + +import java.util.Arrays; + +public class GTBoat extends Boat { + + public GTBoat(EntityType entityType, Level level) { + super(entityType, level); + this.blocksBuilding = true; + } + + public GTBoat(Level level, double x, double y, double z) { + super(GTEntityTypes.BOAT.get(), level); + this.setPos(x, y, z); + this.xo = x; + this.yo = y; + this.zo = z; + } + + @Nullable + @Override + public Component getCustomName() { + return super.getCustomName(); + } + + @Override + public Packet getAddEntityPacket() { + return new ClientboundAddEntityPacket(this); + } + + @Override + protected void addAdditionalSaveData(CompoundTag compound) { + compound.putString("Type", getBoatType().getName()); + } + + @Override + protected void readAdditionalSaveData(CompoundTag compound) { + if (compound.contains("Type")) { + entityData.set(DATA_ID_TYPE, BoatType.byName(compound.getString("Type")).ordinal()); + } + } + + @Override + public Item getDropItem() { + return switch (BoatType.byId(this.entityData.get(DATA_ID_TYPE))) { + case RUBBER -> GTItems.RUBBER_BOAT.get(); + case TREATED_WOOD -> GTItems.TREATED_WOOD_BOAT.get(); + }; + } + + public void setBoatType(BoatType type) { + this.entityData.set(DATA_ID_TYPE, type.ordinal()); + } + + public BoatType getBoatType() { + return BoatType.byId(entityData.get(DATA_ID_TYPE)); + } + + @Override + public void setVariant(Type variant) {} + + @Override + public Type getVariant() { + return Type.OAK; + } + + public enum BoatType { + + RUBBER("rubber", GTBlocks.RUBBER_PLANK.get()), + TREATED_WOOD("treated", GTBlocks.TREATED_WOOD_PLANK.get()); + + private final String name; + private final Block planks; + + private static final BoatType[] VALUES = values(); + + private BoatType(String name, Block planks) { + this.name = name; + this.planks = planks; + } + + public String getName() { + return this.name; + } + + public Block getPlanks() { + return this.planks; + } + + public String toString() { + return this.name; + } + + /** + * Get a boat type by its enum ordinal + */ + public static BoatType byId(int id) { + if (id < 0 || id >= VALUES.length) id = 0; + return VALUES[id]; + } + + public static BoatType byName(String name) { + return Arrays.stream(VALUES).filter(type -> type.getName().equals(name)).findFirst().orElse(VALUES[0]); + } + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/entity/GTChestBoat.java b/src/main/java/com/gregtechceu/gtceu/common/entity/GTChestBoat.java new file mode 100644 index 0000000000..81825a0b61 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/entity/GTChestBoat.java @@ -0,0 +1,71 @@ +package com.gregtechceu.gtceu.common.entity; + +import com.gregtechceu.gtceu.common.data.GTEntityTypes; +import com.gregtechceu.gtceu.common.data.GTItems; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.vehicle.ChestBoat; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; + +public class GTChestBoat extends ChestBoat { + + public GTChestBoat(EntityType entityType, Level level) { + super(entityType, level); + this.blocksBuilding = true; + } + + public GTChestBoat(Level level, double x, double y, double z) { + super(GTEntityTypes.CHEST_BOAT.get(), level); + this.setPos(x, y, z); + this.xo = x; + this.yo = y; + this.zo = z; + } + + @Override + public Packet getAddEntityPacket() { + return new ClientboundAddEntityPacket(this); + } + + @Override + protected void addAdditionalSaveData(CompoundTag compound) { + compound.putString("Type", getBoatType().getName()); + } + + @Override + protected void readAdditionalSaveData(CompoundTag compound) { + if (compound.contains("Type")) { + entityData.set(DATA_ID_TYPE, GTBoat.BoatType.byName(compound.getString("Type")).ordinal()); + } + } + + @Override + public Item getDropItem() { + return switch (GTBoat.BoatType.byId(this.entityData.get(DATA_ID_TYPE))) { + case RUBBER -> GTItems.RUBBER_CHEST_BOAT.get(); + case TREATED_WOOD -> GTItems.TREATED_WOOD_CHEST_BOAT.get(); + }; + } + + public void setBoatType(GTBoat.BoatType type) { + this.entityData.set(DATA_ID_TYPE, type.ordinal()); + } + + public GTBoat.BoatType getBoatType() { + return GTBoat.BoatType.byId(entityData.get(DATA_ID_TYPE)); + } + + @Override + public void setVariant(Type variant) {} + + @Override + public Type getVariant() { + return Type.OAK; + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/GTBoatItem.java b/src/main/java/com/gregtechceu/gtceu/common/item/GTBoatItem.java new file mode 100644 index 0000000000..945cc8a009 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/item/GTBoatItem.java @@ -0,0 +1,91 @@ +package com.gregtechceu.gtceu.common.item; + +import com.gregtechceu.gtceu.common.entity.GTBoat; +import com.gregtechceu.gtceu.common.entity.GTChestBoat; + +import net.minecraft.stats.Stats; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.DispenserBlock; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; + +import java.util.List; +import java.util.function.Predicate; + +public class GTBoatItem extends Item { + + private static final Predicate ENTITY_PREDICATE = EntitySelector.NO_SPECTATORS.and(Entity::isPickable); + private final GTBoat.BoatType type; + private final boolean hasChest; + + public GTBoatItem(boolean hasChest, GTBoat.BoatType type, Item.Properties properties) { + super(properties); + this.hasChest = hasChest; + this.type = type; + DispenserBlock.registerBehavior(this, new GTBoatItemDispenseBehaviour(type, hasChest)); + } + + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + ItemStack itemstack = player.getItemInHand(hand); + HitResult hitresult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.ANY); + if (hitresult.getType() == HitResult.Type.MISS) { + return InteractionResultHolder.pass(itemstack); + } else { + Vec3 vec3 = player.getViewVector(1.0F); + double d0 = 5.0; + List list = level.getEntities(player, + player.getBoundingBox().expandTowards(vec3.scale(5.0)).inflate(1.0), ENTITY_PREDICATE); + if (!list.isEmpty()) { + Vec3 vec31 = player.getEyePosition(); + for (Entity e : list) { + AABB aabb = e.getBoundingBox().inflate((double) e.getPickRadius()); + if (aabb.contains(vec31)) { + return InteractionResultHolder.pass(itemstack); + } + } + } + + if (hitresult.getType() == HitResult.Type.BLOCK) { + Boat boat; + if (hasChest) { + boat = new GTChestBoat(level, hitresult.getLocation().x, hitresult.getLocation().y, + hitresult.getLocation().z); + ((GTChestBoat) boat).setBoatType(type); + } else { + boat = new GTBoat(level, hitresult.getLocation().x, hitresult.getLocation().y, + hitresult.getLocation().z); + ((GTBoat) boat).setBoatType(type); + } + + boat.setYRot(player.getYRot()); + if (!level.noCollision(boat, boat.getBoundingBox())) { + return InteractionResultHolder.fail(itemstack); + } else { + if (!level.isClientSide) { + level.addFreshEntity(boat); + level.gameEvent(player, GameEvent.ENTITY_PLACE, hitresult.getLocation()); + if (!player.getAbilities().instabuild) { + itemstack.shrink(1); + } + } + + player.awardStat(Stats.ITEM_USED.get(this)); + return InteractionResultHolder.sidedSuccess(itemstack, level.isClientSide()); + } + } else { + return InteractionResultHolder.pass(itemstack); + } + } + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/GTBoatItemDispenseBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/GTBoatItemDispenseBehaviour.java new file mode 100644 index 0000000000..edad373466 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/item/GTBoatItemDispenseBehaviour.java @@ -0,0 +1,72 @@ +package com.gregtechceu.gtceu.common.item; + +import com.gregtechceu.gtceu.common.entity.GTBoat; +import com.gregtechceu.gtceu.common.entity.GTChestBoat; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.BlockSource; +import net.minecraft.core.Direction; +import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.DispenserBlock; + +public class GTBoatItemDispenseBehaviour extends DefaultDispenseItemBehavior { + + private final DefaultDispenseItemBehavior defaultDispenseItemBehavior = new DefaultDispenseItemBehavior(); + private final GTBoat.BoatType type; + private final boolean isChestBoat; + + public GTBoatItemDispenseBehaviour(GTBoat.BoatType type) { + this(type, false); + } + + public GTBoatItemDispenseBehaviour(GTBoat.BoatType type, boolean isChestBoat) { + this.type = type; + this.isChestBoat = isChestBoat; + } + + public ItemStack execute(BlockSource source, ItemStack stack) { + Direction direction = (Direction) source.getBlockState().getValue(DispenserBlock.FACING); + Level level = source.getLevel(); + double d0 = 0.5625 + (double) EntityType.BOAT.getWidth() / 2.0; + double d1 = source.x() + (double) direction.getStepX() * d0; + double d2 = source.y() + (double) ((float) direction.getStepY() * 1.125F); + double d3 = source.z() + (double) direction.getStepZ() * d0; + BlockPos blockpos = source.getPos().relative(direction); + + Boat boat; + if (isChestBoat) { + boat = new GTChestBoat(level, d0, d1, d2); + ((GTChestBoat) boat).setBoatType(type); + } else { + boat = new GTBoat(level, d0, d1, d2); + ((GTBoat) boat).setBoatType(type); + } + + boat.setYRot(direction.toYRot()); + double d4; + if (((Boat) boat).canBoatInFluid(level.getFluidState(blockpos))) { + d4 = 1.0; + } else { + if (!level.getBlockState(blockpos).isAir() || + !((Boat) boat).canBoatInFluid(level.getFluidState(blockpos.below()))) { + return this.defaultDispenseItemBehavior.dispense(source, stack); + } + + d4 = 0.0; + } + + ((Boat) boat).setPos(d1, d2 + d4, d3); + level.addFreshEntity((Entity) boat); + stack.shrink(1); + return stack; + } + + protected void playSound(BlockSource source) { + source.getLevel().levelEvent(1000, source.getPos(), 0); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java index 612f4772ce..3aa735944d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java @@ -11,6 +11,7 @@ import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeHelper; +import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.logic.OCParams; import com.gregtechceu.gtceu.api.recipe.logic.OCResult; import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; @@ -114,6 +115,14 @@ public static GTRecipe recipeModifier(MetaMachine machine, @NotNull GTRecipe rec long eut = turbineMachine.boostProduction((long) (EUt * holderEfficiency * parallelResult.getSecond())); + recipe = new GTRecipe(recipe.recipeType, recipe.id, + recipe.copyContents(recipe.inputs, ContentModifier.multiplier(parallelResult.getSecond())), + recipe.copyContents(recipe.outputs, ContentModifier.multiplier(parallelResult.getSecond())), + recipe.tickInputs, recipe.tickOutputs, recipe.inputChanceLogics, recipe.outputChanceLogics, + recipe.tickInputChanceLogics, recipe.tickOutputChanceLogics, recipe.conditions, + recipe.ingredientActions, + recipe.data, recipe.duration, recipe.isFuel); + result.init(-eut, recipe.duration, parallelResult.getSecond(), params.getOcAmount()); return recipe; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java index 2b6ad191b0..1fea9651b7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java @@ -16,7 +16,7 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.common.item.PortableScannerBehavior; import com.gregtechceu.gtceu.common.machine.multiblock.electric.research.DataBankMachine; -import com.gregtechceu.gtceu.common.recipe.ResearchCondition; +import com.gregtechceu.gtceu.common.recipe.condition.ResearchCondition; import com.gregtechceu.gtceu.utils.ItemStackHashStrategy; import com.gregtechceu.gtceu.utils.ResearchManager; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java index 34d104c590..fd28c3939c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java @@ -304,7 +304,7 @@ public boolean onLeftClick(Player player, Level world, InteractionHand hand, Blo var drained = cache.extractItem(0, player.isShiftKeyDown() ? stored.getItem().getMaxStackSize() : 1, false); if (!drained.isEmpty()) { - if (player.addItem(drained)) { + if (!player.addItem(drained)) { Block.popResource(world, getPos().relative(getFrontFacing()), drained); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumTankMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumTankMachine.java index 22b9da889e..ae31c03d89 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumTankMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumTankMachine.java @@ -123,7 +123,9 @@ public int fill(FluidStack resource, FluidAction action) { private int handleVoiding(int filled, FluidStack resource) { if (filled < resource.getAmount() && isVoiding && isFluidValid(0, resource)) { - return resource.getAmount(); + if (stored.isEmpty() || stored.isFluidEqual(resource)) { + return resource.getAmount(); + } } return filled; diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/AdjacentBlockCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentBlockCondition.java similarity index 70% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/AdjacentBlockCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentBlockCondition.java index 6ae076a69b..5774deb674 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/AdjacentBlockCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/AdjacentBlockCondition.java @@ -1,8 +1,10 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import com.gregtechceu.gtceu.utils.GTUtil; import net.minecraft.core.Direction; @@ -10,15 +12,26 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; +@NoArgsConstructor public class AdjacentBlockCondition extends RecipeCondition { + public static final Codec CODEC = RecordCodecBuilder + .create(instance -> RecipeCondition.isReverse(instance) + .apply(instance, AdjacentBlockCondition::new)); public final static AdjacentBlockCondition INSTANCE = new AdjacentBlockCondition(); + public AdjacentBlockCondition(boolean isReverse) { + super(isReverse); + } + @Override - public String getType() { - return "adjacent_block"; + public RecipeConditionType getType() { + return GTRecipeConditions.ADJACENT_BLOCK; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/BiomeCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/BiomeCondition.java similarity index 76% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/BiomeCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/BiomeCondition.java index 6293fee73d..2f2755d17c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/BiomeCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/BiomeCondition.java @@ -1,8 +1,10 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; @@ -15,6 +17,8 @@ import net.minecraft.world.level.biome.Biome; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @@ -26,16 +30,26 @@ @NoArgsConstructor public class BiomeCondition extends RecipeCondition { + public static final Codec CODEC = RecordCodecBuilder + .create(instance -> RecipeCondition.isReverse(instance) + .and(ResourceLocation.CODEC.fieldOf("biome").forGetter(val -> val.biome)) + .apply(instance, BiomeCondition::new)); + public final static BiomeCondition INSTANCE = new BiomeCondition(); private ResourceLocation biome = new ResourceLocation("dummy"); + public BiomeCondition(boolean isReverse, ResourceLocation biome) { + super(isReverse); + this.biome = biome; + } + public BiomeCondition(ResourceLocation biome) { this.biome = biome; } @Override - public String getType() { - return "biome"; + public RecipeConditionType getType() { + return GTRecipeConditions.BIOME; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/CleanroomCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/CleanroomCondition.java similarity index 78% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/CleanroomCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/CleanroomCondition.java index 2040782aea..9105335357 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/CleanroomCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/CleanroomCondition.java @@ -1,4 +1,4 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.capability.ICleanroomReceiver; import com.gregtechceu.gtceu.api.machine.MetaMachine; @@ -8,6 +8,8 @@ import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import com.gregtechceu.gtceu.config.ConfigHolder; import net.minecraft.network.FriendlyByteBuf; @@ -15,6 +17,8 @@ import net.minecraft.util.GsonHelper; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -24,14 +28,23 @@ @NoArgsConstructor public class CleanroomCondition extends RecipeCondition { + public static final Codec CODEC = RecordCodecBuilder + .create(instance -> RecipeCondition.isReverse(instance) + .and(CleanroomType.CODEC.fieldOf("cleanroom").forGetter(val -> val.cleanroom)) + .apply(instance, CleanroomCondition::new)); public final static CleanroomCondition INSTANCE = new CleanroomCondition(); @Getter private CleanroomType cleanroom = CleanroomType.CLEANROOM; + public CleanroomCondition(boolean isReverse, CleanroomType cleanroom) { + super(isReverse); + this.cleanroom = cleanroom; + } + @Override - public String getType() { - return "cleanroom"; + public RecipeConditionType getType() { + return GTRecipeConditions.CLEANROOM; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/DimensionCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/DimensionCondition.java similarity index 81% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/DimensionCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/DimensionCondition.java index c7b648faba..931b4854d4 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/DimensionCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/DimensionCondition.java @@ -1,10 +1,12 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.data.DimensionMarker; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; import com.gregtechceu.gtceu.api.registry.GTRegistries; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import com.gregtechceu.gtceu.config.ConfigHolder; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; @@ -21,6 +23,8 @@ import net.minecraft.world.level.block.Blocks; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @@ -32,6 +36,11 @@ @NoArgsConstructor public class DimensionCondition extends RecipeCondition { + public static final Codec CODEC = RecordCodecBuilder + .create(instance -> RecipeCondition.isReverse(instance) + .and(ResourceLocation.CODEC.fieldOf("dimension").forGetter(val -> val.dimension)) + .apply(instance, DimensionCondition::new)); + public final static DimensionCondition INSTANCE = new DimensionCondition(); private ResourceLocation dimension = new ResourceLocation("dummy"); @@ -39,9 +48,14 @@ public DimensionCondition(ResourceLocation dimension) { this.dimension = dimension; } + public DimensionCondition(boolean isReverse, ResourceLocation dimension) { + super(isReverse); + this.dimension = dimension; + } + @Override - public String getType() { - return "dimension"; + public RecipeConditionType getType() { + return GTRecipeConditions.DIMENSION; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/EUToStartCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/EUToStartCondition.java similarity index 72% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/EUToStartCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/EUToStartCondition.java index 063324e118..54f3c4efc8 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/EUToStartCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/EUToStartCondition.java @@ -1,15 +1,19 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.util.GsonHelper; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @@ -21,6 +25,10 @@ @NoArgsConstructor public class EUToStartCondition extends RecipeCondition { + public static final Codec CODEC = RecordCodecBuilder + .create(instance -> RecipeCondition.isReverse(instance) + .and(Codec.LONG.fieldOf("eu_to_start").forGetter(val -> val.euToStart)) + .apply(instance, EUToStartCondition::new)); public static final EUToStartCondition INSTANCE = new EUToStartCondition(); private long euToStart; @@ -29,9 +37,14 @@ public EUToStartCondition(long euToStart) { this.euToStart = euToStart; } + public EUToStartCondition(boolean isReverse, long euToStart) { + super(isReverse); + this.euToStart = euToStart; + } + @Override - public String getType() { - return "eu_to_start"; + public RecipeConditionType getType() { + return GTRecipeConditions.EU_TO_START; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/EnvironmentalHazardCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/EnvironmentalHazardCondition.java similarity index 76% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/EnvironmentalHazardCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/EnvironmentalHazardCondition.java index c97e925669..881b212113 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/EnvironmentalHazardCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/EnvironmentalHazardCondition.java @@ -1,11 +1,13 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.data.medicalcondition.MedicalCondition; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; import com.gregtechceu.gtceu.common.capability.EnvironmentalHazardSavedData; import com.gregtechceu.gtceu.common.data.GTMedicalConditions; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import com.gregtechceu.gtceu.config.ConfigHolder; import net.minecraft.network.FriendlyByteBuf; @@ -14,6 +16,8 @@ import net.minecraft.util.GsonHelper; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -23,14 +27,23 @@ @AllArgsConstructor public class EnvironmentalHazardCondition extends RecipeCondition { - public final static EnvironmentalHazardCondition INSTANCE = new EnvironmentalHazardCondition(); + public static final Codec CODEC = RecordCodecBuilder + .create(instance -> RecipeCondition.isReverse(instance) + .and( + MedicalCondition.CODEC.fieldOf("condition").forGetter(val -> val.condition)) + .apply(instance, EnvironmentalHazardCondition::new)); @Getter private MedicalCondition condition = GTMedicalConditions.CARBON_MONOXIDE_POISONING; + public EnvironmentalHazardCondition(boolean isReverse, MedicalCondition condition) { + super(isReverse); + this.condition = condition; + } + @Override - public String getType() { - return "environmental_hazard"; + public RecipeConditionType getType() { + return GTRecipeConditions.ENVIRONMENTAL_HAZARD; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/PositionYCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/PositionYCondition.java similarity index 71% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/PositionYCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/PositionYCondition.java index 5b5dfd7e15..433c7944c3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/PositionYCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/PositionYCondition.java @@ -1,14 +1,18 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.util.GsonHelper; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @@ -20,6 +24,13 @@ @NoArgsConstructor public class PositionYCondition extends RecipeCondition { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> RecipeCondition + .isReverse(instance) + .and(instance.group( + Codec.INT.fieldOf("min").forGetter(val -> val.min), + Codec.INT.fieldOf("max").forGetter(val -> val.max))) + .apply(instance, PositionYCondition::new)); + public final static PositionYCondition INSTANCE = new PositionYCondition(); private int min; private int max; @@ -29,9 +40,15 @@ public PositionYCondition(int min, int max) { this.max = max; } + public PositionYCondition(boolean isReverse, int min, int max) { + super(isReverse); + this.min = min; + this.max = max; + } + @Override - public String getType() { - return "pos_y"; + public RecipeConditionType getType() { + return GTRecipeConditions.POSITION_Y; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/RPMCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/RPMCondition.java similarity index 77% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/RPMCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/RPMCondition.java index 71883ca34e..e6ae5c6cd1 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/RPMCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/RPMCondition.java @@ -1,10 +1,12 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import com.gregtechceu.gtceu.common.machine.kinetic.IKineticMachine; import net.minecraft.network.FriendlyByteBuf; @@ -12,6 +14,8 @@ import net.minecraft.util.GsonHelper; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @@ -23,16 +27,26 @@ @NoArgsConstructor public class RPMCondition extends RecipeCondition { + public static final Codec CODEC = RecordCodecBuilder + .create(instance -> RecipeCondition.isReverse(instance) + .and(Codec.FLOAT.fieldOf("rpm").forGetter(val -> val.rpm)) + .apply(instance, RPMCondition::new)); + public final static RPMCondition INSTANCE = new RPMCondition(); private float rpm; + public RPMCondition(boolean isReverse, float rpm) { + super(isReverse); + this.rpm = rpm; + } + public RPMCondition(float rpm) { this.rpm = rpm; } @Override - public String getType() { - return "rpm"; + public RecipeConditionType getType() { + return GTRecipeConditions.RPM; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/RainingCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/RainingCondition.java similarity index 72% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/RainingCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/RainingCondition.java index 789e747cec..2df96806fb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/RainingCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/RainingCondition.java @@ -1,8 +1,10 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; @@ -10,6 +12,8 @@ import net.minecraft.world.level.Level; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @@ -21,16 +25,26 @@ @NoArgsConstructor public class RainingCondition extends RecipeCondition { + public static final Codec CODEC = RecordCodecBuilder + .create(instance -> RecipeCondition.isReverse(instance) + .and(Codec.FLOAT.fieldOf("level").forGetter(val -> val.level)) + .apply(instance, RainingCondition::new)); + public final static RainingCondition INSTANCE = new RainingCondition(); private float level; + public RainingCondition(boolean isReverse, float level) { + super(isReverse); + this.level = level; + } + public RainingCondition(float level) { this.level = level; } @Override - public String getType() { - return "rain"; + public RecipeConditionType getType() { + return GTRecipeConditions.RAINING; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/ResearchCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/ResearchCondition.java similarity index 66% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/ResearchCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/ResearchCondition.java index f3ea02cb8a..d7327efff2 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/ResearchCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/ResearchCondition.java @@ -1,30 +1,43 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; import com.gregtechceu.gtceu.api.recipe.ResearchData; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.AllArgsConstructor; import org.jetbrains.annotations.NotNull; @AllArgsConstructor public class ResearchCondition extends RecipeCondition { - public final static ResearchCondition INSTANCE = new ResearchCondition(); + public static final Codec CODEC = RecordCodecBuilder + .create(instance -> RecipeCondition.isReverse(instance) + .and(ResearchData.CODEC.fieldOf("research").forGetter(val -> val.data)) + .apply(instance, ResearchCondition::new)); + public static final ResearchCondition INSTANCE = new ResearchCondition(); public ResearchData data; public ResearchCondition() { this.data = new ResearchData(); } + public ResearchCondition(boolean isReverse, ResearchData data) { + super(isReverse); + this.data = data; + } + @Override - public String getType() { - return "reseach"; + public RecipeConditionType getType() { + return GTRecipeConditions.RESEARCH; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/RockBreakerCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/RockBreakerCondition.java similarity index 73% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/RockBreakerCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/RockBreakerCondition.java index c12afa914c..a81e10a3f0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/RockBreakerCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/RockBreakerCondition.java @@ -1,8 +1,10 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import com.gregtechceu.gtceu.utils.GTUtil; import net.minecraft.core.Direction; @@ -10,6 +12,8 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @@ -21,11 +25,19 @@ @NoArgsConstructor public class RockBreakerCondition extends RecipeCondition { + public static final Codec CODEC = RecordCodecBuilder + .create(instance -> RecipeCondition.isReverse(instance) + .apply(instance, RockBreakerCondition::new)); + public final static RockBreakerCondition INSTANCE = new RockBreakerCondition(); + public RockBreakerCondition(boolean isReverse) { + super(isReverse); + } + @Override - public String getType() { - return "rock_breaker"; + public RecipeConditionType getType() { + return GTRecipeConditions.ROCK_BREAKER; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/ThunderCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/ThunderCondition.java similarity index 72% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/ThunderCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/ThunderCondition.java index 743616338b..be8cec0e5c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/ThunderCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/ThunderCondition.java @@ -1,8 +1,10 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; @@ -10,6 +12,8 @@ import net.minecraft.world.level.Level; import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @@ -21,16 +25,26 @@ @NoArgsConstructor public class ThunderCondition extends RecipeCondition { + public static final Codec CODEC = RecordCodecBuilder + .create(instance -> RecipeCondition.isReverse(instance) + .and(Codec.FLOAT.fieldOf("level").forGetter(val -> val.level)) + .apply(instance, ThunderCondition::new)); + public final static ThunderCondition INSTANCE = new ThunderCondition(); private float level; + public ThunderCondition(boolean isReverse, float level) { + super(isReverse); + this.level = level; + } + public ThunderCondition(float level) { this.level = level; } @Override - public String getType() { - return "thunder"; + public RecipeConditionType getType() { + return GTRecipeConditions.THUNDER; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/VentCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/VentCondition.java similarity index 64% rename from src/main/java/com/gregtechceu/gtceu/common/recipe/VentCondition.java rename to src/main/java/com/gregtechceu/gtceu/common/recipe/condition/VentCondition.java index f15a83e872..45792aa7a7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/VentCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/condition/VentCondition.java @@ -1,12 +1,16 @@ -package com.gregtechceu.gtceu.common.recipe; +package com.gregtechceu.gtceu.common.recipe.condition; import com.gregtechceu.gtceu.api.machine.feature.IExhaustVentMachine; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; +import com.gregtechceu.gtceu.api.recipe.condition.RecipeConditionType; +import com.gregtechceu.gtceu.common.data.GTRecipeConditions; import net.minecraft.network.chat.Component; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @@ -18,11 +22,18 @@ @NoArgsConstructor public class VentCondition extends RecipeCondition { + public static final Codec CODEC = RecordCodecBuilder + .create(instance -> RecipeCondition.isReverse(instance) + .apply(instance, VentCondition::new)); public final static VentCondition INSTANCE = new VentCondition(); + public VentCondition(boolean isReverse) { + super(isReverse); + } + @Override - public String getType() { - return "steam_vent"; + public RecipeConditionType getType() { + return GTRecipeConditions.VENT; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/unification/material/MaterialRegistryImpl.java b/src/main/java/com/gregtechceu/gtceu/common/unification/material/MaterialRegistryImpl.java index d8bafbe58b..03e4081f63 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/unification/material/MaterialRegistryImpl.java +++ b/src/main/java/com/gregtechceu/gtceu/common/unification/material/MaterialRegistryImpl.java @@ -30,14 +30,15 @@ public void register(Material material) { } @Override - public void register(@NotNull java.lang.String key, @NotNull Material value) { + public T register(@NotNull java.lang.String key, @NotNull T value) { if (isRegistryClosed) { GTCEu.LOGGER.error( "Materials cannot be registered in the PostMaterialEvent (or after)! Must be added in the MaterialEvent. Skipping material {}...", key); - return; + return null; } super.register(key, value); + return value; } @NotNull diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/WoodTypeEntry.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/WoodTypeEntry.java index 82e4334adf..ddab441154 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/WoodTypeEntry.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/WoodTypeEntry.java @@ -80,6 +80,14 @@ public final class WoodTypeEntry { public final Item chestBoat; @Nullable public final String chestBoatRecipeName; + @Nullable + public final Item sign; + @Nullable + public final String signRecipeName; + @Nullable + public final Item hangingSign; + @Nullable + public final String hangingSignRecipeName; public final Material material; public final boolean addLogOreDict; @@ -115,6 +123,8 @@ private WoodTypeEntry(@NotNull String modid, @NotNull String woodName, @NotNull @Nullable Item stairs, @Nullable String stairsRecipeName, boolean addStairsCraftingRecipe, @Nullable Item boat, @Nullable String boatRecipeName, @Nullable Item chestBoat, @Nullable String chestBoatRecipeName, + @Nullable Item sign, @Nullable String signRecipeName, + @Nullable Item hangingSign, @Nullable String hangingSignRecipeName, @Nullable Material material, boolean addLogOreDict, boolean addPlanksOreDict, boolean addDoorsOreDict, boolean addSlabsOreDict, @@ -153,6 +163,10 @@ private WoodTypeEntry(@NotNull String modid, @NotNull String woodName, @NotNull this.boatRecipeName = boatRecipeName; this.chestBoat = chestBoat; this.chestBoatRecipeName = chestBoatRecipeName; + this.sign = sign; + this.signRecipeName = signRecipeName; + this.hangingSign = hangingSign; + this.hangingSignRecipeName = hangingSignRecipeName; this.material = material != null ? material : GTMaterials.Wood; this.addLogOreDict = addLogOreDict; @@ -219,6 +233,10 @@ public static class Builder { private String boatRecipeName; private Item chestBoat = null; private String chestBoatRecipeName; + private Item sign = null; + private String signRecipeName; + private Item hangingSign = null; + private String hangingSignRecipeName; @Nullable private Material material = null; @@ -462,6 +480,32 @@ public Builder chestBoat(@NotNull Item chestBoat, @Nullable String chestBoatReci return this; } + /** + * Add an entry for a sign + * + * @param sign the sign to add + * @param signRecipeName the recipe name for crafting the sign + * @return this + */ + public Builder sign(@NotNull Item sign, @Nullable String signRecipeName) { + this.sign = sign; + this.signRecipeName = signRecipeName; + return this; + } + + /** + * Add an entry for a sign + * + * @param hangingSign the hanging sign to add + * @param hangingSignRecipeName the recipe name for crafting the hanging sign + * @return this + */ + public Builder hangingSign(@NotNull Item hangingSign, @Nullable String hangingSignRecipeName) { + this.hangingSign = hangingSign; + this.hangingSignRecipeName = hangingSignRecipeName; + return this; + } + /** * Specify material for wood entry. If not provided, {@link GTMaterials#Wood} will be used * @@ -573,6 +617,7 @@ public WoodTypeEntry build() { fence, fenceRecipeName, fenceGate, fenceGateRecipeName, stairs, stairsRecipeName, addStairsCraftingRecipe, boat, boatRecipeName, chestBoat, chestBoatRecipeName, + sign, signRecipeName, hangingSign, hangingSignRecipeName, material, addLogOreDict, addPlanksOreDict, addDoorsOreDict, addSlabsOreDict, addFencesOreDict, addFenceGatesOreDict, addStairsOreDict, addPlanksUnificationInfo, diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java index 5dab22da22..8ab8c6d4ed 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java @@ -20,7 +20,7 @@ import com.gregtechceu.gtceu.api.recipe.ingredient.SizedIngredient; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; -import com.gregtechceu.gtceu.common.recipe.*; +import com.gregtechceu.gtceu.common.recipe.condition.*; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.ResearchManager; @@ -1085,7 +1085,7 @@ public void toJson(JsonObject json) { JsonArray array = new JsonArray(); for (RecipeCondition condition : conditions) { JsonObject cond = new JsonObject(); - cond.addProperty("type", GTRegistries.RECIPE_CONDITIONS.getKey(condition.getClass())); + cond.addProperty("type", GTRegistries.RECIPE_CONDITIONS.getKey(condition.getType())); cond.add("data", condition.serialize()); array.add(cond); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java index ca7f209f1d..b3e856005a 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java @@ -82,6 +82,11 @@ private static void compressingRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.CLAY)) .save(provider); + COMPRESSOR_RECIPES.recipeBuilder("snowballs_to_snow").duration(200).EUt(2) + .inputItems(new ItemStack(Items.SNOWBALL, 4)) + .outputItems(new ItemStack(Items.SNOW_BLOCK)) + .save(provider); + COMPRESSOR_RECIPES.recipeBuilder("glowstone").duration(300).EUt(2) .inputItems(new ItemStack(Items.GLOWSTONE_DUST, 4)) .outputItems(new ItemStack(Blocks.GLOWSTONE)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java index e2ea57c159..c340d257cc 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java @@ -8,6 +8,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.stack.UnificationEntry; import com.gregtechceu.gtceu.api.data.tag.TagUtil; import com.gregtechceu.gtceu.common.data.GTBlocks; +import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; @@ -63,6 +64,8 @@ private static List getDefaultEntries() { .stairs(Items.OAK_STAIRS, "oak_stairs") .boat(Items.OAK_BOAT, "oak_boat") .chestBoat(Items.OAK_CHEST_BOAT, "oak_chest_boat") + .sign(Items.OAK_SIGN, "oak_sign") + .hangingSign(Items.OAK_HANGING_SIGN, "oak_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "spruce") @@ -79,6 +82,8 @@ private static List getDefaultEntries() { .stairs(Items.SPRUCE_STAIRS, "spruce_stairs") .boat(Items.SPRUCE_BOAT, "spruce_boat") .chestBoat(Items.SPRUCE_CHEST_BOAT, "spruce_chest_boat") + .sign(Items.SPRUCE_SIGN, "spruce_sign") + .hangingSign(Items.SPRUCE_HANGING_SIGN, "spruce_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "birch") @@ -95,6 +100,8 @@ private static List getDefaultEntries() { .stairs(Items.BIRCH_STAIRS, "birch_stairs") .boat(Items.BIRCH_BOAT, "birch_boat") .chestBoat(Items.BIRCH_CHEST_BOAT, "birch_chest_boat") + .sign(Items.BIRCH_SIGN, "birch_sign") + .hangingSign(Items.BIRCH_HANGING_SIGN, "birch_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "jungle") @@ -111,6 +118,8 @@ private static List getDefaultEntries() { .stairs(Items.JUNGLE_STAIRS, "jungle_stairs") .boat(Items.JUNGLE_BOAT, "jungle_boat") .chestBoat(Items.JUNGLE_CHEST_BOAT, "jungle_chest_boat") + .sign(Items.JUNGLE_SIGN, "jungle_sign") + .hangingSign(Items.JUNGLE_HANGING_SIGN, "jungle_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "acacia") @@ -127,6 +136,8 @@ private static List getDefaultEntries() { .stairs(Items.ACACIA_STAIRS, "acacia_stairs") .boat(Items.ACACIA_BOAT, "acacia_boat") .chestBoat(Items.ACACIA_CHEST_BOAT, "acacia_chest_boat") + .sign(Items.ACACIA_SIGN, "acacia_sign") + .hangingSign(Items.ACACIA_HANGING_SIGN, "acacia_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "dark_oak") @@ -143,6 +154,8 @@ private static List getDefaultEntries() { .stairs(Items.DARK_OAK_STAIRS, "dark_oak_stairs") .boat(Items.DARK_OAK_BOAT, "dark_oak_boat") .chestBoat(Items.DARK_OAK_CHEST_BOAT, "dark_oak_chest_boat") + .sign(Items.DARK_OAK_SIGN, "dark_oak_sign") + .hangingSign(Items.DARK_OAK_HANGING_SIGN, "dark_oak_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "bamboo") @@ -158,6 +171,8 @@ private static List getDefaultEntries() { .stairs(Items.BAMBOO_STAIRS, "bamboo_stairs") .boat(Items.BAMBOO_RAFT, "bamboo_raft") .chestBoat(Items.BAMBOO_CHEST_RAFT, "bamboo_chest_raft") + .sign(Items.BAMBOO_SIGN, "bamboo_sign") + .hangingSign(Items.BAMBOO_HANGING_SIGN, "bamboo_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "cherry") @@ -174,6 +189,8 @@ private static List getDefaultEntries() { .stairs(Items.CHERRY_STAIRS, "cherry_stairs") .boat(Items.CHERRY_BOAT, "cherry_boat") .chestBoat(Items.CHERRY_CHEST_BOAT, "cherry_chest_boat") + .sign(Items.CHERRY_SIGN, "cherry_sign") + .hangingSign(Items.CHERRY_HANGING_SIGN, "cherry_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "mangrove") @@ -190,6 +207,8 @@ private static List getDefaultEntries() { .stairs(Items.MANGROVE_STAIRS, "mangrove_stairs") .boat(Items.MANGROVE_BOAT, "mangrove_boat") .chestBoat(Items.MANGROVE_CHEST_BOAT, "mangrove_chest_boat") + .sign(Items.MANGROVE_SIGN, "mangrove_sign") + .hangingSign(Items.MANGROVE_HANGING_SIGN, "mangrove_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "crimson") @@ -205,6 +224,8 @@ private static List getDefaultEntries() { .fence(Items.CRIMSON_FENCE, "crimson_fence") .fenceGate(Items.CRIMSON_FENCE_GATE, "crimson_fence_gate") .stairs(Items.CRIMSON_STAIRS, "crimson_stairs") + .sign(Items.CRIMSON_SIGN, "crimson_sign") + .hangingSign(Items.CRIMSON_HANGING_SIGN, "crimson_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(mcModId, "warped") @@ -220,6 +241,8 @@ private static List getDefaultEntries() { .fence(Items.WARPED_FENCE, "warped_fence") .fenceGate(Items.WARPED_FENCE_GATE, "warped_fence_gate") .stairs(Items.WARPED_STAIRS, "warped_stairs") + .sign(Items.WARPED_SIGN, "warped_sign") + .hangingSign(Items.WARPED_HANGING_SIGN, "warped_hanging_sign") .registerAllUnificationInfo() .build(), new WoodTypeEntry.Builder(GTCEu.MOD_ID, "rubber") @@ -229,12 +252,15 @@ private static List getDefaultEntries() { .wood(GTBlocks.RUBBER_WOOD.asItem()) .strippedWood(GTBlocks.STRIPPED_RUBBER_WOOD.asItem()) .door(GTBlocks.RUBBER_DOOR.asItem(), null) - .trapdoor(GTBlocks.RUBBER_TRAPDOOR.asItem(), null) + .trapdoor(GTBlocks.RUBBER_TRAPDOOR.asItem(), "rubber_trapdoor") .slab(GTBlocks.RUBBER_SLAB.asItem(), null).addSlabRecipe() .fence(GTBlocks.RUBBER_FENCE.asItem(), null) .fenceGate(GTBlocks.RUBBER_FENCE_GATE.asItem(), null) .stairs(GTBlocks.RUBBER_STAIRS.asItem(), null).addStairsRecipe() - // .boat(GTItems.RUBBER_BOAT.asItem(), null) // TODO someone forgot boat textures. + .boat(GTItems.RUBBER_BOAT.asItem(), null) + .chestBoat(GTItems.RUBBER_CHEST_BOAT.asItem(), null) + .sign(GTBlocks.RUBBER_SIGN.asItem(), null) + .hangingSign(GTBlocks.RUBBER_HANGING_SIGN.asItem(), null) .generateLogToPlankRecipe(false) // rubber log does not have a tag .registerAllTags() .registerAllUnificationInfo() @@ -247,10 +273,12 @@ private static List getDefaultEntries() { .fence(GTBlocks.TREATED_WOOD_FENCE.asItem(), null) .fenceGate(GTBlocks.TREATED_WOOD_FENCE_GATE.asItem(), null) .stairs(GTBlocks.TREATED_WOOD_STAIRS.asItem(), null).addStairsRecipe() - // .boat(GTItems.TREATED_WOOD_BOAT.asItem(), null) // TODO someone forgot boat textures. + .boat(GTItems.TREATED_WOOD_BOAT.asItem(), null) + .chestBoat(GTItems.TREATED_WOOD_CHEST_BOAT.asItem(), null) + .sign(GTBlocks.TREATED_WOOD_SIGN.asItem(), null) + .hangingSign(GTBlocks.TREATED_WOOD_HANGING_SIGN.asItem(), null) .material(TreatedWood) - .generateLogToPlankRecipe(false) - .registerAllUnificationInfo() + .registerUnificationInfo(false, true, true, true, true, true, true, true) .build()); } return DEFAULT_ENTRIES; @@ -456,6 +484,102 @@ public static void registerWoodTypeRecipe(Consumer provider, @No } } + // sign + if (entry.sign != null && entry.slab != null) { + final boolean hasSignRecipe = entry.signRecipeName != null; + String recipeName = hasSignRecipe ? entry.signRecipeName : name + "_sign"; + if (ConfigHolder.INSTANCE.recipes.hardWoodRecipes) { + VanillaRecipeHelper.addShapedRecipe(provider, recipeName + "_iron", new ItemStack(entry.sign), + "LLL", "rPr", "sSd", + 'P', entry.planks, + 'r', new UnificationEntry(screw, Iron), + 'L', entry.slab, + 'S', entry.getStick()); + + // plank -> sign assembling + ASSEMBLER_RECIPES.recipeBuilder(recipeName + "_iron") + .circuitMeta(4) + .inputItems(new ItemStack(entry.slab, 1)) + .inputItems(entry.getStick(), 1) + .inputFluids(Iron.getFluid(GTValues.L / 9)) + .outputItems(entry.sign, 3) + .duration(200).EUt(4).save(provider); + + VanillaRecipeHelper.addShapedRecipe(provider, recipeName + "_steel", new ItemStack(entry.sign, 2), + "LLL", "rPr", "sSd", + 'P', entry.planks, + 'r', new UnificationEntry(screw, Steel), + 'L', entry.slab, + 'S', entry.getStick()); + + // plank -> sign assembling + ASSEMBLER_RECIPES.recipeBuilder(recipeName + "_steel") + .circuitMeta(4) + .inputItems(new ItemStack(entry.slab, 1)) + .inputItems(entry.getStick(), 1) + .inputFluids(Steel.getFluid(GTValues.L / 9)) + .outputItems(entry.sign, 5) + .duration(200).EUt(4).save(provider); + } else { + VanillaRecipeHelper.addShapedRecipe(provider, recipeName, new ItemStack(entry.sign, 3), + "PPP", "PPP", " s ", + 'P', entry.planks, + 's', entry.getStick()); + } + + if (entry.hangingSign != null) { + final boolean hasHangingSignRecipe = entry.hangingSignRecipeName != null; + String recipeNameHanging = hasHangingSignRecipe ? entry.hangingSignRecipeName : name + "_hanging_sign"; + ASSEMBLER_RECIPES.recipeBuilder(recipeNameHanging) + .inputItems(entry.sign) + .inputItems(ring, Iron, 2) + .inputItems(Items.CHAIN, 2) + .circuitMeta(5) + .duration(150) + .EUt(4) + .save(provider); + } + } + + // trapdoor + if (entry.trapdoor != null) { + final boolean hasTrapdoorRecipe = entry.trapdoorRecipeName != null; + String recipeName = hasTrapdoorRecipe ? entry.trapdoorRecipeName : name + "_trapdoor"; + if (ConfigHolder.INSTANCE.recipes.hardWoodRecipes) { + VanillaRecipeHelper.addShapedRecipe(provider, recipeName + "_iron", new ItemStack(entry.trapdoor), + "bPS", "PdP", "SPb", + 'P', entry.planks, + 'b', new UnificationEntry(bolt, Iron), + 'S', entry.getStick()); + + // plank -> trapdoor assembling + ASSEMBLER_RECIPES.recipeBuilder(recipeName + "_iron") + .circuitMeta(3) + .inputItems(new ItemStack(entry.planks, 2)) + .inputFluids(Iron.getFluid(GTValues.L / 9)) + .outputItems(entry.trapdoor) + .duration(200).EUt(4).save(provider); + + VanillaRecipeHelper.addShapedRecipe(provider, recipeName + "_steel", new ItemStack(entry.trapdoor, 2), + "bPS", "PdP", "SPb", + 'P', entry.planks, + 'b', new UnificationEntry(bolt, Steel), + 'S', entry.getStick()); + + // plank -> trapdoor assembling + ASSEMBLER_RECIPES.recipeBuilder(recipeName + "_steel") + .circuitMeta(3) + .inputItems(new ItemStack(entry.planks, 2)) + .inputFluids(Steel.getFluid(GTValues.L / 9)) + .outputItems(entry.trapdoor, 2) + .duration(200).EUt(4).save(provider); + } else { + VanillaRecipeHelper.addShapedRecipe(provider, recipeName, new ItemStack(entry.trapdoor, 2), + "PPP", "PPP", + 'P', entry.planks); + } + } + // stairs if (entry.stairs != null) { final boolean hasStairRecipe = entry.stairsRecipeName != null; @@ -590,29 +714,24 @@ public static void registerWoodTypeRecipe(Consumer provider, @No // chest boat if (entry.chestBoat != null) { final boolean hasChestBoatRecipe = entry.chestBoatRecipeName != null; + String recipeName = hasChestBoatRecipe ? entry.chestBoatRecipeName : name + "_chest_boat"; if (ConfigHolder.INSTANCE.recipes.hardWoodRecipes) { - if (entry.boat != null) { - - VanillaRecipeHelper.addShapedRecipe(provider, - hasChestBoatRecipe ? entry.chestBoatRecipeName : name + "_chest_boat", - new ItemStack(entry.chestBoat), - " B ", "SCS", " w ", - 'B', entry.boat, - 'S', new UnificationEntry(bolt, Wood), - 'C', Tags.Items.CHESTS_WOODEN); - } + VanillaRecipeHelper.addShapedRecipe(provider, recipeName, + new ItemStack(entry.chestBoat), + " B ", "SCS", " w ", + 'B', entry.boat, + 'S', new UnificationEntry(bolt, Wood), + 'C', Tags.Items.CHESTS_WOODEN); } else { - if (!hasChestBoatRecipe) { - VanillaRecipeHelper.addShapelessRecipe(provider, name + "_chest_boat", - new ItemStack(entry.chestBoat), - entry.boat, Tags.Items.CHESTS); - } + VanillaRecipeHelper.addShapelessRecipe(provider, recipeName, + new ItemStack(entry.chestBoat), + entry.boat, Tags.Items.CHESTS_WOODEN); } - // plank -> boat assembling + // boat -> chest boat assembling ASSEMBLER_RECIPES.recipeBuilder(name + "_chest_boat") .inputItems(new ItemStack(entry.boat)) - .inputItems(Tags.Items.CHESTS) + .inputItems(Tags.Items.CHESTS_WOODEN) .outputItems(entry.chestBoat) .circuitMeta(16) .duration(100).EUt(4).save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/GTRecipeWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/GTRecipeWidget.java index ae1cae8529..8a34fcfd0c 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/GTRecipeWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/GTRecipeWidget.java @@ -15,7 +15,7 @@ import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.logic.OCParams; import com.gregtechceu.gtceu.api.recipe.logic.OCResult; -import com.gregtechceu.gtceu.common.recipe.DimensionCondition; +import com.gregtechceu.gtceu.common.recipe.condition.DimensionCondition; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.lowdragmc.lowdraglib.LDLib; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java index 6542d5071e..d9a92265a1 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java @@ -16,7 +16,7 @@ import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.ingredient.*; -import com.gregtechceu.gtceu.common.recipe.*; +import com.gregtechceu.gtceu.common.recipe.condition.*; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; import com.gregtechceu.gtceu.integration.kjs.recipe.components.CapabilityMap; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java index 7867b7d9cd..120060e83a 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java @@ -180,7 +180,7 @@ public Class componentClass() { @Override public JsonElement write(RecipeJS recipe, RecipeCondition value) { JsonObject object = new JsonObject(); - object.addProperty("type", GTRegistries.RECIPE_CONDITIONS.getKey(value.getClass())); + object.addProperty("type", GTRegistries.RECIPE_CONDITIONS.getKey(value.getType())); object.add("data", value.serialize()); return object; } @@ -189,22 +189,22 @@ public JsonElement write(RecipeJS recipe, RecipeCondition value) { public RecipeCondition read(RecipeJS recipe, Object from) { if (from instanceof CharSequence) { var conditionKey = from.toString(); - var clazz = GTRegistries.RECIPE_CONDITIONS.get(conditionKey); - if (clazz != null) { - return RecipeCondition.create(clazz); + var type = GTRegistries.RECIPE_CONDITIONS.get(conditionKey); + if (type != null) { + return type.factory.createDefault(); } } if (from instanceof JsonPrimitive primitive) { var conditionKey = primitive.getAsString(); - var clazz = GTRegistries.RECIPE_CONDITIONS.get(conditionKey); - if (clazz != null) { - return RecipeCondition.create(clazz); + var type = GTRegistries.RECIPE_CONDITIONS.get(conditionKey); + if (type != null) { + return type.factory.createDefault(); } } else if (from instanceof JsonObject jsonObject) { var conditionKey = GsonHelper.getAsString(jsonObject, "type", ""); - var clazz = GTRegistries.RECIPE_CONDITIONS.get(conditionKey); - if (clazz != null) { - RecipeCondition condition = RecipeCondition.create(clazz); + var type = GTRegistries.RECIPE_CONDITIONS.get(conditionKey); + if (type != null) { + RecipeCondition condition = type.factory.createDefault(); if (condition != null) { return condition.deserialize(GsonHelper.getAsJsonObject(jsonObject, "data", new JsonObject())); } diff --git a/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipeAccessor.java b/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipeAccessor.java deleted file mode 100644 index 7f16e440fc..0000000000 --- a/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipeAccessor.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gregtechceu.gtceu.syncdata; - -import com.gregtechceu.gtceu.api.recipe.GTRecipe; -import com.gregtechceu.gtceu.api.recipe.GTRecipeSerializer; - -import com.lowdragmc.lowdraglib.syncdata.AccessorOp; -import com.lowdragmc.lowdraglib.syncdata.accessor.CustomObjectAccessor; -import com.lowdragmc.lowdraglib.syncdata.payload.FriendlyBufPayload; -import com.lowdragmc.lowdraglib.syncdata.payload.ITypedPayload; - -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.resources.ResourceLocation; - -import io.netty.buffer.Unpooled; - -/** - * @author KilaBash - * @date 2023/2/18 - * @implNote GTRecipeAccessor - */ -public class GTRecipeAccessor extends CustomObjectAccessor { - - public GTRecipeAccessor() { - super(GTRecipe.class, true); - } - - @Override - public ITypedPayload serialize(AccessorOp accessorOp, GTRecipe gtRecipe) { - FriendlyByteBuf serializedHolder = new FriendlyByteBuf(Unpooled.buffer()); - serializedHolder.writeUtf(gtRecipe.id.toString()); - GTRecipeSerializer.SERIALIZER.toNetwork(serializedHolder, gtRecipe); - return FriendlyBufPayload.of(serializedHolder); - } - - @Override - public GTRecipe deserialize(AccessorOp accessorOp, ITypedPayload payload) { - if (payload instanceof FriendlyBufPayload buffer) { - var id = new ResourceLocation(buffer.getPayload().readUtf()); - return GTRecipeSerializer.SERIALIZER.fromNetwork(id, buffer.getPayload()); - } - return null; - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipePayload.java b/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipePayload.java new file mode 100644 index 0000000000..7cb4dd877d --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipePayload.java @@ -0,0 +1,61 @@ +package com.gregtechceu.gtceu.syncdata; + +import com.gregtechceu.gtceu.api.recipe.GTRecipe; + +import com.lowdragmc.lowdraglib.Platform; +import com.lowdragmc.lowdraglib.syncdata.payload.ObjectTypedPayload; + +import net.minecraft.client.Minecraft; +import net.minecraft.nbt.ByteArrayTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.RecipeManager; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import org.jetbrains.annotations.Nullable; + +/** + * @author KilaBash + * @date 2023/2/18 + * @implNote GTRecipePayload + */ +public class GTRecipePayload extends ObjectTypedPayload { + + @Nullable + @Override + public Tag serializeNBT() { + return StringTag.valueOf(payload.id.toString()); + } + + @Override + public void deserializeNBT(Tag tag) { + RecipeManager recipeManager = Platform.getMinecraftServer().getRecipeManager(); + if (tag instanceof StringTag stringTag) { + payload = (GTRecipe) recipeManager.byKey(new ResourceLocation(stringTag.getAsString())).orElse(null); + } else if (tag instanceof ByteArrayTag byteArray) { + ByteBuf copiedDataBuffer = Unpooled.copiedBuffer(byteArray.getAsByteArray()); + FriendlyByteBuf buf = new FriendlyByteBuf(copiedDataBuffer); + payload = (GTRecipe) recipeManager.byKey(buf.readResourceLocation()).orElse(null); + buf.release(); + } + } + + @Override + public void writePayload(FriendlyByteBuf buf) { + buf.writeResourceLocation(this.payload.id); + } + + @Override + public void readPayload(FriendlyByteBuf buf) { + RecipeManager recipeManager; + if (!Platform.isClient()) { + recipeManager = Platform.getMinecraftServer().getRecipeManager(); + } else { + recipeManager = Minecraft.getInstance().getConnection().getRecipeManager(); + } + this.payload = (GTRecipe) recipeManager.byKey(buf.readResourceLocation()).orElse(null); + } +} diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 6131827e9f..e416b85be7 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -20,6 +20,8 @@ public net.minecraft.world.entity.item.ItemEntity f_31986_ # pickupDelay public net.minecraft.server.network.ServerGamePacketListenerImpl f_9737_ # aboveGroundTickCount public net.minecraft.world.entity.Entity m_20115_(IZ)V # setSharedFlag +public net.minecraft.world.entity.vehicle.Boat f_38285_ # DATA_ID_TYPE + # for AE2 to be able to load (idk why but it needs these?) public net.minecraft.world.level.block.Blocks m_50774_(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Z # always public net.minecraft.world.level.block.Blocks m_50805_(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Z # never diff --git a/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_16a.json b/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_16a.json index 61f3a15388..376c5d7004 100644 --- a/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_16a.json +++ b/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_16a.json @@ -2,7 +2,7 @@ "credit": "Made with Blockbench", "parent": "block/block", "textures": { - "gearbox": "gtceu:block/gearbox", + "gearbox": "gtceu:block/machines/gearbox", "bottom": "gtceu:block/casings/voltage/lv/bottom", "top": "gtceu:block/casings/voltage/lv/top", "particle": "gtceu:block/casings/voltage/lv/side", @@ -141,4 +141,4 @@ "children": [10, 11, 12, 13] } ] -} \ No newline at end of file +} diff --git a/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_2a.json b/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_2a.json index 61f3a15388..376c5d7004 100644 --- a/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_2a.json +++ b/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_2a.json @@ -2,7 +2,7 @@ "credit": "Made with Blockbench", "parent": "block/block", "textures": { - "gearbox": "gtceu:block/gearbox", + "gearbox": "gtceu:block/machines/gearbox", "bottom": "gtceu:block/casings/voltage/lv/bottom", "top": "gtceu:block/casings/voltage/lv/top", "particle": "gtceu:block/casings/voltage/lv/side", @@ -141,4 +141,4 @@ "children": [10, 11, 12, 13] } ] -} \ No newline at end of file +} diff --git a/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_32a.json b/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_32a.json index 61f3a15388..376c5d7004 100644 --- a/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_32a.json +++ b/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_32a.json @@ -2,7 +2,7 @@ "credit": "Made with Blockbench", "parent": "block/block", "textures": { - "gearbox": "gtceu:block/gearbox", + "gearbox": "gtceu:block/machines/gearbox", "bottom": "gtceu:block/casings/voltage/lv/bottom", "top": "gtceu:block/casings/voltage/lv/top", "particle": "gtceu:block/casings/voltage/lv/side", @@ -141,4 +141,4 @@ "children": [10, 11, 12, 13] } ] -} \ No newline at end of file +} diff --git a/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_8a.json b/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_8a.json index 61f3a15388..376c5d7004 100644 --- a/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_8a.json +++ b/src/main/resources/assets/gtceu/models/block/machine/electric_gear_box_8a.json @@ -2,7 +2,7 @@ "credit": "Made with Blockbench", "parent": "block/block", "textures": { - "gearbox": "gtceu:block/gearbox", + "gearbox": "gtceu:block/machines/gearbox", "bottom": "gtceu:block/casings/voltage/lv/bottom", "top": "gtceu:block/casings/voltage/lv/top", "particle": "gtceu:block/casings/voltage/lv/side", @@ -141,4 +141,4 @@ "children": [10, 11, 12, 13] } ] -} \ No newline at end of file +} diff --git a/src/main/resources/assets/gtceu/models/block/machine/kinetic_electric_machine.json b/src/main/resources/assets/gtceu/models/block/machine/kinetic_electric_machine.json index 3cc33c85d4..6c10dcaa71 100644 --- a/src/main/resources/assets/gtceu/models/block/machine/kinetic_electric_machine.json +++ b/src/main/resources/assets/gtceu/models/block/machine/kinetic_electric_machine.json @@ -2,7 +2,7 @@ "credit": "Made with Blockbench", "parent": "block/block", "textures": { - "gearbox": "gtceu:block/gearbox", + "gearbox": "gtceu:block/machines/gearbox", "bottom": "gtceu:block/casings/voltage/lv/bottom", "top": "gtceu:block/casings/voltage/lv/top", "particle": "gtceu:block/casings/voltage/lv/side", @@ -135,4 +135,4 @@ "children": [10, 11, 12, 13] } ] -} \ No newline at end of file +} diff --git a/src/main/resources/assets/gtceu/models/block/machine/part/kinetic_input_box.json b/src/main/resources/assets/gtceu/models/block/machine/part/kinetic_input_box.json index 5f5e596559..0fb707de57 100644 --- a/src/main/resources/assets/gtceu/models/block/machine/part/kinetic_input_box.json +++ b/src/main/resources/assets/gtceu/models/block/machine/part/kinetic_input_box.json @@ -3,7 +3,7 @@ "parent": "block/block", "textures": { "overlay": "gtceu:block/overlay/machine/overlay_pipe_in", - "gearbox": "gtceu:block/gearbox", + "gearbox": "gtceu:block/machines/gearbox", "bottom": "gtceu:block/casings/voltage/lv/bottom", "top": "gtceu:block/casings/voltage/lv/top", "particle": "gtceu:block/casings/voltage/lv/side", @@ -152,4 +152,4 @@ "children": [11, 12, 13, 14] } ] -} \ No newline at end of file +} diff --git a/src/main/resources/assets/gtceu/models/block/machine/part/kinetic_output_box.json b/src/main/resources/assets/gtceu/models/block/machine/part/kinetic_output_box.json index 1a2d2843bb..ca0aafa82f 100644 --- a/src/main/resources/assets/gtceu/models/block/machine/part/kinetic_output_box.json +++ b/src/main/resources/assets/gtceu/models/block/machine/part/kinetic_output_box.json @@ -3,7 +3,7 @@ "parent": "block/block", "textures": { "overlay": "gtceu:block/overlay/machine/overlay_pipe_out", - "gearbox": "gtceu:block/gearbox", + "gearbox": "gtceu:block/machines/gearbox", "bottom": "gtceu:block/casings/voltage/lv/bottom", "top": "gtceu:block/casings/voltage/lv/top", "particle": "gtceu:block/casings/voltage/lv/side", @@ -152,4 +152,4 @@ "children": [11, 12, 13, 14] } ] -} \ No newline at end of file +} diff --git a/src/main/resources/assets/gtceu/textures/block/black_lamp.png b/src/main/resources/assets/gtceu/textures/block/black_lamp.png deleted file mode 100644 index 77f2d80c66..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/black_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/blue_lamp.png b/src/main/resources/assets/gtceu/textures/block/blue_lamp.png deleted file mode 100644 index be00897572..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/blue_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/brown_lamp.png b/src/main/resources/assets/gtceu/textures/block/brown_lamp.png deleted file mode 100644 index 35aae98fd5..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/brown_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/cover/OVERLAY_SCREEN.png b/src/main/resources/assets/gtceu/textures/block/cover/overlay_screen.png similarity index 100% rename from src/main/resources/assets/gtceu/textures/block/cover/OVERLAY_SCREEN.png rename to src/main/resources/assets/gtceu/textures/block/cover/overlay_screen.png diff --git a/src/main/resources/assets/gtceu/textures/block/cyan_lamp.png b/src/main/resources/assets/gtceu/textures/block/cyan_lamp.png deleted file mode 100644 index 2f48f3b277..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/cyan_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/gray_lamp.png b/src/main/resources/assets/gtceu/textures/block/gray_lamp.png deleted file mode 100644 index 0efadbcbc8..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/gray_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/green_lamp.png b/src/main/resources/assets/gtceu/textures/block/green_lamp.png deleted file mode 100644 index 5c5ab75869..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/green_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/lamps/light_gray.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/lamps/light_gray.png.mcmeta index 876352e371..d9f02a1f1e 100644 --- a/src/main/resources/assets/gtceu/textures/block/lamps/light_gray.png.mcmeta +++ b/src/main/resources/assets/gtceu/textures/block/lamps/light_gray.png.mcmeta @@ -1,5 +1,5 @@ { "ldlib": { - "connection": "gtceu:block/lamps/silver_ctm" + "connection": "gtceu:block/lamps/light_gray_ctm" } } diff --git a/src/main/resources/assets/gtceu/textures/block/lamps/light_gray_emissive.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/lamps/light_gray_emissive.png.mcmeta index cbf07ef6d1..f198565e7c 100644 --- a/src/main/resources/assets/gtceu/textures/block/lamps/light_gray_emissive.png.mcmeta +++ b/src/main/resources/assets/gtceu/textures/block/lamps/light_gray_emissive.png.mcmeta @@ -1,6 +1,6 @@ { "ldlib": { - "connection": "gtceu:block/lamps/silver_ctm_emissive" + "connection": "gtceu:block/lamps/light_gray_ctm_emissive" }, "shimmer": { "bloom": true diff --git a/src/main/resources/assets/gtceu/textures/block/lamps/light_gray_off.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/lamps/light_gray_off.png.mcmeta index c884f74ba1..74f9b7d0d2 100644 --- a/src/main/resources/assets/gtceu/textures/block/lamps/light_gray_off.png.mcmeta +++ b/src/main/resources/assets/gtceu/textures/block/lamps/light_gray_off.png.mcmeta @@ -1,5 +1,5 @@ { "ldlib": { - "connection": "gtceu:block/lamps/silver_off_ctm" + "connection": "gtceu:block/lamps/light_gray_off_ctm" } } diff --git a/src/main/resources/assets/gtceu/textures/block/light_blue_lamp.png b/src/main/resources/assets/gtceu/textures/block/light_blue_lamp.png deleted file mode 100644 index 5a225bed70..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/light_blue_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/light_gray_lamp.png b/src/main/resources/assets/gtceu/textures/block/light_gray_lamp.png deleted file mode 100644 index 7928825289..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/light_gray_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/lime_lamp.png b/src/main/resources/assets/gtceu/textures/block/lime_lamp.png deleted file mode 100644 index c3b986bb08..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/lime_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/machines/fermenter/overlay_front_active.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/machines/fermenter/overlay_front_active.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/machines/fermenter/overlay_front_active.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/machines/fermenter/overlay_front_active_emissive.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/machines/fermenter/overlay_front_active_emissive.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/machines/fermenter/overlay_front_active_emissive.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/gearbox.png b/src/main/resources/assets/gtceu/textures/block/machines/gearbox.png similarity index 100% rename from src/main/resources/assets/gtceu/textures/block/gearbox.png rename to src/main/resources/assets/gtceu/textures/block/machines/gearbox.png diff --git a/src/main/resources/assets/gtceu/textures/block/magenta_lamp.png b/src/main/resources/assets/gtceu/textures/block/magenta_lamp.png deleted file mode 100644 index da6872b464..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/magenta_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/industrial_tnt_side.png b/src/main/resources/assets/gtceu/textures/block/misc/industrial_tnt_side.png similarity index 100% rename from src/main/resources/assets/gtceu/textures/block/industrial_tnt_side.png rename to src/main/resources/assets/gtceu/textures/block/misc/industrial_tnt_side.png diff --git a/src/main/resources/assets/gtceu/textures/block/molybdenum_disilicide_coil_block.png b/src/main/resources/assets/gtceu/textures/block/molybdenum_disilicide_coil_block.png deleted file mode 100644 index db354b252f..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/molybdenum_disilicide_coil_block.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/molybdenum_disilicide_coil_block.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/molybdenum_disilicide_coil_block.png.mcmeta deleted file mode 100644 index 652de39854..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/molybdenum_disilicide_coil_block.png.mcmeta +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ldlib": { - "connection": "gtceu:block/molybdenum_disilicide_coil_block_ctm" - } -} diff --git a/src/main/resources/assets/gtceu/textures/block/molybdenum_disilicide_coil_block_ctm.png b/src/main/resources/assets/gtceu/textures/block/molybdenum_disilicide_coil_block_ctm.png deleted file mode 100644 index fecdb133d7..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/molybdenum_disilicide_coil_block_ctm.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/multiblock/fluid_drilling_rig/overlay_front_active.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/multiblock/fluid_drilling_rig/overlay_front_active.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/multiblock/fluid_drilling_rig/overlay_front_active.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/multiblock/fluid_drilling_rig/overlay_front_active_emissive.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/multiblock/fluid_drilling_rig/overlay_front_active_emissive.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/multiblock/fluid_drilling_rig/overlay_front_active_emissive.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/multiblock/generator/large_steel_boiler/overlay_front_active.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/multiblock/generator/large_steel_boiler/overlay_front_active.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/multiblock/generator/large_steel_boiler/overlay_front_active.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/multiblock/generator/large_steel_boiler/overlay_front_active_emissive.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/multiblock/generator/large_steel_boiler/overlay_front_active_emissive.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/multiblock/generator/large_steel_boiler/overlay_front_active_emissive.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/multiblock/generator/large_titanium_boiler/overlay_front_active.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/multiblock/generator/large_titanium_boiler/overlay_front_active.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/multiblock/generator/large_titanium_boiler/overlay_front_active.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/multiblock/generator/large_titanium_boiler/overlay_front_active_emissive.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/multiblock/generator/large_titanium_boiler/overlay_front_active_emissive.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/multiblock/generator/large_titanium_boiler/overlay_front_active_emissive.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/multiblock/implosion_compressor/overlay_front_active.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/multiblock/implosion_compressor/overlay_front_active.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/multiblock/implosion_compressor/overlay_front_active.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/multiblock/implosion_compressor/overlay_front_active_emissive.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/multiblock/implosion_compressor/overlay_front_active_emissive.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/multiblock/implosion_compressor/overlay_front_active_emissive.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/multiblock/multi_furnace/overlay_front_active.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/multiblock/multi_furnace/overlay_front_active.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/multiblock/multi_furnace/overlay_front_active.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/multiblock/multi_furnace/overlay_front_active_emissive.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/multiblock/multi_furnace/overlay_front_active_emissive.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/multiblock/multi_furnace/overlay_front_active_emissive.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/multiblock/pyrolyse_oven/overlay_front_active.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/multiblock/pyrolyse_oven/overlay_front_active.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/multiblock/pyrolyse_oven/overlay_front_active.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/multiblock/pyrolyse_oven/overlay_front_active_emissive.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/multiblock/pyrolyse_oven/overlay_front_active_emissive.png.mcmeta deleted file mode 100644 index cfcef74876..0000000000 --- a/src/main/resources/assets/gtceu/textures/block/multiblock/pyrolyse_oven/overlay_front_active_emissive.png.mcmeta +++ /dev/null @@ -1,10 +0,0 @@ -{ - "animation": { - "frametime": 16, - "frames": [ - 0, - 1, - 2 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/block/orange_lamp.png b/src/main/resources/assets/gtceu/textures/block/orange_lamp.png deleted file mode 100644 index 9ccca32548..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/orange_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/pink_lamp.png b/src/main/resources/assets/gtceu/textures/block/pink_lamp.png deleted file mode 100644 index a898516106..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/pink_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/purple_lamp.png b/src/main/resources/assets/gtceu/textures/block/purple_lamp.png deleted file mode 100644 index 9ffa35898f..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/purple_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/red_lamp.png b/src/main/resources/assets/gtceu/textures/block/red_lamp.png deleted file mode 100644 index 823082ff5b..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/red_lamp.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/rubber_hanging_sign.png b/src/main/resources/assets/gtceu/textures/block/rubber_hanging_sign.png deleted file mode 100644 index 02e77aabd0..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/rubber_hanging_sign.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/rubber_sign.png b/src/main/resources/assets/gtceu/textures/block/rubber_sign.png deleted file mode 100644 index 189063160b..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/rubber_sign.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/rubber_wall_hanging_sign.png b/src/main/resources/assets/gtceu/textures/block/rubber_wall_hanging_sign.png deleted file mode 100644 index 02e77aabd0..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/rubber_wall_hanging_sign.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/rubber_wall_sign.png b/src/main/resources/assets/gtceu/textures/block/rubber_wall_sign.png deleted file mode 100644 index 189063160b..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/rubber_wall_sign.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_0.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_0.png deleted file mode 100644 index f4c8b519fc..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_0.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_1.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_1.png deleted file mode 100644 index f5150dccb7..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_1.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_10.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_10.png deleted file mode 100644 index 5e63bfb09d..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_10.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_11.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_11.png deleted file mode 100644 index 139df6448d..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_11.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_12.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_12.png deleted file mode 100644 index 64951eb2db..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_12.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_13.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_13.png deleted file mode 100644 index c73b52eac2..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_13.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_14.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_14.png deleted file mode 100644 index 514b96f753..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_14.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_15.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_15.png deleted file mode 100644 index c5bc02e9ed..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_15.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_2.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_2.png deleted file mode 100644 index 9f36c7668c..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_2.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_3.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_3.png deleted file mode 100644 index c3340157af..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_3.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_4.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_4.png deleted file mode 100644 index 29dfc67657..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_4.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_5.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_5.png deleted file mode 100644 index 4b1fbcf333..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_5.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_6.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_6.png deleted file mode 100644 index 2938d67347..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_6.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_7.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_7.png deleted file mode 100644 index 5451f4883a..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_7.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_8.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_8.png deleted file mode 100644 index 01d77b072c..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_8.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_9.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_9.png deleted file mode 100644 index 1202099cb3..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_9.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_background.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_background.png deleted file mode 100644 index b3781b1041..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_background.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_border.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_border.png deleted file mode 100644 index 23d6c10087..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/metal_border.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_0.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_0.png deleted file mode 100644 index f4c8b519fc..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_0.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_1.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_1.png deleted file mode 100644 index 24a957f0b5..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_1.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_10.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_10.png deleted file mode 100644 index d849cb2941..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_10.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_11.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_11.png deleted file mode 100644 index db74d322da..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_11.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_12.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_12.png deleted file mode 100644 index 0ad5616dd2..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_12.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_13.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_13.png deleted file mode 100644 index 79d2cc1634..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_13.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_14.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_14.png deleted file mode 100644 index c12d1e9e8d..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_14.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_15.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_15.png deleted file mode 100644 index f642a694f1..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_15.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_2.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_2.png deleted file mode 100644 index 2c95591fa1..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_2.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_3.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_3.png deleted file mode 100644 index ad4f3ed29f..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_3.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_4.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_4.png deleted file mode 100644 index 97a61a94a4..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_4.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_5.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_5.png deleted file mode 100644 index 8aabbb4ed0..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_5.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_6.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_6.png deleted file mode 100644 index 9435521e54..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_6.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_7.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_7.png deleted file mode 100644 index 9946a5dbbb..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_7.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_8.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_8.png deleted file mode 100644 index 3a1909badc..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_8.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_9.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_9.png deleted file mode 100644 index 92d03e654f..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_9.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_background.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_background.png deleted file mode 100644 index b3781b1041..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_background.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_border.png b/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_border.png deleted file mode 100644 index e8a8cae131..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/storage/tank/wooden_border.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/block/stripped_rubber_wood.png b/src/main/resources/assets/gtceu/textures/block/stripped_rubber_wood.png index a4c0d2afb7..814313935a 100644 Binary files a/src/main/resources/assets/gtceu/textures/block/stripped_rubber_wood.png and b/src/main/resources/assets/gtceu/textures/block/stripped_rubber_wood.png differ diff --git a/src/main/resources/assets/gtceu/textures/block/treated_wood_hanging_sign.png b/src/main/resources/assets/gtceu/textures/block/treated_wood_hanging_sign.png deleted file mode 100644 index f8085eba53..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/block/treated_wood_hanging_sign.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/entity/boat/rubber_boat.png b/src/main/resources/assets/gtceu/textures/entity/boat/rubber_boat.png new file mode 100644 index 0000000000..97e9a65ef9 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/entity/boat/rubber_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/entity/boat/rubber_chest_boat.png b/src/main/resources/assets/gtceu/textures/entity/boat/rubber_chest_boat.png new file mode 100644 index 0000000000..443a3f0f94 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/entity/boat/rubber_chest_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/entity/boat/treated_boat.png b/src/main/resources/assets/gtceu/textures/entity/boat/treated_boat.png new file mode 100644 index 0000000000..b599ef2a56 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/entity/boat/treated_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/entity/boat/treated_chest_boat.png b/src/main/resources/assets/gtceu/textures/entity/boat/treated_chest_boat.png new file mode 100644 index 0000000000..f3a00cba8f Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/entity/boat/treated_chest_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/entity/signs/hanging/treated_wood.png b/src/main/resources/assets/gtceu/textures/entity/signs/hanging/treated_wood.png index d1b019d3a5..3549aa963a 100644 Binary files a/src/main/resources/assets/gtceu/textures/entity/signs/hanging/treated_wood.png and b/src/main/resources/assets/gtceu/textures/entity/signs/hanging/treated_wood.png differ diff --git a/src/main/resources/assets/gtceu/textures/entity/signs/treated_wood.png b/src/main/resources/assets/gtceu/textures/entity/signs/treated_wood.png index e178b70d4c..0d2ae60204 100644 Binary files a/src/main/resources/assets/gtceu/textures/entity/signs/treated_wood.png and b/src/main/resources/assets/gtceu/textures/entity/signs/treated_wood.png differ diff --git a/src/main/resources/assets/gtceu/textures/gui/hanging_signs/rubber.png b/src/main/resources/assets/gtceu/textures/gui/hanging_signs/rubber.png new file mode 100644 index 0000000000..ef4b9f33b0 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/gui/hanging_signs/rubber.png differ diff --git a/src/main/resources/assets/gtceu/textures/gui/hanging_signs/treated_wood.png b/src/main/resources/assets/gtceu/textures/gui/hanging_signs/treated_wood.png new file mode 100644 index 0000000000..0f24893123 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/gui/hanging_signs/treated_wood.png differ diff --git a/src/main/resources/assets/gtceu/textures/gui/rubber.png b/src/main/resources/assets/gtceu/textures/gui/rubber.png deleted file mode 100644 index 7cc979de2a..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/gui/rubber.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/hanging_signs/rubber.png b/src/main/resources/assets/gtceu/textures/hanging_signs/rubber.png deleted file mode 100644 index 7cc979de2a..0000000000 Binary files a/src/main/resources/assets/gtceu/textures/hanging_signs/rubber.png and /dev/null differ diff --git a/src/main/resources/assets/gtceu/textures/item/bioware.mainframe.png.mcmeta b/src/main/resources/assets/gtceu/textures/item/bioware.mainframe.png.mcmeta deleted file mode 100644 index 8a6e059cfa..0000000000 --- a/src/main/resources/assets/gtceu/textures/item/bioware.mainframe.png.mcmeta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "animation": { - "interpolate": false, - "frametime": 2, - "frames": [ - 0, 1, 2, 3, 4, 3, 2, 1 - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/gtceu/textures/item/data_stick.png.mcmeta b/src/main/resources/assets/gtceu/textures/item/data_stick.png.mcmeta index 5f132698f8..592ac6b260 100644 --- a/src/main/resources/assets/gtceu/textures/item/data_stick.png.mcmeta +++ b/src/main/resources/assets/gtceu/textures/item/data_stick.png.mcmeta @@ -10,7 +10,8 @@ { "index": 5, "time": 2 }, { "index": 6, "time": 2 }, { "index": 7, "time": 2 }, - { "index": 8, "time": 2 } + { "index": 8, "time": 2 }, + { "index": 9, "time": 2 } ] } -} \ No newline at end of file +} diff --git a/src/main/resources/assets/gtceu/textures/item/rubber_boat.png b/src/main/resources/assets/gtceu/textures/item/rubber_boat.png new file mode 100644 index 0000000000..d2998da345 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/rubber_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/rubber_chest_boat.png b/src/main/resources/assets/gtceu/textures/item/rubber_chest_boat.png new file mode 100644 index 0000000000..bfceb351ba Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/rubber_chest_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/treated_wood_boat.png b/src/main/resources/assets/gtceu/textures/item/treated_wood_boat.png new file mode 100644 index 0000000000..94bc2aeef7 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/treated_wood_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/treated_wood_chest_boat.png b/src/main/resources/assets/gtceu/textures/item/treated_wood_chest_boat.png new file mode 100644 index 0000000000..8ca8ead5ee Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/treated_wood_chest_boat.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/wetware_processor_mainframe.png b/src/main/resources/assets/gtceu/textures/item/wetware_processor_mainframe.png index fc00c09388..463ad2c6b8 100644 Binary files a/src/main/resources/assets/gtceu/textures/item/wetware_processor_mainframe.png and b/src/main/resources/assets/gtceu/textures/item/wetware_processor_mainframe.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/wetware_processor_mainframe.png.mcmeta b/src/main/resources/assets/gtceu/textures/item/wetware_processor_mainframe.png.mcmeta index e945b0c407..fb20356f73 100644 --- a/src/main/resources/assets/gtceu/textures/item/wetware_processor_mainframe.png.mcmeta +++ b/src/main/resources/assets/gtceu/textures/item/wetware_processor_mainframe.png.mcmeta @@ -5,33 +5,33 @@ "frames": [ { "index": 1, "time": 40 }, 0, - 3, - { "index": 5, "time": 60 }, - 7, - 8, + 2, + { "index": 4, "time": 60 }, + 6, 7, - 3, - { "index": 4, "time": 50 }, + 6, + 2, + { "index": 3, "time": 50 }, 0, - { "index": 6, "time": 30 }, - 7, - 8, + { "index": 5, "time": 30 }, + 6, 7, + 6, { "index": 1, "time": 40 }, 0, - 3, - { "index": 5, "time": 60 }, - 7, - 8, + 2, + { "index": 4, "time": 60 }, + 6, 7, - 3, - { "index": 4, "time": 50 }, + 6, + 2, + { "index": 3, "time": 50 }, 0, - { "index": 6, "time": 30 }, + { "index": 5, "time": 30 }, { "index": 0, "time": 120 }, - 7, - 8, - 7 + 6, + 7, + 6 ] } -} \ No newline at end of file +}