3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-14 18:40:10 +01:00
Dieser Commit ist enthalten in:
Jake Potrebic 2021-06-11 17:57:04 -07:00 committet von MiniDigger | Martin
Ursprung 3a3831d6aa
Commit 650edb93ca
62 geänderte Dateien mit 491 neuen und 529 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Expose server CommandMap
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 0636edd8d9121eabfa60957c8c224261d228a16b..8d707e117035d5bc0d8c9a5fd386ee8355359259 100644
index 1014871a3d7bfcf2b749d20e6ef8096876f9b4d7..72f0268e70382a258aeac9a9d6d860e0284378ad 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1717,6 +1717,19 @@ public final class Bukkit {
@ -29,7 +29,7 @@ index 0636edd8d9121eabfa60957c8c224261d228a16b..8d707e117035d5bc0d8c9a5fd386ee83
public static Server.Spigot spigot() {
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 5c638e0d45e8896382bdbf9b9c10474b05a97df5..24bcc63afbda5f27aad385dc707f262d1a3a3399 100644
index 3f74dc04df61e7d038c99ad9c1c3bfff086a019a..8fc591b16da774d60e85e3f13e44e9b5be671a3b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1311,6 +1311,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses
Change Javadoc to be accurate
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 10274053320f1ec690a65d3794abb44b58658059..22b83b142de97dcba28fa9a49730de7880d0b5d2 100644
index 72f0268e70382a258aeac9a9d6d860e0284378ad..8646fc0987a8833996c5d977c36fe0d01bf72992 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -285,6 +285,30 @@ public final class Bukkit {
@ -41,7 +41,7 @@ index 10274053320f1ec690a65d3794abb44b58658059..22b83b142de97dcba28fa9a49730de78
* Gets the name of the update folder. The update folder is used to safely
* update plugins at the right moment on a plugin load.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 7e4a728ceb943b6a32b9ba9b84bada34e71c0980..9ce9b4ce2da6c57c62607502ae2042e30fc26d88 100644
index 8fc591b16da774d60e85e3f13e44e9b5be671a3b..599347ef656acad9a40be15fc5030e5d0f1630df 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -234,6 +234,30 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@ -76,7 +76,7 @@ index 7e4a728ceb943b6a32b9ba9b84bada34e71c0980..9ce9b4ce2da6c57c62607502ae2042e3
* Gets the name of the update folder. The update folder is used to safely
* update plugins at the right moment on a plugin load.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 68795a48cb15d322906ce0569b7701231c1f94c2..88853cc165c67fd60a0a8f87e4ce356e4ca045f9 100644
index f34601480a3b3069c30c52d258a35a2a79c981fb..4686212255e8de3e5a6f43d86f28fad595f687ed 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -614,6 +614,42 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM

Datei anzeigen

@ -506,7 +506,7 @@ index f020cb04eba27a2e70fc7cf799ebbfb434b9d974..adfc7aae2c0f49bbcdd358e83b04a0cf
}
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 745eaa8f2f2ff83536301db8ca47a8af30df7a73..d0fec44d2546290091649879450761ce08514fcb 100644
index 7548e40af8043c1b5716f2d7d0122833466854c4..c2c49ee9b5531bc4761d2da54cd707c57fc647bf 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -23,6 +23,10 @@ import java.util.WeakHashMap;

Datei anzeigen

@ -432,7 +432,7 @@ index 0000000000000000000000000000000000000000..9e90c3df567a65b48a0b9341f784eb90
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 88853cc165c67fd60a0a8f87e4ce356e4ca045f9..c9e4cb2d153fc0c6853fe520263a0073e7504e38 100644
index 4686212255e8de3e5a6f43d86f28fad595f687ed..769ad98fd7a6a866b320e1ccffd7962228d564cf 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2,6 +2,7 @@ package org.bukkit.entity;

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Use ASM for event executors.
Uses method handles for private or static methods.
diff --git a/pom.xml b/pom.xml
index 1ced7a212684cee8faf07fa9a083adcd47be7fcb..7ec7e6047193a6b390d24f6d2722e35d1d36830d 100644
index cae43ce5c1287a4cd117fd069d34ebc1b64b7fdb..2c757ffb2253748c6a81f9b373290108209b6ff2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -163,6 +163,17 @@

Datei anzeigen

@ -3,6 +3,8 @@ 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
Not needed anymore, packet spawn sends full position
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 59a5f82c9f57d760ba4959a040ce8cbf0f49e4aa..d1bc927c8b429f43de2cdad98f8b329ff4c8b4db 100644

Datei anzeigen

@ -0,0 +1,31 @@
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 69ff8df7340e60c476803256750a48f0b43414d3..df444daeb181ff78170f7b92bd02f1f1862dfa2e 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTitlesPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTitlesPacket.java
@@ -47,6 +47,17 @@ 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 {
@@ -55,6 +66,8 @@ 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);

Datei anzeigen

@ -5,6 +5,8 @@ Subject: [PATCH] Change implementation of (tile)entity removal list
use sets for faster removal
1.17: no more unload lists
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 6c6098731752d61b5241710b075d4ffe3826daac..89472b6e8f38921db50440d0213e40ac893892f1 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java

Datei anzeigen

@ -1,65 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Wed, 2 Mar 2016 15:03:53 -0600
Subject: [PATCH] Configurable mob spawner tick rate
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 2f7a5a4a5a7b29750cfd777e0bc5d19a14e93fa2..4de86b09c6bc3c1974ce61b550ccb73d37f6f170 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -176,4 +176,9 @@ public class PaperWorldConfig {
private void disableIceAndSnow(){
disableIceAndSnow = getBoolean("disable-ice-and-snow", false);
}
+
+ public int mobSpawnerTickRate;
+ private void mobSpawnerTickRate() {
+ mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1);
+ }
}
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 10058d3c3565382faa893b79119c5caf845bf29a..ed631d5bfba5d2543e8eed017a7c484ad3ddb453 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -41,6 +41,7 @@ public abstract class BaseSpawner {
public int maxNearbyEntities = 6;
public int requiredPlayerRange = 16;
public int spawnRange = 4;
+ private int tickDelay = 0; // Paper
public BaseSpawner() {}
@@ -70,6 +71,10 @@ public abstract class BaseSpawner {
}
public void tick() {
+ // Paper start - Configurable mob spawner tick rate
+ if (spawnDelay > 0 && --tickDelay > 0) return;
+ tickDelay = this.getLevel().paperConfig.mobSpawnerTickRate;
+ // Paper end
if (!this.isNearPlayer()) {
this.oSpin = this.spin;
} else {
@@ -84,18 +89,18 @@ 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
}
this.oSpin = this.spin;
this.spin = (this.spin + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D;
} else {
- if (this.spawnDelay == -1) {
+ if (this.spawnDelay < -tickDelay) { // Paper
this.delay();
}
if (this.spawnDelay > 0) {
- --this.spawnDelay;
+ this.spawnDelay -= tickDelay; // Paper
return;
}

Datei anzeigen

@ -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 c91f7bcfab2da6a23114a3cff63ca31dab443393..5f75c6d653a31f65fcf9c0e280d796e15d059c00 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
@@ -25,7 +25,6 @@ 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;
@@ -41,6 +40,11 @@ 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 {
@@ -260,21 +264,37 @@ 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
}
}
}
@@ -297,10 +317,10 @@ 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
}
}
@@ -308,7 +328,7 @@ 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() {
@@ -368,7 +388,7 @@ 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;
}

Datei anzeigen

@ -1,21 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 2 Mar 2016 23:45:17 -0600
Subject: [PATCH] Disable spigot tick limiters
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index f71b56fa079e2c7b2123061a8e1a7cb41935bab6..e25666328dbf433b8358f2637d93b4128034bbaa 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -707,9 +707,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Spigot start
// Iterator iterator = this.tileEntityListTick.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);
// Spigot start

Datei anzeigen

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:33:53 -0600
Subject: [PATCH] Ensure inv drag is in bounds
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index c377a425dc3274b8aa25f94ce8f76efda2652def..72b0cfcc5aab03e14e63440c734436e9c1432111 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -238,7 +238,7 @@ public abstract class AbstractContainerMenu {
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)) {

Datei anzeigen

@ -19,10 +19,10 @@ index 4881b03d470646843bad1bc343eb6a6ab9072d8e..2222c1bb5f8625eee4d88946e4bfdfa2
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e5f8cee6726ea9a90c540bb10fd8594a35bb5e40..afd114e1ce00db72534d470fed12101bb237f266 100644
index ebe33c891e25c729c4373190da86c7a8198b6a55..cc8fb033ca8241acb984e3440a44c7a083e2f3f6 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1280,6 +1280,7 @@ public abstract class LivingEntity extends Entity {
@@ -1380,6 +1380,7 @@ public abstract class LivingEntity extends Entity {
}
}
@ -30,7 +30,7 @@ index e5f8cee6726ea9a90c540bb10fd8594a35bb5e40..afd114e1ce00db72534d470fed12101b
if (flag1) {
if (flag) {
this.level.broadcastEntityEvent(this, (byte) 29);
@@ -1298,6 +1299,7 @@ public abstract class LivingEntity extends Entity {
@@ -1400,6 +1401,7 @@ public abstract class LivingEntity extends Entity {
b0 = 2;
}
@ -38,7 +38,7 @@ index e5f8cee6726ea9a90c540bb10fd8594a35bb5e40..afd114e1ce00db72534d470fed12101b
this.level.broadcastEntityEvent(this, b0);
}
@@ -1321,6 +1323,7 @@ public abstract class LivingEntity extends Entity {
@@ -1423,6 +1425,7 @@ public abstract class LivingEntity extends Entity {
}
}
@ -47,10 +47,10 @@ index e5f8cee6726ea9a90c540bb10fd8594a35bb5e40..afd114e1ce00db72534d470fed12101b
if (!this.checkTotemDeathProtection(source)) {
SoundEvent soundeffect = this.getDeathSound();
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index db46caaa5ad5f129d313c65c5006cb24853768be..45a75f7be308678336e192828becf6cf5c9047bc 100644
index 5e06fa58bd5064fea4154f7f34fdef6aa08a2daf..edc0845ae735a9cf3e0f1a3a2b7eabf726d62744 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -215,14 +215,14 @@ public class Explosion {
@@ -243,14 +243,14 @@ public class Explosion {
double d14 = d13;
if (entity instanceof LivingEntity) {
@ -62,8 +62,8 @@ index db46caaa5ad5f129d313c65c5006cb24853768be..45a75f7be308678336e192828becf6cf
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));
}
}

Datei anzeigen

@ -19,15 +19,15 @@ index 2222c1bb5f8625eee4d88946e4bfdfa2fe598977..083e421f8496b5336af473b108498ed2
+ }
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index d2bb9385fbc21cdef6cef06680fac685d3da3570..3fc8fb197400c63bc85f57ff484803659619f775 100644
index d26e8803222276fb7bb1bedd9fd13a8861ce671c..4792280988ac13593d59f6a10fa111eafa08328f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -580,7 +580,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
@@ -592,7 +592,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
gameprofilerfiller.push("thunder");
BlockPos blockposition;
- 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);

Datei anzeigen

@ -19,10 +19,10 @@ index 083e421f8496b5336af473b108498ed28b984774..2f7a5a4a5a7b29750cfd777e0bc5d19a
+ }
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 3fc8fb197400c63bc85f57ff484803659619f775..6c6098731752d61b5241710b075d4ffe3826daac 100644
index 4792280988ac13593d59f6a10fa111eafa08328f..b0ecf3c491e802aa292a0a8b7be37362c38ce084 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -604,7 +604,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
@@ -616,7 +616,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
}
gameprofilerfiller.popPush("iceandsnow");

