aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/level/block/DropExperienceBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/DropExperienceBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/level/block/DropExperienceBlock.java.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/DropExperienceBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/DropExperienceBlock.java.patch
new file mode 100644
index 0000000000..bf7056797a
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/DropExperienceBlock.java.patch
@@ -0,0 +1,63 @@
+--- a/net/minecraft/world/level/block/DropExperienceBlock.java
++++ b/net/minecraft/world/level/block/DropExperienceBlock.java
+@@ -2,38 +2,45 @@
+
+ import com.mojang.serialization.MapCodec;
+ import com.mojang.serialization.codecs.RecordCodecBuilder;
+-import com.mojang.serialization.codecs.RecordCodecBuilder.Instance;
+ import net.minecraft.core.BlockPos;
+ import net.minecraft.server.level.ServerLevel;
+ import net.minecraft.util.valueproviders.IntProvider;
+ import net.minecraft.world.item.ItemStack;
+ import net.minecraft.world.level.block.state.BlockBehaviour;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+
+ public class DropExperienceBlock extends Block {
+- public static final MapCodec<DropExperienceBlock> CODEC = RecordCodecBuilder.mapCodec(
+- instance -> instance.group(
+- IntProvider.codec(0, 10).fieldOf("experience").forGetter(dropExperienceBlock -> dropExperienceBlock.xpRange), propertiesCodec()
+- )
+- .apply(instance, DropExperienceBlock::new)
+- );
++
++ public static final MapCodec<DropExperienceBlock> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
++ return instance.group(IntProvider.codec(0, 10).fieldOf("experience").forGetter((dropexperienceblock) -> {
++ return dropexperienceblock.xpRange;
++ }), propertiesCodec()).apply(instance, DropExperienceBlock::new);
++ });
+ private final IntProvider xpRange;
+
+ @Override
+ public MapCodec<? extends DropExperienceBlock> codec() {
+- return CODEC;
++ return DropExperienceBlock.CODEC;
+ }
+
+- public DropExperienceBlock(IntProvider intProvider, BlockBehaviour.Properties properties) {
+- super(properties);
+- this.xpRange = intProvider;
++ public DropExperienceBlock(IntProvider intprovider, BlockBehaviour.Properties blockbase_info) {
++ super(blockbase_info);
++ this.xpRange = intprovider;
+ }
+
+ @Override
+- public void spawnAfterBreak(BlockState state, ServerLevel level, BlockPos pos, ItemStack stack, boolean dropExperience) {
++ public void spawnAfterBreak(IBlockData state, ServerLevel level, BlockPos pos, ItemStack stack, boolean dropExperience) {
+ super.spawnAfterBreak(state, level, pos, stack, dropExperience);
+- if (dropExperience) {
+- this.tryDropExperience(level, pos, stack, this.xpRange);
++ // CraftBukkit start - Delegate to getExpDrop
++ }
++
++ @Override
++ public int getExpDrop(IBlockData iblockdata, ServerLevel worldserver, BlockPos blockposition, ItemStack itemstack, boolean flag) {
++ if (flag) {
++ return this.tryDropExperience(worldserver, blockposition, itemstack, this.xpRange);
+ }
++
++ return 0;
++ // CraftBukkit end
+ }
+ }