aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/level/block/PowderSnowBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/PowderSnowBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/level/block/PowderSnowBlock.java.patch172
1 files changed, 172 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/PowderSnowBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/PowderSnowBlock.java.patch
new file mode 100644
index 0000000000..d89092747b
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/PowderSnowBlock.java.patch
@@ -0,0 +1,172 @@
+--- a/net/minecraft/world/level/block/PowderSnowBlock.java
++++ b/net/minecraft/world/level/block/PowderSnowBlock.java
+@@ -23,8 +23,8 @@
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.level.LevelAccessor;
+ import net.minecraft.world.level.block.state.BlockBehaviour;
+-import net.minecraft.world.level.block.state.BlockState;
+-import net.minecraft.world.level.pathfinder.PathComputationType;
++import net.minecraft.world.level.block.state.IBlockData;
++import net.minecraft.world.level.pathfinder.PathMode;
+ import net.minecraft.world.phys.Vec3;
+ import net.minecraft.world.phys.shapes.CollisionContext;
+ import net.minecraft.world.phys.shapes.EntityCollisionContext;
+@@ -32,18 +32,19 @@
+ import net.minecraft.world.phys.shapes.VoxelShape;
+
+ public class PowderSnowBlock extends Block implements BucketPickup {
++
+ public static final MapCodec<PowderSnowBlock> CODEC = simpleCodec(PowderSnowBlock::new);
+ private static final float HORIZONTAL_PARTICLE_MOMENTUM_FACTOR = 0.083333336F;
+ private static final float IN_BLOCK_HORIZONTAL_SPEED_MULTIPLIER = 0.9F;
+ private static final float IN_BLOCK_VERTICAL_SPEED_MULTIPLIER = 1.5F;
+ private static final float NUM_BLOCKS_TO_FALL_INTO_BLOCK = 2.5F;
+- private static final VoxelShape FALLING_COLLISION_SHAPE = Shapes.box(0.0, 0.0, 0.0, 1.0, 0.9F, 1.0);
+- private static final double MINIMUM_FALL_DISTANCE_FOR_SOUND = 4.0;
+- private static final double MINIMUM_FALL_DISTANCE_FOR_BIG_SOUND = 7.0;
++ private static final VoxelShape FALLING_COLLISION_SHAPE = Shapes.box(0.0D, 0.0D, 0.0D, 1.0D, 0.8999999761581421D, 1.0D);
++ private static final double MINIMUM_FALL_DISTANCE_FOR_SOUND = 4.0D;
++ private static final double MINIMUM_FALL_DISTANCE_FOR_BIG_SOUND = 7.0D;
+
+ @Override
+ public MapCodec<PowderSnowBlock> codec() {
+- return CODEC;
++ return PowderSnowBlock.CODEC;
+ }
+
+ public PowderSnowBlock(BlockBehaviour.Properties properties) {
+@@ -51,67 +52,69 @@
+ }
+
+ @Override
+- public boolean skipRendering(BlockState state, BlockState adjacentState, Direction direction) {
+- return adjacentState.is(this) || super.skipRendering(state, adjacentState, direction);
++ public boolean skipRendering(IBlockData state, IBlockData adjacentState, Direction direction) {
++ return adjacentState.is((Block) this) ? true : super.skipRendering(state, adjacentState, direction);
+ }
+
+ @Override
+- public VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) {
++ public VoxelShape getOcclusionShape(IBlockData state, BlockGetter level, BlockPos pos) {
+ return Shapes.empty();
+ }
+
+ @Override
+- public void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
+- if (!(entity instanceof LivingEntity) || entity.getFeetBlockState().is(this)) {
+- entity.makeStuckInBlock(state, new Vec3(0.9F, 1.5, 0.9F));
++ public void entityInside(IBlockData state, Level level, BlockPos pos, Entity entity) {
++ if (!(entity instanceof LivingEntity) || entity.getFeetBlockState().is((Block) this)) {
++ entity.makeStuckInBlock(state, new Vec3(0.8999999761581421D, 1.5D, 0.8999999761581421D));
+ if (level.isClientSide) {
+- RandomSource random = level.getRandom();
++ RandomSource randomsource = level.getRandom();
+ boolean flag = entity.xOld != entity.getX() || entity.zOld != entity.getZ();
+- if (flag && random.nextBoolean()) {
+- level.addParticle(
+- ParticleTypes.SNOWFLAKE,
+- entity.getX(),
+- (double)(pos.getY() + 1),
+- entity.getZ(),
+- (double)(Mth.randomBetween(random, -1.0F, 1.0F) * 0.083333336F),
+- 0.05F,
+- (double)(Mth.randomBetween(random, -1.0F, 1.0F) * 0.083333336F)
+- );
++
++ if (flag && randomsource.nextBoolean()) {
++ level.addParticle(ParticleTypes.SNOWFLAKE, entity.getX(), (double) (pos.getY() + 1), entity.getZ(), (double) (Mth.randomBetween(randomsource, -1.0F, 1.0F) * 0.083333336F), 0.05000000074505806D, (double) (Mth.randomBetween(randomsource, -1.0F, 1.0F) * 0.083333336F));
+ }
+ }
+ }
+
+ entity.setIsInPowderSnow(true);
+ if (!level.isClientSide) {
+- if (entity.isOnFire()
+- && (level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof Player)
+- && entity.mayInteract(level, pos)) {
++ // CraftBukkit start
++ if (entity.isOnFire() && entity.mayInteract(level, pos)) {
++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !(level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof Player))) {
++ return;
++ }
++ // CraftBukkit end
+ level.destroyBlock(pos, false);
+ }
+
+ entity.setSharedFlagOnFire(false);
+ }
++
+ }
+
+ @Override
+- public void fallOn(Level level, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
+- if (!((double)fallDistance < 4.0) && entity instanceof LivingEntity livingEntity) {
+- LivingEntity.Fallsounds fallSounds = livingEntity.getFallSounds();
+- SoundEvent soundEvent = (double)fallDistance < 7.0 ? fallSounds.small() : fallSounds.big();
+- entity.playSound(soundEvent, 1.0F, 1.0F);
++ public void fallOn(Level level, IBlockData state, BlockPos pos, Entity entity, float fallDistance) {
++ if ((double) fallDistance >= 4.0D && entity instanceof LivingEntity) {
++ LivingEntity entityliving = (LivingEntity) entity;
++ LivingEntity.a entityliving_a = entityliving.getFallSounds();
++ SoundEvent soundeffect = (double) fallDistance < 7.0D ? entityliving_a.small() : entityliving_a.big();
++
++ entity.playSound(soundeffect, 1.0F, 1.0F);
+ }
+ }
+
+ @Override
+- public VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
+- if (context instanceof EntityCollisionContext entityCollisionContext) {
+- Entity entity = entityCollisionContext.getEntity();
++ public VoxelShape getCollisionShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
++ if (context instanceof EntityCollisionContext) {
++ EntityCollisionContext voxelshapecollisionentity = (EntityCollisionContext) context;
++ Entity entity = voxelshapecollisionentity.getEntity();
++
+ if (entity != null) {
+ if (entity.fallDistance > 2.5F) {
+- return FALLING_COLLISION_SHAPE;
++ return PowderSnowBlock.FALLING_COLLISION_SHAPE;
+ }
+
+ boolean flag = entity instanceof FallingBlockEntity;
++
+ if (flag || canEntityWalkOnPowderSnow(entity) && context.isAbove(Shapes.block(), pos, false) && !context.isDescending()) {
+ return super.getCollisionShape(state, level, pos, context);
+ }
+@@ -122,20 +125,19 @@
+ }
+
+ @Override
+- public VoxelShape getVisualShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
++ public VoxelShape getVisualShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
+ return Shapes.empty();
+ }
+
+ public static boolean canEntityWalkOnPowderSnow(Entity entity) {
+- return entity.getType().is(EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS)
+- || entity instanceof LivingEntity && ((LivingEntity)entity).getItemBySlot(EquipmentSlot.FEET).is(Items.LEATHER_BOOTS);
++ return entity.getType().is(EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS) ? true : (entity instanceof LivingEntity ? ((LivingEntity) entity).getItemBySlot(EquipmentSlot.FEET).is(Items.LEATHER_BOOTS) : false);
+ }
+
+ @Override
+- public ItemStack pickupBlock(@Nullable Player player, LevelAccessor levelAccessor, BlockPos blockPos, BlockState blockState) {
+- levelAccessor.setBlock(blockPos, Blocks.AIR.defaultBlockState(), 11);
+- if (!levelAccessor.isClientSide()) {
+- levelAccessor.levelEvent(2001, blockPos, Block.getId(blockState));
++ public ItemStack pickupBlock(@Nullable Player entityhuman, LevelAccessor generatoraccess, BlockPos blockposition, IBlockData iblockdata) {
++ generatoraccess.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 11);
++ if (!generatoraccess.isClientSide()) {
++ generatoraccess.levelEvent(2001, blockposition, Block.getId(iblockdata));
+ }
+
+ return new ItemStack(Items.POWDER_SNOW_BUCKET);
+@@ -147,7 +149,7 @@
+ }
+
+ @Override
+- public boolean isPathfindable(BlockState state, BlockGetter level, BlockPos pos, PathComputationType type) {
++ public boolean isPathfindable(IBlockData state, BlockGetter level, BlockPos pos, PathMode type) {
+ return true;
+ }
+ }