diff --git a/changelog.txt b/changelog.txt index 61cd69970..796b30b32 100644 --- a/changelog.txt +++ b/changelog.txt @@ -29,6 +29,7 @@ AgriCraft is *not* installed. - prevent a crash when opening the Edit HUD position screen while looking at an entity - soft coating no longer voids the contents of shulker boxes (or other tile-entities) - bloodmagic:geode_harvestable now adds forge:clusters as a tag instead of a block, meaning it'll actually work with them +- now uses a fake player so certus quartz now actually drops, instead of getting voided because there was no entity passed to the drop generation ------------------------------------------------------ Version 3.3.5 diff --git a/src/main/java/wayoftime/bloodmagic/ritual/types/RitualGeode.java b/src/main/java/wayoftime/bloodmagic/ritual/types/RitualGeode.java index a83a9fde6..a6954671f 100644 --- a/src/main/java/wayoftime/bloodmagic/ritual/types/RitualGeode.java +++ b/src/main/java/wayoftime/bloodmagic/ritual/types/RitualGeode.java @@ -1,5 +1,6 @@ package wayoftime.bloodmagic.ritual.types; +import com.mojang.authlib.GameProfile; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -14,8 +15,12 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.level.storage.loot.parameters.LootContextParam; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; +import net.minecraftforge.common.util.FakePlayer; +import net.minecraftforge.common.util.FakePlayerFactory; import wayoftime.bloodmagic.BloodMagic; import wayoftime.bloodmagic.ConfigManager; import wayoftime.bloodmagic.api.compat.EnumDemonWillType; @@ -113,6 +118,8 @@ public void performRitual(IMasterRitualStone masterRitualStone) { if (steadfastWill > MIN_STEADFAST) { toolStack = silkPick; doSilk = true; + // if both are configured silk touch takes priority and fortune cost shouldnt be paid + doFortune = false; } double fortuneWill = destructiveWill; @@ -132,9 +139,15 @@ public void performRitual(IMasterRitualStone masterRitualStone) { continue; } } - LootParams.Builder lootBuilder = new LootParams.Builder((ServerLevel) world); - Vec3 blockCenter = new Vec3(harvestPos.getX() + 0.5, harvestPos.getY() + 0.5, harvestPos.getZ() + 0.5); - List blockDrops = state.getDrops(lootBuilder.withParameter(LootContextParams.ORIGIN, blockCenter).withParameter(LootContextParams.TOOL, toolStack)); + + LootParams.Builder paramsBuilder = new LootParams.Builder((ServerLevel) world) + .withParameter(LootContextParams.ORIGIN, pos.getCenter()) + .withParameter(LootContextParams.BLOCK_STATE, world.getBlockState(pos)) + .withParameter(LootContextParams.TOOL, toolStack) + .withOptionalParameter(LootContextParams.BLOCK_ENTITY, world.getBlockEntity(pos)) + .withOptionalParameter(LootContextParams.THIS_ENTITY, FakePlayerFactory.get((ServerLevel) world, new GameProfile(masterRitualStone.getOwner(), "[BM Geode]"))); + + List blockDrops = state.getDrops(paramsBuilder); drops.addAll(blockDrops); BlockProtectionHelper.tryBreakBlockNoDrops(world, harvestPos, masterRitualStone.getOwner()); if (doFortune) { @@ -145,10 +158,9 @@ public void performRitual(IMasterRitualStone masterRitualStone) { } for (ItemStack dropStack : drops) { - if (doStore && storeWill >= WILL_PER_STORE * blockDrops.size()) { - int size = dropStack.getCount(); + if (doStore && storeWill >= WILL_PER_STORE) { dropStack = Utils.insertStackIntoTile(dropStack, inv, Direction.DOWN); - storeWill -= (size - dropStack.getCount()); + storeWill -= WILL_PER_STORE; } if (!dropStack.isEmpty()) { Utils.spawnStackAtBlock(world, harvestPos, Direction.UP, dropStack); diff --git a/src/main/resources/assets/bloodmagic/patchouli_books/guide/en_us/entries/utility/changelog.json b/src/main/resources/assets/bloodmagic/patchouli_books/guide/en_us/entries/utility/changelog.json index 1b979a1fb..37ccbf7b1 100644 --- a/src/main/resources/assets/bloodmagic/patchouli_books/guide/en_us/entries/utility/changelog.json +++ b/src/main/resources/assets/bloodmagic/patchouli_books/guide/en_us/entries/utility/changelog.json @@ -39,7 +39,7 @@ }, { "type": "patchouli:text", - "text": "$(li)forge:storage_blocks/hellforged block and item tags have been added to the respective forge:storage_blocks tag$(li)prevent a crash when opening the Edit HUD position screen while looking at an entity$(li)soft coating no longer voids the contents of shulker boxes (or other tile-entities)" + "text": "$(li)forge:storage_blocks/hellforged block and item tags have been added to the respective forge:storage_blocks tag$(li)prevent a crash when opening the Edit HUD position screen while looking at an entity$(li)soft coating no longer voids the contents of shulker boxes (or other tile-entities)$(li)now actually harvests certus quartz" }, { "type": "patchouli:text",