geforkt von Mirrors/Paper
more patches
Dieser Commit ist enthalten in:
Ursprung
cf306c3a89
Commit
bfc788437f
@ -1,103 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Wed, 2 Mar 2016 23:30:53 -0600
|
||||
Subject: [PATCH] Add BeaconEffectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
-import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.BeaconMenu;
|
||||
import net.minecraft.world.inventory.ContainerData;
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.world.phys.AABB;
|
||||
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
// CraftBukkit end
|
||||
+// Paper start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import com.destroystokyo.paper.event.block.BeaconEffectEvent;
|
||||
+// Paper end
|
||||
|
||||
public class BeaconBlockEntity extends BlockEntity implements MenuProvider, TickableBlockEntity {
|
||||
|
||||
@@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Tick
|
||||
double d0 = (double) (this.levels * 10 + 10);
|
||||
|
||||
AABB axisalignedbb = (new AABB(this.worldPosition)).inflate(d0).expandTowards(0.0D, (double) this.level.getMaxBuildHeight(), 0.0D);
|
||||
- List<Player> list = this.level.getEntitiesOfClass(Player.class, axisalignedbb);
|
||||
+ List<net.minecraft.world.entity.player.Player> list = this.level.getEntitiesOfClass(net.minecraft.world.entity.player.Player.class, axisalignedbb);
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
private void applyEffect(List list, MobEffect effects, int i, int b0) {
|
||||
+ // Paper - BeaconEffectEvent
|
||||
+ applyEffect(list, effects, i, b0, true);
|
||||
+ }
|
||||
+
|
||||
+ private void applyEffect(List list, MobEffect effects, int i, int b0, boolean isPrimary) {
|
||||
+ // Paper - BeaconEffectEvent
|
||||
{
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
- Player entityhuman;
|
||||
+ net.minecraft.world.entity.player.Player entityhuman;
|
||||
+
|
||||
+ // Paper start - BeaconEffectEvent
|
||||
+ org.bukkit.block.Block block = level.getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
|
||||
+ PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(effects, i, b0, true, true));
|
||||
+ // Paper end
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- entityhuman = (Player) iterator.next();
|
||||
- entityhuman.addEffect(new MobEffectInstance(effects, i, b0, true, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
||||
+ entityhuman = (net.minecraft.world.entity.player.Player) iterator.next();
|
||||
+
|
||||
+ // Paper start - BeaconEffectEvent
|
||||
+ BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (Player) entityhuman.getBukkitEntity(), isPrimary);
|
||||
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
|
||||
+ entityhuman.addEffect(new MobEffectInstance(CraftPotionUtil.fromBukkit(event.getEffect())), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Tick
|
||||
int i = getLevelCb();
|
||||
List list = getHumansInRange();
|
||||
|
||||
- applyEffect(list, this.primaryPower, i, b0);
|
||||
+ applyEffect(list, this.primaryPower, i, b0, true); // Paper - BeaconEffectEvent
|
||||
|
||||
if (hasSecondaryEffect()) {
|
||||
- applyEffect(list, this.secondaryPower, i, 0);
|
||||
+ applyEffect(list, this.secondaryPower, i, 0, false); // Paper - BeaconEffectEvent
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Tick
|
||||
// CraftBukkit end
|
||||
|
||||
public void playSound(SoundEvent soundeffect) {
|
||||
- this.level.playSound((Player) null, this.worldPosition, soundeffect, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ this.level.playSound((net.minecraft.world.entity.player.Player) null, this.worldPosition, soundeffect, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
public int getLevels() {
|
||||
@@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Tick
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
- public AbstractContainerMenu createMenu(int syncId, Inventory inv, Player player) {
|
||||
+ public AbstractContainerMenu createMenu(int syncId, Inventory inv, net.minecraft.world.entity.player.Player player) {
|
||||
return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName()) ? new BeaconMenu(syncId, inv, this.dataAccess, ContainerLevelAccess.create(this.level, this.getBlockPos())) : null;
|
||||
}
|
||||
|
@ -1,48 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Joseph Hirschfeld <joe@ibj.io>
|
||||
Date: Thu, 3 Mar 2016 02:39:54 -0600
|
||||
Subject: [PATCH] Change implementation of (tile)entity removal list
|
||||
|
||||
use sets for faster removal
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
||||
}
|
||||
}
|
||||
// Spigot End
|
||||
- this.blockEntitiesToUnload.addAll(chunk.getBlockEntities().values());
|
||||
+ this.tileEntityListUnload.addAll(chunk.getBlockEntities().values());
|
||||
List[] aentityslice = chunk.getEntitySlices(); // Spigot
|
||||
int i = aentityslice.length;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public final List<BlockEntity> blockEntityList = Lists.newArrayList();
|
||||
public final List<BlockEntity> tickableBlockEntities = Lists.newArrayList();
|
||||
protected final List<BlockEntity> pendingBlockEntities = Lists.newArrayList();
|
||||
- protected final List<BlockEntity> blockEntitiesToUnload = Lists.newArrayList();
|
||||
+ protected final java.util.Set<BlockEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet();
|
||||
public final Thread thread;
|
||||
private final boolean isDebug;
|
||||
private int skyDarken;
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
gameprofilerfiller.push("blockEntities");
|
||||
timings.tileEntityTick.startTiming(); // Spigot
|
||||
- if (!this.blockEntitiesToUnload.isEmpty()) {
|
||||
- this.tickableBlockEntities.removeAll(this.blockEntitiesToUnload);
|
||||
- this.blockEntityList.removeAll(this.blockEntitiesToUnload);
|
||||
- this.blockEntitiesToUnload.clear();
|
||||
+ if (!this.tileEntityListUnload.isEmpty()) {
|
||||
+ this.tickableBlockEntities.removeAll(this.tileEntityListUnload);
|
||||
+ this.blockEntityList.removeAll(this.tileEntityListUnload);
|
||||
+ this.tileEntityListUnload.clear();
|
||||
}
|
||||
|
||||
this.updatingBlockEntities = true;
|
@ -1,108 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Wed, 2 Mar 2016 23:13:07 -0600
|
||||
Subject: [PATCH] Send absolute position the first time an entity is seen
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
private final Entity entity;
|
||||
private final int range;
|
||||
private SectionPos lastSectionPos;
|
||||
- public final Set<ServerPlayer> seenBy = Sets.newHashSet();
|
||||
+ // Paper start
|
||||
+ // Replace trackedPlayers Set with a Map. The value is true until the player receives
|
||||
+ // their first update (which is forced to have absolute coordinates), false afterward.
|
||||
+ public java.util.Map<ServerPlayer, Boolean> trackedPlayerMap = new java.util.HashMap<>();
|
||||
+ public Set<ServerPlayer> seenBy = trackedPlayerMap.keySet();
|
||||
|
||||
public TrackedEntity(Entity entity, int i, int j, boolean flag) {
|
||||
- this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, seenBy); // CraftBukkit
|
||||
+ this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, trackedPlayerMap); // CraftBukkit // Paper
|
||||
this.entity = entity;
|
||||
this.range = i;
|
||||
this.lastSectionPos = SectionPos.of(entity);
|
||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
player.entitiesToRemove.remove(Integer.valueOf(this.entity.getId()));
|
||||
// CraftBukkit end
|
||||
|
||||
- if (flag1 && this.seenBy.add(player)) {
|
||||
+ if (flag1 && this.trackedPlayerMap.putIfAbsent(player, true) == null) { // Paper
|
||||
this.serverEntity.addPairing(player);
|
||||
}
|
||||
} else if (this.seenBy.remove(player)) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -0,0 +0,0 @@ import com.google.common.collect.Lists;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
+import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -0,0 +0,0 @@ public class ServerEntity {
|
||||
private final Entity entity;
|
||||
private final int updateInterval;
|
||||
private final boolean trackDelta;
|
||||
- private final Consumer<Packet<?>> broadcast;
|
||||
+ private final Consumer<Packet<?>> broadcast; private Consumer<Packet<?>> getPacketConsumer() { return broadcast; } // Paper - OBFHELPER
|
||||
private long xp;
|
||||
private long yp;
|
||||
private long zp;
|
||||
@@ -0,0 +0,0 @@ public class ServerEntity {
|
||||
private boolean wasOnGround;
|
||||
// CraftBukkit start
|
||||
private final Set<ServerPlayer> trackedPlayers;
|
||||
+ // Paper start
|
||||
+ private java.util.Map<ServerPlayer, Boolean> trackedPlayerMap = null;
|
||||
+
|
||||
+ /**
|
||||
+ * Requested in https://github.com/PaperMC/Paper/issues/1537 to allow intercepting packets
|
||||
+ */
|
||||
+ public void sendPlayerPacket(ServerPlayer player, Packet packet) {
|
||||
+ player.connection.send(packet);
|
||||
+ }
|
||||
+
|
||||
+ public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, java.util.Map<ServerPlayer, Boolean> trackedPlayers) {
|
||||
+ this(worldserver, entity, i, flag, consumer, trackedPlayers.keySet());
|
||||
+ trackedPlayerMap = trackedPlayers;
|
||||
+ }
|
||||
|
||||
public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayer> trackedPlayers) {
|
||||
+ // Paper end
|
||||
this.trackedPlayers = trackedPlayers;
|
||||
// CraftBukkit end
|
||||
this.ap = Vec3.ZERO;
|
||||
@@ -0,0 +0,0 @@ public class ServerEntity {
|
||||
}
|
||||
|
||||
if (packet1 != null) {
|
||||
- this.broadcast.accept(packet1);
|
||||
+ // paper start
|
||||
+ if (trackedPlayerMap == null || packet1 instanceof ClientboundTeleportEntityPacket) {
|
||||
+ this.broadcast.accept((packet1));
|
||||
+ } else {
|
||||
+ ClientboundTeleportEntityPacket teleportPacket = null;
|
||||
+
|
||||
+ for (java.util.Map.Entry<ServerPlayer, Boolean> viewer : trackedPlayerMap.entrySet()) {
|
||||
+ if (viewer.getValue()) {
|
||||
+ viewer.setValue(false);
|
||||
+ if (teleportPacket == null) {
|
||||
+ teleportPacket = new ClientboundTeleportEntityPacket(this.entity);
|
||||
+ }
|
||||
+ sendPlayerPacket(viewer.getKey(), teleportPacket);
|
||||
+ } else {
|
||||
+ sendPlayerPacket(viewer.getKey(), packet1);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
this.sendDirtyEntityData();
|
62
patches/server/Add-BeaconEffectEvent.patch
Normale Datei
62
patches/server/Add-BeaconEffectEvent.patch
Normale Datei
@ -0,0 +1,62 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Wed, 2 Mar 2016 23:30:53 -0600
|
||||
Subject: [PATCH] Add BeaconEffectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.world.phys.AABB;
|
||||
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
// CraftBukkit end
|
||||
+// Paper start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import com.destroystokyo.paper.event.block.BeaconEffectEvent;
|
||||
+// Paper end
|
||||
|
||||
public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
||||
|
||||
@@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
||||
}
|
||||
}
|
||||
|
||||
- private static void applyEffect(List list, MobEffect mobeffectlist, int j, int b0) {
|
||||
- {
|
||||
+ private static void applyEffect(List list, MobEffect effects, int i, int b0, boolean isPrimary, BlockPos worldPosition) { // Paper - BeaconEffectEvent
|
||||
+ if (!list.isEmpty()) { // Paper - BeaconEffectEvent
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
Player entityhuman;
|
||||
+ // Paper start - BeaconEffectEvent
|
||||
+ org.bukkit.block.Block block = ((Player) list.get(0)).level.getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
|
||||
+ PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(effects, i, b0, true, true));
|
||||
+ // Paper end
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- entityhuman = (Player) iterator.next();
|
||||
- entityhuman.addEffect(new MobEffectInstance(mobeffectlist, j, b0, true, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
||||
+ // Paper start - BeaconEffectEvent
|
||||
+ entityhuman = (ServerPlayer) iterator.next();
|
||||
+ BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), isPrimary);
|
||||
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
|
||||
+ entityhuman.addEffect(new MobEffectInstance(CraftPotionUtil.fromBukkit(event.getEffect())), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
||||
int j = BeaconBlockEntity.getLevel(beaconLevel);
|
||||
List list = BeaconBlockEntity.getHumansInRange(world, pos, beaconLevel);
|
||||
|
||||
- BeaconBlockEntity.applyEffect(list, primaryEffect, j, b0);
|
||||
+ BeaconBlockEntity.applyEffect(list, primaryEffect, j, b0, true, pos); // Paper - BeaconEffectEvent
|
||||
|
||||
if (BeaconBlockEntity.hasSecondaryEffect(beaconLevel, primaryEffect, secondaryEffect)) {
|
||||
- BeaconBlockEntity.applyEffect(list, secondaryEffect, j, 0);
|
||||
+ BeaconBlockEntity.applyEffect(list, secondaryEffect, j, 0, false, pos); // Paper - BeaconEffectEvent
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
Player bukkitPlayer = player.getBukkitEntity();
|
||||
- org.spigotmc.event.player.PlayerSpawnLocationEvent ev = new org.spigotmc.event.player.PlayerSpawnLocationEvent(bukkitPlayer, bukkitPlayer.getLocation());
|
||||
+ org.spigotmc.event.player.PlayerSpawnLocationEvent ev = new com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent(bukkitPlayer, bukkitPlayer.getLocation()); // Paper use our duplicate event
|
||||
cserver.getPluginManager().callEvent(ev);
|
||||
this.cserver.getPluginManager().callEvent(ev);
|
||||
|
||||
Location loc = ev.getSpawnLocation();
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
@ -37,7 +37,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
return d1 * d1 + d2 * d2 + d3 * d3 < radius * radius;
|
||||
}
|
||||
|
@ -26,18 +26,18 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
double d4 = DimensionType.getTeleportationScale(this.level.dimensionType(), destination.dimensionType());
|
||||
BlockPos blockposition = new BlockPos(Mth.clamp(this.getX() * d4, d0, d2), this.getY(), Mth.clamp(this.getZ() * d4, d1, d3));
|
||||
// CraftBukkit start
|
||||
- CraftPortalEvent event = callPortalEvent(this, destination, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
||||
- CraftPortalEvent event = this.callPortalEvent(this, destination, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
||||
+ // Paper start
|
||||
+ int portalSearchRadius = destination.paperConfig.portalSearchRadius;
|
||||
+ if (level.paperConfig.portalSearchVanillaDimensionScaling && flag2) { // == THE_NETHER
|
||||
+ portalSearchRadius = (int) (portalSearchRadius / destination.dimensionType().coordinateScale());
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ CraftPortalEvent event = callPortalEvent(this, destination, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, destination.paperConfig.portalCreateRadius); // Paper start - configurable portal radius
|
||||
+ CraftPortalEvent event = this.callPortalEvent(this, destination, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, destination.paperConfig.portalCreateRadius); // Paper start - configurable portal radius
|
||||
if (event == null) {
|
||||
return null;
|
||||
}
|
||||
@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
@@ -0,0 +0,0 @@ public class PortalForcer {
|
||||
|
||||
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos blockposition, boolean flag) {
|
||||
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos destPos, boolean destIsNether) {
|
||||
// CraftBukkit start
|
||||
- return findPortalAround(blockposition, flag ? 16 : 128); // Search Radius
|
||||
+ return findPortalAround(blockposition, flag ? level.paperConfig.portalCreateRadius : level.paperConfig.portalSearchRadius); // Paper - search Radius
|
||||
- return this.findPortal(destPos, destIsNether ? 16 : 128); // Search Radius
|
||||
+ return this.findPortal(destPos, destIsNether ? level.paperConfig.portalCreateRadius : level.paperConfig.portalSearchRadius); // Search Radius // Paper - search Radius
|
||||
}
|
||||
|
||||
public Optional<BlockUtil.FoundRectangle> findPortal(BlockPos blockposition, int i) {
|
@ -122,19 +122,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.serialization.Codec;
|
||||
import java.io.IOException;
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
gameprofilerfiller.pop();
|
||||
} catch (Throwable throwable) {
|
||||
// Paper start - Prevent tile entity and entity crashes
|
||||
- System.err.println("TileEntity threw exception at " + tileentity.level.getWorld().getName() + ":" + tileentity.worldPosition.getX() + "," + tileentity.worldPosition.getY() + "," + tileentity.worldPosition.getZ());
|
||||
+ String msg = "TileEntity threw exception at " + tileentity.getLevel().getWorld().getName() + ":" + tileentity.getBlockPos().getX() + "," + tileentity.getBlockPos().getY() + "," + tileentity.getBlockPos().getZ();
|
||||
+ System.err.println(msg);
|
||||
throwable.printStackTrace();
|
||||
+ getCraftServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable)));
|
||||
+ // Paper end
|
||||
tilesThisCycle--;
|
||||
this.tickableBlockEntities.remove(tileTickPosition--);
|
||||
continue;
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
tickConsumer.accept(entity);
|
||||
} catch (Throwable throwable) {
|
||||
@ -144,9 +131,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ System.err.println(msg);
|
||||
throwable.printStackTrace();
|
||||
+ getCraftServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable)));
|
||||
entity.removed = true;
|
||||
return;
|
||||
entity.discard();
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
@ -160,12 +147,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public final class NaturalSpawner {
|
||||
entity = biomesettingsmobs_c.type.create((Level) worldaccess.getLevel());
|
||||
} catch (Exception exception) {
|
||||
NaturalSpawner.LOGGER.warn("Failed to create mob", exception);
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper
|
||||
continue;
|
||||
}
|
||||
entity = biomesettingsmobs_c.type.create((Level) world.getLevel());
|
||||
} catch (Exception exception) {
|
||||
NaturalSpawner.LOGGER.warn("Failed to create mob", exception);
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper
|
||||
continue;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@ -174,30 +161,43 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@
|
||||
package net.minecraft.world.level.chunk;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
+import com.destroystokyo.paper.exception.ServerInternalException;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||
import com.google.common.collect.UnmodifiableIterator;
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk implements ChunkAccess {
|
||||
this.blockEntities.remove(pos);
|
||||
this.blockEntities.remove(blockposition);
|
||||
// Paper end
|
||||
} else {
|
||||
- System.out.println("Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + "," + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()
|
||||
- + " (" + getBlockState(pos) + ") where there was no entity tile!");
|
||||
- + " (" + this.getBlockState(blockposition) + ") where there was no entity tile!");
|
||||
- System.out.println("Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
|
||||
- new Exception().printStackTrace();
|
||||
+ // Paper start
|
||||
+ ServerInternalException e = new ServerInternalException(
|
||||
+ "Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + ","
|
||||
+ + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()
|
||||
+ + " (" + getBlockState(pos) + ") where there was no entity tile!\n" +
|
||||
+ "Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
|
||||
+ "Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + ","
|
||||
+ + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()
|
||||
+ + " (" + getBlockState(blockposition) + ") where there was no entity tile!\n" +
|
||||
+ "Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
|
||||
+ e.printStackTrace();
|
||||
+ ServerInternalException.reportInternalException(e);
|
||||
+ // Paper end
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk implements ChunkAccess {
|
||||
gameprofilerfiller.pop();
|
||||
} catch (Throwable throwable) {
|
||||
// Paper start - Prevent tile entity and entity crashes
|
||||
- System.err.println("TileEntity threw exception at " + LevelChunk.this.getLevel().getWorld().getName() + ":" + this.getPos().getX() + "," + this.getPos().getY() + "," + this.getPos().getZ());
|
||||
+ String msg = "TileEntity threw exception at " + LevelChunk.this.getLevel().getWorld().getName() + ":" + this.getPos().getX() + "," + this.getPos().getY() + "," + this.getPos().getZ();
|
||||
+ System.err.println(msg);
|
||||
throwable.printStackTrace();
|
||||
+ net.minecraft.world.level.chunk.LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new ServerInternalException(msg, throwable)));
|
||||
LevelChunk.this.removeBlockEntity(this.getPos());
|
||||
// Paper end
|
||||
// Spigot start
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
@ -211,25 +211,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable {
|
||||
((java.nio.Buffer) bytebuffer).position(5); // CraftBukkit - decompile error
|
||||
filechannel.write(bytebuffer);
|
||||
} catch (Throwable throwable1) {
|
||||
throwable = throwable1;
|
||||
} catch (Throwable throwable) {
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(throwable); // Paper
|
||||
throw throwable1;
|
||||
} finally {
|
||||
if (filechannel != null) {
|
||||
try {
|
||||
filechannel.close();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
@@ -0,0 +0,0 @@ public class DimensionDataStorage {
|
||||
}
|
||||
} catch (Throwable throwable6) {
|
||||
throwable = throwable6;
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(throwable); // Paper
|
||||
throw throwable6;
|
||||
} finally {
|
||||
if (fileinputstream != null) {
|
||||
|
||||
pushbackInputStream.close();
|
||||
} catch (Throwable var15) {
|
||||
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(var15); // Paper
|
||||
try {
|
||||
fileInputStream.close();
|
||||
} catch (Throwable var10) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
@ -252,13 +252,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ new ServerExceptionEvent(new ServerSchedulerException(msg, throwable, task)));
|
||||
// Paper end
|
||||
} finally {
|
||||
currentTask = null;
|
||||
this.currentTask = null;
|
||||
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
parsePending();
|
||||
this.parsePending();
|
||||
} else {
|
||||
debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass()));
|
||||
- executor.execute(task);
|
||||
+ executor.execute(new ServerSchedulerReportingWrapper(task)); // Paper
|
||||
this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass()));
|
||||
- this.executor.execute(task);
|
||||
+ this.executor.execute(new ServerSchedulerReportingWrapper(task)); // Paper
|
||||
// We don't need to parse pending
|
||||
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
|
||||
}
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
getHandle().persistentInvisibility = invisible;
|
||||
getHandle().setSharedFlag(5, invisible);
|
||||
this.getHandle().persistentInvisibility = invisible;
|
||||
this.getHandle().setSharedFlag(5, invisible);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
@ -29,8 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ CraftServer.excessiveVelEx = new Exception("Excessive velocity set detected: tried to set velocity of entity " + entity.getScoreboardName() + " id #" + getEntityId() + " to (" + velocity.getX() + "," + velocity.getY() + "," + velocity.getZ() + ").");
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
entity.setDeltaMovement(CraftVector.toNMS(velocity));
|
||||
this.entity.setDeltaMovement(CraftVector.toNMS(velocity));
|
||||
entity.hurtMarked = true;
|
||||
}
|
||||
|
||||
@ -61,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return getHandle().getBbHeight();
|
||||
return this.getHandle().getBbHeight();
|
||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@ -86,4 +85,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
log.log( Level.SEVERE, "------------------------------" );
|
||||
log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
|
||||
dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
|
||||
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
|
@ -26,8 +26,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
ChunkPos chunkcoordintpair = new ChunkPos(pos);
|
||||
- boolean flag = WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getLevel().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot
|
||||
+ boolean flag = world.getLevel().paperConfig.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getLevel().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper
|
||||
- boolean flag = WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot
|
||||
+ boolean flag = world.getMinecraftWorld().paperConfig.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper
|
||||
|
||||
if (random.nextInt(10) == 0 && flag && pos.getY() < 40) {
|
||||
return checkMobSpawnRules(type, world, spawnReason, pos, random);
|
@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public void setHealth(double health) {
|
||||
health = (float) health;
|
||||
if ((health < 0) || (health > getMaxHealth())) {
|
||||
- throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth() + "(" + health + ")");
|
||||
if ((health < 0) || (health > this.getMaxHealth())) {
|
||||
- throw new IllegalArgumentException("Health must be between 0 and " + this.getMaxHealth() + "(" + health + ")");
|
||||
+ // Paper - Be more informative
|
||||
+ throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth() + ", but was " + health
|
||||
+ + ". (attribute base value: " + this.getHandle().getAttribute(Attributes.MAX_HEALTH).getBaseValue()
|
||||
+ + (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')'));
|
||||
+ + ". (attribute base value: " + this.getHandle().getAttribute(Attributes.MAX_HEALTH).getBaseValue()
|
||||
+ + (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')'));
|
||||
}
|
||||
|
||||
getHandle().setHealth((float) health);
|
||||
this.getHandle().setHealth((float) health);
|
@ -32,14 +32,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
||||
|
||||
protected void write(ChunkPos pos, CompoundTag tag) throws IOException {
|
||||
protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException {
|
||||
RegionFile regionfile = this.getFile(pos, false); // CraftBukkit
|
||||
+ int attempts = 0; Exception laste = null; while (attempts++ < 5) { try { // Paper
|
||||
DataOutputStream dataoutputstream = regionfile.getChunkDataOutputStream(pos);
|
||||
Throwable throwable = null;
|
||||
|
||||
if (nbt == null) {
|
||||
regionfile.clear(pos);
|
||||
@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
@ -8,19 +8,20 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
// CraftBukkit start
|
||||
public void handleResourcePackResponse(ServerboundResourcePackPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
- this.craftServer.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getPlayer(), PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()]));
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
|
||||
this.disconnect(new TranslatableComponent("multiplayer.requiredTexturePrompt.disconnect"));
|
||||
}
|
||||
- this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()])); // CraftBukkit
|
||||
-
|
||||
+ // Paper start
|
||||
+ PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
|
||||
+ player.getBukkitEntity().setResourcePackStatus(packStatus);
|
||||
+ this.craftServer.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getPlayer(), packStatus));
|
||||
+ this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packStatus)); // CraftBukkit
|
||||
+ // Paper end
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@Override
|
||||
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
|
||||
@ -45,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public void setResourcePack(String url, String hash) {
|
||||
+ Validate.notNull(url, "Resource pack URL cannot be null");
|
||||
+ Validate.notNull(hash, "Hash cannot be null");
|
||||
+ this.getHandle().sendTexturePack(url, hash);
|
||||
+ this.getHandle().sendTexturePack(url, hash, false, new net.minecraft.network.chat.TextComponent(""));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
@ -39,6 +39,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
++this.life;
|
||||
- if (this.life >= ((this instanceof ThrownTrident) ? level.spigotConfig.tridentDespawnRate : level.spigotConfig.arrowDespawnRate)) { // Spigot
|
||||
+ if (this.life >= (pickup == Pickup.CREATIVE_ONLY ? level.paperConfig.creativeArrowDespawnRate : (pickup == Pickup.DISALLOWED ? level.paperConfig.nonPlayerArrowDespawnRate : ((this instanceof ThrownTrident) ? level.spigotConfig.tridentDespawnRate : level.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init?
|
||||
this.remove();
|
||||
this.discard();
|
||||
}
|
||||
|
@ -22,15 +22,15 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
|
||||
public boolean ignoreSlotUpdateHack;
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||
private int containerCounter;
|
||||
public int latency;
|
||||
public boolean wonGame;
|
||||
+ private int containerUpdateDelay; // Paper
|
||||
|
||||
// CraftBukkit start
|
||||
public String displayName;
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||
--this.invulnerableTime;
|
||||
}
|
||||
|
@ -23,43 +23,40 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -0,0 +0,0 @@ public abstract class BaseSpawner {
|
||||
public int maxNearbyEntities = 6;
|
||||
public int requiredPlayerRange = 16;
|
||||
public int spawnRange = 4;
|
||||
public int requiredPlayerRange;
|
||||
public int spawnRange;
|
||||
private final Random random;
|
||||
+ private int tickDelay = 0; // Paper
|
||||
|
||||
public BaseSpawner() {}
|
||||
|
||||
public BaseSpawner() {
|
||||
this.spawnPotentials = BaseSpawner.EMPTY_POTENTIALS;
|
||||
@@ -0,0 +0,0 @@ public abstract class BaseSpawner {
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
public void serverTick(ServerLevel world, BlockPos pos) {
|
||||
+ // Paper start - Configurable mob spawner tick rate
|
||||
+ if (spawnDelay > 0 && --tickDelay > 0) return;
|
||||
+ tickDelay = this.getLevel().paperConfig.mobSpawnerTickRate;
|
||||
+ tickDelay = world.paperConfig.mobSpawnerTickRate;
|
||||
+ // Paper end
|
||||
if (!this.isNearPlayer()) {
|
||||
this.oSpin = this.spin;
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public abstract class BaseSpawner {
|
||||
world.addParticle(ParticleTypes.SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
world.addParticle(ParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
if (this.spawnDelay > 0) {
|
||||
- --this.spawnDelay;
|
||||
+ this.spawnDelay -= tickDelay; // Paper
|
||||
}
|
||||
if (this.isNearPlayer(world, pos)) {
|
||||
- if (this.spawnDelay == -1) {
|
||||
+ if (this.spawnDelay < -tickDelay) {
|
||||
this.delay(world, pos);
|
||||
}
|
||||
|
||||
this.oSpin = this.spin;
|
||||
this.spin = (this.spin + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D;
|
||||
if (this.spawnDelay > 0) {
|
||||
- --this.spawnDelay;
|
||||
+ this.spawnDelay -= tickDelay; // Paper
|
||||
} else {
|
||||
- if (this.spawnDelay == -1) {
|
||||
+ if (this.spawnDelay < -tickDelay) { // Paper
|
||||
this.delay();
|
||||
}
|
||||
|
||||
if (this.spawnDelay > 0) {
|
||||
- --this.spawnDelay;
|
||||
+ this.spawnDelay -= tickDelay; // Paper
|
||||
return;
|
||||
}
|
||||
boolean flag = false;
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class BaseSpawner {
|
||||
((Mob) entity).finalizeSpawn(world, world.getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.SPAWNER, (SpawnGroupData) null, (CompoundTag) null);
|
||||
}
|
||||
// Spigot Start
|
||||
- if ( entityinsentient.level.spigotConfig.nerfSpawnerMobs )
|
||||
- {
|
||||
+ if (entityinsentient.level.spigotConfig.nerfSpawnerMobs) {
|
||||
entityinsentient.aware = false;
|
||||
}
|
||||
// Spigot End
|
@ -34,19 +34,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
if (type == PluginLoadOrder.STARTUP) {
|
||||
helpMap.clear();
|
||||
helpMap.initializeGeneralTopics();
|
||||
|
||||
if (!Main.useConsole) {
|
||||
this.getLogger().info("Console input is disabled due to --noconsole command argument");
|
||||
+ if (com.destroystokyo.paper.PaperConfig.loadPermsBeforePlugins) loadCustomPermissions(); // Paper
|
||||
}
|
||||
|
||||
Plugin[] plugins = pluginManager.getPlugins();
|
||||
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
commandMap.registerServerAliases();
|
||||
this.commandMap.registerServerAliases();
|
||||
DefaultPermissions.registerCorePermissions();
|
||||
CraftDefaultPermissions.registerCorePermissions();
|
||||
- loadCustomPermissions();
|
||||
+ if (!com.destroystokyo.paper.PaperConfig.loadPermsBeforePlugins) loadCustomPermissions(); // Paper
|
||||
helpMap.initializeCommands();
|
||||
syncCommands();
|
||||
- this.loadCustomPermissions();
|
||||
+ if (!com.destroystokyo.paper.PaperConfig.loadPermsBeforePlugins) this.loadCustomPermissions(); // Paper
|
||||
this.helpMap.initializeCommands();
|
||||
this.syncCommands();
|
||||
}
|
@ -28,12 +28,12 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
|
||||
@Nullable
|
||||
public Team getTeam() {
|
||||
+ if (!this.level.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper
|
||||
return this.level.getScoreboard().getPlayerTeam(this.getScoreboardName());
|
||||
return this.level.getScoreboard().getPlayersTeam(this.getScoreboardName());
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@ -41,9 +41,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
|
||||
if (tag.contains("Team", 8)) {
|
||||
String s = tag.getString("Team");
|
||||
PlayerTeam scoreboardteam = this.level.getScoreboard().getTeam(s);
|
||||
if (nbt.contains("Team", 8)) {
|
||||
String s = nbt.getString("Team");
|
||||
PlayerTeam scoreboardteam = this.level.getScoreboard().getPlayerTeam(s);
|
||||
+ if (!level.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof net.minecraft.world.entity.player.Player)) { scoreboardteam = null; } // Paper
|
||||
boolean flag = scoreboardteam != null && this.level.getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam);
|
||||
|
@ -62,8 +62,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (entity instanceof Player) {
|
||||
Player entityhuman = (Player) entity;
|
||||
|
||||
- if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.abilities.flying)) {
|
||||
+ if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.abilities.flying) && !level.paperConfig.disableExplosionKnockback) { // Paper - Disable explosion knockback
|
||||
- if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying)) {
|
||||
+ if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying) && !level.paperConfig.disableExplosionKnockback) { // Paper - Disable explosion knockback
|
||||
this.hitPlayers.put(entityhuman, new Vec3(d8 * d13, d9 * d13, d10 * d13));
|
||||
}
|
||||
}
|
@ -10,12 +10,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Spigot start
|
||||
// Iterator iterator = this.tileEntityListTick.iterator();
|
||||
// Iterator iterator = this.blockEntityTickers.iterator();
|
||||
int tilesThisCycle = 0;
|
||||
- for (tileLimiter.initTick();
|
||||
- tilesThisCycle < tickableBlockEntities.size() && (tilesThisCycle % 10 != 0 || tileLimiter.shouldContinue());
|
||||
- tileTickPosition++, tilesThisCycle++) {
|
||||
+ for (tileTickPosition = 0; tileTickPosition < tickableBlockEntities.size(); tileTickPosition++) { // Paper - Disable tick limiters
|
||||
tileTickPosition = (tileTickPosition < tickableBlockEntities.size()) ? tileTickPosition : 0;
|
||||
BlockEntity tileentity = (BlockEntity) this.tickableBlockEntities.get(tileTickPosition);
|
||||
- for (this.tileLimiter.initTick();
|
||||
- tilesThisCycle < this.blockEntityTickers.size() && (tilesThisCycle % 10 != 0 || this.tileLimiter.shouldContinue());
|
||||
- this.tileTickPosition++, tilesThisCycle++) {
|
||||
+ for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
|
||||
this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
|
||||
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(tileTickPosition);
|
||||
// Spigot start
|
@ -28,6 +28,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
- if (flag && this.isThundering() && this.random.nextInt(100000) == 0) {
|
||||
+ if (!this.paperConfig.disableThunder && flag && this.isThundering() && this.random.nextInt(100000) == 0) { // Paper - Disable thunder
|
||||
blockposition = this.findLightingTargetAround(this.getBlockRandomPos(j, 0, k, 15));
|
||||
blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15));
|
||||
if (this.isRainingAt(blockposition)) {
|
||||
DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);
|
@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public class ClientboundChatPacket implements Packet<ClientGamePacketListener> {
|
||||
// Paper end
|
||||
// Spigot start
|
||||
if (components != null) {
|
||||
- buf.writeByteArray(net.md_5.bungee.chat.ComponentSerializer.toString(components));
|
||||
+ //packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below
|
||||
if (this.components != null) {
|
||||
- buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(components));
|
||||
+ // buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below
|
||||
+ // Paper start - don't nest if we don't need to so that we can preserve formatting
|
||||
+ if (this.components.length == 1) {
|
||||
+ buf.writeByteArray(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0]));
|
||||
+ buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0]));
|
||||
+ } else {
|
||||
+ buf.writeByteArray(net.md_5.bungee.chat.ComponentSerializer.toString(this.components));
|
||||
+ buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components));
|
||||
+ }
|
||||
+ // Paper end
|
||||
} else {
|
@ -17,7 +17,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
}
|
||||
|
||||
if (!async && s.startsWith("/")) {
|
||||
@ -77,8 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper End
|
||||
+
|
||||
if (commandMap.dispatch(sender, commandLine)) {
|
||||
if (this.commandMap.dispatch(sender, commandLine)) {
|
||||
return true;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
@ -90,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
try {
|
||||
org.spigotmc.AsyncCatcher.enabled = false; // Spigot
|
||||
+ org.spigotmc.AsyncCatcher.shuttingDown = true; // Paper
|
||||
server.close();
|
||||
this.server.close();
|
||||
} finally {
|
||||
try {
|
||||
diff --git a/src/main/java/org/spigotmc/AsyncCatcher.java b/src/main/java/org/spigotmc/AsyncCatcher.java
|
@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.resetQuickCraft();
|
||||
}
|
||||
} else if (this.quickcraftStatus == 1) {
|
||||
- Slot slot = (Slot) this.slots.get(i);
|
||||
+ Slot slot = i < this.slots.size() ? this.slots.get(i) : null; // Paper - Ensure drag in bounds
|
||||
|
||||
itemstack1 = playerinventory.getCarried();
|
||||
if (slot != null && canItemQuickReplace(slot, itemstack1, true) && slot.isAllowed(itemstack1) && (this.quickcraftType == 2 || itemstack1.getCount() > this.quickcraftSlots.size()) && this.canDragTo(slot)) {
|
||||
- slot = (Slot) this.slots.get(slotIndex);
|
||||
+ slot = slotIndex < this.slots.size() ? this.slots.get(slotIndex) : null; // Paper - Ensure drag in bounds
|
||||
itemstack = this.getCarried();
|
||||
if (AbstractContainerMenu.canItemQuickReplace(slot, itemstack, true) && slot.mayPlace(itemstack) && (this.quickcraftType == 2 || itemstack.getCount() > this.quickcraftSlots.size()) && this.canDragTo(slot)) {
|
||||
this.quickcraftSlots.add(slot);
|
@ -9,10 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
return helpMap;
|
||||
return this.helpMap;
|
||||
}
|
||||
|
||||
+ @Override // Paper - add override
|
||||
public SimpleCommandMap getCommandMap() {
|
||||
return commandMap;
|
||||
return this.commandMap;
|
||||
}
|
@ -21,18 +21,18 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/ja
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
@@ -0,0 +0,0 @@ import java.text.DecimalFormatSymbols;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
+import java.util.Collections;
|
||||
+import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
private BlockInWorld cachedPlaceBlock;
|
||||
private boolean cachedPlaceBlockResult;
|
||||
return this.getItem().getTooltipImage(this);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private static final java.util.Comparator<? super CompoundTag> enchantSorter = java.util.Comparator.comparing(o -> o.getString("id"));
|
||||
@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ try {
|
||||
+ //noinspection unchecked
|
||||
+ list.sort((Comparator<? super Tag>) enchantSorter); // Paper
|
||||
+ list.sort((Comparator<? super net.minecraft.nbt.Tag>) enchantSorter); // Paper
|
||||
+ } catch (Exception ignored) {}
|
||||
+ }
|
||||
+ // Paper end
|
||||
@ -55,13 +55,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this(item, 1);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
if (nbttagcompound.contains("tag", 10)) {
|
||||
// CraftBukkit start - make defensive copy as this data may be coming from the save thread
|
||||
this.tag = (CompoundTag) nbttagcompound.getCompound("tag").copy();
|
||||
+ processEnchantOrder(this.tag); // Paper
|
||||
this.getItem().verifyTagAfterLoad(this.tag);
|
||||
// CraftBukkit end
|
||||
+ this.processEnchantOrder(this.tag); // Paper
|
||||
this.getItem().verifyTagAfterLoad(this.tag);
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
// Paper end
|
||||
public void setTag(@Nullable CompoundTag tag) {
|
||||
@ -94,13 +94,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void addUnsafeEnchantment(Enchantment ench, int level) {
|
||||
Validate.notNull(ench, "Cannot add null enchantment");
|
||||
|
||||
- if (!makeTag(handle)) {
|
||||
- if (!CraftItemStack.makeTag(this.handle)) {
|
||||
- return;
|
||||
- }
|
||||
- ListTag list = getEnchantmentList(handle);
|
||||
- ListTag list = CraftItemStack.getEnchantmentList(this.handle);
|
||||
- if (list == null) {
|
||||
- list = new ListTag();
|
||||
- handle.getTag().put(ENCHANTMENTS.NBT, list);
|
||||
- this.handle.getTag().put(ENCHANTMENTS.NBT, list);
|
||||
- }
|
||||
- int size = list.size();
|
||||
-
|
||||
@ -117,9 +117,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- tag.putShort(ENCHANTMENTS_LVL.NBT, (short) level);
|
||||
- list.add(tag);
|
||||
+ // Paper start - Replace whole method
|
||||
+ final ItemMeta itemMeta = getItemMeta();
|
||||
+ final ItemMeta itemMeta = this.getItemMeta();
|
||||
+ itemMeta.addEnchant(ench, level, true);
|
||||
+ setItemMeta(itemMeta);
|
||||
+ this.setItemMeta(itemMeta);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@ -128,25 +128,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Override
|
||||
public boolean containsEnchantment(Enchantment ench) {
|
||||
- return getEnchantmentLevel(ench) > 0;
|
||||
+ return hasItemMeta() && getItemMeta().hasEnchant(ench); // Paper - use meta
|
||||
- return this.getEnchantmentLevel(ench) > 0;
|
||||
+ return this.hasItemMeta() && this.getItemMeta().hasEnchant(ench); // Paper - use meta
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnchantmentLevel(Enchantment ench) {
|
||||
- Validate.notNull(ench, "Cannot find null enchantment");
|
||||
- if (handle == null) {
|
||||
- if (this.handle == null) {
|
||||
- return 0;
|
||||
- }
|
||||
- return EnchantmentHelper.getItemEnchantmentLevel(CraftEnchantment.getRaw(ench), handle);
|
||||
+ return hasItemMeta() ? getItemMeta().getEnchantLevel(ench) : 0; // Paper - replace entire method with meta
|
||||
+ return this.hasItemMeta() ? this.getItemMeta().getEnchantLevel(ench) : 0; // Paper - replace entire method with meta
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeEnchantment(Enchantment ench) {
|
||||
Validate.notNull(ench, "Cannot remove null enchantment");
|
||||
|
||||
- ListTag list = getEnchantmentList(handle), listCopy;
|
||||
- ListTag list = CraftItemStack.getEnchantmentList(this.handle), listCopy;
|
||||
- if (list == null) {
|
||||
- return 0;
|
||||
- }
|
||||
@ -168,9 +168,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- return 0;
|
||||
- }
|
||||
- if (size == 1) {
|
||||
- handle.getTag().remove(ENCHANTMENTS.NBT);
|
||||
- if (handle.getTag().isEmpty()) {
|
||||
- handle.setTag(null);
|
||||
- this.handle.getTag().remove(ENCHANTMENTS.NBT);
|
||||
- if (this.handle.getTag().isEmpty()) {
|
||||
- this.handle.setTag(null);
|
||||
- }
|
||||
- return level;
|
||||
- }
|
||||
@ -182,13 +182,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- listCopy.add(list.get(i));
|
||||
- }
|
||||
+ // Paper start - replace entire method
|
||||
+ final ItemMeta itemMeta = getItemMeta();
|
||||
+ final ItemMeta itemMeta = this.getItemMeta();
|
||||
+ int level = itemMeta.getEnchantLevel(ench);
|
||||
+ if (level > 0) {
|
||||
+ itemMeta.removeEnchant(ench);
|
||||
+ setItemMeta(itemMeta);
|
||||
+ this.setItemMeta(itemMeta);
|
||||
}
|
||||
- handle.getTag().put(ENCHANTMENTS.NBT, listCopy);
|
||||
- this.handle.getTag().put(ENCHANTMENTS.NBT, listCopy);
|
||||
+ // Paper end
|
||||
|
||||
return level;
|
||||
@ -196,8 +196,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Override
|
||||
public Map<Enchantment, Integer> getEnchantments() {
|
||||
- return getEnchantments(handle);
|
||||
+ return hasItemMeta() ? getItemMeta().getEnchants() : ImmutableMap.<Enchantment, Integer>of(); // Paper - use Item Meta
|
||||
- return CraftItemStack.getEnchantments(this.handle);
|
||||
+ return this.hasItemMeta() ? this.getItemMeta().getEnchants() : ImmutableMap.<Enchantment, Integer>of(); // Paper - use Item Meta
|
||||
}
|
||||
|
||||
static Map<Enchantment, Integer> getEnchantments(net.minecraft.world.item.ItemStack item) {
|
||||
@ -244,7 +244,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
private CompoundTag internalTag;
|
||||
- private final Map<String, Tag> unhandledTags = new HashMap<String, Tag>();
|
||||
+ private final Map<String, Tag> unhandledTags = new TreeMap<>(); // Paper
|
||||
private CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY);
|
||||
private CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftMetaItem.DATA_TYPE_REGISTRY);
|
||||
|
||||
private int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@ -292,16 +292,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Override
|
||||
public Map<Enchantment, Integer> getEnchants() {
|
||||
- return hasEnchants() ? ImmutableMap.copyOf(enchantments) : ImmutableMap.<Enchantment, Integer>of();
|
||||
+ return hasEnchants() ? ImmutableSortedMap.copyOfSorted(enchantments) : ImmutableMap.<Enchantment, Integer>of(); // Paper
|
||||
- return this.hasEnchants() ? ImmutableMap.copyOf(enchantments) : ImmutableMap.<Enchantment, Integer>of();
|
||||
+ return this.hasEnchants() ? ImmutableSortedMap.copyOfSorted(this.enchantments) : ImmutableMap.<Enchantment, Integer>of(); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addEnchant(Enchantment ench, int level, boolean ignoreRestrictions) {
|
||||
Validate.notNull(ench, "Enchantment cannot be null");
|
||||
if (enchantments == null) {
|
||||
- enchantments = new LinkedHashMap<Enchantment, Integer>(4);
|
||||
+ enchantments = new EnchantmentMap(); // Paper
|
||||
if (this.enchantments == null) {
|
||||
- this.enchantments = new LinkedHashMap<Enchantment, Integer>(4);
|
||||
+ this.enchantments = new EnchantmentMap(); // Paper
|
||||
}
|
||||
|
||||
if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) {
|
||||
@ -315,7 +315,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (this.hasAttributeModifiers()) {
|
||||
clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers);
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
return HANDLED_TAGS;
|
||||
return CraftMetaItem.HANDLED_TAGS;
|
||||
}
|
||||
}
|
||||
+
|
@ -32,37 +32,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@Nullable
|
||||
public static MutableComponent fromJson(String json) {
|
||||
return (MutableComponent) GsonHelper.fromJson(Component.Serializer.GSON, json, MutableComponent.class, false);
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTitlesPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTitlesPacket.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTitlesPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTitlesPacket.java
|
||||
@@ -0,0 +0,0 @@ public class ClientboundSetTitlesPacket implements Packet<ClientGamePacketListen
|
||||
}
|
||||
|
||||
}
|
||||
+ // Paper start
|
||||
+ public net.md_5.bungee.api.chat.BaseComponent[] components;
|
||||
+
|
||||
+ public ClientboundSetTitlesPacket(Type action, net.md_5.bungee.api.chat.BaseComponent[] components, int fadeIn, int stay, int fadeOut) {
|
||||
+ this.type = action;
|
||||
+ this.components = components;
|
||||
+ this.fadeInTime = fadeIn;
|
||||
+ this.stayTime = stay;
|
||||
+ this.fadeOutTime = fadeOut;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) throws IOException {
|
||||
@@ -0,0 +0,0 @@ public class ClientboundSetTitlesPacket implements Packet<ClientGamePacketListen
|
||||
// Paper start
|
||||
if (this.adventure$text != null) {
|
||||
buf.writeComponent(this.adventure$text);
|
||||
+ } else if (this.components != null) {
|
||||
+ buf.writeComponent(this.components);
|
||||
} else
|
||||
// Paper end
|
||||
buf.writeComponent(this.text);
|
||||
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
|
@ -15,9 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
+ Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
pluginManager.clearPlugins();
|
||||
commandMap.clearCommands();
|
||||
+
|
||||
this.pluginManager.clearPlugins();
|
||||
this.commandMap.clearCommands();
|
||||
+ // Paper start
|
||||
+ for (Plugin plugin : pluginClone) {
|
||||
+ entityMetadata.removeAll(plugin);
|
||||
@ -25,7 +24,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ playerMetadata.removeAll(plugin);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
resetRecipes();
|
||||
reloadData();
|
||||
this.resetRecipes();
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
@ -10,15 +10,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
@@ -0,0 +0,0 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
if (name == null) {
|
||||
setProfile(null);
|
||||
this.setProfile(null);
|
||||
} else {
|
||||
- setProfile(new GameProfile(null, name));
|
||||
- this.setProfile(new GameProfile(null, name));
|
||||
+ // Paper start - Use Online Players Skull
|
||||
+ GameProfile newProfile = null;
|
||||
+ net.minecraft.server.EntityPlayer player = net.minecraft.server.MinecraftServer.getServer().getPlayerList().getPlayerByName(name);
|
||||
+ if (player != null) newProfile = player.getProfile();
|
||||
+ net.minecraft.server.level.ServerPlayer player = net.minecraft.server.MinecraftServer.getServer().getPlayerList().getPlayerByName(name);
|
||||
+ if (player != null) newProfile = player.getGameProfile();
|
||||
+ if (newProfile == null) newProfile = new GameProfile(null, name);
|
||||
+ setProfile(newProfile);
|
||||
+ this.setProfile(newProfile);
|
||||
+ // Paper end
|
||||
}
|
||||
|
@ -11,17 +11,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag tag) {
|
||||
- this.setAbsorptionAmount(tag.getFloat("AbsorptionAmount"));
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||
- this.setAbsorptionAmount(nbt.getFloat("AbsorptionAmount"));
|
||||
+ // Paper start - jvm keeps optimizing the setter
|
||||
+ float absorptionAmount = tag.getFloat("AbsorptionAmount");
|
||||
+ float absorptionAmount = nbt.getFloat("AbsorptionAmount");
|
||||
+ if (Float.isNaN(absorptionAmount)) {
|
||||
+ absorptionAmount = 0;
|
||||
+ }
|
||||
+ this.setAbsorptionAmount(absorptionAmount);
|
||||
+ // Paper end
|
||||
if (tag.contains("Attributes", 9) && this.level != null && !this.level.isClientSide) {
|
||||
this.getAttributes().load(tag.getList("Attributes", 10));
|
||||
if (nbt.contains("Attributes", 9) && this.level != null && !this.level.isClientSide) {
|
||||
this.getAttributes().load(nbt.getList("Attributes", 10));
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
@ -43,6 +43,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
amount = 0.0F;
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
|
||||
this.setDeltaMovement((double) ((float) packet.getXd() / 8000.0F), (double) ((float) packet.getYd() / 8000.0F), (double) ((float) packet.getZd() / 8000.0F));
|
||||
}
|
||||
}
|
||||
+
|
||||
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
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren