diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/SignBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/level/block/SignBlock.java.patch | 222 |
1 files changed, 222 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SignBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SignBlock.java.patch new file mode 100644 index 0000000000..3f47c78fa0 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SignBlock.java.patch @@ -0,0 +1,222 @@ +--- a/net/minecraft/world/level/block/SignBlock.java ++++ b/net/minecraft/world/level/block/SignBlock.java +@@ -7,10 +7,10 @@ + import net.minecraft.core.BlockPos; + import net.minecraft.core.Direction; + import net.minecraft.network.chat.CommonComponents; +-import net.minecraft.network.chat.contents.PlainTextContents; ++import net.minecraft.network.chat.contents.LiteralContents; + import net.minecraft.sounds.SoundSource; + import net.minecraft.stats.Stats; +-import net.minecraft.world.InteractionHand; ++import net.minecraft.world.EnumHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.entity.player.Player; + import net.minecraft.world.item.Item; +@@ -25,7 +25,7 @@ + import net.minecraft.world.level.block.entity.SignBlockEntity; + import net.minecraft.world.level.block.entity.SignText; + 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.properties.BlockStateProperties; + import net.minecraft.world.level.block.state.properties.BooleanProperty; + import net.minecraft.world.level.block.state.properties.WoodType; +@@ -45,47 +45,41 @@ + protected static final VoxelShape SHAPE = Block.box(4.0D, 0.0D, 4.0D, 12.0D, 16.0D, 12.0D); + private final WoodType type; + +- protected SignBlock(WoodType woodtype, BlockBehaviour.Properties blockbehaviour_properties) { +- super(blockbehaviour_properties); +- this.type = woodtype; ++ protected SignBlock(WoodType blockpropertywood, BlockBehaviour.Properties blockbase_info) { ++ super(blockbase_info); ++ this.type = blockpropertywood; + } + + @Override +- @Override + protected abstract MapCodec<? extends SignBlock> codec(); + + @Override +- @Override +- public BlockState updateShape(BlockState blockstate, Direction direction, BlockState blockstate1, LevelAccessor levelaccessor, BlockPos blockpos, BlockPos blockpos1) { +- if ((Boolean) blockstate.getValue(SignBlock.WATERLOGGED)) { +- levelaccessor.scheduleTick(blockpos, (Fluid) Fluids.WATER, Fluids.WATER.getTickDelay(levelaccessor)); ++ public IBlockData updateShape(IBlockData state, Direction facing, IBlockData facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) { ++ if ((Boolean) state.getValue(SignBlock.WATERLOGGED)) { ++ level.scheduleTick(currentPos, (Fluid) Fluids.WATER, Fluids.WATER.getTickDelay(level)); + } + +- return super.updateShape(blockstate, direction, blockstate1, levelaccessor, blockpos, blockpos1); ++ return super.updateShape(state, facing, facingState, level, currentPos, facingPos); + } + + @Override +- @Override +- public VoxelShape getShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) { ++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) { + return SignBlock.SHAPE; + } + + @Override +- @Override +- public boolean isPossibleToRespawnInThis(BlockState blockstate) { ++ public boolean isPossibleToRespawnInThis(IBlockData state) { + return true; + } + + @Override +- @Override +- public BlockEntity newBlockEntity(BlockPos blockpos, BlockState blockstate) { +- return new SignBlockEntity(blockpos, blockstate); ++ public BlockEntity newBlockEntity(BlockPos pos, IBlockData state) { ++ return new SignBlockEntity(pos, state); + } + + @Override +- @Override +- public InteractionResult use(BlockState blockstate, Level level, BlockPos blockpos, Player player, InteractionHand interactionhand, BlockHitResult blockhitresult) { +- ItemStack itemstack = player.getItemInHand(interactionhand); ++ public InteractionResult use(IBlockData state, Level level, BlockPos pos, Player player, EnumHand hand, BlockHitResult hit) { ++ ItemStack itemstack = player.getItemInHand(hand); + Item item = itemstack.getItem(); + Item item1 = itemstack.getItem(); + SignApplicator signapplicator; +@@ -100,37 +94,37 @@ + + SignApplicator signapplicator2 = signapplicator; + boolean flag = signapplicator2 != null && player.mayBuild(); +- BlockEntity blockentity = level.getBlockEntity(blockpos); ++ BlockEntity tileentity = level.getBlockEntity(pos); + +- if (blockentity instanceof SignBlockEntity) { +- SignBlockEntity signblockentity = (SignBlockEntity) blockentity; ++ if (tileentity instanceof SignBlockEntity) { ++ SignBlockEntity tileentitysign = (SignBlockEntity) tileentity; + + if (!level.isClientSide) { +- boolean flag1 = signblockentity.isFacingFrontText(player); +- SignText signtext = signblockentity.getText(flag1); +- boolean flag2 = signblockentity.executeClickCommandsIfPresent(player, level, blockpos, flag1); ++ boolean flag1 = tileentitysign.isFacingFrontText(player); ++ SignText signtext = tileentitysign.getText(flag1); ++ boolean flag2 = tileentitysign.executeClickCommandsIfPresent(player, level, pos, flag1); + +- if (signblockentity.isWaxed()) { +- level.playSound((Player) null, signblockentity.getBlockPos(), signblockentity.getSignInteractionFailedSoundEvent(), SoundSource.BLOCKS); ++ if (tileentitysign.isWaxed()) { ++ level.playSound((Player) null, tileentitysign.getBlockPos(), tileentitysign.getSignInteractionFailedSoundEvent(), SoundSource.BLOCKS); + return this.getInteractionResult(flag); +- } else if (flag && !this.otherPlayerIsEditingSign(player, signblockentity) && signapplicator2.canApplyToSign(signtext, player) && signapplicator2.tryApplyToSign(level, signblockentity, flag1, player)) { ++ } else if (flag && !this.otherPlayerIsEditingSign(player, tileentitysign) && signapplicator2.canApplyToSign(signtext, player) && signapplicator2.tryApplyToSign(level, tileentitysign, flag1, player)) { + if (!player.isCreative()) { + itemstack.shrink(1); + } + +- level.gameEvent(GameEvent.BLOCK_CHANGE, signblockentity.getBlockPos(), GameEvent.Context.of(player, signblockentity.getBlockState())); ++ level.gameEvent(GameEvent.BLOCK_CHANGE, tileentitysign.getBlockPos(), GameEvent.Context.of(player, tileentitysign.getBlockState())); + player.awardStat(Stats.ITEM_USED.get(item)); + return InteractionResult.SUCCESS; + } else if (flag2) { + return InteractionResult.SUCCESS; +- } else if (!this.otherPlayerIsEditingSign(player, signblockentity) && player.mayBuild() && this.hasEditableText(player, signblockentity, flag1)) { +- this.openTextEdit(player, signblockentity, flag1); ++ } else if (!this.otherPlayerIsEditingSign(player, tileentitysign) && player.mayBuild() && this.hasEditableText(player, tileentitysign, flag1)) { ++ this.openTextEdit(player, tileentitysign, flag1, org.bukkit.event.player.PlayerSignOpenEvent.Cause.INTERACT); // CraftBukkit + return this.getInteractionResult(flag); + } else { + return InteractionResult.PASS; + } + } else { +- return !flag && !signblockentity.isWaxed() ? InteractionResult.CONSUME : InteractionResult.SUCCESS; ++ return !flag && !tileentitysign.isWaxed() ? InteractionResult.CONSUME : InteractionResult.SUCCESS; + } + } else { + return InteractionResult.PASS; +@@ -141,24 +135,23 @@ + return flag ? InteractionResult.PASS : InteractionResult.SUCCESS; + } + +- private boolean hasEditableText(Player player, SignBlockEntity signblockentity, boolean flag) { +- SignText signtext = signblockentity.getText(flag); ++ private boolean hasEditableText(Player player, SignBlockEntity signEntity, boolean isFrontText) { ++ SignText signtext = signEntity.getText(isFrontText); + +- return Arrays.stream(signtext.getMessages(player.isTextFilteringEnabled())).allMatch((component) -> { +- return component.equals(CommonComponents.EMPTY) || component.getContents() instanceof PlainTextContents; ++ return Arrays.stream(signtext.getMessages(player.isTextFilteringEnabled())).allMatch((ichatbasecomponent) -> { ++ return ichatbasecomponent.equals(CommonComponents.EMPTY) || ichatbasecomponent.getContents() instanceof LiteralContents; + }); + } + +- public abstract float getYRotationDegrees(BlockState state); ++ public abstract float getYRotationDegrees(IBlockData state); + +- public Vec3 getSignHitboxCenterPosition(BlockState blockstate) { ++ public Vec3 getSignHitboxCenterPosition(IBlockData state) { + return new Vec3(0.5D, 0.5D, 0.5D); + } + + @Override +- @Override +- public FluidState getFluidState(BlockState blockstate) { +- return (Boolean) blockstate.getValue(SignBlock.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(blockstate); ++ public FluidState getFluidState(IBlockData state) { ++ return (Boolean) state.getValue(SignBlock.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + public WoodType type() { +@@ -166,32 +159,40 @@ + } + + public static WoodType getWoodType(Block block) { +- WoodType woodtype; ++ WoodType blockpropertywood; + + if (block instanceof SignBlock) { +- woodtype = ((SignBlock) block).type(); ++ blockpropertywood = ((SignBlock) block).type(); + } else { +- woodtype = WoodType.OAK; ++ blockpropertywood = WoodType.OAK; + } + +- return woodtype; ++ return blockpropertywood; + } + +- public void openTextEdit(Player player, SignBlockEntity signblockentity, boolean flag) { +- signblockentity.setAllowedPlayerEditor(player.getUUID()); +- player.openTextEdit(signblockentity, flag); ++ public void openTextEdit(Player player, SignBlockEntity signEntity, boolean isFrontText) { ++ // Craftbukkit start ++ openTextEdit(player, signEntity, isFrontText, org.bukkit.event.player.PlayerSignOpenEvent.Cause.UNKNOWN); + } + +- private boolean otherPlayerIsEditingSign(Player player, SignBlockEntity signblockentity) { +- UUID uuid = signblockentity.getPlayerWhoMayEdit(); ++ public void openTextEdit(Player entityhuman, SignBlockEntity tileentitysign, boolean flag, org.bukkit.event.player.PlayerSignOpenEvent.Cause cause) { ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerSignOpenEvent(entityhuman, tileentitysign, flag, cause)) { ++ return; ++ } ++ // Craftbukkit end ++ tileentitysign.setAllowedPlayerEditor(entityhuman.getUUID()); ++ entityhuman.openTextEdit(tileentitysign, flag); ++ } + ++ private boolean otherPlayerIsEditingSign(Player player, SignBlockEntity signEntity) { ++ UUID uuid = signEntity.getPlayerWhoMayEdit(); ++ + return uuid != null && !uuid.equals(player.getUUID()); + } + + @Nullable + @Override +- @Override +- public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockstate, BlockEntityType<T> blockentitytype) { +- return createTickerHelper(blockentitytype, BlockEntityType.SIGN, SignBlockEntity::tick); ++ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, IBlockData state, BlockEntityType<T> blockEntityType) { ++ return null; // Craftbukkit - remove unnecessary sign ticking + } + } |