aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch
new file mode 100644
index 0000000000..9fc59385d6
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch
@@ -0,0 +1,69 @@
+--- a/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java
++++ b/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java
+@@ -1,5 +1,6 @@
+ package net.minecraft.world.item.enchantment;
+
++import java.util.Iterator;
+ import net.minecraft.core.BlockPos;
+ import net.minecraft.util.Mth;
+ import net.minecraft.world.entity.EquipmentSlot;
+@@ -7,10 +8,11 @@
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.level.block.Blocks;
+ import net.minecraft.world.level.block.FrostedIceBlock;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.phys.shapes.CollisionContext;
+
+ public class FrostWalkerEnchantment extends Enchantment {
++
+ public FrostWalkerEnchantment(Enchantment.Rarity rarity, EquipmentSlot... applicableSlots) {
+ super(rarity, EnchantmentCategory.ARMOR_FEET, applicableSlots);
+ }
+@@ -37,25 +39,32 @@
+
+ public static void onEntityMoved(LivingEntity living, Level level, BlockPos pos, int levelConflicting) {
+ if (living.onGround()) {
+- BlockState blockState = Blocks.FROSTED_ICE.defaultBlockState();
+- int min = Math.min(16, 2 + levelConflicting);
+- BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
++ IBlockData iblockdata = Blocks.FROSTED_ICE.defaultBlockState();
++ int j = Math.min(16, 2 + levelConflicting);
++ BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
++ Iterator iterator = BlockPos.betweenClosed(pos.offset(-j, -1, -j), pos.offset(j, -1, j)).iterator();
+
+- for (BlockPos blockPos : BlockPos.betweenClosed(pos.offset(-min, -1, -min), pos.offset(min, -1, min))) {
+- if (blockPos.closerToCenterThan(living.position(), (double)min)) {
+- mutableBlockPos.set(blockPos.getX(), blockPos.getY() + 1, blockPos.getZ());
+- BlockState blockState1 = level.getBlockState(mutableBlockPos);
+- if (blockState1.isAir()) {
+- BlockState blockState2 = level.getBlockState(blockPos);
+- if (blockState2 == FrostedIceBlock.meltsInto()
+- && blockState.canSurvive(level, blockPos)
+- && level.isUnobstructed(blockState, blockPos, CollisionContext.empty())) {
+- level.setBlockAndUpdate(blockPos, blockState);
+- level.scheduleTick(blockPos, Blocks.FROSTED_ICE, Mth.nextInt(living.getRandom(), 60, 120));
++ while (iterator.hasNext()) {
++ BlockPos blockposition1 = (BlockPos) iterator.next();
++
++ if (blockposition1.closerToCenterThan(living.position(), (double) j)) {
++ blockposition_mutableblockposition.set(blockposition1.getX(), blockposition1.getY() + 1, blockposition1.getZ());
++ IBlockData iblockdata1 = level.getBlockState(blockposition_mutableblockposition);
++
++ if (iblockdata1.isAir()) {
++ IBlockData iblockdata2 = level.getBlockState(blockposition1);
++
++ if (iblockdata2 == FrostedIceBlock.meltsInto() && iblockdata.canSurvive(level, blockposition1) && level.isUnobstructed(iblockdata, blockposition1, CollisionContext.empty())) {
++ // CraftBukkit Start - Call EntityBlockFormEvent for Frost Walker
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, blockposition1, iblockdata, living)) {
++ level.scheduleTick(blockposition1, Blocks.FROSTED_ICE, Mth.nextInt(living.getRandom(), 60, 120));
++ }
++ // CraftBukkit End
+ }
+ }
+ }
+ }
++
+ }
+ }
+