diff --git a/src/generated/resources/.cache/3fa62e6e7a071b2d9f296990c67d7a2df0006913 b/src/generated/resources/.cache/3fa62e6e7a071b2d9f296990c67d7a2df0006913 index 89fb7daf9..ae52d8534 100644 --- a/src/generated/resources/.cache/3fa62e6e7a071b2d9f296990c67d7a2df0006913 +++ b/src/generated/resources/.cache/3fa62e6e7a071b2d9f296990c67d7a2df0006913 @@ -1,4 +1,4 @@ -// 1.20.1 2023-08-09T10:41:17.2384965 Books: theurgy +// 1.20.1 2023-10-10T14:25:54.1601208 Books: theurgy ead61475fc866f8eb903a6d99236808a0383fd5a data/theurgy/modonomicon/books/the_hermetica/book.json 6397585a0c454daf7ca44fdfcd96a0fe11081905 data/theurgy/modonomicon/books/the_hermetica/categories/getting_started.json d4d2dff97b589c74c8cfed44677e9cf1707a99fd data/theurgy/modonomicon/books/the_hermetica/categories/mercury_flux.json @@ -37,4 +37,4 @@ c5f51b786bfc5c7a7803362acde27cfba40b1107 data/theurgy/modonomicon/books/the_herm d3b133f22a814c94248deec0e585fc9c43228179 data/theurgy/modonomicon/books/the_hermetica/entries/spagyrics/liquefaction_cauldron.json 331cba56f57b89d6ecbf894b01af825e50e108d9 data/theurgy/modonomicon/books/the_hermetica/entries/spagyrics/principles.json 385ca34ac424c982fe951a36bbf2063af212639b data/theurgy/modonomicon/books/the_hermetica/entries/spagyrics/pyromantic_brazier.json -8a14684d4563cf8f4ba7212e7f5b19fcc8e2db48 data/theurgy/modonomicon/books/the_hermetica/entries/spagyrics/solvents.json +b0c8a709513a45788fa9bed6ad1347cdb7c17ba3 data/theurgy/modonomicon/books/the_hermetica/entries/spagyrics/solvents.json diff --git a/src/generated/resources/.cache/44e062bf203da5d734205f46ac5f2eb38d3b96a5 b/src/generated/resources/.cache/44e062bf203da5d734205f46ac5f2eb38d3b96a5 index d7c741a67..f3cf4ff50 100644 --- a/src/generated/resources/.cache/44e062bf203da5d734205f46ac5f2eb38d3b96a5 +++ b/src/generated/resources/.cache/44e062bf203da5d734205f46ac5f2eb38d3b96a5 @@ -1,4 +1,4 @@ -// 1.20.1 2023-08-04T14:44:08.3581096 Block States: theurgy +// 1.20.1 2023-10-10T13:40:49.1227737 Block States: theurgy ef875fc2604f4f19d7604536c66d3d2c26163879 assets/theurgy/blockstates/calcination_oven.json 35782a4ebfe09e4f246b30170c9cec57e31cdcee assets/theurgy/blockstates/caloric_flux_emitter.json 92ebf87f417e3426f30d3e42eeafd933e446eb23 assets/theurgy/blockstates/deepslate_sal_ammoniac_ore.json @@ -26,7 +26,7 @@ c79ce877fb80454b4c5ea666bcc5584c881e8c11 assets/theurgy/models/block/liquefactio b409c8a9f0cf680d9b409e9d9dcef1a73e9c0948 assets/theurgy/models/block/mercury_catalyst.json 52afb4cf68605f9a482f6332b02f523a81b74168 assets/theurgy/models/block/pyromantic_brazier.json 90588f4755497f3c8df737fd06b92d33ff4d0542 assets/theurgy/models/block/pyromantic_brazier_lit.json -3d636dd41003fc736ccdcfb3599acc337df2fcd3 assets/theurgy/models/block/sal_ammoniac_accumulator.json +c79ce877fb80454b4c5ea666bcc5584c881e8c11 assets/theurgy/models/block/sal_ammoniac_accumulator.json 1d93f7f921865f74ffbb18817595c1c1316d322d assets/theurgy/models/block/sal_ammoniac_ore.json c79ce877fb80454b4c5ea666bcc5584c881e8c11 assets/theurgy/models/block/sal_ammoniac_tank.json e0f7b66a84e6588f01abbbce75b1803ffe5d46e2 assets/theurgy/models/item/calcination_oven.json @@ -40,6 +40,6 @@ e0f7b66a84e6588f01abbbce75b1803ffe5d46e2 assets/theurgy/models/item/incubator_su 7452e23d15a4905caefbd048ff18482ccaab75c2 assets/theurgy/models/item/liquefaction_cauldron.json a3ce5b4c6144d76177427a7b1939fc3963811d05 assets/theurgy/models/item/mercury_catalyst.json 0040a92c6a948e59b36cb138ba297ede4435095c assets/theurgy/models/item/pyromantic_brazier.json -06b56e124d971cd220c73012c14b4d0adeb032d2 assets/theurgy/models/item/sal_ammoniac_accumulator.json +e0f7b66a84e6588f01abbbce75b1803ffe5d46e2 assets/theurgy/models/item/sal_ammoniac_accumulator.json 62725c755954bb986667238373b2f56bbcd0dfd4 assets/theurgy/models/item/sal_ammoniac_ore.json e0f7b66a84e6588f01abbbce75b1803ffe5d46e2 assets/theurgy/models/item/sal_ammoniac_tank.json diff --git a/src/generated/resources/.cache/96e1c194aa2b8cdd63adb750d34ba507337ea835 b/src/generated/resources/.cache/96e1c194aa2b8cdd63adb750d34ba507337ea835 index a7c7babf4..0c6b64af6 100644 --- a/src/generated/resources/.cache/96e1c194aa2b8cdd63adb750d34ba507337ea835 +++ b/src/generated/resources/.cache/96e1c194aa2b8cdd63adb750d34ba507337ea835 @@ -1,4 +1,4 @@ -// 1.20.1 2023-08-09T10:53:29.7306597 Shaped Crafting Recipes +// 1.20.1 2023-10-10T14:33:00.2626773 Shaped Crafting Recipes 10616b9ecf4903d076f75f2b754a415125413d44 data/theurgy/recipes/crafting/shaped/amethyst_divination_rod.json 10238f21b147011c777703fc0ade32f5708fd6ad data/theurgy/recipes/crafting/shaped/calcination_oven.json e31f43d1025bbbbe3ab7dbc9892e44cba7fdc0ab data/theurgy/recipes/crafting/shaped/caloric_flux_emitter_from_campfire.json @@ -15,7 +15,7 @@ f2f5b3c943abc56b299522e13e48d9dd45cc608f data/theurgy/recipes/crafting/shaped/in 07f4c6dc7399b08687ef579a23091daaaeb481f7 data/theurgy/recipes/crafting/shaped/liquefaction_cauldron.json fcb5ee591de6878bb39c43b57dc8357c2e8eff09 data/theurgy/recipes/crafting/shaped/mercury_catalyst.json 3c4bb4a4dd344b7d4cf2117d22125b0f47492423 data/theurgy/recipes/crafting/shaped/pyromantic_brazier.json -f227545084d653722a0d993c1b8ea7fb73447f12 data/theurgy/recipes/crafting/shaped/sal_ammoniac_accumulator.json +d936646ef1c9e9a146bf63b3676cc3e338c4f253 data/theurgy/recipes/crafting/shaped/sal_ammoniac_accumulator.json a29b1881ae565d790b09ee568780627b7854e0fe data/theurgy/recipes/crafting/shaped/sal_ammoniac_tank.json 447b0ae8e48b94342498e573e74f31835a60a98f data/theurgy/recipes/crafting/shaped/sulfur_attuned_divination_rod_abundant.json 6300e5cdd6946b5b3c4e9b746ffe89201eb8e76b data/theurgy/recipes/crafting/shaped/sulfur_attuned_divination_rod_common.json diff --git a/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 b/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 index 5a58655c9..590ebb138 100644 --- a/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 +++ b/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8 @@ -1,2 +1,2 @@ -// 1.20.1 2023-08-09T18:51:43.5516968 Languages: en_us -7d945b41d6dfc83722dc10485c93b477893bf147 assets/theurgy/lang/en_us.json +// 1.20.1 2023-10-10T14:29:25.6583765 Languages: en_us +13c4aafac66d9901f8eb7b2f36e30ea04fc313a8 assets/theurgy/lang/en_us.json diff --git a/src/generated/resources/assets/theurgy/lang/en_us.json b/src/generated/resources/assets/theurgy/lang/en_us.json index ed147ae72..ddf816413 100644 --- a/src/generated/resources/assets/theurgy/lang/en_us.json +++ b/src/generated/resources/assets/theurgy/lang/en_us.json @@ -295,7 +295,7 @@ "book.theurgy.the_hermetica.spagyrics.pyromantic_brazier.name": "Pyromantic Brazier", "book.theurgy.the_hermetica.spagyrics.pyromantic_brazier.usage.text": "Place the [](item://theurgy:pyromantic_brazier) below the Alchemical Device you want to power, then insert a fuel item by right-clicking the brazier with it.\n\\\n\\\nAlternatively a hopper can be used to insert fuel items.\n\\\n\\\nSee also [Alchemical Apparatus](entry://getting_started/apparatus_how_to).\n", "book.theurgy.the_hermetica.spagyrics.pyromantic_brazier.usage.title": "Usage", - "book.theurgy.the_hermetica.spagyrics.solvents.crafting.text": "Sal Ammoniac is crafted in a [](item://theurgy:sal_ammoniac_accumulator). It has two modes of operation: It can increase the concentration of naturally occuring Sal Ammoniac in water to a usable level via evaporation, which is a rather slow and inefficient process, or it can enrich water with [Sal Ammoniac Crystals](item://theurgy:sal_ammoniac_crystal) to produce a usable solvent much quicker.\n", + "book.theurgy.the_hermetica.spagyrics.solvents.crafting.text": "Sal Ammoniac is crafted in a [](item://theurgy:sal_ammoniac_accumulator). It has two modes of operation: It can increase the concentration of naturally occurring Sal Ammoniac in water to a usable level via evaporation, which is a rather slow and inefficient process, or it can enrich water with [Sal Ammoniac Crystals](item://theurgy:sal_ammoniac_crystal) to produce a usable solvent much quicker.\n", "book.theurgy.the_hermetica.spagyrics.solvents.crafting.title": "Crafting", "book.theurgy.the_hermetica.spagyrics.solvents.description": "Solving all your problems?", "book.theurgy.the_hermetica.spagyrics.solvents.intro.text": "Solvents are required for the process of Liquefaction, by which [#](ad03fc)Alchemical Sulfur[#]() is extracted from matter. Usually they are a type of acid. The following solvents are available:\n- Sal Ammoniac\n- Alkahest *(not yet implemented)*\n", @@ -305,7 +305,7 @@ "book.theurgy.the_hermetica.spagyrics.solvents.sal_ammoniac_fluid_recipe.title.2": "... using Crystal", "book.theurgy.the_hermetica.spagyrics.solvents.usage.text": "Place the [](item://theurgy:sal_ammoniac_accumulator) on top of a [](item://theurgy:sal_ammoniac_tank), and fill it with a Water by right-clicking with a water bucket.\n\\\n\\\nOptionally insert a [](item://theurgy:sal_ammoniac_crystal) by right-clicking the cauldron with it to speed up the process.\n\\\n\\\nSee also [Alchemical Apparatus](entry://getting_started/apparatus_how_to).\n", "book.theurgy.the_hermetica.spagyrics.solvents.usage.title": "Usage", - "book.theurgy.the_hermetica.spagyrics.solvents.working.text": "If the [](item://theurgy:sal_ammoniac_accumulator) is working properly, it will show bubbles.\n", + "book.theurgy.the_hermetica.spagyrics.solvents.working.text": "If working properly, it will show blue or yellow (if using Sal Ammoniac Crystals) bubbles.\n", "book.theurgy.the_hermetica.spagyrics.solvents.working.title": "Working Correctly", "book.theurgy.the_hermetica.tooltip": "A treatise on the Ancient Art of Alchemy.\n§o(In-Game Guide for Theurgy)§r", "config.jade.plugin_theurgy.mercury_flux": "Theurgy Mercury Flux", diff --git a/src/generated/resources/assets/theurgy/models/block/sal_ammoniac_accumulator.json b/src/generated/resources/assets/theurgy/models/block/sal_ammoniac_accumulator.json index 3884aa374..8fa0027ab 100644 --- a/src/generated/resources/assets/theurgy/models/block/sal_ammoniac_accumulator.json +++ b/src/generated/resources/assets/theurgy/models/block/sal_ammoniac_accumulator.json @@ -1,8 +1,5 @@ { - "parent": "theurgy:block/sal_ammoniac_accumulator_template", - "ambientocclusion": false, "textures": { - "particle": "minecraft:block/copper_block", - "texture": "theurgy:block/sal_ammoniac_accumulator" + "particle": "minecraft:block/copper_block" } } \ No newline at end of file diff --git a/src/generated/resources/assets/theurgy/models/item/sal_ammoniac_accumulator.json b/src/generated/resources/assets/theurgy/models/item/sal_ammoniac_accumulator.json index 20b3d0bc0..ad08d9786 100644 --- a/src/generated/resources/assets/theurgy/models/item/sal_ammoniac_accumulator.json +++ b/src/generated/resources/assets/theurgy/models/item/sal_ammoniac_accumulator.json @@ -1,3 +1,3 @@ { - "parent": "theurgy:block/sal_ammoniac_accumulator" + "parent": "minecraft:builtin/entity" } \ No newline at end of file diff --git a/src/generated/resources/data/theurgy/modonomicon/books/the_hermetica/entries/spagyrics/solvents.json b/src/generated/resources/data/theurgy/modonomicon/books/the_hermetica/entries/spagyrics/solvents.json index 0baf4f573..328df07bd 100644 --- a/src/generated/resources/data/theurgy/modonomicon/books/the_hermetica/entries/spagyrics/solvents.json +++ b/src/generated/resources/data/theurgy/modonomicon/books/the_hermetica/entries/spagyrics/solvents.json @@ -61,7 +61,7 @@ "anchor": "", "border": true, "images": [ - "theurgy:textures/gui/book/256.png" + "theurgy:textures/gui/book/sal_ammoniac_accumulator_working.png" ], "text": "book.theurgy.the_hermetica.spagyrics.solvents.working.text", "title": "book.theurgy.the_hermetica.spagyrics.solvents.working.title" diff --git a/src/generated/resources/data/theurgy/recipes/crafting/shaped/sal_ammoniac_accumulator.json b/src/generated/resources/data/theurgy/recipes/crafting/shaped/sal_ammoniac_accumulator.json index 2f9e60685..b74cb02bf 100644 --- a/src/generated/resources/data/theurgy/recipes/crafting/shaped/sal_ammoniac_accumulator.json +++ b/src/generated/resources/data/theurgy/recipes/crafting/shaped/sal_ammoniac_accumulator.json @@ -1,20 +1,20 @@ { "type": "minecraft:crafting_shaped", "key": { - "C": { - "tag": "forge:storage_blocks/copper" - }, "I": { "tag": "forge:ingots/iron" }, + "R": { + "tag": "forge:rods/wooden" + }, "S": { "tag": "forge:stone" } }, "pattern": [ - "ICI", - "SIS", - "S S" + "SSS", + "III", + "R R" ], "result": { "count": 1, diff --git a/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/SalAmmoniacAccumulatorBlock.java b/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/SalAmmoniacAccumulatorBlock.java index 97b2903c4..47ea5a68e 100644 --- a/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/SalAmmoniacAccumulatorBlock.java +++ b/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/SalAmmoniacAccumulatorBlock.java @@ -15,6 +15,7 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; @@ -24,10 +25,14 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.items.wrapper.RecipeWrapper; import org.jetbrains.annotations.Nullable; public class SalAmmoniacAccumulatorBlock extends Block implements EntityBlock { + + protected static final VoxelShape SHAPE = Block.box(1, 0, 1, 16, 6, 16); protected ItemHandlerBehaviour itemHandlerBehaviour; protected FluidHandlerBehaviour fluidHandlerBehaviour; @@ -37,6 +42,12 @@ public SalAmmoniacAccumulatorBlock(Properties pProperties) { this.fluidHandlerBehaviour = new OneTankFluidHandlerBehaviour(); } + @Override + public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { + final VoxelShape SHAPE = Block.box(1, 0, 1, 15, 13, 15); + return SHAPE; + } + @Override @SuppressWarnings("deprecation") public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand, BlockHitResult pHit) { diff --git a/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/SalAmmoniacAccumulatorBlockEntity.java b/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/SalAmmoniacAccumulatorBlockEntity.java index 793e23e10..2436ce875 100644 --- a/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/SalAmmoniacAccumulatorBlockEntity.java +++ b/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/SalAmmoniacAccumulatorBlockEntity.java @@ -32,10 +32,16 @@ import net.minecraftforge.items.ItemStackHandler; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import software.bernie.geckolib.animatable.GeoBlockEntity; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.util.GeckoLibUtil; import java.util.function.Predicate; -public class SalAmmoniacAccumulatorBlockEntity extends BlockEntity { +public class SalAmmoniacAccumulatorBlockEntity extends BlockEntity implements GeoBlockEntity { + + protected final AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); public ItemStackHandler inventory; public LazyOptional inventoryCapability; @@ -54,7 +60,7 @@ public SalAmmoniacAccumulatorBlockEntity(BlockPos pPos, BlockState pState) { this.inventory = new Inventory(); this.inventoryCapability = LazyOptional.of(() -> this.inventory); - this.craftingBehaviour = new SalAmmoniacAccumulatorCraftingBehaviour(this, () -> this.inventory, () -> this.inventory, () -> this.waterTank, () -> this.getOutputTank()); + this.craftingBehaviour = new SalAmmoniacAccumulatorCraftingBehaviour(this, () -> this.inventory, () -> this.inventory, () -> this.waterTank, this::getOutputTank); this.waterTank = new WaterTank(FluidType.BUCKET_VOLUME * 10, this.craftingBehaviour::canProcess); this.waterTankCapability = LazyOptional.of(() -> this.waterTank); @@ -137,7 +143,7 @@ public void tickClient() { var fluidHeight = fluidStack.getAmount() / (float) this.waterTank.getCapacity(); //move fluid plane between bottom and top of the model - fluidHeight += 0.5f; + fluidHeight += 0.3f; fluidHeight *= 0.60f; this.getLevel().addParticle( @@ -213,6 +219,16 @@ public void load(CompoundTag pTag) { this.craftingBehaviour.load(pTag); } + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return this.animatableInstanceCache; + } + public class WaterTank extends FluidTank { public WaterTank(int capacity, Predicate validator) { diff --git a/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/SalAmmoniacAccumulatorBlockItem.java b/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/SalAmmoniacAccumulatorBlockItem.java new file mode 100644 index 000000000..2ac3bc789 --- /dev/null +++ b/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/SalAmmoniacAccumulatorBlockItem.java @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: 2023 klikli-dev +// +// SPDX-License-Identifier: MIT + +package com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator; + +import com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator.render.SalAmmoniacAccumulatorBEWLR; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.level.block.Block; +import net.minecraftforge.client.extensions.common.IClientItemExtensions; +import software.bernie.geckolib.animatable.GeoItem; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.util.GeckoLibUtil; + +import java.util.function.Consumer; + +public class SalAmmoniacAccumulatorBlockItem extends BlockItem implements GeoItem { + + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public SalAmmoniacAccumulatorBlockItem(Block pBlock, Properties pProperties) { + super(pBlock, pProperties); + } + + + @Override + public void initializeClient(Consumer consumer) { + consumer.accept(new IClientItemExtensions() { + @Override + public BlockEntityWithoutLevelRenderer getCustomRenderer() { + return SalAmmoniacAccumulatorBEWLR.get(); + } + }); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + //do not show anims on item + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return this.cache; + } +} diff --git a/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/render/SalAmmoniacAccumulatorBEWLR.java b/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/render/SalAmmoniacAccumulatorBEWLR.java new file mode 100644 index 000000000..1f7509469 --- /dev/null +++ b/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/render/SalAmmoniacAccumulatorBEWLR.java @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: 2023 klikli-dev +// +// SPDX-License-Identifier: MIT + +package com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator.render; + +import com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator.SalAmmoniacAccumulatorBlockItem; +import com.klikli_dev.theurgy.content.apparatus.salammoniactank.SalAmmoniacTankBlockItem; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.model.ItemTransform; +import net.minecraft.world.item.ItemDisplayContext; +import org.joml.Matrix4f; +import org.joml.Vector3f; +import software.bernie.geckolib.cache.object.BakedGeoModel; +import software.bernie.geckolib.renderer.GeoItemRenderer; + +public class SalAmmoniacAccumulatorBEWLR extends GeoItemRenderer { + + private static final SalAmmoniacAccumulatorBEWLR instance = new SalAmmoniacAccumulatorBEWLR(); + private final ItemTransform transform; + + public SalAmmoniacAccumulatorBEWLR() { + super(new SalAmmoniacAccumulatorModel()); + this.withScale(0.5f); + this.transform = new ItemTransform(new Vector3f(30, 255, 0), new Vector3f(0, 0, 0), new Vector3f(1, 1, 1)); + } + + public static SalAmmoniacAccumulatorBEWLR get() { + return instance; + } + + @Override + public void preRender(PoseStack poseStack, SalAmmoniacAccumulatorBlockItem animatable, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green, float blue, + float alpha) { + //copied from parent, but fixed to also center the model when scaling + this.itemRenderTranslations = new Matrix4f(poseStack.last().pose()); + + if (this.scaleWidth != 1 && this.scaleHeight != 1) { + poseStack.scale(this.scaleWidth, this.scaleHeight, this.scaleWidth); + + //this is not as clean as I would like it - but it exactly centers the model for 0.5 scale :D + poseStack.translate(this.scaleWidth / 0.5 - 0.5, -0.1, this.scaleWidth / 0.5 - 0.5); + } + + poseStack.translate(0.5f, 0.51f, 0.5f); + + if (this.renderPerspective == ItemDisplayContext.GUI) { + this.transform.apply(false, poseStack); + } + } +} diff --git a/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/render/SalAmmoniacAccumulatorModel.java b/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/render/SalAmmoniacAccumulatorModel.java new file mode 100644 index 000000000..716ba8c9f --- /dev/null +++ b/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/render/SalAmmoniacAccumulatorModel.java @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: 2023 klikli-dev +// +// SPDX-License-Identifier: MIT + +package com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator.render; + +import com.klikli_dev.theurgy.Theurgy; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.resources.ResourceLocation; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.model.GeoModel; + +public class SalAmmoniacAccumulatorModel extends GeoModel { + @Override + public ResourceLocation getModelResource(GeoAnimatable animatable) { + return Theurgy.loc("geo/sal_ammoniac_accumulator.geo.json"); + } + + @Override + public ResourceLocation getTextureResource(GeoAnimatable animatable) { + return Theurgy.loc("textures/block/sal_ammoniac_accumulator.png"); + } + + @Override + public ResourceLocation getAnimationResource(GeoAnimatable animatable) { + return Theurgy.loc(""); + } +} diff --git a/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/render/SalAmmoniacAccumulatorRenderer.java b/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/render/SalAmmoniacAccumulatorRenderer.java index d24d86e8a..95ff7d4d0 100644 --- a/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/render/SalAmmoniacAccumulatorRenderer.java +++ b/src/main/java/com/klikli_dev/theurgy/content/apparatus/salammoniacaccumulator/render/SalAmmoniacAccumulatorRenderer.java @@ -5,96 +5,60 @@ package com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator.render; import com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator.SalAmmoniacAccumulatorBlockEntity; -import com.klikli_dev.theurgy.content.render.RenderTypes; -import com.klikli_dev.theurgy.registry.ItemTagRegistry; +import com.klikli_dev.theurgy.content.render.FluidRenderer; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; -import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.core.Direction; -import net.minecraft.core.Vec3i; -import net.minecraft.world.inventory.InventoryMenu; -import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; +import net.minecraft.util.Mth; +import software.bernie.geckolib.cache.object.BakedGeoModel; +import software.bernie.geckolib.renderer.GeoBlockRenderer; -public class SalAmmoniacAccumulatorRenderer implements BlockEntityRenderer { +public class SalAmmoniacAccumulatorRenderer extends GeoBlockRenderer { public SalAmmoniacAccumulatorRenderer(BlockEntityRendererProvider.Context pContext) { + super(new SalAmmoniacAccumulatorModel()); } - private static void putVertex(VertexConsumer builder, PoseStack ms, float x, float y, float z, int color, float u, - float v, Direction face, int light) { - Vec3i normal = face.getNormal(); - PoseStack.Pose peek = ms.last(); - int a = color >> 24 & 0xff; - int r = color >> 16 & 0xff; - int g = color >> 8 & 0xff; - int b = color & 0xff; - - builder.vertex(peek.pose(), x, y, z) - .color(r, g, b, a) - .uv(u, v) - .overlayCoords(OverlayTexture.NO_OVERLAY) - .uv2(light) - .normal(peek.normal(), normal.getX(), normal.getY(), normal.getZ()) - .endVertex(); - } - - @Override /** - * Based on com.simibubi.create.content.contraptions.fluids.tank.FluidTankR + * See com.simibubi.create.content.fluids.tank.FluidTankRenderer */ - public void render(SalAmmoniacAccumulatorBlockEntity pBlockEntity, float pPartialTick, PoseStack pPoseStack, MultiBufferSource pBufferSource, int pPackedLight, int pPackedOverlay) { + @Override + public void actuallyRender(PoseStack poseStack, SalAmmoniacAccumulatorBlockEntity pBlockEntity, BakedGeoModel model, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int pPackedLight, int packedOverlay, float red, float green, float blue, float alpha) { + super.actuallyRender(poseStack, pBlockEntity, model, renderType, bufferSource, buffer, isReRender, partialTick, pPackedLight, packedOverlay, red, green, blue, alpha); + if (pBlockEntity.waterTank.isEmpty()) return; var fluidStack = pBlockEntity.waterTank.getFluid(); - var fluid = fluidStack.getFluid(); - var fluidType = fluid.getFluidType(); - var fluidClientExtension = IClientFluidTypeExtensions.of(fluid); - - TextureAtlasSprite fluidTexture = Minecraft.getInstance() - .getTextureAtlas(InventoryMenu.BLOCK_ATLAS) - .apply(fluidClientExtension.getStillTexture(fluidStack)); - - int color = fluidClientExtension.getTintColor(fluidStack); - - if (pBlockEntity.inventory.getStackInSlot(0).is(ItemTagRegistry.SAL_AMMONIAC_GEMS)) - color = 0xFFC080FF; - - int blockLightIn = (pPackedLight >> 4) & 0xF; - int luminosity = Math.max(blockLightIn, fluidType.getLightLevel(fluidStack)); - var fluidLight = (pPackedLight & 0xF00000) | luminosity << 4; var fluidHeight = fluidStack.getAmount() / (float) pBlockEntity.waterTank.getCapacity(); - //move fluid plane between bottom and top of the model - fluidHeight += 0.5f; - fluidHeight *= 0.60f; - - pPoseStack.pushPose(); - - var min = 0.25f; - var max = 1 - min; - - var builder = pBufferSource.getBuffer(RenderTypes.fluid()); - - putVertex(builder, pPoseStack, min, fluidHeight, min, color, - fluidTexture.getU(2), fluidTexture.getV(2), Direction.UP, fluidLight); - - putVertex(builder, pPoseStack, min, fluidHeight, max, color, - fluidTexture.getU(14), fluidTexture.getV(2), Direction.UP, fluidLight); - - putVertex(builder, pPoseStack, max, fluidHeight, max, color, - fluidTexture.getU(14), fluidTexture.getV(14), Direction.UP, fluidLight); - - putVertex(builder, pPoseStack, max, fluidHeight, min, color, - fluidTexture.getU(2), fluidTexture.getV(14), Direction.UP, fluidLight); - - pPoseStack.popPose(); + float blockHeight = 12 / 16f - 2 / 128f; + float blockWidth = 1; + float capHeight = 0 / 4f; + float tankHullWidth = 3 / 16f + 2 / 128f; + float minPuddleHeight = 1 / 16f; + float totalHeight = blockHeight - 2 * capHeight - minPuddleHeight; + + float level = fluidHeight; +// if (level < 1 / (512f * totalHeight)) //leads to not rendering in fill levels below 10/1000 or so. +// return; + float clampedLevel = Mth.clamp(level * totalHeight, 0, totalHeight); + + float xMin = tankHullWidth; + float xMax = xMin + blockWidth - 2 * tankHullWidth; + float yMin = totalHeight + capHeight + minPuddleHeight - clampedLevel; + float yMax = yMin + clampedLevel; + + float zMin = tankHullWidth; + float zMax = zMin + blockWidth - 2 * tankHullWidth; + + poseStack.pushPose(); + poseStack.translate(0, clampedLevel - totalHeight, 0); + FluidRenderer.renderFluidBox(fluidStack, xMin, yMin, zMin, xMax, yMax, zMax, bufferSource, poseStack, pPackedLight, false); + poseStack.popPose(); } } diff --git a/src/main/java/com/klikli_dev/theurgy/datagen/book/SpagyricsCategoryProvider.java b/src/main/java/com/klikli_dev/theurgy/datagen/book/SpagyricsCategoryProvider.java index 97c9e5d78..f13312335 100644 --- a/src/main/java/com/klikli_dev/theurgy/datagen/book/SpagyricsCategoryProvider.java +++ b/src/main/java/com/klikli_dev/theurgy/datagen/book/SpagyricsCategoryProvider.java @@ -352,7 +352,7 @@ private BookEntryModel makeSolventsEntry(char location) { this.add(this.context().pageTitle(), "Crafting"); this.add(this.context().pageText(), """ - Sal Ammoniac is crafted in a {0}. It has two modes of operation: It can increase the concentration of naturally occuring Sal Ammoniac in water to a usable level via evaporation, which is a rather slow and inefficient process, or it can enrich water with {1} to produce a usable solvent much quicker. + Sal Ammoniac is crafted in a {0}. It has two modes of operation: It can increase the concentration of naturally occurring Sal Ammoniac in water to a usable level via evaporation, which is a rather slow and inefficient process, or it can enrich water with {1} to produce a usable solvent much quicker. """, this.itemLink(ItemRegistry.SAL_AMMONIAC_ACCUMULATOR.get()), this.itemLink("Sal Ammoniac Crystals", ItemRegistry.SAL_AMMONIAC_CRYSTAL.get()) @@ -401,12 +401,12 @@ private BookEntryModel makeSolventsEntry(char location) { var working = BookImagePageModel.builder() .withTitle(this.context().pageTitle()) .withText(this.context().pageText()) - .withImages(this.modLoc("textures/gui/book/256.png")) //TODO: Hermetica: add real image + .withImages(this.modLoc("textures/gui/book/sal_ammoniac_accumulator_working.png")) .build(); this.add(this.context().pageTitle(), "Working Correctly"); this.add(this.context().pageText(), """ - If the {0} is working properly, it will show bubbles. + If working properly, it will show blue or yellow (if using Sal Ammoniac Crystals) bubbles. """, this.itemLink(ItemRegistry.SAL_AMMONIAC_ACCUMULATOR.get()) ); diff --git a/src/main/java/com/klikli_dev/theurgy/datagen/model/TheurgyBlockStateProvider.java b/src/main/java/com/klikli_dev/theurgy/datagen/model/TheurgyBlockStateProvider.java index c5135c4b8..33eb10d2a 100644 --- a/src/main/java/com/klikli_dev/theurgy/datagen/model/TheurgyBlockStateProvider.java +++ b/src/main/java/com/klikli_dev/theurgy/datagen/model/TheurgyBlockStateProvider.java @@ -59,14 +59,15 @@ protected void registerCaloricFluxEmitter() { } protected void registerSalAmmoniacAccumulator() { - var model = this.models().withExistingParent("sal_ammoniac_accumulator", this.modLoc("block/sal_ammoniac_accumulator_template")) - .ao(false) - //blockbench spits out garbage textures by losing the folder name so we fix them here - .texture("texture", this.modLoc("block/sal_ammoniac_accumulator")) - .texture("particle", this.mcLoc("block/copper_block")); + //accumulator is rendered by geckolib, so we just give a model with a particle texture + //we then use it for both the lit and unlit blockstate + var model = this.models().getBuilder("sal_ammoniac_accumulator").texture("particle", "minecraft:block/copper_block"); //build blockstate - this.simpleBlockWithItem(BlockRegistry.SAL_AMMONIAC_ACCUMULATOR.get(), model); + this.simpleBlock(BlockRegistry.SAL_AMMONIAC_ACCUMULATOR.get(), model); + + //needs an item model that allows geckolib to render + this.itemModels().getBuilder("sal_ammoniac_accumulator").parent(new ModelFile.UncheckedModelFile("builtin/entity")); } protected void registerSalAmmoniacTank() { diff --git a/src/main/java/com/klikli_dev/theurgy/datagen/recipe/ShapedRecipeProvider.java b/src/main/java/com/klikli_dev/theurgy/datagen/recipe/ShapedRecipeProvider.java index f7cee5c07..6a0a6b924 100644 --- a/src/main/java/com/klikli_dev/theurgy/datagen/recipe/ShapedRecipeProvider.java +++ b/src/main/java/com/klikli_dev/theurgy/datagen/recipe/ShapedRecipeProvider.java @@ -172,10 +172,10 @@ void buildRecipes(BiConsumer recipeConsumer) { this.makeRecipe(ItemRegistry.SAL_AMMONIAC_ACCUMULATOR.get(), new RecipeBuilder( ItemRegistry.SAL_AMMONIAC_ACCUMULATOR.get(), 1) - .pattern("ICI") - .pattern("SIS") - .pattern("S S") - .define('C', Tags.Items.STORAGE_BLOCKS_COPPER) + .pattern("SSS") + .pattern("III") + .pattern("R R") + .define('R', Tags.Items.RODS_WOODEN) .define('I', Tags.Items.INGOTS_IRON) .define('S', Tags.Items.STONE) ); diff --git a/src/main/java/com/klikli_dev/theurgy/registry/ItemRegistry.java b/src/main/java/com/klikli_dev/theurgy/registry/ItemRegistry.java index d6ea90396..b9c1962d5 100644 --- a/src/main/java/com/klikli_dev/theurgy/registry/ItemRegistry.java +++ b/src/main/java/com/klikli_dev/theurgy/registry/ItemRegistry.java @@ -11,6 +11,7 @@ import com.klikli_dev.theurgy.content.apparatus.incubator.IncubatorMercuryVesselBlockItem; import com.klikli_dev.theurgy.content.apparatus.incubator.IncubatorSaltVesselBlockItem; import com.klikli_dev.theurgy.content.apparatus.incubator.IncubatorSulfurVesselBlockItem; +import com.klikli_dev.theurgy.content.apparatus.salammoniacaccumulator.SalAmmoniacAccumulatorBlockItem; import com.klikli_dev.theurgy.content.apparatus.salammoniactank.SalAmmoniacTankBlockItem; import com.klikli_dev.theurgy.content.item.DivinationRodItem; import net.minecraft.world.item.*; @@ -116,7 +117,7 @@ public class ItemRegistry { public static final RegistryObject INCUBATOR_SULFUR_VESSEL = ITEMS.register("incubator_sulfur_vessel", () -> new IncubatorSulfurVesselBlockItem(BlockRegistry.INCUBATOR_SULFUR_VESSEL.get(), new Item.Properties())); public static final RegistryObject SAL_AMMONIAC_ACCUMULATOR = - ITEMS.register("sal_ammoniac_accumulator", () -> new BlockItem(BlockRegistry.SAL_AMMONIAC_ACCUMULATOR.get(), new Item.Properties())); + ITEMS.register("sal_ammoniac_accumulator", () -> new SalAmmoniacAccumulatorBlockItem(BlockRegistry.SAL_AMMONIAC_ACCUMULATOR.get(), new Item.Properties())); public static final RegistryObject SAL_AMMONIAC_TANK = ITEMS.register("sal_ammoniac_tank", () -> new SalAmmoniacTankBlockItem(BlockRegistry.SAL_AMMONIAC_TANK.get(), new Item.Properties())); public static final RegistryObject MERCURY_CATALYST = diff --git a/src/main/resources/assets/theurgy/geo/sal_ammoniac_accumulator.geo.json b/src/main/resources/assets/theurgy/geo/sal_ammoniac_accumulator.geo.json new file mode 100644 index 000000000..847486c9a --- /dev/null +++ b/src/main/resources/assets/theurgy/geo/sal_ammoniac_accumulator.geo.json @@ -0,0 +1,32 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.sal_ammoniac_accumulator", + "texture_width": 64, + "texture_height": 64, + "visible_bounds_width": 3, + "visible_bounds_height": 2.5, + "visible_bounds_offset": [0, 0.75, 0] + }, + "bones": [ + { + "name": "bb_main", + "pivot": [0, -2, 0], + "cubes": [ + {"origin": [-7, 11.95, -7], "size": [14, 1, 4], "uv": [0, 27]}, + {"origin": [-7, 11.95, 3], "size": [14, 1, 4], "pivot": [0, 12.45, 5], "rotation": [0, 180, 0], "uv": [0, 22]}, + {"origin": [2, 11.95, 8], "size": [6, 1, 4], "pivot": [10, 12.45, 5], "rotation": [0, -90, 0], "uv": [30, 5]}, + {"origin": [2, 11.95, 18], "size": [6, 1, 4], "pivot": [10, 12.45, 5], "rotation": [0, -90, 0], "uv": [30, 0]}, + {"origin": [-6, -1.05, -6], "size": [2, 13, 2], "uv": [24, 32]}, + {"origin": [4, -1.05, -6], "size": [2, 13, 2], "uv": [16, 32]}, + {"origin": [4, -1.05, 4], "size": [2, 13, 2], "uv": [0, 32]}, + {"origin": [-5, -0.05, -5], "size": [10, 12, 10], "uv": [0, 0]}, + {"origin": [-6, -1.05, 4], "size": [2, 13, 2], "uv": [8, 32]} + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/theurgy/textures/block/sal_ammoniac_accumulator.png b/src/main/resources/assets/theurgy/textures/block/sal_ammoniac_accumulator.png index 58f4a5c41..bf1c3a72e 100644 Binary files a/src/main/resources/assets/theurgy/textures/block/sal_ammoniac_accumulator.png and b/src/main/resources/assets/theurgy/textures/block/sal_ammoniac_accumulator.png differ diff --git a/src/main/resources/assets/theurgy/textures/gui/book/sal_ammoniac_accumulator_working.png b/src/main/resources/assets/theurgy/textures/gui/book/sal_ammoniac_accumulator_working.png new file mode 100644 index 000000000..6e5b0c4ee Binary files /dev/null and b/src/main/resources/assets/theurgy/textures/gui/book/sal_ammoniac_accumulator_working.png differ