Fix some compilation errors

This commit is contained in:
Nassim Jahnke 2024-12-15 21:28:08 +01:00
parent de10a277e2
commit 6dcb4a33b6
No known key found for this signature in database
GPG key ID: EF6771C01F6EF02F
12 changed files with 74 additions and 27 deletions

View file

@ -7,7 +7,7 @@
+ // CraftBukkit start
+ return this.parse(reader, allowSelectors, true);
+ }
+ private EntitySelector parse(StringReader reader, boolean allowSelectors, boolean overridePermissions) throws CommandSyntaxException {
+ public EntitySelector parse(StringReader reader, boolean allowSelectors, boolean overridePermissions) throws CommandSyntaxException {
+ // CraftBukkit end
int i = 0;
EntitySelectorParser entitySelectorParser = new EntitySelectorParser(reader, allowSelectors);

View file

@ -0,0 +1,16 @@
--- a/net/minecraft/server/commands/DebugCommand.java
+++ b/net/minecraft/server/commands/DebugCommand.java
@@ -262,6 +_,13 @@
return true;
}
+ // Paper start
+ @Override
+ public org.bukkit.command.CommandSender getBukkitSender(final CommandSourceStack wrapper) {
+ throw new UnsupportedOperationException();
+ }
+ // Paper end
+
@Override
public void close() {
IOUtils.closeQuietly((Writer)this.output);

View file

@ -39,15 +39,6 @@
}
}
}
@@ -341,7 +_,7 @@
@Nullable
@Override
- protected SoundEvent getDeathSound() {
+ public SoundEvent getDeathSound() { // Paper - decompile error
return SoundEvents.DOLPHIN_DEATH;
}
@@ -497,7 +_,7 @@
@Override

View file

@ -0,0 +1,16 @@
--- a/net/minecraft/world/entity/npc/ClientSideMerchant.java
+++ b/net/minecraft/world/entity/npc/ClientSideMerchant.java
@@ -56,6 +_,13 @@
return this.source == player;
}
+ // Paper start
+ @Override
+ public org.bukkit.craftbukkit.inventory.CraftMerchant getCraftMerchant() {
+ throw new UnsupportedOperationException();
+ }
+ // Paper end
+
@Override
public int getVillagerXp() {
return this.xp;

View file

@ -0,0 +1,21 @@
--- a/net/minecraft/world/level/EmptyBlockAndTintGetter.java
+++ b/net/minecraft/world/level/EmptyBlockAndTintGetter.java
@@ -39,6 +_,18 @@
return Blocks.AIR.defaultBlockState();
}
+ // Paper start
+ @Override
+ public @org.jetbrains.annotations.Nullable BlockState getBlockStateIfLoaded(final BlockPos blockposition) {
+ return null;
+ }
+
+ @Override
+ public @org.jetbrains.annotations.Nullable FluidState getFluidIfLoaded(final BlockPos blockposition) {
+ return null;
+ }
+ // Paper end
+
@Override
public FluidState getFluidState(BlockPos pos) {
return Fluids.EMPTY.defaultFluidState();

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/ConcretePowderBlock.java
+++ b/net/minecraft/world/level/block/ConcretePowderBlock.java
@@ -38,7 +_,7 @@
@@ -38,16 +_,33 @@
@Override
public void onLand(Level level, BlockPos pos, BlockState state, BlockState replaceableState, FallingBlockEntity fallingBlock) {
if (shouldSolidify(level, pos, replaceableState)) {
@ -9,8 +9,10 @@
}
}
@@ -47,7 +_,24 @@
BlockGetter level = context.getLevel();
@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
- BlockGetter level = context.getLevel();
+ Level level = context.getLevel(); // Paper
BlockPos clickedPos = context.getClickedPos();
BlockState blockState = level.getBlockState(clickedPos);
- return shouldSolidify(level, clickedPos, blockState) ? this.concrete.defaultBlockState() : super.getStateForPlacement(context);

View file

@ -24,7 +24,7 @@
} else {
ItemStack itemStack = new ItemStack(this.potted);
+ // Paper start - Add PlayerFlowerPotManipulateEvent
+ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos);
+ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(level, pos);
+ org.bukkit.inventory.ItemStack pottedStack = new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.block.CraftBlockType.minecraftToBukkit(this.potted));
+
+ io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent event = new io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent((org.bukkit.entity.Player) player.getBukkitEntity(), block, pottedStack, false);

