From 5c42b1c4a20a99e0eb7751cbfdabb8b949e84b43 Mon Sep 17 00:00:00 2001 From: BlayTheNinth <1933180+BlayTheNinth@users.noreply.github.com> Date: Wed, 28 Feb 2024 20:21:43 +0100 Subject: [PATCH] wip: fixes --- .../fabric/datagen/ModRecipeProvider.java | 30 -------------- .../entity/WoodenCrucibleBlockEntity.java | 4 +- .../mods/excompressum/client/ModModels.java | 9 ---- .../excompressum/client/ModRenderers.java | 1 - .../blockentity/WoodenCrucibleRenderer.java | 2 +- .../item/CompressedCrookItem.java | 18 +++----- .../item/CompressedHammerItem.java | 41 +------------------ .../excompressum/item/ICompressedCrook.java | 11 ----- .../excompressum/item/ICompressedHammer.java | 13 ------ .../mods/excompressum/tag/ModItemTags.java | 5 --- .../exnihilosequentia/crushed_andesite.json | 18 ++++++++ .../exnihilosequentia/crushed_diorite.json | 18 ++++++++ .../exnihilosequentia/crushed_end_stone.json | 2 +- .../exnihilosequentia/crushed_granite.json | 18 ++++++++ .../exnihilosequentia/crushed_netherrack.json | 2 +- 15 files changed, 65 insertions(+), 127 deletions(-) delete mode 100644 shared/src/main/java/net/blay09/mods/excompressum/item/ICompressedCrook.java delete mode 100644 shared/src/main/java/net/blay09/mods/excompressum/item/ICompressedHammer.java create mode 100644 shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_andesite.json create mode 100644 shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_diorite.json create mode 100644 shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_granite.json diff --git a/fabric/src/main/java/net/blay09/mods/excompressum/fabric/datagen/ModRecipeProvider.java b/fabric/src/main/java/net/blay09/mods/excompressum/fabric/datagen/ModRecipeProvider.java index 32bb30a6..ac814661 100644 --- a/fabric/src/main/java/net/blay09/mods/excompressum/fabric/datagen/ModRecipeProvider.java +++ b/fabric/src/main/java/net/blay09/mods/excompressum/fabric/datagen/ModRecipeProvider.java @@ -653,36 +653,6 @@ public void buildRecipes(Consumer exporter) { .requires(ModBlocks.compressedBlocks[CompressedBlockType.SOUL_SAND.ordinal()]) .unlockedBy("has_compressed_soul_sand", has(ModBlocks.compressedBlocks[CompressedBlockType.SOUL_SAND.ordinal()])) .save(exporter); - - // TODO shapeless(RecipeCategory.BUILDING_BLOCKS, ModItems.crushedAndesite, 9) - // TODO .requires(ModBlocks.compressedBlocks[CompressedBlockType.CRUSHED_ANDESITE.ordinal()]) - // TODO .unlockedBy("has_compressed_crushed_andesite", has(ModBlocks.compressedBlocks[CompressedBlockType.CRUSHED_ANDESITE.ordinal()])) - // TODO .save(exporter); - - // TODO shapeless(RecipeCategory.BUILDING_BLOCKS, ModItems.crushedDiorite, 9) - // TODO .requires(ModBlocks.compressedBlocks[CompressedBlockType.CRUSHED_DIORITE.ordinal()]) - // TODO .unlockedBy("has_compressed_crushed_diorite", has(ModBlocks.compressedBlocks[CompressedBlockType.CRUSHED_DIORITE.ordinal()])) - // TODO .save(exporter); - - // TODO shapeless(RecipeCategory.BUILDING_BLOCKS, ModItems.crushedGranite, 9) - // TODO .requires(ModBlocks.compressedBlocks[CompressedBlockType.CRUSHED_GRANITE.ordinal()]) - // TODO .unlockedBy("has_compressed_crushed_granite", has(ModBlocks.compressedBlocks[CompressedBlockType.CRUSHED_GRANITE.ordinal()])) - // TODO .save(exporter); - - // TODO shapeless(RecipeCategory.BUILDING_BLOCKS, ModItems.dust, 9) - // TODO .requires(ModBlocks.compressedBlocks[CompressedBlockType.DUST.ordinal()]) - // TODO .unlockedBy("has_compressed_dust", has(ModBlocks.compressedBlocks[CompressedBlockType.DUST.ordinal()])) - // TODO .save(exporter); - - // TODO shapeless(RecipeCategory.BUILDING_BLOCKS, ModItems.enderGravel, 9) - // TODO .requires(ModBlocks.compressedBlocks[CompressedBlockType.ENDER_GRAVEL.ordinal()]) - // TODO .unlockedBy("has_compressed_ender_gravel", has(ModBlocks.compressedBlocks[CompressedBlockType.ENDER_GRAVEL.ordinal()])) - // TODO .save(exporter); - - // TODO shapeless(RecipeCategory.BUILDING_BLOCKS, ModItems.netherGravel, 9) - // TODO .requires(ModBlocks.compressedBlocks[CompressedBlockType.NETHER_GRAVEL.ordinal()]) - // TODO .unlockedBy("has_compressed_nether_gravel", has(ModBlocks.compressedBlocks[CompressedBlockType.NETHER_GRAVEL.ordinal()])) - // TODO .save(exporter); } } diff --git a/shared/src/main/java/net/blay09/mods/excompressum/block/entity/WoodenCrucibleBlockEntity.java b/shared/src/main/java/net/blay09/mods/excompressum/block/entity/WoodenCrucibleBlockEntity.java index 9579199d..23d451f5 100644 --- a/shared/src/main/java/net/blay09/mods/excompressum/block/entity/WoodenCrucibleBlockEntity.java +++ b/shared/src/main/java/net/blay09/mods/excompressum/block/entity/WoodenCrucibleBlockEntity.java @@ -38,7 +38,7 @@ public class WoodenCrucibleBlockEntity extends BalmBlockEntity implements BalmFl public int fill(Fluid fluid, int maxFill, boolean simulate) { int result = super.fill(fluid, maxFill, simulate); if (getAmount() > 1000) { - // TODO setAmount(1000); + setAmount(1000); } return result; } @@ -90,7 +90,7 @@ public boolean addItem(ItemStack itemStack, boolean isAutomated, boolean simulat // Otherwise, try to add it as a recipe WoodenCrucibleRecipe recipe = ExRegistries.getWoodenCrucibleRegistry().getRecipe(level, itemStack); if (recipe != null) { - if (/*fluidTank.isEmpty() ||*/ recipe.matchesFluid(fluidTank.getFluid())) { // TODO isEmpty + if (fluidTank.isEmpty() || recipe.matchesFluid(fluidTank.getFluid())) { int capacityLeft = fluidTank.getCapacity() - fluidTank.getAmount() - solidVolume; if ((isAutomated && capacityLeft >= recipe.getAmount()) || (!isAutomated && capacityLeft > 0)) { if (!simulate) { diff --git a/shared/src/main/java/net/blay09/mods/excompressum/client/ModModels.java b/shared/src/main/java/net/blay09/mods/excompressum/client/ModModels.java index f8476e49..100ac506 100644 --- a/shared/src/main/java/net/blay09/mods/excompressum/client/ModModels.java +++ b/shared/src/main/java/net/blay09/mods/excompressum/client/ModModels.java @@ -35,13 +35,4 @@ private static ResourceLocation location(String path) { return new ResourceLocation(ExCompressum.MOD_ID, path); } - // TODO - /*@SubscribeEvent(priority = EventPriority.HIGHEST) - public static void onBake(ModelBakeEvent event) { - HeavySieveType[] sieveTypes = HeavySieveType.values; - for (HeavySieveType sieveType : sieveTypes) { - UnbakedModel model = event.getModelLoader().getModel(location("block/" + sieveType.getSerializedName() + "_sieve")); - model.getMaterials(event.getModelLoader()::getModel, Collections.emptySet()); - } - }*/ } diff --git a/shared/src/main/java/net/blay09/mods/excompressum/client/ModRenderers.java b/shared/src/main/java/net/blay09/mods/excompressum/client/ModRenderers.java index 282c0efb..fb6f407c 100644 --- a/shared/src/main/java/net/blay09/mods/excompressum/client/ModRenderers.java +++ b/shared/src/main/java/net/blay09/mods/excompressum/client/ModRenderers.java @@ -32,7 +32,6 @@ public static void initialize(BalmRenderers renderers) { renderers.registerBlockEntityRenderer(ModBlockEntities.autoCompressedHammer::get, AutoHammerRenderer::compressed); renderers.registerBlockEntityRenderer(ModBlockEntities.woodenCrucible::get, WoodenCrucibleRenderer::new); renderers.registerBlockEntityRenderer(ModBlockEntities.bait::get, BaitRenderer::new); -// TODO renderers.registerBlockEntityRenderer(ModBlockEntities.manaSieve::get, AutoSieveRenderer::normal); renderers.registerEntityRenderer(ModEntities.angryChicken::get, context -> new AngryChickenRenderer(context, new ChickenModel<>(context.bakeLayer(ModelLayers.CHICKEN)), 0.3f)); diff --git a/shared/src/main/java/net/blay09/mods/excompressum/client/render/blockentity/WoodenCrucibleRenderer.java b/shared/src/main/java/net/blay09/mods/excompressum/client/render/blockentity/WoodenCrucibleRenderer.java index 1948995d..1021e40b 100644 --- a/shared/src/main/java/net/blay09/mods/excompressum/client/render/blockentity/WoodenCrucibleRenderer.java +++ b/shared/src/main/java/net/blay09/mods/excompressum/client/render/blockentity/WoodenCrucibleRenderer.java @@ -45,7 +45,7 @@ public void render(WoodenCrucibleBlockEntity blockEntity, float partialTicks, Po } final var fluidTank = blockEntity.getFluidTank(); - if (!fluidTank.getFluid().isSame(Fluids.EMPTY)) { // TODO fluidTank.isEmpty() + if (!fluidTank.isEmpty()) { poseStack.pushPose(); float fillLevel = (float) fluidTank.getAmount() / (float) blockEntity.getFluidTank().getCapacity(); poseStack.translate(0f, fillLevel * 11 / 16f, 0f); diff --git a/shared/src/main/java/net/blay09/mods/excompressum/item/CompressedCrookItem.java b/shared/src/main/java/net/blay09/mods/excompressum/item/CompressedCrookItem.java index 4427b9e0..c01c6c47 100644 --- a/shared/src/main/java/net/blay09/mods/excompressum/item/CompressedCrookItem.java +++ b/shared/src/main/java/net/blay09/mods/excompressum/item/CompressedCrookItem.java @@ -2,6 +2,7 @@ import net.blay09.mods.excompressum.ExCompressum; import net.blay09.mods.excompressum.config.ExCompressumConfig; +import net.blay09.mods.excompressum.tag.ModBlockTags; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.world.InteractionHand; @@ -16,7 +17,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; -public class CompressedCrookItem extends DiggerItem implements ICompressedCrook { +public class CompressedCrookItem extends DiggerItem { public static final String name = "compressed_crook"; public static final ResourceLocation registryName = new ResourceLocation(ExCompressum.MOD_ID, name); @@ -54,18 +55,9 @@ private void pushEntity(ItemStack itemStack, Player player, Entity entity) { } @Override - public boolean isCorrectToolForDrops(BlockState block) { - return block.is(BlockTags.LEAVES); - } - - @Override - public float getDestroySpeed(ItemStack item, BlockState block) { - return block.is(BlockTags.LEAVES) ? (float) (getTier().getSpeed() * ExCompressumConfig.getActive().tools.compressedCrookSpeedMultiplier) : 0f; - } - - @Override - public boolean canCrook(ItemStack itemStack, Level level, BlockState state, Player player) { - return true; + public float getDestroySpeed(ItemStack itemStack, BlockState state) { + final var speed = ExCompressumConfig.getActive().tools.compressedCrookSpeedMultiplier; + return state.is(ModBlockTags.MINEABLE_WITH_CROOK) ? (float) (getTier().getSpeed() * speed) : 0f; } } diff --git a/shared/src/main/java/net/blay09/mods/excompressum/item/CompressedHammerItem.java b/shared/src/main/java/net/blay09/mods/excompressum/item/CompressedHammerItem.java index 314de210..a955345e 100644 --- a/shared/src/main/java/net/blay09/mods/excompressum/item/CompressedHammerItem.java +++ b/shared/src/main/java/net/blay09/mods/excompressum/item/CompressedHammerItem.java @@ -1,52 +1,13 @@ package net.blay09.mods.excompressum.item; -import net.blay09.mods.excompressum.ExCompressum; -import net.blay09.mods.excompressum.registry.ExRegistries; -import net.blay09.mods.excompressum.registry.ExNihilo; - -import net.blay09.mods.excompressum.utils.StupidUtils; -import net.minecraft.tags.BlockTags; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.DiggerItem; import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Tier; -import net.minecraft.world.item.crafting.RecipeManager; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.state.BlockState; - -import java.util.HashSet; -public class CompressedHammerItem extends DiggerItem implements ICompressedHammer { +public class CompressedHammerItem extends DiggerItem { public CompressedHammerItem(Tier tier, Item.Properties properties) { super(6f, -3.2f, tier, ModTags.MINEABLE_WITH_HAMMER, properties); } - @Override - public boolean isCorrectToolForDrops(BlockState state) { - RecipeManager recipeManager = ExCompressum.proxy.get().getRecipeManager(null); - ItemStack itemStack = StupidUtils.getItemStackFromState(state); - return ExRegistries.getCompressedHammerRegistry().isHammerable(recipeManager, itemStack) || ExNihilo.getInstance().isHammerable(state); - } - - @Override - public float getDestroySpeed(ItemStack stack, BlockState state) { - RecipeManager recipeManager = ExCompressum.proxy.get().getRecipeManager(null); - ItemStack itemStack = StupidUtils.getItemStackFromState(state); - if ((ExRegistries.getCompressedHammerRegistry().isHammerable(recipeManager, itemStack) || ExNihilo.getInstance().isHammerable(state))) { - return speed * 0.75f; - } - return 0.8f; - } - - @Override - public boolean canHammer(ItemStack itemStack, Level level, BlockState state, Player player) { - return true; - } - - @Override - public int getHammerLevel(ItemStack itemStack, Level level, BlockState state, Player player) { - return getTier().getLevel(); - } } diff --git a/shared/src/main/java/net/blay09/mods/excompressum/item/ICompressedCrook.java b/shared/src/main/java/net/blay09/mods/excompressum/item/ICompressedCrook.java deleted file mode 100644 index 60b18c5c..00000000 --- a/shared/src/main/java/net/blay09/mods/excompressum/item/ICompressedCrook.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.blay09.mods.excompressum.item; - - -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.state.BlockState; - -public interface ICompressedCrook { - boolean canCrook(ItemStack itemStack, Level level, BlockState state, Player entityPlayer); -} diff --git a/shared/src/main/java/net/blay09/mods/excompressum/item/ICompressedHammer.java b/shared/src/main/java/net/blay09/mods/excompressum/item/ICompressedHammer.java deleted file mode 100644 index b5bcb01a..00000000 --- a/shared/src/main/java/net/blay09/mods/excompressum/item/ICompressedHammer.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.blay09.mods.excompressum.item; - - -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.state.BlockState; - -public interface ICompressedHammer { - boolean canHammer(ItemStack itemStack, Level level, BlockState state, Player entityPlayer); - - int getHammerLevel(ItemStack itemStack, Level level, BlockState state, Player entityPlayer); -} diff --git a/shared/src/main/java/net/blay09/mods/excompressum/tag/ModItemTags.java b/shared/src/main/java/net/blay09/mods/excompressum/tag/ModItemTags.java index e2772c47..58fd4c9a 100644 --- a/shared/src/main/java/net/blay09/mods/excompressum/tag/ModItemTags.java +++ b/shared/src/main/java/net/blay09/mods/excompressum/tag/ModItemTags.java @@ -22,15 +22,10 @@ public class ModItemTags { public static final TagKey WOODEN_CROOKS = TagKey.create(Registries.ITEM, new ResourceLocation(ExCompressum.MOD_ID, "wooden_crooks")); public static final TagKey WOODEN_COMPRESSED_CROOKS = TagKey.create(Registries.ITEM, new ResourceLocation(ExCompressum.MOD_ID, "wooden_compressed_crooks")); public static final TagKey WOODEN_CRUCIBLES = TagKey.create(Registries.ITEM, new ResourceLocation(ExCompressum.MOD_ID, "wooden_crucibles")); - public static final TagKey CRUSHED_ANDESITES = TagKey.create(Registries.ITEM, new ResourceLocation(ExCompressum.MOD_ID, "crushed_andesites")); public static final TagKey CRUSHED_DIORITES = TagKey.create(Registries.ITEM, new ResourceLocation(ExCompressum.MOD_ID, "crushed_diorites")); public static final TagKey CRUSHED_GRANITES = TagKey.create(Registries.ITEM, new ResourceLocation(ExCompressum.MOD_ID, "crushed_granites")); public static final TagKey CRUSHED_NETHERRACKS = TagKey.create(Registries.ITEM, new ResourceLocation(ExCompressum.MOD_ID, "crushed_netherracks")); public static final TagKey CRUSHED_END_STONES = TagKey.create(Registries.ITEM, new ResourceLocation(ExCompressum.MOD_ID, "crushed_end_stones")); public static final TagKey DUSTS = TagKey.create(Registries.ITEM, new ResourceLocation(ExCompressum.MOD_ID, "dusts")); - - public static final TagKey CRUCIBLES = TagKey.create(Registries.ITEM, new ResourceLocation(ExCompressum.MOD_ID, "crucibles")); // TODO needed? - public static final TagKey CROOKS = TagKey.create(Registries.ITEM, new ResourceLocation(ExCompressum.MOD_ID, "crooks")); // TODO needed? - public static final TagKey COMPRESSED_CROOKS = TagKey.create(Registries.ITEM, new ResourceLocation(ExCompressum.MOD_ID, "compressed_crooks")); // TODO needed? } diff --git a/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_andesite.json b/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_andesite.json new file mode 100644 index 00000000..6164d1a6 --- /dev/null +++ b/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_andesite.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shapeless", + "result": { + "item": "exnihilosequentia:crushed_andesite", + "count": 9 + }, + "ingredients": [ + { + "item": "excompressum:compressed_crushed_andesite" + } + ], + "conditions": [ + { + "type": "forge:item_exists", + "item": "exnihilosequentia:crushed_andesite" + } + ] +} diff --git a/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_diorite.json b/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_diorite.json new file mode 100644 index 00000000..4af3690f --- /dev/null +++ b/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_diorite.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shapeless", + "result": { + "item": "exnihilosequentia:crushed_diorite", + "count": 9 + }, + "ingredients": [ + { + "item": "excompressum:compressed_crushed_diorite" + } + ], + "conditions": [ + { + "type": "forge:item_exists", + "item": "exnihilosequentia:crushed_diorite" + } + ] +} diff --git a/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_end_stone.json b/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_end_stone.json index 0621cfe4..04b2798c 100644 --- a/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_end_stone.json +++ b/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_end_stone.json @@ -6,7 +6,7 @@ }, "ingredients": [ { - "item": "excompressum:compressed_ender_gravel" + "item": "excompressum:compressed_crushed_end_stone" } ], "conditions": [ diff --git a/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_granite.json b/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_granite.json new file mode 100644 index 00000000..4069ed1b --- /dev/null +++ b/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_granite.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shapeless", + "result": { + "item": "exnihilosequentia:crushed_granite", + "count": 9 + }, + "ingredients": [ + { + "item": "excompressum:compressed_crushed_granite" + } + ], + "conditions": [ + { + "type": "forge:item_exists", + "item": "exnihilosequentia:crushed_granite" + } + ] +} diff --git a/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_netherrack.json b/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_netherrack.json index 1ef500fa..434006d3 100644 --- a/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_netherrack.json +++ b/shared/src/main/resources/data/excompressum/recipes/exnihilosequentia/crushed_netherrack.json @@ -11,7 +11,7 @@ "type": "minecraft:crafting_shapeless", "ingredients": [ { - "item": "excompressum:compressed_nether_gravel" + "item": "excompressum:compressed_crushed_netherrack" } ], "conditions": [