mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
487/1053
This commit is contained in:
parent
7bcc1a4674
commit
29e69c49da
103 changed files with 92 additions and 158 deletions
|
@ -304,6 +304,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
/**
|
/**
|
||||||
* Jukebox songs.
|
* Jukebox songs.
|
||||||
*
|
*
|
||||||
|
* @see JukeboxSong
|
||||||
|
*/
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
- Registry<JukeboxSong> JUKEBOX_SONG = Objects.requireNonNull(Bukkit.getRegistry(JukeboxSong.class), "No registry present for JukeboxSong. This is a bug.");
|
||||||
|
+ Registry<JukeboxSong> JUKEBOX_SONG = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.JUKEBOX_SONG); // Paper
|
||||||
|
/**
|
||||||
|
* Villager profession.
|
||||||
|
*
|
||||||
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
* Wolf variants.
|
* Wolf variants.
|
||||||
*
|
*
|
||||||
|
|
|
@ -95,6 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+import org.bukkit.Art;
|
+import org.bukkit.Art;
|
||||||
+import org.bukkit.Fluid;
|
+import org.bukkit.Fluid;
|
||||||
+import org.bukkit.GameEvent;
|
+import org.bukkit.GameEvent;
|
||||||
|
+import org.bukkit.JukeboxSong;
|
||||||
+import org.bukkit.MusicInstrument;
|
+import org.bukkit.MusicInstrument;
|
||||||
+import org.bukkit.Particle;
|
+import org.bukkit.Particle;
|
||||||
+import org.bukkit.Sound;
|
+import org.bukkit.Sound;
|
||||||
|
@ -206,10 +207,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ */
|
+ */
|
||||||
+ RegistryKey<DamageType> DAMAGE_TYPE = create("damage_type");
|
+ RegistryKey<DamageType> DAMAGE_TYPE = create("damage_type");
|
||||||
+ /**
|
+ /**
|
||||||
+ * Data-driven registry for wolf variants
|
+ * Data-driven registry for wolf variants.
|
||||||
+ * @see io.papermc.paper.registry.keys.WolfVariantKeys
|
+ * @see io.papermc.paper.registry.keys.WolfVariantKeys
|
||||||
+ */
|
+ */
|
||||||
+ RegistryKey<Wolf.Variant> WOLF_VARIANT = create("wolf_variant");
|
+ RegistryKey<Wolf.Variant> WOLF_VARIANT = create("wolf_variant");
|
||||||
|
+ /**
|
||||||
|
+ * Data-driven registry for jukebox songs.
|
||||||
|
+ */
|
||||||
|
+ RegistryKey<JukeboxSong> JUKEBOX_SONG = create("jukebox_song");
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+ /* ******************* *
|
+ /* ******************* *
|
||||||
|
|
|
@ -16,9 +16,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
if (throwable instanceof TimeoutException) {
|
if (throwable instanceof TimeoutException) {
|
||||||
Connection.LOGGER.debug("Timeout", throwable);
|
Connection.LOGGER.debug("Timeout", throwable);
|
||||||
+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.TIMED_OUT; // Paper - Add API for quit reason
|
+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.TIMED_OUT; // Paper - Add API for quit reason
|
||||||
this.disconnect(Component.translatable("disconnect.timeout"));
|
this.disconnect((Component) Component.translatable("disconnect.timeout"));
|
||||||
} else {
|
} else {
|
||||||
MutableComponent ichatmutablecomponent = Component.translatable("disconnect.genericReason", "Internal Exception: " + String.valueOf(throwable));
|
MutableComponent ichatmutablecomponent = Component.translatable("disconnect.genericReason", "Internal Exception: " + String.valueOf(throwable));
|
||||||
|
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||||
|
disconnectiondetails = new DisconnectionDetails(ichatmutablecomponent);
|
||||||
|
}
|
||||||
|
|
||||||
+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.ERRONEOUS_STATE; // Paper - Add API for quit reason
|
+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.ERRONEOUS_STATE; // Paper - Add API for quit reason
|
||||||
if (flag) {
|
if (flag) {
|
||||||
|
@ -28,7 +31,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||||
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
||||||
public @Nullable String clientBrandName = null; // Paper - Brand support
|
public @Nullable String clientBrandName = null; // Paper - Brand support
|
||||||
|
@ -41,12 +44,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||||
final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
|
private void disconnect0(DisconnectionDetails disconnectiondetails) {
|
||||||
|
// CraftBukkit end
|
||||||
+ this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper - Add API for quit reason
|
+ this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper - Add API for quit reason
|
||||||
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
|
this.connection.send(new ClientboundDisconnectPacket(disconnectiondetails.reason()), PacketSendListener.thenRun(() -> {
|
||||||
this.connection.disconnect(ichatbasecomponent);
|
this.connection.disconnect(disconnectiondetails);
|
||||||
}));
|
}));
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
@ -10,20 +10,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||||
@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
||||||
public void releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) {
|
public void releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) {
|
||||||
int i = this.getUseDuration(stack) - remainingUseTicks;
|
int i = this.getUseDuration(stack, user) - remainingUseTicks;
|
||||||
float f = getPowerForTime(i, stack);
|
float f = getPowerForTime(i, stack, user);
|
||||||
- if (f >= 1.0F && !isCharged(stack) && tryLoadProjectiles(user, stack)) {
|
- if (f >= 1.0F && !isCharged(stack) && tryLoadProjectiles(user, stack)) {
|
||||||
+ // Paper start
|
+ // Paper start - Add EntityLoadCrossbowEvent
|
||||||
+ if (f >= 1.0F && !isCharged(stack)) {
|
+ if (f >= 1.0F && !isCharged(stack)) {
|
||||||
+ final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(user.getUsedItemHand()));
|
+ final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(user.getUsedItemHand()));
|
||||||
+ if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem()) || !event.shouldConsumeItem()) {
|
+ if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem()) || !event.shouldConsumeItem()) {
|
||||||
+ if (user instanceof ServerPlayer player) player.containerMenu.sendAllDataToRemote();
|
+ if (user instanceof ServerPlayer player) player.containerMenu.sendAllDataToRemote();
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - Add EntityLoadCrossbowEvent
|
+ // Paper end - Add EntityLoadCrossbowEvent
|
||||||
world.playSound(
|
CrossbowItem.ChargingSounds chargingSounds = this.getChargingSounds(stack);
|
||||||
null,
|
chargingSounds.end()
|
||||||
user.getX(),
|
.ifPresent(
|
||||||
@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
@@ -0,0 +0,0 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,12 +48,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ public abstract class ProjectileWeaponItem extends Item {
|
@@ -0,0 +0,0 @@ public abstract class ProjectileWeaponItem extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static List<ItemStack> draw(ItemStack weaponStack, ItemStack projectileStack, LivingEntity shooter) {
|
protected static List<ItemStack> draw(ItemStack stack, ItemStack projectileStack, LivingEntity shooter) {
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ return draw(weaponStack, projectileStack, shooter, true);
|
+ return draw(stack, projectileStack, shooter, true);
|
||||||
+ }
|
+ }
|
||||||
+ protected static List<ItemStack> draw(ItemStack weaponStack, ItemStack projectileStack, LivingEntity shooter, boolean consume) {
|
+ protected static List<ItemStack> draw(ItemStack stack, ItemStack projectileStack, LivingEntity shooter, boolean consume) {
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
if (projectileStack.isEmpty()) {
|
if (projectileStack.isEmpty()) {
|
||||||
return List.of();
|
return List.of();
|
||||||
} else {
|
} else {
|
||||||
|
@ -61,8 +61,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
ItemStack itemstack2 = projectileStack.copy();
|
ItemStack itemstack2 = projectileStack.copy();
|
||||||
|
|
||||||
for (int k = 0; k < j; ++k) {
|
for (int k = 0; k < j; ++k) {
|
||||||
- list.add(ProjectileWeaponItem.useAmmo(weaponStack, k == 0 ? projectileStack : itemstack2, shooter, k > 0));
|
- ItemStack itemstack3 = ProjectileWeaponItem.useAmmo(stack, k == 0 ? projectileStack : itemstack2, shooter, k > 0);
|
||||||
+ list.add(ProjectileWeaponItem.useAmmo(weaponStack, k == 0 ? projectileStack : itemstack2, shooter, k > 0 || !consume)); // Paper
|
+ ItemStack itemstack3 = ProjectileWeaponItem.useAmmo(stack, k == 0 ? projectileStack : itemstack2, shooter, k > 0 || !consume); // Paper
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
if (!itemstack3.isEmpty()) {
|
||||||
|
list.add(itemstack3);
|
|
@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupRecipeList(Container input, ItemStack stack) {
|
private static SingleRecipeInput createRecipeInput(Container inventory) {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
@ -30,10 +30,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+import net.minecraft.world.item.enchantment.Enchantment;
|
+import net.minecraft.world.item.enchantment.Enchantment;
|
||||||
+import net.minecraft.world.level.levelgen.structure.Structure;
|
+import net.minecraft.world.level.levelgen.structure.Structure;
|
||||||
+import org.bukkit.GameEvent;
|
+import org.bukkit.GameEvent;
|
||||||
|
+import org.bukkit.JukeboxSong;
|
||||||
+import org.bukkit.Keyed;
|
+import org.bukkit.Keyed;
|
||||||
+import org.bukkit.MusicInstrument;
|
+import org.bukkit.MusicInstrument;
|
||||||
+import org.bukkit.block.BlockType;
|
+import org.bukkit.block.BlockType;
|
||||||
+import org.bukkit.craftbukkit.CraftGameEvent;
|
+import org.bukkit.craftbukkit.CraftGameEvent;
|
||||||
|
+import org.bukkit.craftbukkit.CraftJukeboxSong;
|
||||||
+import org.bukkit.craftbukkit.CraftMusicInstrument;
|
+import org.bukkit.craftbukkit.CraftMusicInstrument;
|
||||||
+import org.bukkit.craftbukkit.block.CraftBlockType;
|
+import org.bukkit.craftbukkit.block.CraftBlockType;
|
||||||
+import org.bukkit.craftbukkit.damage.CraftDamageType;
|
+import org.bukkit.craftbukkit.damage.CraftDamageType;
|
||||||
|
@ -84,6 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ entry(Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, TrimPattern.class, CraftTrimPattern::new).delayed(),
|
+ entry(Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, TrimPattern.class, CraftTrimPattern::new).delayed(),
|
||||||
+ entry(Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, DamageType.class, CraftDamageType::new).delayed(),
|
+ entry(Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, DamageType.class, CraftDamageType::new).delayed(),
|
||||||
+ entry(Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, Wolf.Variant.class, CraftWolf.CraftVariant::new).delayed(),
|
+ entry(Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, Wolf.Variant.class, CraftWolf.CraftVariant::new).delayed(),
|
||||||
|
+ entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(),
|
||||||
+
|
+
|
||||||
+ // api-only
|
+ // api-only
|
||||||
+ apiOnly(Registries.BIOME, RegistryKey.BIOME, () -> org.bukkit.Registry.BIOME),
|
+ apiOnly(Registries.BIOME, RegistryKey.BIOME, () -> org.bukkit.Registry.BIOME),
|
||||||
|
@ -686,7 +689,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java
|
--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java
|
||||||
+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
|
+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
|
||||||
@@ -0,0 +0,0 @@ public class RegistryDataLoader {
|
@@ -0,0 +0,0 @@ public class RegistryDataLoader {
|
||||||
public static record RegistryData<T>(ResourceKey<? extends Registry<T>> key, Codec<T> elementCodec) {
|
|
||||||
RegistryDataLoader.Loader<T> create(Lifecycle lifecycle, Map<ResourceKey<?>, Exception> errors) {
|
RegistryDataLoader.Loader<T> create(Lifecycle lifecycle, Map<ResourceKey<?>, Exception> errors) {
|
||||||
WritableRegistry<T> writableRegistry = new MappedRegistry<>(this.key, lifecycle);
|
WritableRegistry<T> writableRegistry = new MappedRegistry<>(this.key, lifecycle);
|
||||||
+ io.papermc.paper.registry.PaperRegistryAccess.instance().registerRegistry(this.key, writableRegistry); // Paper - initialize API registry
|
+ io.papermc.paper.registry.PaperRegistryAccess.instance().registerRegistry(this.key, writableRegistry); // Paper - initialize API registry
|
||||||
|
@ -703,8 +706,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
WritableRegistry<T> writableRegistry = new MappedRegistry<>(type.registryKey(), Lifecycle.experimental());
|
WritableRegistry<T> writableRegistry = new MappedRegistry<>(type.registryKey(), Lifecycle.experimental());
|
||||||
+ io.papermc.paper.registry.PaperRegistryAccess.instance().registerReloadableRegistry(type.registryKey(), writableRegistry); // Paper - register reloadable registry
|
+ io.papermc.paper.registry.PaperRegistryAccess.instance().registerReloadableRegistry(type.registryKey(), writableRegistry); // Paper - register reloadable registry
|
||||||
Map<ResourceLocation, JsonElement> map = new HashMap<>();
|
Map<ResourceLocation, JsonElement> map = new HashMap<>();
|
||||||
SimpleJsonResourceReloadListener.scanDirectory(resourceManager, type.directory(), GSON, map);
|
String string = Registries.elementsDirPath(type.registryKey());
|
||||||
map.forEach(
|
SimpleJsonResourceReloadListener.scanDirectory(resourceManager, string, GSON, map);
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
|
||||||
|
@ -748,6 +751,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- if (bukkitClass == DamageType.class) {
|
- if (bukkitClass == DamageType.class) {
|
||||||
- return new CraftRegistry<>(DamageType.class, registryHolder.registryOrThrow(Registries.DAMAGE_TYPE), CraftDamageType::new, FieldRename.NONE);
|
- return new CraftRegistry<>(DamageType.class, registryHolder.registryOrThrow(Registries.DAMAGE_TYPE), CraftDamageType::new, FieldRename.NONE);
|
||||||
- }
|
- }
|
||||||
|
- if (bukkitClass == JukeboxSong.class) {
|
||||||
|
- return new CraftRegistry<>(JukeboxSong.class, registryHolder.registryOrThrow(Registries.JUKEBOX_SONG), CraftJukeboxSong::new, FieldRename.NONE);
|
||||||
|
- }
|
||||||
- if (bukkitClass == Wolf.Variant.class) {
|
- if (bukkitClass == Wolf.Variant.class) {
|
||||||
- return new CraftRegistry<>(Wolf.Variant.class, registryHolder.registryOrThrow(Registries.WOLF_VARIANT), CraftWolf.CraftVariant::new, FieldRename.NONE);
|
- return new CraftRegistry<>(Wolf.Variant.class, registryHolder.registryOrThrow(Registries.WOLF_VARIANT), CraftWolf.CraftVariant::new, FieldRename.NONE);
|
||||||
- }
|
- }
|
||||||
|
@ -1092,6 +1098,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- register(TrimMaterial.class, Registries.TRIM_MATERIAL, CraftTrimMaterial.class, net.minecraft.world.item.armortrim.TrimMaterial.class);
|
- register(TrimMaterial.class, Registries.TRIM_MATERIAL, CraftTrimMaterial.class, net.minecraft.world.item.armortrim.TrimMaterial.class);
|
||||||
- register(TrimPattern.class, Registries.TRIM_PATTERN, CraftTrimPattern.class, net.minecraft.world.item.armortrim.TrimPattern.class);
|
- register(TrimPattern.class, Registries.TRIM_PATTERN, CraftTrimPattern.class, net.minecraft.world.item.armortrim.TrimPattern.class);
|
||||||
- register(DamageType.class, Registries.DAMAGE_TYPE, CraftDamageType.class, net.minecraft.world.damagesource.DamageType.class);
|
- register(DamageType.class, Registries.DAMAGE_TYPE, CraftDamageType.class, net.minecraft.world.damagesource.DamageType.class);
|
||||||
|
- register(JukeboxSong.class, Registries.JUKEBOX_SONG, CraftJukeboxSong.class, net.minecraft.world.item.JukeboxSong.class);
|
||||||
- register(Wolf.Variant.class, Registries.WOLF_VARIANT, CraftWolf.CraftVariant.class, WolfVariant.class);
|
- register(Wolf.Variant.class, Registries.WOLF_VARIANT, CraftWolf.CraftVariant.class, WolfVariant.class);
|
||||||
- register(ItemType.class, Registries.ITEM, CraftItemType.class, net.minecraft.world.item.Item.class, true);
|
- register(ItemType.class, Registries.ITEM, CraftItemType.class, net.minecraft.world.item.Item.class, true);
|
||||||
- register(BlockType.class, Registries.BLOCK, CraftBlockType.class, net.minecraft.world.level.block.Block.class, true);
|
- register(BlockType.class, Registries.BLOCK, CraftBlockType.class, net.minecraft.world.level.block.Block.class, true);
|
||||||
|
@ -1105,6 +1112,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ register(RegistryKey.TRIM_MATERIAL, TrimMaterial.class, Registries.TRIM_MATERIAL, CraftTrimMaterial.class, net.minecraft.world.item.armortrim.TrimMaterial.class);
|
+ register(RegistryKey.TRIM_MATERIAL, TrimMaterial.class, Registries.TRIM_MATERIAL, CraftTrimMaterial.class, net.minecraft.world.item.armortrim.TrimMaterial.class);
|
||||||
+ register(RegistryKey.TRIM_PATTERN, TrimPattern.class, Registries.TRIM_PATTERN, CraftTrimPattern.class, net.minecraft.world.item.armortrim.TrimPattern.class);
|
+ register(RegistryKey.TRIM_PATTERN, TrimPattern.class, Registries.TRIM_PATTERN, CraftTrimPattern.class, net.minecraft.world.item.armortrim.TrimPattern.class);
|
||||||
+ register(RegistryKey.DAMAGE_TYPE, DamageType.class, Registries.DAMAGE_TYPE, CraftDamageType.class, net.minecraft.world.damagesource.DamageType.class);
|
+ register(RegistryKey.DAMAGE_TYPE, DamageType.class, Registries.DAMAGE_TYPE, CraftDamageType.class, net.minecraft.world.damagesource.DamageType.class);
|
||||||
|
+ register(RegistryKey.JUKEBOX_SONG, JukeboxSong.class, Registries.JUKEBOX_SONG, CraftJukeboxSong.class, net.minecraft.world.item.JukeboxSong.class);
|
||||||
+ register(RegistryKey.WOLF_VARIANT, Wolf.Variant.class, Registries.WOLF_VARIANT, CraftWolf.CraftVariant.class, WolfVariant.class);
|
+ register(RegistryKey.WOLF_VARIANT, Wolf.Variant.class, Registries.WOLF_VARIANT, CraftWolf.CraftVariant.class, WolfVariant.class);
|
||||||
+ register(RegistryKey.ITEM, ItemType.class, Registries.ITEM, CraftItemType.class, net.minecraft.world.item.Item.class, true);
|
+ register(RegistryKey.ITEM, ItemType.class, Registries.ITEM, CraftItemType.class, net.minecraft.world.item.Item.class, true);
|
||||||
+ register(RegistryKey.BLOCK, BlockType.class, Registries.BLOCK, CraftBlockType.class, net.minecraft.world.level.block.Block.class, true);
|
+ register(RegistryKey.BLOCK, BlockType.class, Registries.BLOCK, CraftBlockType.class, net.minecraft.world.level.block.Block.class, true);
|
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
@@ -0,0 +0,0 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||||
this.populateDefaultEquipmentSlots(randomsource, difficulty);
|
this.populateDefaultEquipmentSlots(randomsource, difficulty);
|
||||||
this.populateDefaultEquipmentEnchantments(randomsource, difficulty);
|
this.populateDefaultEquipmentEnchantments(world, randomsource, difficulty);
|
||||||
this.reassessWeaponGoal();
|
this.reassessWeaponGoal();
|
||||||
- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier());
|
- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier());
|
||||||
+ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper - Add world settings for mobs picking up loot
|
+ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper - Add world settings for mobs picking up loot
|
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||||
public boolean isRealPlayer; // Paper
|
public boolean isRealPlayer; // Paper
|
||||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||||
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
|
@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+++ b/src/main/java/com/mojang/datafixers/DataFixerBuilder.java
|
+++ b/src/main/java/com/mojang/datafixers/DataFixerBuilder.java
|
||||||
@@ -0,0 +0,0 @@ public class DataFixerBuilder {
|
@@ -0,0 +0,0 @@ public class DataFixerBuilder {
|
||||||
private final Int2ObjectSortedMap<Schema> schemas = new Int2ObjectAVLTreeMap<>();
|
private final Int2ObjectSortedMap<Schema> schemas = new Int2ObjectAVLTreeMap<>();
|
||||||
private final List<DataFix> globalList = Lists.newArrayList();
|
private final List<DataFix> globalList = new ArrayList<>();
|
||||||
private final IntSortedSet fixerVersions = new IntAVLTreeSet();
|
private final IntSortedSet fixerVersions = new IntAVLTreeSet();
|
||||||
+ private final int minDataFixPrecacheVersion; // Paper - Perf: Cache DataFixerUpper Rewrite Rules on demand
|
+ private final int minDataFixPrecacheVersion; // Paper - Perf: Cache DataFixerUpper Rewrite Rules on demand
|
||||||
|
|
||||||
|
@ -45,10 +45,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class DataFixerBuilder {
|
@@ -0,0 +0,0 @@ public class DataFixerBuilder {
|
||||||
final IntBidirectionalIterator iterator = fixerUpper.fixerVersions().iterator();
|
final IntIterator iterator = fixerUpper.fixerVersions().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
final int versionKey = iterator.nextInt();
|
final int versionKey = iterator.nextInt();
|
||||||
+ if (versionKey < minDataFixPrecacheVersion) continue; // Paper - Perf: Cache DataFixerUpper Rewrite Rules on demand
|
+ if (versionKey < minDataFixPrecacheVersion) continue; // Paper - Perf: Cache DataFixerUpper Rewrite Rules on demand
|
||||||
final Schema schema = schemas.get(versionKey);
|
final Schema schema = schemas.get(versionKey);
|
||||||
for (final String typeName : schema.types()) {
|
for (final String typeName : schema.types()) {
|
||||||
if (!requiredTypeNames.contains(typeName)) {
|
if (!requiredTypeNames.contains(typeName)) {
|
|
@ -145,7 +145,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/ma
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
@@ -0,0 +0,0 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
@@ -0,0 +0,0 @@ public class Boat extends VehicleEntity implements Leashable, VariantHolder<Boat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -32,7 +32,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/ma
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
@@ -0,0 +0,0 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
@@ -0,0 +0,0 @@ public class Boat extends VehicleEntity implements Leashable, VariantHolder<Boat
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void push(Entity entity) {
|
public void push(Entity entity) {
|
19
patches/server/Configurable-max-leash-distance.patch
Normal file
19
patches/server/Configurable-max-leash-distance.patch
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||||
|
Date: Sun, 3 Jan 2021 21:04:03 -0800
|
||||||
|
Subject: [PATCH] Configurable max leash distance
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/Leashable.java b/src/main/java/net/minecraft/world/entity/Leashable.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/Leashable.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/Leashable.java
|
||||||
|
@@ -0,0 +0,0 @@ public interface Leashable {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if ((double) f > 10.0D) {
|
||||||
|
+ if ((double) f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance
|
||||||
|
((Leashable) entity).leashTooFarBehaviour();
|
||||||
|
} else if ((double) f > 6.0D) {
|
||||||
|
((Leashable) entity).elasticRangeLeashBehaviour(entity1, f);
|
|
@ -24,9 +24,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
// Paper start - guard against serializing mismatching coordinates
|
// Paper start - guard against serializing mismatching coordinates
|
||||||
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
||||||
}
|
|
||||||
// Paper end - guard against serializing mismatching coordinates
|
// Paper end - guard against serializing mismatching coordinates
|
||||||
public static ProtoChunk read(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt) {
|
|
||||||
|
public static ProtoChunk read(ServerLevel world, PoiManager poiStorage, RegionStorageInfo key, ChunkPos chunkPos, CompoundTag nbt) {
|
||||||
+ // Paper start - Do not let the server load chunks from newer versions
|
+ // Paper start - Do not let the server load chunks from newer versions
|
||||||
+ if (nbt.contains("DataVersion", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
|
+ if (nbt.contains("DataVersion", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
|
||||||
+ final int dataVersion = nbt.getInt("DataVersion");
|
+ final int dataVersion = nbt.getInt("DataVersion");
|
|
@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
public class DefaultDispenseItemBehavior implements DispenseItemBehavior {
|
public class DefaultDispenseItemBehavior implements DispenseItemBehavior {
|
||||||
+ private Direction enumdirection; // Paper - cache facing direction
|
+ private Direction enumdirection; // Paper - cache facing direction
|
||||||
|
|
||||||
// CraftBukkit start
|
private static final int DEFAULT_ACCURACY = 6;
|
||||||
private boolean dropper;
|
|
||||||
@@ -0,0 +0,0 @@ public class DefaultDispenseItemBehavior implements DispenseItemBehavior {
|
@@ -0,0 +0,0 @@ public class DefaultDispenseItemBehavior implements DispenseItemBehavior {
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -22,9 +22,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
this.lastGoodY = this.awaitingPositionFromClient.y;
|
this.lastGoodY = this.awaitingPositionFromClient.y;
|
||||||
this.lastGoodZ = this.awaitingPositionFromClient.z;
|
this.lastGoodZ = this.awaitingPositionFromClient.z;
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
this.awaitingTeleportTime = this.tickCount;
|
this.awaitingTeleportTime = this.tickCount;
|
||||||
this.player.resetCurrentImpulseContext();
|
|
||||||
- this.player.absMoveTo(d0, d1, d2, f, f1);
|
- this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||||
+ this.player.moveTo(d0, d1, d2, f, f1); // Paper - Fix Entity Teleportation and cancel velocity if teleported
|
+ this.player.moveTo(d0, d1, d2, f, f1); // Paper - Fix Entity Teleportation and cancel velocity if teleported
|
||||||
this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
|
this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
|
|
@ -22,6 +22,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
- if (!whitelist.isWhiteListed(entityplayer.getGameProfile())) {
|
- if (!whitelist.isWhiteListed(entityplayer.getGameProfile())) {
|
||||||
+ if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420)
|
+ if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420)
|
||||||
entityplayer.connection.disconnect(Component.translatable("multiplayer.disconnect.not_whitelisted"));
|
entityplayer.connection.disconnect((Component) Component.translatable("multiplayer.disconnect.not_whitelisted"));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ Component ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(adventureComponent); // Paper - Fix hex colors not working in some kick messages
|
+ Component ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(adventureComponent); // Paper - Fix hex colors not working in some kick messages
|
||||||
+
|
+
|
||||||
this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));
|
this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));
|
||||||
this.connection.disconnect(ichatmutablecomponent);
|
this.connection.disconnect((Component) ichatmutablecomponent);
|
||||||
} else {
|
} else {
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
@ -1444,6 +1444,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+import net.minecraft.world.entity.Entity;
|
+import net.minecraft.world.entity.Entity;
|
||||||
+import net.minecraft.world.entity.EntityType;
|
+import net.minecraft.world.entity.EntityType;
|
||||||
+import net.minecraft.world.entity.ExperienceOrb;
|
+import net.minecraft.world.entity.ExperienceOrb;
|
||||||
|
+import net.minecraft.world.entity.Leashable;
|
||||||
+import net.minecraft.world.entity.MobCategory;
|
+import net.minecraft.world.entity.MobCategory;
|
||||||
+import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
+import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||||
+import net.minecraft.world.entity.decoration.HangingEntity;
|
+import net.minecraft.world.entity.decoration.HangingEntity;
|
||||||
|
@ -1945,7 +1946,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ public boolean showSignClickCommandFailureMsgsToPlayer = false;
|
+ public boolean showSignClickCommandFailureMsgsToPlayer = false;
|
||||||
+ public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
|
+ public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
|
||||||
+ public boolean disableEndCredits = false;
|
+ public boolean disableEndCredits = false;
|
||||||
+ public float maxLeashDistance = 10f;
|
+ public double maxLeashDistance = Leashable.LEASH_TOO_FAR_DIST;
|
||||||
+ public boolean disableSprintInterruptionOnAttack = false;
|
+ public boolean disableSprintInterruptionOnAttack = false;
|
||||||
+ public int shieldBlockingDelay = 5;
|
+ public int shieldBlockingDelay = 5;
|
||||||
+ public boolean disableRelativeProjectileVelocity = false;
|
+ public boolean disableRelativeProjectileVelocity = false;
|
||||||
|
|
|
@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public MerchantOffers getOffers() {
|
public MerchantOffers getOffers() {
|
||||||
if (this.offers == null) {
|
if (this.level().isClientSide) {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue