aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/level/block/WitherSkullBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/WitherSkullBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/level/block/WitherSkullBlock.java.patch146
1 files changed, 146 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/WitherSkullBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/WitherSkullBlock.java.patch
new file mode 100644
index 0000000000..9679161a58
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/WitherSkullBlock.java.patch
@@ -0,0 +1,146 @@
+--- a/net/minecraft/world/level/block/WitherSkullBlock.java
++++ b/net/minecraft/world/level/block/WitherSkullBlock.java
+@@ -19,12 +19,16 @@
+ import net.minecraft.world.level.block.entity.BlockEntity;
+ import net.minecraft.world.level.block.entity.SkullBlockEntity;
+ 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.block.state.pattern.BlockInWorld;
+ import net.minecraft.world.level.block.state.pattern.BlockPattern;
+ import net.minecraft.world.level.block.state.pattern.BlockPatternBuilder;
+ import net.minecraft.world.level.block.state.predicate.BlockStatePredicate;
+
++// CraftBukkit start
++import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
++// CraftBukkit end
++
+ public class WitherSkullBlock extends SkullBlock {
+
+ public static final MapCodec<WitherSkullBlock> CODEC = simpleCodec(WitherSkullBlock::new);
+@@ -34,55 +38,60 @@
+ private static BlockPattern witherPatternBase;
+
+ @Override
+- @Override
+ public MapCodec<WitherSkullBlock> codec() {
+ return WitherSkullBlock.CODEC;
+ }
+
+- protected WitherSkullBlock(BlockBehaviour.Properties blockbehaviour_properties) {
+- super(SkullBlock.Types.WITHER_SKELETON, blockbehaviour_properties);
++ protected WitherSkullBlock(BlockBehaviour.Properties properties) {
++ super(SkullBlock.Type.WITHER_SKELETON, properties);
+ }
+
+ @Override
+- @Override
+- public void setPlacedBy(Level level, BlockPos blockpos, BlockState blockstate, @Nullable LivingEntity livingentity, ItemStack itemstack) {
+- super.setPlacedBy(level, blockpos, blockstate, livingentity, itemstack);
+- BlockEntity blockentity = level.getBlockEntity(blockpos);
++ public void setPlacedBy(Level level, BlockPos pos, IBlockData state, @Nullable LivingEntity placer, ItemStack stack) {
++ super.setPlacedBy(level, pos, state, placer, stack);
++ BlockEntity tileentity = level.getBlockEntity(pos);
+
+- if (blockentity instanceof SkullBlockEntity) {
+- checkSpawn(level, blockpos, (SkullBlockEntity) blockentity);
++ if (tileentity instanceof SkullBlockEntity) {
++ checkSpawn(level, pos, (SkullBlockEntity) tileentity);
+ }
+
+ }
+
+- public static void checkSpawn(Level level, BlockPos blockpos, SkullBlockEntity skullblockentity) {
++ public static void checkSpawn(Level level, BlockPos pos, SkullBlockEntity blockEntity) {
++ if (level.captureBlockStates) return; // CraftBukkit
+ if (!level.isClientSide) {
+- BlockState blockstate = skullblockentity.getBlockState();
+- boolean flag = blockstate.is(Blocks.WITHER_SKELETON_SKULL) || blockstate.is(Blocks.WITHER_SKELETON_WALL_SKULL);
++ IBlockData iblockdata = blockEntity.getBlockState();
++ boolean flag = iblockdata.is(Blocks.WITHER_SKELETON_SKULL) || iblockdata.is(Blocks.WITHER_SKELETON_WALL_SKULL);
+
+- if (flag && blockpos.getY() >= level.getMinBuildHeight() && level.getDifficulty() != Difficulty.PEACEFUL) {
+- BlockPattern.BlockPatternMatch blockpattern_blockpatternmatch = getOrCreateWitherFull().find(level, blockpos);
++ if (flag && pos.getY() >= level.getMinBuildHeight() && level.getDifficulty() != Difficulty.PEACEFUL) {
++ BlockPattern.BlockPatternMatch shapedetector_shapedetectorcollection = getOrCreateWitherFull().find(level, pos);
+
+- if (blockpattern_blockpatternmatch != null) {
+- WitherBoss witherboss = (WitherBoss) EntityType.WITHER.create(level);
++ if (shapedetector_shapedetectorcollection != null) {
++ WitherBoss entitywither = (WitherBoss) EntityType.WITHER.create(level);
+
+- if (witherboss != null) {
+- CarvedPumpkinBlock.clearPatternBlocks(level, blockpattern_blockpatternmatch);
+- BlockPos blockpos1 = blockpattern_blockpatternmatch.getBlock(1, 2, 0).getPos();
++ if (entitywither != null) {
++ // BlockPumpkinCarved.clearPatternBlocks(world, shapedetector_shapedetectorcollection); // CraftBukkit - move down
++ BlockPos blockposition1 = shapedetector_shapedetectorcollection.getBlock(1, 2, 0).getPos();
+
+- witherboss.moveTo((double) blockpos1.getX() + 0.5D, (double) blockpos1.getY() + 0.55D, (double) blockpos1.getZ() + 0.5D, blockpattern_blockpatternmatch.getForwards().getAxis() == Direction.Axis.X ? 0.0F : 90.0F, 0.0F);
+- witherboss.yBodyRot = blockpattern_blockpatternmatch.getForwards().getAxis() == Direction.Axis.X ? 0.0F : 90.0F;
+- witherboss.makeInvulnerable();
+- Iterator iterator = level.getEntitiesOfClass(ServerPlayer.class, witherboss.getBoundingBox().inflate(50.0D)).iterator();
++ entitywither.moveTo((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getForwards().getAxis() == Direction.Axis.X ? 0.0F : 90.0F, 0.0F);
++ entitywither.yBodyRot = shapedetector_shapedetectorcollection.getForwards().getAxis() == Direction.Axis.X ? 0.0F : 90.0F;
++ entitywither.makeInvulnerable();
++ // CraftBukkit start
++ if (!level.addFreshEntity(entitywither, SpawnReason.BUILD_WITHER)) {
++ return;
++ }
++ CarvedPumpkinBlock.clearPatternBlocks(level, shapedetector_shapedetectorcollection); // CraftBukkit - from above
++ // CraftBukkit end
++ Iterator iterator = level.getEntitiesOfClass(ServerPlayer.class, entitywither.getBoundingBox().inflate(50.0D)).iterator();
+
+ while (iterator.hasNext()) {
+- ServerPlayer serverplayer = (ServerPlayer) iterator.next();
++ ServerPlayer entityplayer = (ServerPlayer) iterator.next();
+
+- CriteriaTriggers.SUMMONED_ENTITY.trigger(serverplayer, (Entity) witherboss);
++ CriteriaTriggers.SUMMONED_ENTITY.trigger(entityplayer, (Entity) entitywither);
+ }
+
+- level.addFreshEntity(witherboss);
+- CarvedPumpkinBlock.updatePatternBlocks(level, blockpattern_blockpatternmatch);
++ // world.addFreshEntity(entitywither); // CraftBukkit - moved up
++ CarvedPumpkinBlock.updatePatternBlocks(level, shapedetector_shapedetectorcollection);
+ }
+
+ }
+@@ -90,16 +99,16 @@
+ }
+ }
+
+- public static boolean canSpawnMob(Level level, BlockPos blockpos, ItemStack itemstack) {
+- return itemstack.is(Items.WITHER_SKELETON_SKULL) && blockpos.getY() >= level.getMinBuildHeight() + 2 && level.getDifficulty() != Difficulty.PEACEFUL && !level.isClientSide ? getOrCreateWitherBase().find(level, blockpos) != null : false;
++ public static boolean canSpawnMob(Level level, BlockPos pos, ItemStack stack) {
++ return stack.is(Items.WITHER_SKELETON_SKULL) && pos.getY() >= level.getMinBuildHeight() + 2 && level.getDifficulty() != Difficulty.PEACEFUL && !level.isClientSide ? getOrCreateWitherBase().find(level, pos) != null : false;
+ }
+
+ private static BlockPattern getOrCreateWitherFull() {
+ if (WitherSkullBlock.witherPatternFull == null) {
+- WitherSkullBlock.witherPatternFull = BlockPatternBuilder.start().aisle("^^^", "###", "~#~").where('#', (blockinworld) -> {
+- return blockinworld.getState().is(BlockTags.WITHER_SUMMON_BASE_BLOCKS);
+- }).where('^', BlockInWorld.hasState(BlockStatePredicate.forBlock(Blocks.WITHER_SKELETON_SKULL).or(BlockStatePredicate.forBlock(Blocks.WITHER_SKELETON_WALL_SKULL)))).where('~', (blockinworld) -> {
+- return blockinworld.getState().isAir();
++ WitherSkullBlock.witherPatternFull = BlockPatternBuilder.start().aisle("^^^", "###", "~#~").where('#', (shapedetectorblock) -> {
++ return shapedetectorblock.getState().is(BlockTags.WITHER_SUMMON_BASE_BLOCKS);
++ }).where('^', BlockInWorld.hasState(BlockStatePredicate.forBlock(Blocks.WITHER_SKELETON_SKULL).or(BlockStatePredicate.forBlock(Blocks.WITHER_SKELETON_WALL_SKULL)))).where('~', (shapedetectorblock) -> {
++ return shapedetectorblock.getState().isAir();
+ }).build();
+ }
+
+@@ -108,10 +117,10 @@
+
+ private static BlockPattern getOrCreateWitherBase() {
+ if (WitherSkullBlock.witherPatternBase == null) {
+- WitherSkullBlock.witherPatternBase = BlockPatternBuilder.start().aisle(" ", "###", "~#~").where('#', (blockinworld) -> {
+- return blockinworld.getState().is(BlockTags.WITHER_SUMMON_BASE_BLOCKS);
+- }).where('~', (blockinworld) -> {
+- return blockinworld.getState().isAir();
++ WitherSkullBlock.witherPatternBase = BlockPatternBuilder.start().aisle(" ", "###", "~#~").where('#', (shapedetectorblock) -> {
++ return shapedetectorblock.getState().is(BlockTags.WITHER_SUMMON_BASE_BLOCKS);
++ }).where('~', (shapedetectorblock) -> {
++ return shapedetectorblock.getState().isAir();
+ }).build();
+ }
+