aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/level/block/BaseFireBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/BaseFireBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/level/block/BaseFireBlock.java.patch281
1 files changed, 281 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/BaseFireBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/BaseFireBlock.java.patch
new file mode 100644
index 0000000000..3df0d4f312
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/BaseFireBlock.java.patch
@@ -0,0 +1,281 @@
+--- a/net/minecraft/world/level/block/BaseFireBlock.java
++++ b/net/minecraft/world/level/block/BaseFireBlock.java
+@@ -14,16 +14,17 @@
+ import net.minecraft.world.level.BlockGetter;
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.level.block.state.BlockBehaviour;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.level.portal.PortalShape;
+ import net.minecraft.world.phys.shapes.CollisionContext;
+ import net.minecraft.world.phys.shapes.VoxelShape;
+
+ public abstract class BaseFireBlock extends Block {
++
+ private static final int SECONDS_ON_FIRE = 8;
+ private final float fireDamage;
+ protected static final float AABB_OFFSET = 1.0F;
+- protected static final VoxelShape DOWN_AABB = Block.box(0.0, 0.0, 0.0, 16.0, 1.0, 16.0);
++ protected static final VoxelShape DOWN_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D);
+
+ public BaseFireBlock(BlockBehaviour.Properties properties, float fireDamage) {
+ super(properties);
+@@ -34,101 +35,106 @@
+ protected abstract MapCodec<? extends BaseFireBlock> codec();
+
+ @Override
+- public BlockState getStateForPlacement(BlockPlaceContext context) {
++ public IBlockData getStateForPlacement(BlockPlaceContext context) {
+ return getState(context.getLevel(), context.getClickedPos());
+ }
+
+- public static BlockState getState(BlockGetter reader, BlockPos pos) {
+- BlockPos blockPos = pos.below();
+- BlockState blockState = reader.getBlockState(blockPos);
+- return SoulFireBlock.canSurviveOnBlock(blockState) ? Blocks.SOUL_FIRE.defaultBlockState() : ((FireBlock)Blocks.FIRE).getStateForPlacement(reader, pos);
++ public static IBlockData getState(BlockGetter reader, BlockPos pos) {
++ BlockPos blockposition1 = pos.below();
++ IBlockData iblockdata = reader.getBlockState(blockposition1);
++
++ return SoulFireBlock.canSurviveOnBlock(iblockdata) ? Blocks.SOUL_FIRE.defaultBlockState() : ((FireBlock) Blocks.FIRE).getStateForPlacement(reader, pos);
+ }
+
+ @Override
+- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
+- return DOWN_AABB;
++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
++ return BaseFireBlock.DOWN_AABB;
+ }
+
+ @Override
+- public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) {
++ public void animateTick(IBlockData state, Level level, BlockPos pos, RandomSource random) {
+ if (random.nextInt(24) == 0) {
+- level.playLocalSound(
+- (double)pos.getX() + 0.5,
+- (double)pos.getY() + 0.5,
+- (double)pos.getZ() + 0.5,
+- SoundEvents.FIRE_AMBIENT,
+- SoundSource.BLOCKS,
+- 1.0F + random.nextFloat(),
+- random.nextFloat() * 0.7F + 0.3F,
+- false
+- );
++ level.playLocalSound((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, SoundEvents.FIRE_AMBIENT, SoundSource.BLOCKS, 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false);
+ }
+
+- BlockPos blockPos = pos.below();
+- BlockState blockState = level.getBlockState(blockPos);
+- if (!this.canBurn(blockState) && !blockState.isFaceSturdy(level, blockPos, Direction.UP)) {
++ BlockPos blockposition1 = pos.below();
++ IBlockData iblockdata1 = level.getBlockState(blockposition1);
++ double d0;
++ double d1;
++ double d2;
++ int i;
++
++ if (!this.canBurn(iblockdata1) && !iblockdata1.isFaceSturdy(level, blockposition1, Direction.UP)) {
+ if (this.canBurn(level.getBlockState(pos.west()))) {
+- for (int i = 0; i < 2; i++) {
+- double d = (double)pos.getX() + random.nextDouble() * 0.1F;
+- double d1 = (double)pos.getY() + random.nextDouble();
+- double d2 = (double)pos.getZ() + random.nextDouble();
+- level.addParticle(ParticleTypes.LARGE_SMOKE, d, d1, d2, 0.0, 0.0, 0.0);
++ for (i = 0; i < 2; ++i) {
++ d0 = (double) pos.getX() + random.nextDouble() * 0.10000000149011612D;
++ d1 = (double) pos.getY() + random.nextDouble();
++ d2 = (double) pos.getZ() + random.nextDouble();
++ level.addParticle(ParticleTypes.LARGE_SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+
+ if (this.canBurn(level.getBlockState(pos.east()))) {
+- for (int i = 0; i < 2; i++) {
+- double d = (double)(pos.getX() + 1) - random.nextDouble() * 0.1F;
+- double d1 = (double)pos.getY() + random.nextDouble();
+- double d2 = (double)pos.getZ() + random.nextDouble();
+- level.addParticle(ParticleTypes.LARGE_SMOKE, d, d1, d2, 0.0, 0.0, 0.0);
++ for (i = 0; i < 2; ++i) {
++ d0 = (double) (pos.getX() + 1) - random.nextDouble() * 0.10000000149011612D;
++ d1 = (double) pos.getY() + random.nextDouble();
++ d2 = (double) pos.getZ() + random.nextDouble();
++ level.addParticle(ParticleTypes.LARGE_SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+
+ if (this.canBurn(level.getBlockState(pos.north()))) {
+- for (int i = 0; i < 2; i++) {
+- double d = (double)pos.getX() + random.nextDouble();
+- double d1 = (double)pos.getY() + random.nextDouble();
+- double d2 = (double)pos.getZ() + random.nextDouble() * 0.1F;
+- level.addParticle(ParticleTypes.LARGE_SMOKE, d, d1, d2, 0.0, 0.0, 0.0);
++ for (i = 0; i < 2; ++i) {
++ d0 = (double) pos.getX() + random.nextDouble();
++ d1 = (double) pos.getY() + random.nextDouble();
++ d2 = (double) pos.getZ() + random.nextDouble() * 0.10000000149011612D;
++ level.addParticle(ParticleTypes.LARGE_SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+
+ if (this.canBurn(level.getBlockState(pos.south()))) {
+- for (int i = 0; i < 2; i++) {
+- double d = (double)pos.getX() + random.nextDouble();
+- double d1 = (double)pos.getY() + random.nextDouble();
+- double d2 = (double)(pos.getZ() + 1) - random.nextDouble() * 0.1F;
+- level.addParticle(ParticleTypes.LARGE_SMOKE, d, d1, d2, 0.0, 0.0, 0.0);
++ for (i = 0; i < 2; ++i) {
++ d0 = (double) pos.getX() + random.nextDouble();
++ d1 = (double) pos.getY() + random.nextDouble();
++ d2 = (double) (pos.getZ() + 1) - random.nextDouble() * 0.10000000149011612D;
++ level.addParticle(ParticleTypes.LARGE_SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+
+ if (this.canBurn(level.getBlockState(pos.above()))) {
+- for (int i = 0; i < 2; i++) {
+- double d = (double)pos.getX() + random.nextDouble();
+- double d1 = (double)(pos.getY() + 1) - random.nextDouble() * 0.1F;
+- double d2 = (double)pos.getZ() + random.nextDouble();
+- level.addParticle(ParticleTypes.LARGE_SMOKE, d, d1, d2, 0.0, 0.0, 0.0);
++ for (i = 0; i < 2; ++i) {
++ d0 = (double) pos.getX() + random.nextDouble();
++ d1 = (double) (pos.getY() + 1) - random.nextDouble() * 0.10000000149011612D;
++ d2 = (double) pos.getZ() + random.nextDouble();
++ level.addParticle(ParticleTypes.LARGE_SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+ } else {
+- for (int i = 0; i < 3; i++) {
+- double d = (double)pos.getX() + random.nextDouble();
+- double d1 = (double)pos.getY() + random.nextDouble() * 0.5 + 0.5;
+- double d2 = (double)pos.getZ() + random.nextDouble();
+- level.addParticle(ParticleTypes.LARGE_SMOKE, d, d1, d2, 0.0, 0.0, 0.0);
++ for (i = 0; i < 3; ++i) {
++ d0 = (double) pos.getX() + random.nextDouble();
++ d1 = (double) pos.getY() + random.nextDouble() * 0.5D + 0.5D;
++ d2 = (double) pos.getZ() + random.nextDouble();
++ level.addParticle(ParticleTypes.LARGE_SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ }
+ }
++
+ }
+
+- protected abstract boolean canBurn(BlockState state);
++ protected abstract boolean canBurn(IBlockData state);
+
+ @Override
+- public void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
++ public void entityInside(IBlockData state, Level level, BlockPos pos, Entity entity) {
+ if (!entity.fireImmune()) {
+ entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
+ if (entity.getRemainingFireTicks() == 0) {
+- entity.setSecondsOnFire(8);
++ // CraftBukkit start
++ org.bukkit.event.entity.EntityCombustEvent event = new org.bukkit.event.entity.EntityCombustByBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(level, pos), entity.getBukkitEntity(), 8);
++ level.getCraftServer().getPluginManager().callEvent(event);
++
++ if (!event.isCancelled()) {
++ entity.setSecondsOnFire(event.getDuration(), false);
++ }
++ // CraftBukkit end
+ }
+ }
+
+@@ -137,53 +143,59 @@
+ }
+
+ @Override
+- public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) {
++ public void onPlace(IBlockData state, Level level, BlockPos pos, IBlockData oldState, boolean isMoving) {
+ if (!oldState.is(state.getBlock())) {
+ if (inPortalDimension(level)) {
+ Optional<PortalShape> optional = PortalShape.findEmptyPortalShape(level, pos, Direction.Axis.X);
++
+ if (optional.isPresent()) {
+- optional.get().createPortalBlocks();
++ ((PortalShape) optional.get()).createPortalBlocks();
+ return;
+ }
+ }
+
+ if (!state.canSurvive(level, pos)) {
+- level.removeBlock(pos, false);
++ fireExtinguished(level, pos); // CraftBukkit - fuel block broke
+ }
++
+ }
+ }
+
+ private static boolean inPortalDimension(Level level) {
+- return level.dimension() == Level.OVERWORLD || level.dimension() == Level.NETHER;
++ return level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.OVERWORLD || level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER; // CraftBukkit - getTypeKey()
+ }
+
+ @Override
+- protected void spawnDestroyParticles(Level level, Player player, BlockPos pos, BlockState state) {
+- }
++ protected void spawnDestroyParticles(Level level, Player player, BlockPos pos, IBlockData state) {}
+
+ @Override
+- public BlockState playerWillDestroy(Level level, BlockPos blockPos, BlockState blockState, Player player) {
+- if (!level.isClientSide()) {
+- level.levelEvent(null, 1009, blockPos, 0);
++ public IBlockData playerWillDestroy(Level world, BlockPos blockposition, IBlockData iblockdata, Player entityhuman) {
++ if (!world.isClientSide()) {
++ world.levelEvent((Player) null, 1009, blockposition, 0);
+ }
+
+- return super.playerWillDestroy(level, blockPos, blockState, player);
++ return super.playerWillDestroy(world, blockposition, iblockdata, entityhuman);
+ }
+
+ public static boolean canBePlacedAt(Level level, BlockPos pos, Direction direction) {
+- BlockState blockState = level.getBlockState(pos);
+- return blockState.isAir() && (getState(level, pos).canSurvive(level, pos) || isPortal(level, pos, direction));
++ IBlockData iblockdata = level.getBlockState(pos);
++
++ return !iblockdata.isAir() ? false : getState(level, pos).canSurvive(level, pos) || isPortal(level, pos, direction);
+ }
+
+ private static boolean isPortal(Level level, BlockPos pos, Direction direction) {
+ if (!inPortalDimension(level)) {
+ return false;
+ } else {
+- BlockPos.MutableBlockPos mutableBlockPos = pos.mutable();
++ BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable();
+ boolean flag = false;
++ Direction[] aenumdirection = Direction.values();
++ int i = aenumdirection.length;
+
+- for (Direction direction1 : Direction.values()) {
+- if (level.getBlockState(mutableBlockPos.set(pos).move(direction1)).is(Blocks.OBSIDIAN)) {
++ for (int j = 0; j < i; ++j) {
++ Direction enumdirection1 = aenumdirection[j];
++
++ if (level.getBlockState(blockposition_mutableblockposition.set(pos).move(enumdirection1)).is(Blocks.OBSIDIAN)) {
+ flag = true;
+ break;
+ }
+@@ -192,11 +204,18 @@
+ if (!flag) {
+ return false;
+ } else {
+- Direction.Axis axis = direction.getAxis().isHorizontal()
+- ? direction.getCounterClockWise().getAxis()
+- : Direction.Plane.HORIZONTAL.getRandomAxis(level.random);
+- return PortalShape.findEmptyPortalShape(level, pos, axis).isPresent();
++ Direction.Axis enumdirection_enumaxis = direction.getAxis().isHorizontal() ? direction.getCounterClockWise().getAxis() : Direction.Plane.HORIZONTAL.getRandomAxis(level.random);
++
++ return PortalShape.findEmptyPortalShape(level, pos, enumdirection_enumaxis).isPresent();
+ }
+ }
+ }
++
++ // CraftBukkit start
++ protected void fireExtinguished(net.minecraft.world.level.LevelAccessor world, BlockPos position) {
++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, position, Blocks.AIR.defaultBlockState()).isCancelled()) {
++ world.removeBlock(position, false);
++ }
++ }
++ // CraftBukkit end
+ }