Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9088)
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 5efeb7bd Also update compiler version c13b867a Update some Maven plugin versions deb28d9f PR-837: Add more bell API e938d62a PR-819: Allow Player#sendBlockDamage() to specify a source entity 0e75532c PR-818: Add more Guardian API, particularly for its laser a10155aa PR-839: Add BlockData#rotate and BlockData#mirror 77e690b4 PR-836: Add missing API for explosive minecarts 60722059 PR-832: Allow getting chunks without generating them and optimize chunk data request for ungenerated chunks 0a2c4b4b PR-834: Add Player#sendHurtAnimation() CraftBukkit Changes: be8682aa8 Also update compiler version 08e305f5b Update some Maven plugin versions 187bdd463 PR-1160: Add more bell API 2f8e5bc7c PR-1145: Allow Player#sendBlockDamage() to specify a source entity bcbb61b36 PR-1144: Add more Guardian API, particularly for its laser 722ddff6d PR-1162: Add BlockData#rotate and BlockData#mirror 80998277c PR-1159: Add missing API for explosive minecarts 1fddefce1 PR-1155: Allow getting chunks without generating them and optimize chunk data request for ungenerated chunks 20e8a486f PR-1157: Add Player#sendHurtAnimation() Spigot Changes: b31949f2 Rebuild patches
This commit is contained in:
@@ -8,17 +8,6 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
@@ -0,0 +0,0 @@ import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.serialization.Codec;
|
||||
import java.lang.ref.WeakReference;
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
+import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
import java.util.function.BooleanSupplier;
|
||||
@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk {
|
||||
|
||||
@Override
|
||||
@@ -34,9 +23,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.getWorld().getChunkAt(x, z); // Transient load for this tick
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk {
|
||||
}
|
||||
BlockState[] entities = new BlockState[chunk.blockEntities.size()];
|
||||
|
||||
BlockPos position = (BlockPos) obj;
|
||||
for (BlockPos position : chunk.blockEntities.keySet()) {
|
||||
- entities[index++] = this.worldServer.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState();
|
||||
+ // Paper start
|
||||
+ entities[index++] = this.worldServer.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState(useSnapshot);
|
||||
@@ -48,15 +37,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @Override
|
||||
+ public Collection<BlockState> getTileEntities(Predicate<Block> blockPredicate, boolean useSnapshot) {
|
||||
+ Preconditions.checkNotNull(blockPredicate, "blockPredicate");
|
||||
+ if (!isLoaded()) {
|
||||
+ getWorld().getChunkAt(x, z); // Transient load for this tick
|
||||
+ if (!this.isLoaded()) {
|
||||
+ this.getWorld().getChunkAt(this.x, this.z); // Transient load for this tick
|
||||
+ }
|
||||
+ net.minecraft.world.level.chunk.LevelChunk chunk = getHandle();
|
||||
+ ChunkAccess chunk = this.getHandle(ChunkStatus.FULL);
|
||||
+
|
||||
+ List<BlockState> entities = new ArrayList<>();
|
||||
+ java.util.List<BlockState> entities = new java.util.ArrayList<>();
|
||||
+
|
||||
+ for (BlockPos position : chunk.blockEntities.keySet()) {
|
||||
+ Block block = worldServer.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||
+ Block block = this.worldServer.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||
+ if (blockPredicate.test(block)) {
|
||||
+ entities.add(block.getState(useSnapshot));
|
||||
+ }
|
||||
|
||||
@@ -9,14 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ public class BellBlockEntity extends BlockEntity {
|
||||
private static void makeRaidersGlow(Level world, BlockPos pos, List<LivingEntity> hearingEntities) {
|
||||
hearingEntities.stream().filter((entity) -> {
|
||||
return isRaiderWithinRange(pos, entity);
|
||||
- }).forEach(BellBlockEntity::glow);
|
||||
+ }).forEach(entity -> glow(entity, pos)); // Paper - pass BlockPos
|
||||
return BellBlockEntity.isRaiderWithinRange(pos, entityliving);
|
||||
}).map((entity) -> (org.bukkit.entity.LivingEntity) entity.getBukkitEntity()).collect(java.util.stream.Collectors.toCollection(java.util.ArrayList::new)); // CraftBukkit
|
||||
|
||||
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBellResonateEvent(world, pos, entities).forEach(BellBlockEntity::glow);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBellResonateEvent(world, pos, entities).forEach(entity -> glow(entity, pos)); // Paper - pass BlockPos
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
private static void showBellParticles(Level world, BlockPos pos, List<LivingEntity> hearingEntities) {
|
||||
@@ -0,0 +0,0 @@ public class BellBlockEntity extends BlockEntity {
|
||||
return entity.isAlive() && !entity.isRemoved() && pos.closerToCenterThan(entity.position(), 48.0D) && entity.getType().is(EntityTypeTags.RAIDERS);
|
||||
}
|
||||
|
||||
@@ -6,23 +6,20 @@ Subject: [PATCH] Add BellRingEvent
|
||||
Add a new event, BellRingEvent, to trigger whenever a player rings a
|
||||
village bell. Passes along the bell block and the player who rang it.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BellBlock.java b/src/main/java/net/minecraft/world/level/block/BellBlock.java
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BellBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BellBlock.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.world.level.block;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
+import io.papermc.paper.util.MCUtil;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.stats.Stats;
|
||||
@@ -0,0 +0,0 @@ public class BellBlock extends BaseEntityBlock {
|
||||
direction = world.getBlockState(pos).getValue(FACING);
|
||||
}
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
return tradeSelectEvent;
|
||||
}
|
||||
|
||||
+ if (!new io.papermc.paper.event.block.BellRingEvent(world.getWorld().getBlockAt(MCUtil.toLocation(world, pos)), entity == null ? null : entity.getBukkitEntity()).callEvent()) return false; // Paper - BellRingEvent
|
||||
((BellBlockEntity)blockEntity).onHit(direction);
|
||||
world.playSound((Player)null, pos, SoundEvents.BELL_BLOCK, SoundSource.BLOCKS, 2.0F, 1.0F);
|
||||
world.gameEvent(entity, GameEvent.BLOCK_CHANGE, pos);
|
||||
+ @SuppressWarnings("deprecation") // Paper use deprecated event to maintain compat (it extends modern event)
|
||||
public static boolean handleBellRingEvent(Level world, BlockPos position, Direction direction, Entity entity) {
|
||||
Block block = CraftBlock.at(world, position);
|
||||
BlockFace bukkitDirection = CraftBlock.notchToBlockFace(direction);
|
||||
- BellRingEvent event = new BellRingEvent(block, bukkitDirection, (entity != null) ? entity.getBukkitEntity() : null);
|
||||
+ BellRingEvent event = new io.papermc.paper.event.block.BellRingEvent(block, bukkitDirection, (entity != null) ? entity.getBukkitEntity() : null); // Paper - deprecated BellRingEvent
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
return !event.isCancelled();
|
||||
}
|
||||
|
||||
@@ -51,25 +51,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Override
|
||||
public Chunk getChunkAt(int x, int z) {
|
||||
- return this.world.getChunkSource().getChunk(x, z, true).bukkitChunk;
|
||||
- net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) this.world.getChunk(x, z, ChunkStatus.FULL, true);
|
||||
+ // Paper start - add ticket to hold chunk for a little while longer if plugin accesses it
|
||||
+ net.minecraft.world.level.chunk.LevelChunk chunk = world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
|
||||
+ net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
|
||||
+ if (chunk == null) {
|
||||
+ addTicket(x, z);
|
||||
+ this.addTicket(x, z);
|
||||
+ chunk = this.world.getChunkSource().getChunk(x, z, true);
|
||||
+ }
|
||||
+ return chunk.bukkitChunk;
|
||||
+ // Paper end
|
||||
+ }
|
||||
+
|
||||
return new CraftChunk(chunk);
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return new CraftChunk(this.getHandle(), x, z);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private void addTicket(int x, int z) {
|
||||
+ io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(() -> world.getChunkSource().addRegionTicket(TicketType.PLUGIN, new ChunkPos(x, z), 0, Unit.INSTANCE)); // Paper
|
||||
}
|
||||
+ io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(() -> this.world.getChunkSource().addRegionTicket(TicketType.PLUGIN, new ChunkPos(x, z), 0, Unit.INSTANCE)); // Paper
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
+
|
||||
@Override
|
||||
public Chunk getChunkAt(Block block) {
|
||||
Preconditions.checkArgument(block != null, "null block");
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
public boolean unloadChunkRequest(int x, int z) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("chunk unload"); // Spigot
|
||||
@@ -115,7 +120,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> {
|
||||
net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
|
||||
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c;
|
||||
+ if (chunk != null) addTicket(x, z); // Paper
|
||||
ret.complete(chunk == null ? null : chunk.getBukkitChunk());
|
||||
+ if (chunk != null) this.addTicket(x, z); // Paper
|
||||
ret.complete(chunk == null ? null : new CraftChunk(chunk));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: TheFruxz <cedricspitzer@outlook.de>
|
||||
Date: Sat, 26 Mar 2022 18:41:36 +0100
|
||||
Subject: [PATCH] Add custom destroyerIdentity to sendBlockDamage
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public void sendBlockDamage(Location loc, float progress) {
|
||||
+ // Paper start - customBlockDamage identity
|
||||
+ sendBlockDamage(loc, progress, this.getHandle().getId());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendBlockDamage(Location loc, float progress, int destroyerIdentity) {
|
||||
+ // Paper end - customBlockDamage identity
|
||||
Preconditions.checkArgument(loc != null, "loc must not be null");
|
||||
Preconditions.checkArgument(progress >= 0.0 && progress <= 1.0, "progress must be between 0.0 and 1.0 (inclusive)");
|
||||
|
||||
if (this.getHandle().connection == null) return;
|
||||
|
||||
int stage = (int) (9 * progress); // There are 0 - 9 damage states
|
||||
- ClientboundBlockDestructionPacket packet = new ClientboundBlockDestructionPacket(this.getHandle().getId(), new BlockPos(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), stage);
|
||||
+ ClientboundBlockDestructionPacket packet = new ClientboundBlockDestructionPacket(destroyerIdentity, new BlockPos(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), stage); // Paper - customBlockDamage identity
|
||||
this.getHandle().connection.send(packet);
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||
@@ -0,0 +0,0 @@ public class CraftBlockData implements BlockData {
|
||||
public Material getPlacementMaterial() {
|
||||
return CraftMagicNumbers.getMaterial(this.state.getBlock().asItem());
|
||||
public void mirror(Mirror mirror) {
|
||||
this.state = this.state.mirror(net.minecraft.world.level.block.Mirror.valueOf(mirror.name()));
|
||||
}
|
||||
+
|
||||
+ // Paper start - Block tick API
|
||||
|
||||
@@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
LevelLightEngine lightengine = chunk.level.getLightEngine();
|
||||
LevelLightEngine lightengine = this.worldServer.getLightEngine();
|
||||
DataLayer skyLightArray = lightengine.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(x, i, z));
|
||||
@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk {
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.util.Vector;
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
public static final int CUSTOM_DIMENSION_OFFSET = 10;
|
||||
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
|
||||
|
||||
@@ -109,18 +109,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Override
|
||||
+ default Level getNMSWorld() {
|
||||
+ return getTileEntity().getLevel();
|
||||
+ return this.getTileEntity().getLevel();
|
||||
+ }
|
||||
+
|
||||
+ default Block getBlock() {
|
||||
+ final BlockPos position = getTileEntity().getBlockPos();
|
||||
+ final Chunk bukkitChunk = getTileEntity().getLevel().getChunkAt(position).bukkitChunk;
|
||||
+ final BlockPos position = this.getTileEntity().getBlockPos();
|
||||
+ final Chunk bukkitChunk = this.getBukkitWorld().getChunkAt(org.bukkit.craftbukkit.block.CraftBlock.at(this.getNMSWorld(), position));
|
||||
+ return bukkitChunk.getBlock(position.getX(), position.getY(), position.getZ());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default PaperLootableInventoryData getLootableData() {
|
||||
+ return getTileEntity().lootableData;
|
||||
+ return this.getTileEntity().lootableData;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java
|
||||
|
||||
@@ -7071,7 +7071,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
||||
public boolean needsDecoration;
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Paper start
|
||||
@@ -7311,9 +7311,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@Override
|
||||
public Chunk[] getLoadedChunks() {
|
||||
- Long2ObjectLinkedOpenHashMap<ChunkHolder> chunks = this.world.getChunkSource().chunkMap.visibleChunkMap;
|
||||
- return chunks.values().stream().map(ChunkHolder::getFullChunkNow).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.LevelChunk::getBukkitChunk).toArray(Chunk[]::new);
|
||||
- return chunks.values().stream().map(ChunkHolder::getFullChunkNow).filter(Objects::nonNull).map(CraftChunk::new).toArray(Chunk[]::new);
|
||||
+ List<ChunkHolder> chunks = io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(this.world); // Paper
|
||||
+ return chunks.stream().map(ChunkHolder::getFullChunkNow).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.LevelChunk::getBukkitChunk).toArray(Chunk[]::new);
|
||||
+ return chunks.stream().map(ChunkHolder::getFullChunkNow).filter(Objects::nonNull).map(CraftChunk::new).toArray(Chunk[]::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -7335,7 +7335,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (Bukkit.isPrimaryThread()) {
|
||||
+ net.minecraft.world.level.chunk.LevelChunk immediate = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
|
||||
+ if (immediate != null) {
|
||||
+ return java.util.concurrent.CompletableFuture.completedFuture(immediate.getBukkitChunk());
|
||||
+ return java.util.concurrent.CompletableFuture.completedFuture(new CraftChunk(immediate));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -7351,7 +7351,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> {
|
||||
+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
|
||||
+ net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c;
|
||||
+ ret.complete(chunk == null ? null : chunk.getBukkitChunk());
|
||||
+ ret.complete(chunk == null ? null : new CraftChunk(chunk));
|
||||
+ });
|
||||
+ });
|
||||
+
|
||||
|
||||
@@ -786,61 +786,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public void setPickupCooldown(int cooldown) {
|
||||
+ throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns");
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
||||
|
||||
-final class CraftMinecartTNT extends CraftMinecart implements ExplosiveMinecart {
|
||||
+public final class CraftMinecartTNT extends CraftMinecart implements ExplosiveMinecart { // Paper - getHandle -> make public
|
||||
CraftMinecartTNT(CraftServer server, MinecartTNT entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ final class CraftMinecartTNT extends CraftMinecart implements ExplosiveMinecart
|
||||
public EntityType getType() {
|
||||
return EntityType.MINECART_TNT;
|
||||
}
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public net.minecraft.world.entity.vehicle.MinecartTNT getHandle() {
|
||||
+ return (net.minecraft.world.entity.vehicle.MinecartTNT) entity;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setFuseTicks(int fuseTicks) {
|
||||
+ this.getHandle().fuse = fuseTicks;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getFuseTicks() {
|
||||
+ return this.getHandle().getFuse();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isIgnited() {
|
||||
+ return this.getHandle().isPrimed();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void ignite() {
|
||||
+ this.getHandle().primeFuse();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void explode() {
|
||||
+ explode(this.getHandle().getDeltaMovement().horizontalDistanceSqr());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void explode(double power) {
|
||||
+ com.google.common.base.Preconditions.checkArgument(power >= 0 && Double.isFinite(power), "Explosion power must be a finite non-negative number");
|
||||
+ this.getHandle().explode(power);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
|
||||
|
||||
@@ -34,17 +34,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void sendMultiBlockChange(Map<Location, BlockData> blockChanges, boolean suppressLightUpdates) {
|
||||
+ public void sendMultiBlockChange(final Map<? extends io.papermc.paper.math.Position, BlockData> blockChanges, final boolean suppressLightUpdates) {
|
||||
+ if (this.getHandle().connection == null) return;
|
||||
+
|
||||
+ Map<SectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<net.minecraft.world.level.block.state.BlockState>> sectionMap = new HashMap<>();
|
||||
+
|
||||
+ for (Map.Entry<Location, BlockData> entry : blockChanges.entrySet()) {
|
||||
+ Location location = entry.getKey();
|
||||
+ if (!location.getWorld().equals(this.getWorld())) continue;
|
||||
+
|
||||
+ for (Map.Entry<? extends io.papermc.paper.math.Position, BlockData> entry : blockChanges.entrySet()) {
|
||||
+ BlockData blockData = entry.getValue();
|
||||
+ BlockPos blockPos = new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
+ BlockPos blockPos = io.papermc.paper.util.MCUtil.toBlockPos(entry.getKey());
|
||||
+ SectionPos sectionPos = SectionPos.of(blockPos);
|
||||
+
|
||||
+ it.unimi.dsi.fastutil.shorts.Short2ObjectMap<net.minecraft.world.level.block.state.BlockState> sectionData = sectionMap.computeIfAbsent(sectionPos, key -> new it.unimi.dsi.fastutil.shorts.Short2ObjectArrayMap<>());
|
||||
|
||||
@@ -16832,9 +16832,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
/*
|
||||
* If it's a new world, the first few chunks are generated inside
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess {
|
||||
* no way of creating a CraftWorld/CraftServer at that point.
|
||||
*/
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration));
|
||||
org.bukkit.Chunk bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(bukkitChunk, this.needsDecoration));
|
||||
+ this.chunkHolder.getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system
|
||||
|
||||
if (this.needsDecoration) {
|
||||
@@ -16845,9 +16845,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void unloadCallback() {
|
||||
+ if (!this.loadedTicketLevel) { LOGGER.error("Double calling chunk unload!", new Throwable()); } // Paper
|
||||
org.bukkit.Server server = this.level.getCraftServer();
|
||||
- org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isUnsaved());
|
||||
+ this.chunkHolder.getEntityChunk().callEntitiesUnloadEvent(); // Paper - rewrite chunk system
|
||||
+ org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, true); // Paper - rewrite chunk system - force save to true so that mustNotSave is correctly set below
|
||||
org.bukkit.Chunk bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
||||
- org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(bukkitChunk, this.isUnsaved());
|
||||
+ org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(bukkitChunk, true); // Paper - rewrite chunk system - force save to true so that mustNotSave is correctly set below
|
||||
server.getPluginManager().callEvent(unloadEvent);
|
||||
// note: saving can be prevented, but not forced if no saving is actually required
|
||||
this.mustNotSave = !unloadEvent.isSaveChunk();
|
||||
|
||||
@@ -505,7 +505,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-jar-plugin</artifactId>
|
||||
- <version>3.2.2</version>
|
||||
- <version>3.3.0</version>
|
||||
- <configuration>
|
||||
- <archive>
|
||||
- <manifest>
|
||||
@@ -623,7 +623,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-assembly-plugin</artifactId>
|
||||
- <version>3.3.0</version>
|
||||
- <version>3.5.0</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>package</phase>
|
||||
@@ -650,23 +650,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-compiler-plugin</artifactId>
|
||||
- <version>3.10.1</version>
|
||||
- <version>3.11.0</version>
|
||||
- <configuration>
|
||||
- <!-- we use the Eclipse compiler as it doesn't need a JDK -->
|
||||
- <compilerId>eclipse</compilerId>
|
||||
- <!-- default changed with version 3.11.0 -->
|
||||
- <showWarnings>false</showWarnings>
|
||||
- </configuration>
|
||||
- <dependencies>
|
||||
- <dependency>
|
||||
- <groupId>org.codehaus.plexus</groupId>
|
||||
- <artifactId>plexus-compiler-eclipse</artifactId>
|
||||
- <version>2.12.0</version>
|
||||
- <version>2.13.0</version>
|
||||
- </dependency>
|
||||
- </dependencies>
|
||||
- </plugin>
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-surefire-plugin</artifactId>
|
||||
- <version>2.12.4</version>
|
||||
- <version>3.0.0</version>
|
||||
- <configuration>
|
||||
- <workingDirectory>${basedir}/target/test-server</workingDirectory>
|
||||
- <excludes>
|
||||
@@ -695,7 +697,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-checkstyle-plugin</artifactId>
|
||||
- <version>3.1.2</version>
|
||||
- <version>3.2.1</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>test-compile</phase>
|
||||
|
||||
@@ -1590,7 +1590,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess {
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration));
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(bukkitChunk, this.needsDecoration));
|
||||
|
||||
if (this.needsDecoration) {
|
||||
+ try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper
|
||||
@@ -1600,7 +1600,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess {
|
||||
}
|
||||
}
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk));
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
|
||||
+ } // Paper
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public Chunk getChunkAt(int x, int z) {
|
||||
+ warnUnsafeChunk("getting a faraway chunk", x, z); // Paper
|
||||
// Paper start - add ticket to hold chunk for a little while longer if plugin accesses it
|
||||
net.minecraft.world.level.chunk.LevelChunk chunk = world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
|
||||
net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
|
||||
if (chunk == null) {
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user