From 493d3f862a28dbfd55b84e2302c46e5479004230 Mon Sep 17 00:00:00 2001 From: Maxx <53229958+MBatt1@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:24:49 -0500 Subject: [PATCH] backport 2.2.5 fixes from 1.20.5 --- gradle.properties | 2 +- .../blocks/blockentity/TreeTapBlockEntity.java | 4 ++-- .../blocks/mechanical/TreeTapBlock.java | 3 ++- .../items/tools/ParadiseLostToolMaterials.java | 17 +++++++---------- .../items/utils/IngredientUtil.java | 17 ----------------- .../recipes/flaxweave_cushion.json | 5 ++--- .../recipes/flaxweave_from_cushion.json | 2 +- .../recipes/tree_tap/dragon_breath.json | 12 ++++++++++++ .../recipes/tree_tap/regeneration_potion.json | 15 +++++++++++++++ 9 files changed, 42 insertions(+), 35 deletions(-) delete mode 100644 src/main/java/net/id/paradiselost/items/utils/IngredientUtil.java create mode 100644 src/main/resources/data/paradise_lost/recipes/tree_tap/dragon_breath.json create mode 100644 src/main/resources/data/paradise_lost/recipes/tree_tap/regeneration_potion.json diff --git a/gradle.properties b/gradle.properties index 53b6284c1..c1dfd0af1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ # suppress inspection "UnusedProperty" for whole file org.gradle.jvmargs=-Xmx2G -paradiseLostVersion=2.2.4-beta+1.20.3 +paradiseLostVersion=2.2.5-beta+1.20.3 minecraft_version=1.20.3 yarn_mappings=1.20.3+build.1 diff --git a/src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java b/src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java index 3e0a9d175..a4439657a 100644 --- a/src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java +++ b/src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java @@ -144,8 +144,8 @@ public void tryCraft() { if (convertBlock != Blocks.BEE_NEST) { stack.decrement(1); - if (convertBlock != world.getBlockState(this.pos).getBlock()) { - world.setBlockState(attachedPos, convertBlock.getDefaultState(), 0); + if (convertBlock != attachedBlock.getBlock()) { + world.setBlockState(attachedPos, convertBlock.getDefaultState()); } if (!world.isClient) world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, 0.5f, world.getRandom().nextFloat() * 0.4f + 0.8f); diff --git a/src/main/java/net/id/paradiselost/blocks/mechanical/TreeTapBlock.java b/src/main/java/net/id/paradiselost/blocks/mechanical/TreeTapBlock.java index c3744ebd5..07454526a 100644 --- a/src/main/java/net/id/paradiselost/blocks/mechanical/TreeTapBlock.java +++ b/src/main/java/net/id/paradiselost/blocks/mechanical/TreeTapBlock.java @@ -6,6 +6,7 @@ import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.block.BlockWithEntity; +import net.minecraft.block.Blocks; import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; @@ -71,7 +72,7 @@ public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { BlockPos blockPos = pos.offset(direction.getOpposite()); BlockState blockState = world.getBlockState(blockPos); - return blockState.isSideSolidFullSquare(world, blockPos, direction); + return blockState.isSideSolidFullSquare(world, blockPos, direction) || blockState.isOf(Blocks.DRAGON_HEAD); } @Override diff --git a/src/main/java/net/id/paradiselost/items/tools/ParadiseLostToolMaterials.java b/src/main/java/net/id/paradiselost/items/tools/ParadiseLostToolMaterials.java index 527b4719a..2260220ed 100644 --- a/src/main/java/net/id/paradiselost/items/tools/ParadiseLostToolMaterials.java +++ b/src/main/java/net/id/paradiselost/items/tools/ParadiseLostToolMaterials.java @@ -2,10 +2,8 @@ import net.fabricmc.yarn.constants.MiningLevels; import net.id.paradiselost.items.ParadiseLostItems; -import net.id.paradiselost.items.utils.IngredientUtil; import net.minecraft.item.ToolMaterial; import net.minecraft.recipe.Ingredient; -import net.minecraft.util.Lazy; import java.util.function.Supplier; @@ -13,10 +11,9 @@ @SuppressWarnings("unused") public class ParadiseLostToolMaterials { - public static ToolMaterial OLVITE = create(MiningLevels.IRON, 250, 4.5f, 2f, 14, () -> IngredientUtil.itemIngredient(ParadiseLostItems.OLVITE)); - public static ToolMaterial SURTRUM = create(MiningLevels.DIAMOND, 827, 7.0f, 3f, 16, () -> IngredientUtil.itemIngredient(ParadiseLostItems.REFINED_SURTRUM)); - public static ToolMaterial GLAZED_GOLD = create(MiningLevels.IRON, 131, 12f, 2f, 22, () -> IngredientUtil.itemIngredient(ParadiseLostItems.GOLDEN_AMBER)); - + public static final ToolMaterial OLVITE = create(MiningLevels.IRON, 250, 4.5f, 2f, 14, () -> Ingredient.ofItems(ParadiseLostItems.OLVITE)); + public static ToolMaterial SURTRUM = create(MiningLevels.DIAMOND, 827, 7.0f, 3f, 16, () -> Ingredient.ofItems(ParadiseLostItems.REFINED_SURTRUM)); + public static ToolMaterial GLAZED_GOLD = create(MiningLevels.IRON, 131, 12f, 2f, 22, () -> Ingredient.ofItems(ParadiseLostItems.GOLDEN_AMBER)); static class ParadiseToolMaterial implements ToolMaterial { @@ -26,18 +23,18 @@ static class ParadiseToolMaterial implements ToolMaterial { private final float miningSpeed; private final float attackDamage; private final int enchantability; - private final Lazy repairIngredient; + private final Supplier repairIngredient; - ParadiseToolMaterial(int miningLevel, int itemDurability, float miningSpeed, float attackDamage, int enchantability, Supplier repairIngredient) { + ParadiseToolMaterial(int miningLevel, int itemDurability, float miningSpeed, float attackDamage, int enchantability, Supplier repairIngredient) { this.miningLevel = miningLevel; this.itemDurability = itemDurability; this.miningSpeed = miningSpeed; this.attackDamage = attackDamage; this.enchantability = enchantability; - this.repairIngredient = new Lazy(repairIngredient); + this.repairIngredient = repairIngredient; } - public static ParadiseToolMaterial create(int miningLevel, int itemDurability, float miningSpeed, float attackDamage, int enchantability, Supplier repairIngredient) { + public static ParadiseToolMaterial create(int miningLevel, int itemDurability, float miningSpeed, float attackDamage, int enchantability, Supplier repairIngredient) { return new ParadiseToolMaterial(miningLevel, itemDurability, miningSpeed, attackDamage, enchantability, repairIngredient); } diff --git a/src/main/java/net/id/paradiselost/items/utils/IngredientUtil.java b/src/main/java/net/id/paradiselost/items/utils/IngredientUtil.java deleted file mode 100644 index 1c9561e2b..000000000 --- a/src/main/java/net/id/paradiselost/items/utils/IngredientUtil.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.id.paradiselost.items.utils; - -import net.minecraft.item.ItemConvertible; -import net.minecraft.recipe.Ingredient; - -import java.util.function.Supplier; - -/** - * Because passing lambdas to EnumExtender requires a lengthy cast - */ -public class IngredientUtil { - public static final Supplier EMPTY = Ingredient::empty; - - public static Supplier itemIngredient(ItemConvertible item) { - return () -> Ingredient.ofItems(item); - } -} diff --git a/src/main/resources/data/paradise_lost/recipes/flaxweave_cushion.json b/src/main/resources/data/paradise_lost/recipes/flaxweave_cushion.json index 2c0524cea..c5db740d5 100644 --- a/src/main/resources/data/paradise_lost/recipes/flaxweave_cushion.json +++ b/src/main/resources/data/paradise_lost/recipes/flaxweave_cushion.json @@ -1,9 +1,8 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - "###", - "###", - "###" + "##", + "##" ], "key": { "#": { diff --git a/src/main/resources/data/paradise_lost/recipes/flaxweave_from_cushion.json b/src/main/resources/data/paradise_lost/recipes/flaxweave_from_cushion.json index bea8d66a7..b90555ae1 100644 --- a/src/main/resources/data/paradise_lost/recipes/flaxweave_from_cushion.json +++ b/src/main/resources/data/paradise_lost/recipes/flaxweave_from_cushion.json @@ -7,6 +7,6 @@ ], "result": { "item": "paradise_lost:flaxweave", - "count": 9 + "count": 4 } } \ No newline at end of file diff --git a/src/main/resources/data/paradise_lost/recipes/tree_tap/dragon_breath.json b/src/main/resources/data/paradise_lost/recipes/tree_tap/dragon_breath.json new file mode 100644 index 000000000..77ca4cb53 --- /dev/null +++ b/src/main/resources/data/paradise_lost/recipes/tree_tap/dragon_breath.json @@ -0,0 +1,12 @@ +{ + "type": "paradise_lost:tree_tap", + "ingredient": { + "item": "minecraft:glass_bottle" + }, + "tapped_block": "minecraft:dragon_head", + "result_block": "minecraft:dragon_head", + "result": { + "item": "minecraft:dragon_breath" + }, + "chance": 8 +} diff --git a/src/main/resources/data/paradise_lost/recipes/tree_tap/regeneration_potion.json b/src/main/resources/data/paradise_lost/recipes/tree_tap/regeneration_potion.json new file mode 100644 index 000000000..f1d514f35 --- /dev/null +++ b/src/main/resources/data/paradise_lost/recipes/tree_tap/regeneration_potion.json @@ -0,0 +1,15 @@ +{ + "type": "paradise_lost:tree_tap", + "ingredient": { + "item": "minecraft:glass_bottle" + }, + "tapped_block": "minecraft:crying_obsidian", + "result_block": "minecraft:obsidian", + "result": { + "item": "minecraft:potion", + "nbt": { + "Potion": "minecraft:regeneration" + } + }, + "chance": 2 +}