Datei anzeigen

@ -0,0 +1,62 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
Date: Wed, 2 Mar 2016 15:03:53 -0600
Subject: [PATCH] Configurable mob spawner tick rate
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 2f7a5a4a5a7b29750cfd777e0bc5d19a14e93fa2..4de86b09c6bc3c1974ce61b550ccb73d37f6f170 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -176,4 +176,9 @@ public class PaperWorldConfig {
private void disableIceAndSnow(){
disableIceAndSnow = getBoolean("disable-ice-and-snow", false);
}
+
+ public int mobSpawnerTickRate;
+ private void mobSpawnerTickRate() {
+ mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1);
+ }
}
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index a003e1c0d99a4d4c88269ea5bad250ba73bbc9c9..037dafb59e54047d1d54474c44897d35b8f46c98 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -46,6 +46,7 @@ public abstract class BaseSpawner {
public int requiredPlayerRange;
public int spawnRange;
private final Random random;
+ private int tickDelay = 0; // Paper
public BaseSpawner() {
this.spawnPotentials = BaseSpawner.EMPTY_POTENTIALS;
@@ -101,13 +102,17 @@ public abstract class BaseSpawner {
}
public void serverTick(ServerLevel world, BlockPos pos) {
+ // Paper start - Configurable mob spawner tick rate
+ if (spawnDelay > 0 && --tickDelay > 0) return;
+ tickDelay = world.paperConfig.mobSpawnerTickRate;
+ // Paper end
if (this.isNearPlayer(world, pos)) {
- if (this.spawnDelay == -1) {
+ if (this.spawnDelay < -tickDelay) {
this.delay(world, pos);
}
if (this.spawnDelay > 0) {
- --this.spawnDelay;
+ this.spawnDelay -= tickDelay; // Paper
} else {
boolean flag = false;
@@ -156,8 +161,7 @@ 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

Datei anzeigen

@ -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 5406ca495dd3dcb23929605d5b27bb4370a63d4d..0fa01b98f4a2ce2a7d34437a71d8c1cc7e718fb1 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
@@ -43,6 +43,10 @@ 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 {
@@ -274,15 +278,23 @@ 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
}
}
}
@@ -305,10 +317,10 @@ 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
}
}

Datei anzeigen

@ -19,18 +19,18 @@ index 4de86b09c6bc3c1974ce61b550ccb73d37f6f170..5a4c3a8c511f22c8c3240c9c7cd83a65
+ }
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index f3797bd761c2c6782cce3fca25bc9ef37e5c4978..ffad931c72e52855a3f139354f5e85c460e2a80b 100644
index b25f9a2d2d7f0af0fef60c4f1817cf165fed9cd6..b68a58abf254289a806636ca28521be39c13a82f 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -207,6 +207,7 @@ public class ServerPlayer extends Player implements ContainerListener {
public boolean ignoreSlotUpdateHack;
@@ -214,6 +214,7 @@ public class ServerPlayer extends Player {
private int containerCounter;
public int latency;
public boolean wonGame;
+ private int containerUpdateDelay; // Paper
// CraftBukkit start
public String displayName;
@@ -531,7 +532,12 @@ public class ServerPlayer extends Player implements ContainerListener {
@@ -589,7 +590,12 @@ public class ServerPlayer extends Player {
--this.invulnerableTime;
}

Datei anzeigen

@ -5,20 +5,20 @@ Subject: [PATCH] Use UserCache for player heads
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
index 11baf6fd5f7e408a570d5a48ae6b2fc05cd7e243..313ddd6b64e395a8caab77b3da005e52006ab2d7 100644
index 354dcb1ddf74f39e367d50a8b8e2beeb9b2f9d02..b19d50bbe6c944ff66230ac013178bd036a438c8 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -166,7 +166,13 @@ 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
}

Datei anzeigen

@ -0,0 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 2 Mar 2016 23:45:17 -0600
Subject: [PATCH] Disable spigot tick limiters
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 794d43e6f1a2019f67daf7a93498225924c4394b..56362678e8de38c541fc851abf783f385a7903bf 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -696,9 +696,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Spigot start
// Iterator iterator = this.blockEntityTickers.iterator();
int tilesThisCycle = 0;
- 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

Datei anzeigen

@ -9,19 +9,19 @@ This is a duplicate API from spigot, so use our duplicate subclass and
improve setPosition to use raw
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 8cdecaf2f63c78196e0c5046fe2431b40e072c8a..a63babe123fad398b07685ec57cd88756435457c 100644
index 446dd8c15d4ccdced316deeaba379cb6937496ca..8e9d0ca8aa2b1403fc65ed8d792525047a610a3a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -209,7 +209,7 @@ public abstract class PlayerList {
@@ -213,7 +213,7 @@ public abstract class PlayerList {
// Spigot start - spawn location event
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();
@@ -217,7 +217,10 @@ public abstract class PlayerList {
@@ -221,7 +221,10 @@ public abstract class PlayerList {
player.setLevel(worldserver1);
player.gameMode.setLevel((ServerLevel) player.level);
@ -34,10 +34,10 @@ index 8cdecaf2f63c78196e0c5046fe2431b40e072c8a..a63babe123fad398b07685ec57cd8875
// CraftBukkit - Moved message to after join
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f3f48c268639937874dd39eea9bd8e119eebdce7..72eb40f748c33572c2828f48ebd1ca7d5d5712c8 100644
index 7e7291cc41735a6c251738492a4cdd1c7798066f..cb65a20d34196866eead7844b93c65bfb853f74c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -397,7 +397,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
@@ -460,7 +460,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
return d1 * d1 + d2 * d2 + d3 * d3 < radius * radius;
}

Datei anzeigen

@ -20,10 +20,10 @@ index 5a4c3a8c511f22c8c3240c9c7cd83a65119c1054..70e074cdf2087e638af8e0f3878d0ef8
+ }
}
diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
index 1bda9a158eb4372b9ab7cf3097732e64810aefc6..6b95cd2e2af66eef324dfcc8f7642da2f9e39d4e 100644
index 41186ae6c68e86f28e2858e17d926dcfdf30f9a2..eecb8c089b5f426b1395b47f714af32c210555ef 100644
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
@@ -312,6 +312,11 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
@@ -355,6 +355,11 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
}
private static boolean isCatSittingOnChest(LevelAccessor world, BlockPos pos) {

Datei anzeigen

@ -14,10 +14,10 @@ big slowdown in execution but throwing an exception at same time to raise awaren
that it is happening so that plugin authors can fix their code to stop executing commands async.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 016e91a6ca1c8457e3e367ac0597b73e81919b68..00689dc07625a02781052c5df2e466e8abe85708 100644
index 94ebbcb7731c01fcb93f053eea109f544132139a..b38ca69d37d7f1af0e34297f45e63a98da754e35 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1852,6 +1852,29 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -1858,6 +1858,29 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
if (!async && s.startsWith("/")) {
@ -48,10 +48,10 @@ index 016e91a6ca1c8457e3e367ac0597b73e81919b68..00689dc07625a02781052c5df2e466e8
} else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) {
// Do nothing, this is coming from a plugin
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6fa31ca31128b1094eebd5f848c5b506dfeedeeb..783da25e189c0264ebf31e244677a6b653ff7b26 100644
index 9949267091453726b737a1d673db34dacaeed369..70ba011fda5bba9ee30061825b8a0db82be288b1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -759,6 +759,29 @@ public final class CraftServer implements Server {
@@ -762,6 +762,28 @@ public final class CraftServer implements Server {
Validate.notNull(commandLine, "CommandLine cannot be null");
org.spigotmc.AsyncCatcher.catchOp("command dispatch"); // Spigot
@ -77,12 +77,11 @@ index 6fa31ca31128b1094eebd5f848c5b506dfeedeeb..783da25e189c0264ebf31e244677a6b6
+ }
+ }
+ // 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
index ddef523ea8762c927f37f7d16d581e43367e8c6b..70f8d42992aa348ef7b2d03d22cdd59d7c73f0fe 100644
index 19c44daaa407b7c1c7a7ffe56fef8c8814c6d5b2..6a073a9dc44d93eba296a0e18a9c7be8a7881725 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
@@ -13,6 +13,7 @@ public class ServerShutdownThread extends Thread {
@ -90,11 +89,11 @@ index ddef523ea8762c927f37f7d16d581e43367e8c6b..70f8d42992aa348ef7b2d03d22cdd59d
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
index aeed7697254af17ffefe8e578353ad216e15f9f3..9f7d2ef932ab41cef5d3d0736d20a7c7e4a2c888 100644
index bbf0d9d9c44fe8d7add2f978994ec129420814c7..7a23b56752f6733ee626a8b1e4c3b78591855c4e 100644
--- a/src/main/java/org/spigotmc/AsyncCatcher.java
+++ b/src/main/java/org/spigotmc/AsyncCatcher.java
@@ -6,6 +6,7 @@ public class AsyncCatcher
@ -106,7 +105,7 @@ index aeed7697254af17ffefe8e578353ad216e15f9f3..9f7d2ef932ab41cef5d3d0736d20a7c7
public static void catchOp(String reason)
{
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
index a4223094802a7e996cc57c617df92d23bc48f5b5..04ae5fec376af006ec828d1ae568338af5cfe6ce 100644
index 882e93ad4471e3688f2fcfb1e6f16926786ee5e7..94d8ba376cd1f024b244654cac9bb62bb19e3060 100644
--- a/src/main/java/org/spigotmc/RestartCommand.java
+++ b/src/main/java/org/spigotmc/RestartCommand.java
@@ -43,6 +43,7 @@ public class RestartCommand extends Command

Datei anzeigen

@ -19,15 +19,15 @@ index 70e074cdf2087e638af8e0f3878d0ef8eb7305cc..416a6760883cb40367535c7c5acd7797
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
index 8ff8c19f0b258623b9f0a3cfd0ad5595a92f5899..fc8f26e988f1e4826dcfdcf071293bb356163e62 100644
index 0b0fb2331b126b6c0c7c3b2af81f3f9d2ad1f081..53130b34e5964acec191e1d8de6bde996f498699 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
@@ -323,7 +323,7 @@ public class Slime extends Mob implements Enemy {
@@ -322,7 +322,7 @@ public class Slime extends Mob implements Enemy {
}
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);

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] Expose server CommandMap
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 783da25e189c0264ebf31e244677a6b653ff7b26..95d32f37db663a37f8fde927bdf9d3d4802ba1b4 100644
index 70ba011fda5bba9ee30061825b8a0db82be288b1..38e07f62b1e4d7b1e7e0acde17f168345a820c21 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1760,6 +1760,7 @@ public final class CraftServer implements Server {
return helpMap;
@@ -1762,6 +1762,7 @@ public final class CraftServer implements Server {
return this.helpMap;
}
+ @Override // Paper - add override
public SimpleCommandMap getCommandMap() {
return commandMap;
return this.commandMap;
}

Datei anzeigen

@ -5,18 +5,18 @@ Subject: [PATCH] Be a bit more informative in maxHealth exception
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index d8bfb0953f0b23c64f4e27fc84a6c5f3eb0cc8b8..3afdcb3013263a7e06876821d7d889fa48404041 100644
index 4d125e6830684930d78afb99f4865347b8b3e011..b2a91fdff5960975787d4cd8f340f631275290fe 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -99,7 +99,10 @@ 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() + ')' : ')'));
}
getHandle().setHealth((float) health);
this.getHandle().setHealth((float) health);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Player Tab List and Title APIs
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index 59788eaef0dae5ee01ceba1bf45e85cb07f88e53..b4542ce6a8c37ab31e6ecaeb4cbad4742cca0f9b 100644
index c15860c77c7c24b1946c22f140f1b5c12b052ade..c0966a873ea5e265936e17796bf6bbee62eea9b4 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -170,6 +170,11 @@ public class FriendlyByteBuf extends ByteBuf {
@@ -333,6 +333,11 @@ public class FriendlyByteBuf extends ByteBuf {
public FriendlyByteBuf writeComponent(final net.kyori.adventure.text.Component component) {
return this.writeUtf(PaperAdventure.asJsonString(component, this.adventure$locale), 262144);
}
@ -21,10 +21,10 @@ index 59788eaef0dae5ee01ceba1bf45e85cb07f88e53..b4542ce6a8c37ab31e6ecaeb4cbad474
public FriendlyByteBuf writeComponent(Component text) {
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
index 54d186a195aca6d0a4c412ed609d8c86dcc76072..06e9246f05e130be6a63ebb0c9def10c6c9675b7 100644
index 02d19fa4abdee0c8331734932a83e64694356030..969aea457e76b853e34a67a8fd07e0ea3207005b 100644
--- a/src/main/java/net/minecraft/network/chat/Component.java
+++ b/src/main/java/net/minecraft/network/chat/Component.java
@@ -363,6 +363,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
@@ -428,6 +428,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
return Component.Serializer.GSON.toJsonTree(text);
}
@ -32,39 +32,8 @@ index 54d186a195aca6d0a4c412ed609d8c86dcc76072..06e9246f05e130be6a63ebb0c9def10c
@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 69ff8df7340e60c476803256750a48f0b43414d3..df444daeb181ff78170f7b92bd02f1f1862dfa2e 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTitlesPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTitlesPacket.java
@@ -47,6 +47,17 @@ 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 {
@@ -55,6 +66,8 @@ 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 2920ba3d8eeb62670897ea19b50aaf395ab84c5a..63933bd455ad72a772d4db160e946600b84a1791 100644
index 1392d4d5027b3d972b2196af7b19fb409977fb8d..6401bdeeaa42ffe1e415553c94f0ec597b85df0c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1,5 +1,6 @@
@ -74,7 +43,7 @@ index 2920ba3d8eeb62670897ea19b50aaf395ab84c5a..63933bd455ad72a772d4db160e946600
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.common.io.BaseEncoding;
@@ -236,6 +237,96 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -241,6 +242,96 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}

Datei anzeigen

@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:33:53 -0600
Subject: [PATCH] Ensure inv drag is in bounds
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index eaf2c55328e5dd6b7b55b5701501e4441923f060..0d832c4f0c62f56b9208720afcdcc02044662c90 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -374,7 +374,7 @@ public abstract class AbstractContainerMenu {
this.resetQuickCraft();
}
} else if (this.quickcraftStatus == 1) {
- 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);

Datei anzeigen

@ -23,34 +23,34 @@ index 416a6760883cb40367535c7c5acd779742bb8af5..670efbe53241a0ae32d618c83da601cc
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 72eb40f748c33572c2828f48ebd1ca7d5d5712c8..a6f2e671cc9b2ef086dfa3d127a7b33272acbd56 100644
index cb65a20d34196866eead7844b93c65bfb853f74c..daac0e45a1c5307489831638f54472eaee4b2282 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2617,7 +2617,13 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
@@ -2875,7 +2875,13 @@ 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;
}
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
index 948d031627435bfce442b1fe7d3eff4addc85bc4..21c01302635d23bc21e6bb373cbe277ea1eb6a56 100644
index 4d186a7d6ccf09092c5e1577e4b49e0975787980..d5ba2e679ed1858ea18e18feffce50544ae036c2 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
@@ -30,7 +30,7 @@ public class PortalForcer {
@@ -44,7 +44,7 @@ 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) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add velocity warnings
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 95d32f37db663a37f8fde927bdf9d3d4802ba1b4..35d3df7ded4904414a9a61895950b56be530d244 100644
index 38e07f62b1e4d7b1e7e0acde17f168345a820c21..2d84d6a18ef93f591d7eb3ef1bf80e88a1a096f5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -260,6 +260,7 @@ public final class CraftServer implements Server {
@@ -263,6 +263,7 @@ public final class CraftServer implements Server {
public boolean ignoreVanillaPermissions = false;
private final List<CraftPlayer> playerView;
public int reloadCount;
@ -17,10 +17,10 @@ index 95d32f37db663a37f8fde927bdf9d3d4802ba1b4..35d3df7ded4904414a9a61895950b56b
static {
ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index e7a59a8e0424a0839dfa73fc65f44c5b04bd3dec..b028946de7c8f52091635fe154c816453f1ddc93 100644
index bac39ee51f36ad86d6a4978306b6612d9376adbf..271b4e3354c3885e38ae0c547edba48bf06f1e19 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -424,10 +424,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -431,10 +431,40 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public void setVelocity(Vector velocity) {
Preconditions.checkArgument(velocity != null, "velocity");
velocity.checkFinite();
@ -29,8 +29,7 @@ index e7a59a8e0424a0839dfa73fc65f44c5b04bd3dec..b028946de7c8f52091635fe154c81645
+ 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,9 +60,9 @@ index e7a59a8e0424a0839dfa73fc65f44c5b04bd3dec..b028946de7c8f52091635fe154c81645
+
@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 21d7b483920841456707fe3f08b180c1f072b7f7..0ed95268364ea7f6a92a39b726a1e03bc815be07 100644
index d5863b0b06384b25eaa33572fa02649795463ed8..2693cc933d746e40d8a47d96c6cb6799f0a2472f 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -80,7 +80,19 @@ public class WatchdogThread extends Thread
@ -86,4 +85,4 @@ index 21d7b483920841456707fe3f08b180c1f072b7f7..0ed95268364ea7f6a92a39b726a1e03b
+ // 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 );

Datei anzeigen

@ -30,10 +30,10 @@ index 670efbe53241a0ae32d618c83da601ccc1f26e37..abbbe1786eb68af02f9d39650aad730a
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 63933bd455ad72a772d4db160e946600b84a1791..3b9d61b524441f65646edf7d403b6c5b5345b1e5 100644
index 6401bdeeaa42ffe1e415553c94f0ec597b85df0c..d7c3bb17faf667ec90c967fe3c5ea6094faf0226 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -861,7 +861,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -862,7 +862,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (fromWorld == toWorld) {
entity.connection.teleport(to);
} else {

Datei anzeigen

@ -49,10 +49,10 @@ index 0000000000000000000000000000000000000000..f699ce18ca044f813e194ef2786b7ea8
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d1bc927c8b429f43de2cdad98f8b329ff4c8b4db..0597c0c3e881dd43cf91bd3088ed30dfecfe8098 100644
index 39cfa8211f02acaa0851e0cfc1c2890475d609f4..da97afe93a98daac33f143c6da0b42f71db25dba 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -813,6 +813,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -825,6 +825,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return true;
} catch (Exception exception) {
ChunkMap.LOGGER.error("Failed to save chunk {},{}", chunkcoordintpair.x, chunkcoordintpair.z, exception);
@ -61,7 +61,7 @@ index d1bc927c8b429f43de2cdad98f8b329ff4c8b4db..0597c0c3e881dd43cf91bd3088ed30df
}
}
diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
index c167d2fd99a7a352e69e2930551678bd9c9def83..09c5fa2dbcbed05da51ef2d63e6d6112d22d7877 100644
index 60a6d35e8467545e211aa1756cd1494f440f1d78..da515ac94aa3c294855f28e6deb9094cc7187dd9 100644
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
+++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
@@ -1,5 +1,6 @@
@ -71,7 +71,7 @@ index c167d2fd99a7a352e69e2930551678bd9c9def83..09c5fa2dbcbed05da51ef2d63e6d6112
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.Files;
@@ -360,6 +361,7 @@ public class OldUsersConverter {
@@ -362,6 +363,7 @@ public class OldUsersConverter {
root = NbtIo.readCompressed(new java.io.FileInputStream(file5));
} catch (Exception exception) {
exception.printStackTrace();
@ -79,7 +79,7 @@ index c167d2fd99a7a352e69e2930551678bd9c9def83..09c5fa2dbcbed05da51ef2d63e6d6112
}
if (root != null) {
@@ -373,6 +375,7 @@ public class OldUsersConverter {
@@ -375,6 +377,7 @@ public class OldUsersConverter {
NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2));
} catch (Exception exception) {
exception.printStackTrace();
@ -88,7 +88,7 @@ index c167d2fd99a7a352e69e2930551678bd9c9def83..09c5fa2dbcbed05da51ef2d63e6d6112
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java
index 78cea15142f9fd7988f5df397061b90625070eef..f50774f022c78813982bfe08f764b54bde779e04 100644
index 08c5f6fd1a307c89cf8365f56314a0c6d3e89e4b..26e0f03f2e736ed6ba86e2510a7962deee180ef3 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java
@@ -1,5 +1,7 @@
@ -108,7 +108,7 @@ index 78cea15142f9fd7988f5df397061b90625070eef..f50774f022c78813982bfe08f764b54b
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 7b4475807cca0e92ea9ae6ea49a82a8634cc0ff5..94e268a05b4601c29b6d2845f0fc2311643a161f 100644
index 56362678e8de38c541fc851abf783f385a7903bf..a6b1572a82fd22eea5b3d4124c510d94fea5917d 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1,5 +1,10 @@
@ -122,20 +122,7 @@ index 7b4475807cca0e92ea9ae6ea49a82a8634cc0ff5..94e268a05b4601c29b6d2845f0fc2311
import com.google.common.collect.Lists;
import com.mojang.serialization.Codec;
import java.io.IOException;
@@ -737,8 +742,11 @@ 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;
@@ -808,8 +816,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -730,8 +735,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
tickConsumer.accept(entity);
} catch (Throwable throwable) {
// Paper start - Prevent tile entity and entity crashes
@ -144,14 +131,14 @@ index 7b4475807cca0e92ea9ae6ea49a82a8634cc0ff5..94e268a05b4601c29b6d2845f0fc2311
+ 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 fc134b916e95231af8478a4f97bf11a0f37f7f0b..a19ac1cb7e4d8d478648a048b2bfa0daf85a80c9 100644
index b4a7776ba9486bbca42ffb596c8a8bcdf6471ce3..59fae60116167baf989e85596334824e9004e6fb 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -299,6 +299,7 @@ public final class NaturalSpawner {
@@ -308,6 +308,7 @@ public final class NaturalSpawner {
}
} catch (Exception exception) {
NaturalSpawner.LOGGER.warn("Failed to create mob", exception);
@ -159,8 +146,8 @@ index fc134b916e95231af8478a4f97bf11a0f37f7f0b..a19ac1cb7e4d8d478648a048b2bfa0da
return null;
}
}
@@ -405,6 +406,7 @@ public final class NaturalSpawner {
entity = biomesettingsmobs_c.type.create((Level) worldaccess.getLevel());
@@ -410,6 +411,7 @@ public final class NaturalSpawner {
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
@ -168,29 +155,30 @@ index fc134b916e95231af8478a4f97bf11a0f37f7f0b..a19ac1cb7e4d8d478648a048b2bfa0da
}
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 300749822d52f9f973e71c6ec9c8bf29d6a6938e..9ca05aa06696883adc8b67a68ca6d2d850e95d25 100644
index a6e8a8de17acc6c7c0bdeea01544a334797b69b6..9939c4c39549771afe971a6433dfd57e36050dd8 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1,5 +1,6 @@
@@ -1,6 +1,7 @@
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;
@@ -654,10 +655,15 @@ public class LevelChunk implements ChunkAccess {
this.blockEntities.remove(pos);
import com.google.common.collect.UnmodifiableIterator;
@@ -615,10 +616,15 @@ public class LevelChunk implements ChunkAccess {
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" +
+ + " (" + getBlockState(blockposition) + ") where there was no entity tile!\n" +
+ "Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
+ e.printStackTrace();
+ ServerInternalException.reportInternalException(e);
@ -198,11 +186,23 @@ index 300749822d52f9f973e71c6ec9c8bf29d6a6938e..9ca05aa06696883adc8b67a68ca6d2d8
// CraftBukkit end
}
}
@@ -1242,8 +1248,10 @@ 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 60f410a4f838048bbfd2cde52caa7c4c9434b0ba..1598da3449ee1c559cf503e1b20a0daaf6a033dd 100644
index 2da42f1bc6922adae32d782aac780a7e0e94e352..659305865e9c6d9996fcf2596d086050508059cd 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -265,6 +265,7 @@ public class RegionFile implements AutoCloseable {
@@ -278,6 +278,7 @@ public class RegionFile implements AutoCloseable {
return true;
}
} catch (IOException ioexception) {
@ -210,28 +210,28 @@ index 60f410a4f838048bbfd2cde52caa7c4c9434b0ba..1598da3449ee1c559cf503e1b20a0daa
return false;
}
}
@@ -337,6 +338,7 @@ public class RegionFile implements AutoCloseable {
@@ -359,6 +360,7 @@ 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 60b7fdf9c092e8105d41f4af02a08651624f3eb9..99cfd693ea705d45a5eab181cb80c354a2d1159f 100644
index 2fdb313e8eaed868c36f68c9b7f6a6f9f4864575..c8ed0673ff819cb88d0ee6f53f2a2b9b46b203d4 100644
--- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
@@ -150,6 +150,7 @@ public class DimensionDataStorage {
}
} catch (Throwable throwable6) {
throwable = throwable6;
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(throwable); // Paper
throw throwable6;
} finally {
if (fileinputstream != null) {
@@ -120,6 +120,7 @@ public class DimensionDataStorage {
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 ffe9cc1011226d604dc5499e7692e9a9a5132b72..9b6d9373abb59a30c2835ca891282d07559281f5 100644
index e6a09ed5db245eaecd787503dbfb1ef5fea5bb70..0735c2fe139ce8d47a04fdba045fe462492723eb 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -16,6 +16,9 @@ import java.util.concurrent.atomic.AtomicInteger;
@ -252,13 +252,13 @@ index ffe9cc1011226d604dc5499e7692e9a9a5132b72..9b6d9373abb59a30c2835ca891282d07
+ new ServerExceptionEvent(new ServerSchedulerException(msg, throwable, task)));
// Paper end
} finally {
currentTask = null;
this.currentTask = null;
@@ -426,7 +431,7 @@ 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)
}

Datei anzeigen

@ -6,20 +6,20 @@ Subject: [PATCH] Don't nest if we don't need to when cerealising text
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
index e47102cadb40ed8a9c011386445f15fd30de7596..f13da9e7d014bc00fbabf0a495b548bba2f59468 100644
index 1f5050e6c1d932aa196ab9524f7f1f9bd1b45fce..a64780b4b49d01322d8f755ff540a9622c89e983 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
@@ -40,7 +40,14 @@ public class ClientboundChatPacket implements Packet<ClientGamePacketListener> {
@@ -36,7 +36,14 @@ 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 {

Datei anzeigen

@ -25,25 +25,25 @@ index abbbe1786eb68af02f9d39650aad730ac44aac8a..3ac2ac3db9b1c271b3c21930bb137166
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index a6f2e671cc9b2ef086dfa3d127a7b33272acbd56..93d3408231a177cf6d2086594756adffe3efa702 100644
index daac0e45a1c5307489831638f54472eaee4b2282..e9e87dc8c80d83dc7c472b0611077d8f9f4e5fcf 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2288,6 +2288,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
@@ -2524,6 +2524,7 @@ 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
index afd114e1ce00db72534d470fed12101bb237f266..d483d552092c901fec262c43e488784d9cd8acb9 100644
index cc8fb033ca8241acb984e3440a44c7a083e2f3f6..46e514bfe80d999f50173866b59fbc9419bbf3d0 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -738,6 +738,7 @@ public abstract class LivingEntity extends Entity {
if (tag.contains("Team", 8)) {
String s = tag.getString("Team");
PlayerTeam scoreboardteam = this.level.getScoreboard().getTeam(s);
@@ -803,6 +803,7 @@ public abstract class LivingEntity extends Entity {
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);

Datei anzeigen

@ -5,12 +5,12 @@ Subject: [PATCH] Add methods for working with arrows stuck in living entities
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 3afdcb3013263a7e06876821d7d889fa48404041..d8cd88d62f9abfc7960c187dd74239f61267ca57 100644
index b2a91fdff5960975787d4cd8f340f631275290fe..ea94dc9a3b8bd3da5f8ccbeb216384723db668aa 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -677,4 +677,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
getHandle().persistentInvisibility = invisible;
getHandle().setSharedFlag(5, invisible);
@@ -685,4 +685,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().persistentInvisibility = invisible;
this.getHandle().setSharedFlag(5, invisible);
}
+
+ // Paper start

Datei anzeigen

@ -5,27 +5,28 @@ Subject: [PATCH] Complete resource pack API
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 00689dc07625a02781052c5df2e466e8abe85708..73683ba59d0aff3a61f555b4ae15753e9e4e6141 100644
index b38ca69d37d7f1af0e34297f45e63a98da754e35..714fb0d766b654ad05134dea9b1e1b628a939993 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1603,7 +1603,11 @@ 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()]));
@@ -1640,8 +1640,11 @@ 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 3b9d61b524441f65646edf7d403b6c5b5345b1e5..dd29038778d73fae84df360515f3c670915f1d48 100644
index d7c3bb17faf667ec90c967fe3c5ea6094faf0226..074b9e2aa9162aec64007cbf235ccc965db70055 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -136,6 +136,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -141,6 +141,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private double health = 20;
private boolean scaledHealth = false;
private double healthScale = 20;
@ -36,7 +37,7 @@ index 3b9d61b524441f65646edf7d403b6c5b5345b1e5..dd29038778d73fae84df360515f3c670
public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity);
@@ -1872,6 +1876,32 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1873,6 +1877,32 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public boolean getAffectsSpawning() {
return this.getHandle().affectsSpawning;
}
@ -45,7 +46,7 @@ index 3b9d61b524441f65646edf7d403b6c5b5345b1e5..dd29038778d73fae84df360515f3c670
+ 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

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Chunk Save Reattempt
We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks.
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 1598da3449ee1c559cf503e1b20a0daaf6a033dd..1aa4d342b97f8be71c108194a6f1e0e2828aa364 100644
index 659305865e9c6d9996fcf2596d086050508059cd..1a35ef48c487c92f55fcbbfc19a708ededc6a32d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -265,7 +265,7 @@ public class RegionFile implements AutoCloseable {
@@ -278,7 +278,7 @@ public class RegionFile implements AutoCloseable {
return true;
}
} catch (IOException ioexception) {
@ -19,7 +19,7 @@ index 1598da3449ee1c559cf503e1b20a0daaf6a033dd..1aa4d342b97f8be71c108194a6f1e0e2
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 1e49d17b54704e1b99c3ded458c4bc6842bd32bd..97a58da9d64d812942ceb71426d35b490bbbe817 100644
index 7aa1f693c5f44a265ccb442c2c9e995cc3e7418d..1ed8232493c94bc0cf28ef8d4b647cb84bd3fe32 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -11,6 +11,7 @@ import java.io.IOException;
@ -30,16 +30,16 @@ index 1e49d17b54704e1b99c3ded458c4bc6842bd32bd..97a58da9d64d812942ceb71426d35b49
import net.minecraft.util.ExceptionCollector;
import net.minecraft.world.level.ChunkPos;
@@ -92,6 +93,7 @@ public final class RegionFileStorage implements AutoCloseable {
@@ -101,6 +102,7 @@ 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;
@@ -115,6 +117,18 @@ public final class RegionFileStorage implements AutoCloseable {
if (nbt == null) {
regionfile.clear(pos);
@@ -126,6 +128,18 @@ public final class RegionFileStorage implements AutoCloseable {
}
}
+ // Paper start

Datei anzeigen

@ -30,23 +30,23 @@ index 429b74474ced04d8dd8f038b8590b8dfe178bf4d..716f285e67019b8a62922d09c15883c9
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 35d3df7ded4904414a9a61895950b56be530d244..662fc88e2e118a57a6c35a8981d4622188adec3b 100644
index 2d84d6a18ef93f591d7eb3ef1bf80e88a1a096f5..6bf6183d318e277f0dd2d448edea73d90c42cfd3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -397,6 +397,7 @@ public final class CraftServer implements Server {
if (type == PluginLoadOrder.STARTUP) {
helpMap.clear();
helpMap.initializeGeneralTopics();
@@ -294,6 +294,7 @@ public final class CraftServer implements Server {
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();
@@ -416,7 +417,7 @@ public final class CraftServer implements Server {
commandMap.registerServerAliases();
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
@@ -419,7 +420,7 @@ public final class CraftServer implements Server {
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();
}

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Custom Permissions
https://github.com/PaperMC/Paper/issues/49
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 662fc88e2e118a57a6c35a8981d4622188adec3b..50da8e292c131176c263f0bc140ff4f6d890c737 100644
index 6bf6183d318e277f0dd2d448edea73d90c42cfd3..448e750974f9e15e5222ffa1c2d342c1f0a84a1e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2252,5 +2252,23 @@ public final class CraftServer implements Server {
@@ -2254,5 +2254,23 @@ public final class CraftServer implements Server {
}
return this.adventure$audiences;
}

Datei anzeigen

@ -7,17 +7,16 @@ Metadata is not meant to persist reload as things break badly with non primitive
This will remove metadata on reload so it does not crash everything if a plugin uses it.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 50da8e292c131176c263f0bc140ff4f6d890c737..2828936fe294d9d6750a8838da49ec8398835214 100644
index 448e750974f9e15e5222ffa1c2d342c1f0a84a1e..95689d11668e37a894b70517270849c2c4e162aa 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -870,8 +870,18 @@ public final class CraftServer implements Server {
@@ -872,8 +872,16 @@ public final class CraftServer implements Server {
world.paperConfig.init(); // Paper
}
+ 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 50da8e292c131176c263f0bc140ff4f6d890c737..2828936fe294d9d6750a8838da49ec83
+ playerMetadata.removeAll(plugin);
+ }
+ // Paper end
+
resetRecipes();
reloadData();
this.resetRecipes();
this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot

Datei anzeigen

@ -18,21 +18,21 @@ For consistency, the old API methods now forward to use the
ItemMeta API equivalents, and should deprecate the old API's.
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 3faf52e7ac5e7e22d09cfb73cfda6b9f622137d4..123025c6dc9a2eea56c7db5cb508cdfd7c6cc97b 100644
index ac05b201167d8e17f39d3df732adf676dc24b409..d3267cdef523b62f9985e49b768e6ad22fbe874d 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -9,6 +9,8 @@ import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
@@ -13,6 +13,8 @@ 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;
@@ -118,6 +120,23 @@ public final class ItemStack {
private BlockInWorld cachedPlaceBlock;
private boolean cachedPlaceBlockResult;
@@ -153,6 +155,23 @@ public final class ItemStack {
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 3faf52e7ac5e7e22d09cfb73cfda6b9f622137d4..123025c6dc9a2eea56c7db5cb508cdfd
+ }
+ 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
@ -54,15 +54,15 @@ index 3faf52e7ac5e7e22d09cfb73cfda6b9f622137d4..123025c6dc9a2eea56c7db5cb508cdfd
public ItemStack(ItemLike item) {
this(item, 1);
}
@@ -160,6 +179,7 @@ public final class ItemStack {
if (nbttagcompound.contains("tag", 10)) {
@@ -196,6 +215,7 @@ public final class ItemStack {
// 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);
}
@@ -678,6 +698,7 @@ public final class ItemStack {
@@ -745,6 +765,7 @@ public final class ItemStack {
// Paper end
public void setTag(@Nullable CompoundTag tag) {
this.tag = tag;
@ -70,7 +70,7 @@ index 3faf52e7ac5e7e22d09cfb73cfda6b9f622137d4..123025c6dc9a2eea56c7db5cb508cdfd
if (this.getItem().canBeDepleted()) {
this.setDamageValue(this.getDamageValue());
}
@@ -768,6 +789,7 @@ public final class ItemStack {
@@ -1055,6 +1076,7 @@ public final class ItemStack {
nbttagcompound.putString("id", String.valueOf(Registry.ENCHANTMENT.getKey(enchantment)));
nbttagcompound.putShort("lvl", (short) ((byte) level));
nbttaglist.add(nbttagcompound);
@ -79,7 +79,7 @@ index 3faf52e7ac5e7e22d09cfb73cfda6b9f622137d4..123025c6dc9a2eea56c7db5cb508cdfd
public boolean isEnchanted() {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index 01df5263d77771a296ca091a0feec620e6e37229..5f0ccdeb8565505278caa591f7390047eab49cf4 100644
index 1818be091ce06c1f347396a8a5b9e05f9ceca2c9..51c1f62af5c25fe620f1d8a9cb03473e849db68d 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -6,7 +6,6 @@ import java.util.Map;
@ -94,13 +94,13 @@ index 01df5263d77771a296ca091a0feec620e6e37229..5f0ccdeb8565505278caa591f7390047
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 01df5263d77771a296ca091a0feec620e6e37229..5f0ccdeb8565505278caa591f7390047
- 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 01df5263d77771a296ca091a0feec620e6e37229..5f0ccdeb8565505278caa591f7390047
@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 01df5263d77771a296ca091a0feec620e6e37229..5f0ccdeb8565505278caa591f7390047
- 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 01df5263d77771a296ca091a0feec620e6e37229..5f0ccdeb8565505278caa591f7390047
- 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,13 +196,13 @@ index 01df5263d77771a296ca091a0feec620e6e37229..5f0ccdeb8565505278caa591f7390047
@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) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index cca04daf84e506382365c0ba945cb024bd4d4475..521699615778c4b724d10edfee1d3915e036eb2e 100644
index 970fa1e98c873ea4dfd4b58c56b7ea88283b0512..45f4f8265c51a5b08db8aa7f53915c4bd0536d39 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList;
@ -229,7 +229,7 @@ index cca04daf84e506382365c0ba945cb024bd4d4475..521699615778c4b724d10edfee1d3915
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
@@ -270,7 +273,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -271,7 +274,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
private List<String> lore; // null and empty are two different states internally
private Integer customModelData;
private CompoundTag blockData;
@ -238,16 +238,16 @@ index cca04daf84e506382365c0ba945cb024bd4d4475..521699615778c4b724d10edfee1d3915
private Multimap<Attribute, AttributeModifier> attributeModifiers;
private int repairCost;
private int hideFlag;
@@ -281,7 +284,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -282,7 +285,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
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
@@ -302,7 +305,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -303,7 +306,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
this.blockData = meta.blockData;
if (meta.enchantments != null) { // Spigot
@ -256,7 +256,7 @@ index cca04daf84e506382365c0ba945cb024bd4d4475..521699615778c4b724d10edfee1d3915
}
if (meta.hasAttributeModifiers()) {
@@ -385,13 +388,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -386,13 +389,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
}
@ -272,7 +272,7 @@ index cca04daf84e506382365c0ba945cb024bd4d4475..521699615778c4b724d10edfee1d3915
for (int i = 0; i < ench.size(); i++) {
String id = ((CompoundTag) ench.get(i)).getString(ENCHANTMENTS_ID.NBT);
@@ -544,13 +547,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -545,13 +548,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
}
@ -288,24 +288,24 @@ index cca04daf84e506382365c0ba945cb024bd4d4475..521699615778c4b724d10edfee1d3915
for (Map.Entry<?, ?> entry : ench.entrySet()) {
// Doctor older enchants
String enchantKey = entry.getKey().toString();
@@ -826,14 +829,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -827,14 +830,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@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()) {
@@ -1214,7 +1217,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -1215,7 +1218,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
clone.customModelData = this.customModelData;
clone.blockData = this.blockData;
if (this.enchantments != null) {
@ -314,8 +314,8 @@ index cca04daf84e506382365c0ba945cb024bd4d4475..521699615778c4b724d10edfee1d3915
}
if (this.hasAttributeModifiers()) {
clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers);
@@ -1446,4 +1449,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return HANDLED_TAGS;
@@ -1448,4 +1451,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return CraftMetaItem.HANDLED_TAGS;
}
}
+

Datei anzeigen

@ -30,15 +30,15 @@ index 3ac2ac3db9b1c271b3c21930bb13716669ff64d3..3c78d3234054ce2dc46ef77decb6adb0
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 371fdcbf1f9c01f6a356393f6c3767511f230930..0dc5792d542658107c9c22c1f920986decd13920 100644
index aa679dd070b9efd4b4450cfdb5e4d849f5793534..676e5ad3a23bfdccd8f5f7bb9e79c3fa004dc95f 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -281,7 +281,7 @@ public abstract class AbstractArrow extends Projectile {
@@ -310,7 +310,7 @@ public abstract class AbstractArrow extends Projectile {
protected void tickDespawn() {
++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();
}

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add World Util Methods
Methods that can be used for other patches to help improve logic.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 89472b6e8f38921db50440d0213e40ac893892f1..e1f9a12c7fb4818a785b9a4819f94fccde02b6a2 100644
index b0ecf3c491e802aa292a0a8b7be37362c38ce084..6aab4ba5da83f523632a0a39d45a0bcb2405f0cc 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -191,7 +191,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
@@ -202,7 +202,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
public final LevelStorageSource.LevelStorageAccess convertable;
public final UUID uuid;
@ -19,10 +19,10 @@ index 89472b6e8f38921db50440d0213e40ac893892f1..e1f9a12c7fb4818a785b9a4819f94fcc
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 94e268a05b4601c29b6d2845f0fc2311643a161f..799721ac63f0c08dd03a788b87eafa9a8cc976cc 100644
index a6b1572a82fd22eea5b3d4124c510d94fea5917d..aee97243cc3e73f9e07ba8ed5d6dbe8c73ba016e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -297,11 +297,27 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -309,11 +309,27 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
@Override
@ -52,10 +52,10 @@ index 94e268a05b4601c29b6d2845f0fc2311643a161f..799721ac63f0c08dd03a788b87eafa9a
@Override
diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
index 31f17956b3b031d1a47bda4d282554c8a7853097..0846f649dca3422dbab3bb0a4826e27430cc8186 100644
index 72087476c65b69c86af67424a15708c463d69a43..02b10be4878b871742efb0f65980d9672f32b388 100644
--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java
+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
@@ -31,6 +31,7 @@ public class WorldBorder {
@@ -32,6 +32,7 @@ public class WorldBorder {
public WorldBorder() {}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Custom replacement for eaten items
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index d483d552092c901fec262c43e488784d9cd8acb9..3c707ca6b56e89b671db6316d4db90a2903f33b4 100644
index 46e514bfe80d999f50173866b59fbc9419bbf3d0..89db2afd198366ab94c9c074890aa668d3771a79 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3202,9 +3202,10 @@ public abstract class LivingEntity extends Entity {
@@ -3560,9 +3560,10 @@ public abstract class LivingEntity extends Entity {
this.triggerItemUseEffects(this.useItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack;
@ -20,7 +20,7 @@ index d483d552092c901fec262c43e488784d9cd8acb9..3c707ca6b56e89b671db6316d4db90a2
level.getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
@@ -3218,6 +3219,13 @@ public abstract class LivingEntity extends Entity {
@@ -3576,6 +3577,13 @@ public abstract class LivingEntity extends Entity {
} else {
itemstack = this.useItem.finishUsingItem(this.level, this);
}
@ -34,7 +34,7 @@ index d483d552092c901fec262c43e488784d9cd8acb9..3c707ca6b56e89b671db6316d4db90a2
// CraftBukkit end
if (itemstack != this.useItem) {
@@ -3225,6 +3233,11 @@ public abstract class LivingEntity extends Entity {
@@ -3583,6 +3591,11 @@ public abstract class LivingEntity extends Entity {
}
this.stopUsingItem();

Datei anzeigen

@ -5,25 +5,25 @@ Subject: [PATCH] handle NaN health/absorb values and repair bad data
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 3c707ca6b56e89b671db6316d4db90a2903f33b4..a326e5b4ac055f2f8a95c6eaccd8d0a97762da1f 100644
index 89db2afd198366ab94c9c074890aa668d3771a79..83eaa3c6581c1a3f588278124fed4c811e81e53c 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -699,7 +699,13 @@ public abstract class LivingEntity extends Entity {
@@ -764,7 +764,13 @@ 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));
}
@@ -1148,6 +1154,10 @@ public abstract class LivingEntity extends Entity {
@@ -1251,6 +1257,10 @@ public abstract class LivingEntity extends Entity {
}
public void setHealth(float health) {
@ -34,7 +34,7 @@ index 3c707ca6b56e89b671db6316d4db90a2903f33b4..a326e5b4ac055f2f8a95c6eaccd8d0a9
// CraftBukkit start - Handle scaled health
if (this instanceof ServerPlayer) {
org.bukkit.craftbukkit.entity.CraftPlayer player = ((ServerPlayer) this).getBukkitEntity();
@@ -3042,7 +3052,7 @@ public abstract class LivingEntity extends Entity {
@@ -3395,7 +3405,7 @@ public abstract class LivingEntity extends Entity {
}
public void setAbsorptionAmount(float amount) {
@ -43,11 +43,16 @@ index 3c707ca6b56e89b671db6316d4db90a2903f33b4..a326e5b4ac055f2f8a95c6eaccd8d0a9
amount = 0.0F;
}
@@ -4000,3 +4010,4 @@ 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 dd29038778d73fae84df360515f3c670915f1d48..b7d5a718375083a4162df4bb41de3acd57b297fb 100644
index 074b9e2aa9162aec64007cbf235ccc965db70055..7d19f877e66ef10c977b8072732bb16bd978e0de 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1678,6 +1678,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1679,6 +1679,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void setRealHealth(double health) {