View file

@ -62,6 +62,7 @@
WorldBorder worldBorder = level1.getWorldBorder();
double teleportationScale = DimensionType.getTeleportationScale(level.dimensionType(), level1.dimensionType());
BlockPos blockPos = worldBorder.clampToBounds(entity.getX() * teleportationScale, entity.getY(), entity.getZ() * teleportationScale);
- return this.getExitPortal(level1, entity, pos, blockPos, flag, worldBorder);
+ // Paper start - Configurable portal search radius
+ int portalSearchRadius = level1.paperConfig().environment.portalSearchRadius;
+ if (entity.level().paperConfig().environment.portalSearchVanillaDimensionScaling && flag) { // flag = is going to nether
@ -76,8 +77,8 @@
+ level1 = ((org.bukkit.craftbukkit.CraftWorld) event.getTo().getWorld()).getHandle();
+ worldBorder = level1.getWorldBorder();
+ blockPos = worldBorder.clampToBounds(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
+ return this.getExitPortal(level1, entity, pos, blockPos, flag, worldBorder, event.getSearchRadius(), event.getCanCreatePortal(), event.getCreationRadius());
+ // CraftBukkit end
return this.getExitPortal(level1, entity, pos, blockPos, flag, worldBorder);
}
}

View file

@ -5,7 +5,7 @@
return InteractionResult.SUCCESS;
} else {
+ // Paper start - Add PlayerShearBlockEvent
+ io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>());
+ io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>());
+ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.PUMPKIN_SEEDS, 4)));
+ if (!event.callEvent()) {
+ return InteractionResult.PASS;

View file

@ -14,7 +14,7 @@
+ return stack;
+ }
+ // Paper end - Configurable cartographer treasure maps
+ BlockPos blockPos = level.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures)); // Paper - Configurable cartographer treasure maps
+ BlockPos blockPos = level.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, !level.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures)); // Paper - Configurable cartographer treasure maps
if (blockPos != null) {
ItemStack itemStack = MapItem.create(level, blockPos.getX(), blockPos.getZ(), this.zoom, true, true);
MapItem.renderBiomePreviewMap(level, itemStack);

View file

@ -193,8 +193,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public boolean isOnGround() {
if (this.entity instanceof AbstractArrow) {
return ((AbstractArrow) this.entity).isInGround();
if (this.entity instanceof AbstractArrow abstractArrow) {
return abstractArrow.isInGround();
}
return this.entity.onGround();
}
@ -417,7 +417,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public org.bukkit.entity.Entity getPassenger() {
return this.isEmpty() ? null : this.getHandle().passengers.get(0).getBukkitEntity();
return this.isEmpty() ? null : this.getHandle().getPassengers().getFirst().getBukkitEntity();
}
@Override
@ -433,7 +433,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public List<org.bukkit.entity.Entity> getPassengers() {
return Lists.newArrayList(Lists.transform(this.getHandle().passengers, (Function<Entity, org.bukkit.entity.Entity>) input -> input.getBukkitEntity()));
return Lists.newArrayList(Lists.transform(this.getHandle().getPassengers(), (Function<Entity, org.bukkit.entity.Entity>) Entity::getBukkitEntity));
}
@Override
@ -852,12 +852,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public int getPortalCooldown() {
return this.getHandle().portalCooldown;
return this.getHandle().getPortalCooldown();
}
@Override
public void setPortalCooldown(int cooldown) {
this.getHandle().portalCooldown = cooldown;
this.getHandle().setPortalCooldown(cooldown);;
}
@Override

View file

@ -142,9 +142,9 @@ public class ActivationRange
}
/**
* Checks for the activation state of all entities in this chunk.
* Tries to activate an entity.
*
* @param chunk
* @param entity
*/
private static void activateEntity(Entity entity)
{
@ -172,13 +172,13 @@ public class ActivationRange
public static boolean checkEntityImmunities(Entity entity)
{
// quick checks.
if ( entity.wasTouchingWater || entity.getRemainingFireTicks() > 0 )
if ( entity.isInWater() || entity.getRemainingFireTicks() > 0 )
{
return true;
}
if ( !( entity instanceof AbstractArrow ) )
{
if ( !entity.onGround() || !entity.passengers.isEmpty() || entity.isPassenger() )
if ( !entity.onGround() || !entity.getPassengers().isEmpty() || entity.isPassenger() )
{
return true;
}