From cfb17666fff3c983da846604682847f891ceb84a Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Mon, 14 Jun 2021 06:45:16 -0700 Subject: [PATCH] even MOAR progress --- .../0222-Add-more-Evoker-API.patch | 0 ...-translation-keys-for-blocks-entitie.patch | 10 +-- ...ate-HoverEvent-from-ItemStack-Entity.patch | 6 +- .../0557-Add-BellRingEvent.patch | 58 ---------------- .../0564-Add-more-Evoker-API.patch | 57 --------------- patches/server/0501-Add-BellRingEvent.patch | 28 ++++++++ ...dd-zombie-targets-turtle-egg-config.patch} | 16 +++-- .../0503-Buffer-joins-to-world.patch} | 29 +++----- .../0504-Optimize-redstone-algorithm.patch} | 69 +++++++------------ ...s-not-working-in-some-kick-messages.patch} | 18 ++--- ...reateEvent-needs-to-know-its-entity.patch} | 47 +++++++------ .../0507-Fix-CraftTeam-null-check.patch} | 4 +- patches/server/0508-Add-more-Evoker-API.patch | 35 ++++++++++ ...translation-keys-for-blocks-entitie.patch} | 47 +++---------- 14 files changed, 156 insertions(+), 268 deletions(-) rename patches/{api-unmapped => api}/0222-Add-more-Evoker-API.patch (100%) rename patches/{api-unmapped => api}/0223-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch (92%) rename patches/{api-unmapped => api}/0224-Create-HoverEvent-from-ItemStack-Entity.patch (95%) delete mode 100644 patches/server-remapped/0557-Add-BellRingEvent.patch delete mode 100644 patches/server-remapped/0564-Add-more-Evoker-API.patch create mode 100644 patches/server/0501-Add-BellRingEvent.patch rename patches/{server-remapped/0558-Add-zombie-targets-turtle-egg-config.patch => server/0502-Add-zombie-targets-turtle-egg-config.patch} (74%) rename patches/{server-remapped/0559-Buffer-joins-to-world.patch => server/0503-Buffer-joins-to-world.patch} (66%) rename patches/{server-remapped/0560-Optimize-redstone-algorithm.patch => server/0504-Optimize-redstone-algorithm.patch} (94%) rename patches/{server-remapped/0561-Fix-hex-colors-not-working-in-some-kick-messages.patch => server/0505-Fix-hex-colors-not-working-in-some-kick-messages.patch} (82%) rename patches/{server-remapped/0562-PortalCreateEvent-needs-to-know-its-entity.patch => server/0506-PortalCreateEvent-needs-to-know-its-entity.patch} (80%) rename patches/{server-remapped/0563-Fix-CraftTeam-null-check.patch => server/0507-Fix-CraftTeam-null-check.patch} (84%) create mode 100644 patches/server/0508-Add-more-Evoker-API.patch rename patches/{server-remapped/0565-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch => server/0509-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch} (65%) diff --git a/patches/api-unmapped/0222-Add-more-Evoker-API.patch b/patches/api/0222-Add-more-Evoker-API.patch similarity index 100% rename from patches/api-unmapped/0222-Add-more-Evoker-API.patch rename to patches/api/0222-Add-more-Evoker-API.patch diff --git a/patches/api-unmapped/0223-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch b/patches/api/0223-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch similarity index 92% rename from patches/api-unmapped/0223-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch rename to patches/api/0223-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch index bfa151e84..5e9876ef4 100644 --- a/patches/api-unmapped/0223-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch +++ b/patches/api/0223-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch @@ -1,4 +1,4 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From 0000000000000000000000>>>>>>> replacement000000000000000000 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Tue, 11 Aug 2020 19:17:46 +0200 Subject: [PATCH] Add a way to get translation keys for blocks, entities and @@ -6,10 +6,10 @@ Subject: [PATCH] Add a way to get translation keys for blocks, entities and diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 9c28351c7c3f60c6a3b4020329344f91efeedae1..69c85c3a1f45476f7de0a9399852d82eeb4f9c86 100644 +index 52290c43d1c02785c4cae4a73494a75cdc369e02..1efc97d88c38863bcd6cd4c11c8b88a18ee06b25 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -3991,6 +3991,16 @@ public enum Material implements Keyed { +@@ -3992,6 +3992,16 @@ public enum Material implements Keyed { } return false; } @@ -66,10 +66,10 @@ index e348034288c74ab80360086d71f0b7f61551df24..2d9264ffe0fee863f1b814952ef063da // Paper end } diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index e1cc36fbe808973227c0e8ca7166453235c90279..e6647c45f65bae916759cd899256f8130790d242 100644 +index 786b8011e98b2fe93cc2418d624f6350ede62d90..024deba760c41787190d20e4ac5c541920bb4991 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -584,5 +584,13 @@ public interface Block extends Metadatable { +@@ -610,5 +610,13 @@ public interface Block extends Metadatable { */ @NotNull com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup(); diff --git a/patches/api-unmapped/0224-Create-HoverEvent-from-ItemStack-Entity.patch b/patches/api/0224-Create-HoverEvent-from-ItemStack-Entity.patch similarity index 95% rename from patches/api-unmapped/0224-Create-HoverEvent-from-ItemStack-Entity.patch rename to patches/api/0224-Create-HoverEvent-from-ItemStack-Entity.patch index 9a15253cf..982d89240 100644 --- a/patches/api-unmapped/0224-Create-HoverEvent-from-ItemStack-Entity.patch +++ b/patches/api/0224-Create-HoverEvent-from-ItemStack-Entity.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Create HoverEvent from ItemStack Entity diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java -index e2bcc96ad067e2abfe9108b3a2235fe5da7ab3eb..3cbe5afc3548d4b7d0c6e625d9029506133676ff 100644 +index d773e8594f91017bddd7ea8aada3a1ff2781d05b..0a4466c6ca519c3a5da76ff870fb2a4e3a06effd 100644 --- a/src/main/java/org/bukkit/inventory/ItemFactory.java +++ b/src/main/java/org/bukkit/inventory/ItemFactory.java @@ -184,5 +184,62 @@ public interface ItemFactory { */ - @Nullable - String getI18NDisplayName(@Nullable ItemStack item); + @NotNull + ItemStack ensureServerConversions(@NotNull ItemStack item); + + /** + * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that ItemStack for displaying. diff --git a/patches/server-remapped/0557-Add-BellRingEvent.patch b/patches/server-remapped/0557-Add-BellRingEvent.patch deleted file mode 100644 index 05dfb6c0b..000000000 --- a/patches/server-remapped/0557-Add-BellRingEvent.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Eearslya Sleiarion -Date: Sun, 23 Aug 2020 13:04:02 +0200 -Subject: [PATCH] Add BellRingEvent - -Add a new event, BellRingEvent, to trigger whenever a player rings a -village bell. Passes along the bell block and the player who rang it. - -diff --git a/src/main/java/net/minecraft/world/level/block/BellBlock.java b/src/main/java/net/minecraft/world/level/block/BellBlock.java -index affae471e50354bfa9594e188e6dcea183b9b5c9..dc5dc9e533c71908b7a9a3cc9e614bd4a0dcde98 100644 ---- a/src/main/java/net/minecraft/world/level/block/BellBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/BellBlock.java -@@ -1,8 +1,11 @@ - package net.minecraft.world.level.block; - -+import io.papermc.paper.event.block.BellRingEvent; -+ - import javax.annotation.Nullable; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; -+import net.minecraft.server.MCUtil; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; - import net.minecraft.stats.Stats; -@@ -89,7 +92,7 @@ public class BellBlock extends BaseEntityBlock { - boolean flag1 = !flag || this.isProperHit(state, enumdirection, movingobjectpositionblock.getLocation().y - (double) blockposition.getY()); - - if (flag1) { -- boolean flag2 = this.attemptToRing(world, blockposition, enumdirection); -+ boolean flag2 = this.handleBellRing(world, blockposition, enumdirection, entityhuman); // Paper - - if (flag2 && entityhuman != null) { - entityhuman.awardStat(Stats.BELL_RING); -@@ -123,15 +126,21 @@ public class BellBlock extends BaseEntityBlock { - } - - public boolean attemptToRing(Level world, BlockPos pos, @Nullable Direction enumdirection) { -- BlockEntity tileentity = world.getBlockEntity(pos); -+ // Paper start - add ringer param -+ return this.handleBellRing(world, pos, enumdirection, null); -+ } -+ public boolean handleBellRing(Level world, BlockPos blockposition, @Nullable Direction enumdirection, @Nullable Entity ringer) { -+ // Paper end -+ BlockEntity tileentity = world.getBlockEntity(blockposition); - - if (!world.isClientSide && tileentity instanceof BellBlockEntity) { - if (enumdirection == null) { -- enumdirection = (Direction) world.getBlockState(pos).getValue(BellBlock.FACING); -+ enumdirection = (Direction) world.getBlockState(blockposition).getValue(BellBlock.FACING); - } - -+ if (!new BellRingEvent(world.getWorld().getBlockAt(MCUtil.toLocation(world, blockposition)), ringer == null ? null : ringer.getBukkitEntity()).callEvent()) return false; // Paper - BellRingEvent - ((BellBlockEntity) tileentity).onHit(enumdirection); -- world.playSound((Player) null, pos, SoundEvents.BELL_BLOCK, SoundSource.BLOCKS, 2.0F, 1.0F); -+ world.playSound((Player) null, blockposition, SoundEvents.BELL_BLOCK, SoundSource.BLOCKS, 2.0F, 1.0F); - return true; - } else { - return false; diff --git a/patches/server-remapped/0564-Add-more-Evoker-API.patch b/patches/server-remapped/0564-Add-more-Evoker-API.patch deleted file mode 100644 index af8a4c551..000000000 --- a/patches/server-remapped/0564-Add-more-Evoker-API.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sun, 23 Aug 2020 15:28:35 +0200 -Subject: [PATCH] Add more Evoker API - - -diff --git a/src/main/java/net/minecraft/world/entity/monster/Evoker.java b/src/main/java/net/minecraft/world/entity/monster/Evoker.java -index c0a5b0074480aad717177c92b28fa27b8a1d707d..617075955506500dc2d9c734398c48b8fc10b69d 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Evoker.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Evoker.java -@@ -40,7 +40,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; - - public class Evoker extends SpellcasterIllager { - -- private Sheep wololoTarget; -+ private Sheep wololoTarget; public final Sheep getWololoTarget() { return this.wololoTarget; } public final void setWololoTarget(Sheep sheep) { this.wololoTarget = sheep; } // Paper - OBFHELPER - - public Evoker(EntityType type, Level world) { - super(type, world); -@@ -59,7 +59,7 @@ public class Evoker extends SpellcasterIllager { - this.goalSelector.addGoal(8, new RandomStrollGoal(this, 0.6D)); - this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 3.0F, 1.0F)); - this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Mob.class, 8.0F)); -- this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Raider.class})).canUse()); -+ this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Raider.class})).setAlertOthers(new Class[0])); // Paper - decompile fix - this.targetSelector.addGoal(2, (new NearestAttackableTargetGoal<>(this, Player.class, true)).setUnseenMemoryTicks(300)); - this.targetSelector.addGoal(3, (new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)).setUnseenMemoryTicks(300)); - this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, false)); -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java -index 29fec87c938c4252cf5c9473ce9e5c1908ea9063..950e35f67f88138cc2ce923be1ea7976bd317d1f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java -@@ -1,5 +1,6 @@ - package org.bukkit.craftbukkit.entity; - -+import net.minecraft.world.entity.animal.Sheep; - import net.minecraft.world.entity.monster.SpellcasterIllager; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.entity.EntityType; -@@ -35,4 +36,17 @@ public class CraftEvoker extends CraftSpellcaster implements Evoker { - public void setCurrentSpell(Evoker.Spell spell) { - getHandle().setIsCastingSpell(spell == null ? SpellcasterIllager.IllagerSpell.NONE : SpellcasterIllager.IllagerSpell.byId(spell.ordinal())); - } -+ -+ // Paper start -+ @Override -+ public org.bukkit.entity.Sheep getWololoTarget() { -+ Sheep sheep = getHandle().getWololoTarget(); -+ return sheep == null ? null : (org.bukkit.entity.Sheep) sheep.getBukkitEntity(); -+ } -+ -+ @Override -+ public void setWololoTarget(org.bukkit.entity.Sheep sheep) { -+ getHandle().setWololoTarget(sheep == null ? null : ((org.bukkit.craftbukkit.entity.CraftSheep) sheep).getHandle()); -+ } -+ // Paper end - } diff --git a/patches/server/0501-Add-BellRingEvent.patch b/patches/server/0501-Add-BellRingEvent.patch new file mode 100644 index 000000000..e101aa373 --- /dev/null +++ b/patches/server/0501-Add-BellRingEvent.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Eearslya Sleiarion +Date: Sun, 23 Aug 2020 13:04:02 +0200 +Subject: [PATCH] Add BellRingEvent + +Add a new event, BellRingEvent, to trigger whenever a player rings a +village bell. Passes along the bell block and the player who rang it. + +diff --git a/src/main/java/net/minecraft/world/level/block/BellBlock.java b/src/main/java/net/minecraft/world/level/block/BellBlock.java +index 3392d9b45d4bfba7ad3e3a84cdd4f2a29b58e4ff..1864984197a6b28cccb3a57b6856f61766d6a467 100644 +--- a/src/main/java/net/minecraft/world/level/block/BellBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/BellBlock.java +@@ -3,6 +3,7 @@ package net.minecraft.world.level.block; + import javax.annotation.Nullable; + import net.minecraft.core.BlockPos; + import net.minecraft.core.Direction; ++import net.minecraft.server.MCUtil; + import net.minecraft.sounds.SoundEvents; + import net.minecraft.sounds.SoundSource; + import net.minecraft.stats.Stats; +@@ -131,6 +132,7 @@ public class BellBlock extends BaseEntityBlock { + direction = world.getBlockState(pos).getValue(FACING); + } + ++ if (!new io.papermc.paper.event.block.BellRingEvent(world.getWorld().getBlockAt(MCUtil.toLocation(world, pos)), entity == null ? null : entity.getBukkitEntity()).callEvent()) return false; // Paper - BellRingEvent + ((BellBlockEntity)blockEntity).onHit(direction); + world.playSound((Player)null, pos, SoundEvents.BELL_BLOCK, SoundSource.BLOCKS, 2.0F, 1.0F); + world.gameEvent(entity, GameEvent.RING_BELL, pos); diff --git a/patches/server-remapped/0558-Add-zombie-targets-turtle-egg-config.patch b/patches/server/0502-Add-zombie-targets-turtle-egg-config.patch similarity index 74% rename from patches/server-remapped/0558-Add-zombie-targets-turtle-egg-config.patch rename to patches/server/0502-Add-zombie-targets-turtle-egg-config.patch index d46a54fd3..7704727c5 100644 --- a/patches/server-remapped/0558-Add-zombie-targets-turtle-egg-config.patch +++ b/patches/server/0502-Add-zombie-targets-turtle-egg-config.patch @@ -5,24 +5,26 @@ Subject: [PATCH] Add zombie targets turtle egg config diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 978062774c1db286bfb9b0ffdef19d880b1f249b..36ecdfce84141ac731b827e469ac842f5c666259 100644 +index 91917b11163c0740d5e5effc5e93d494e2b2d73e..caac3c9936c764e411799cb6a702b590f49d9955 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -668,4 +668,9 @@ public class PaperWorldConfig { - maxLightningFlashDistance = 512; // Vanilla value +@@ -41,6 +41,11 @@ public class PaperWorldConfig { } } -+ + + public boolean zombiesTargetTurtleEggs = true; + private void zombiesTargetTurtleEggs() { + zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs); + } - } ++ + public short keepLoadedRange; + private void keepLoadedRange() { + keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 1e7c2c603b967c8c606efd94ce95a17c856f78d7..4105c1763d25824aac35d305a793823c1604eee8 100644 +index b036cbb9a1b6bcac91ffc8ee659fc95d6e04d5d4..3125aad3b14a185bbd563827f07c15bbb1ef0895 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -104,7 +104,7 @@ public class Zombie extends Monster { +@@ -109,7 +109,7 @@ public class Zombie extends Monster { @Override protected void registerGoals() { diff --git a/patches/server-remapped/0559-Buffer-joins-to-world.patch b/patches/server/0503-Buffer-joins-to-world.patch similarity index 66% rename from patches/server-remapped/0559-Buffer-joins-to-world.patch rename to patches/server/0503-Buffer-joins-to-world.patch index b9f930aa4..139ee8a61 100644 --- a/patches/server-remapped/0559-Buffer-joins-to-world.patch +++ b/patches/server/0503-Buffer-joins-to-world.patch @@ -22,18 +22,18 @@ index faa1b775e45563b93ac1d5b904938b1f5ad8d80c..545948f20efd6c8dd42140b565af94cd + } } diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index fc63df21aecd4721efdb45d4744666ed0b562c1b..6f7cbce5a049d87d4a0ed7cc4517cb4e8694efb5 100644 +index 7607bf75968cc32d616e2b44e89901b3681b1131..d32b96a5f51d745869cfc40c01c54de58e1eb843 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -32,6 +32,7 @@ import net.minecraft.network.protocol.game.ClientboundDisconnectPacket; - import net.minecraft.network.protocol.game.ClientboundKeepAlivePacket; - import net.minecraft.network.protocol.game.ClientboundSetTitlesPacket; - import net.minecraft.server.MCUtil; +@@ -37,6 +37,7 @@ import net.minecraft.network.protocol.Packet; + import net.minecraft.network.protocol.PacketFlow; + import net.minecraft.network.protocol.game.ClientboundDisconnectPacket; + import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket; +import net.minecraft.server.MinecraftServer; import net.minecraft.server.RunningOnDifferentThreadException; - import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; -@@ -382,10 +383,22 @@ public class Connection extends SimpleChannelInboundHandler> { + import net.minecraft.server.network.ServerLoginPacketListenerImpl; +@@ -373,10 +374,22 @@ public class Connection extends SimpleChannelInboundHandler> { } // Paper end @@ -41,7 +41,7 @@ index fc63df21aecd4721efdb45d4744666ed0b562c1b..6f7cbce5a049d87d4a0ed7cc4517cb4e + private static int joinAttemptsThisTick; // Paper + private static int currTick; // Paper public void tick() { - this.p(); + this.flushQueue(); + // Paper start + if (currTick != MinecraftServer.currentTick) { + currTick = MinecraftServer.currentTick; @@ -56,16 +56,3 @@ index fc63df21aecd4721efdb45d4744666ed0b562c1b..6f7cbce5a049d87d4a0ed7cc4517cb4e } if (this.packetListener instanceof ServerGamePacketListenerImpl) { -diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index e229c7735ba88be3d8721440104958408a2a075e..659bf14cf3c949b896d0333f893a3d5e16ab9c92 100644 ---- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -420,7 +420,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener - return new GameProfile(uuid, profile.getName()); - } - -- static enum State { -+ public enum State { // Paper - package private -> public - - HELLO, KEY, AUTHENTICATING, NEGOTIATING, READY_TO_ACCEPT, DELAY_ACCEPT, ACCEPTED; - diff --git a/patches/server-remapped/0560-Optimize-redstone-algorithm.patch b/patches/server/0504-Optimize-redstone-algorithm.patch similarity index 94% rename from patches/server-remapped/0560-Optimize-redstone-algorithm.patch rename to patches/server/0504-Optimize-redstone-algorithm.patch index 002eed1ee..1c103119e 100644 --- a/patches/server-remapped/0560-Optimize-redstone-algorithm.patch +++ b/patches/server/0504-Optimize-redstone-algorithm.patch @@ -19,14 +19,13 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee Just added Bukkit's event system and took a few liberties with dead code and comment misspellings. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 36ecdfce84141ac731b827e469ac842f5c666259..02bb85364560784adea47c877c13291c3d016b86 100644 +index caac3c9936c764e411799cb6a702b590f49d9955..a88ef43adcf4ba36964f02e3fd363d3e018147cd 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -673,4 +673,14 @@ public class PaperWorldConfig { - private void zombiesTargetTurtleEggs() { +@@ -46,6 +46,16 @@ public class PaperWorldConfig { zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs); } -+ + + public boolean useEigencraftRedstone = false; + private void useEigencraftRedstone() { + useEigencraftRedstone = this.getBoolean("use-faster-eigencraft-redstone", false); @@ -36,10 +35,13 @@ index 36ecdfce84141ac731b827e469ac842f5c666259..02bb85364560784adea47c877c13291c + log("Using vanilla redstone algorithm."); + } + } - } ++ + public short keepLoadedRange; + private void keepLoadedRange() { + keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java new file mode 100644 -index 0000000000000000000000000000000000000000..19604f4d2d0cdf65cb9f164258c4435a5a3450bc +index 0000000000000000000000000000000000000000..3728979e290ab031c9fe9eeb19a0f98d2ce566db --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java @@ -0,0 +1,913 @@ @@ -863,14 +865,14 @@ index 0000000000000000000000000000000000000000..19604f4d2d0cdf65cb9f164258c4435a + j = getMaxCurrentStrength(upd, j); + int l = 0; + -+ wire.setCanProvidePower(false); ++ wire.shouldSignal = false; + // Unfortunately, World.isBlockIndirectlyGettingPowered is complicated, + // and I'm not ready to try to replicate even more functionality from + // elsewhere in Minecraft into this accelerator. So sadly, we must + // suffer the performance hit of this very expensive call. If there + // is consistency to what this call returns, we may be able to cache it. -+ final int k = worldIn.isBlockIndirectlyGettingPowered(upd.self); -+ wire.setCanProvidePower(true); ++ final int k = worldIn.getBestNeighborSignal(upd.self); ++ wire.shouldSignal = true; + + // The variable 'k' holds the maximum redstone power value of any adjacent blocks. + // If 'k' has the highest level of all neighbors, then the power level of this @@ -956,28 +958,8 @@ index 0000000000000000000000000000000000000000..19604f4d2d0cdf65cb9f164258c4435a + return i > strength ? i : strength; + } +} -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 9b50b8030174338c04b60d441b980131e1d593e4..ebb92f88e0402681c47834bcf45e6b236748289a 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -659,6 +659,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - - } - -+ public void neighborChanged(BlockPos pos, Block blockIn, BlockPos fromPos) { neighborChanged(pos, blockIn, fromPos); } // Paper - OBFHELPER - public void neighborChanged(BlockPos sourcePos, Block sourceBlock, BlockPos neighborPos) { - if (!this.isClientSide) { - BlockState iblockdata = this.getBlockState(sourcePos); -@@ -1287,6 +1288,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - return this.getSignal(pos.below(), Direction.DOWN) > 0 ? true : (this.getSignal(pos.above(), Direction.UP) > 0 ? true : (this.getSignal(pos.north(), Direction.NORTH) > 0 ? true : (this.getSignal(pos.south(), Direction.SOUTH) > 0 ? true : (this.getSignal(pos.west(), Direction.WEST) > 0 ? true : this.getSignal(pos.east(), Direction.EAST) > 0)))); - } - -+ public int isBlockIndirectlyGettingPowered(BlockPos pos) { return this.getBestNeighborSignal(pos); } // Paper - OBFHELPER - public int getBestNeighborSignal(BlockPos pos) { - int i = 0; - Direction[] aenumdirection = Level.DIRECTIONS; diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java -index 7318536fe89cddda305007a9ab115970bf18f65d..e5558b73c6159e4c1901d286535a7875924434e9 100644 +index 2f7a34853fb52c840264ae9f01b3c598f1f92e96..881417b16c377572718fb3ed7c3db832ca7bf865 100644 --- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java @@ -1,5 +1,7 @@ @@ -988,16 +970,16 @@ index 7318536fe89cddda305007a9ab115970bf18f65d..e5558b73c6159e4c1901d286535a7875 import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -@@ -49,7 +51,7 @@ public class RedStoneWireBlock extends Block { - private final Map SHAPES_CACHE = Maps.newHashMap(); - private static final Vector3f[] COLORS = new Vector3f[16]; +@@ -69,7 +71,7 @@ public class RedStoneWireBlock extends Block { + }); + private static final float PARTICLE_DENSITY = 0.2F; private final BlockState crossState; - private boolean shouldSignal = true; -+ private boolean shouldSignal = true; public final boolean canProvidePower() { return this.shouldSignal; } public final void setCanProvidePower(boolean value) { this.shouldSignal = value; } // Paper - OBFHELPER ++ public boolean shouldSignal = true; // Paper private -> public public RedStoneWireBlock(BlockBehaviour.Properties settings) { super(settings); -@@ -236,6 +238,121 @@ public class RedStoneWireBlock extends Block { +@@ -256,6 +258,121 @@ public class RedStoneWireBlock extends Block { return floor.isFaceSturdy(world, pos, Direction.UP) || floor.is(Blocks.HOPPER); } @@ -1031,9 +1013,9 @@ index 7318536fe89cddda305007a9ab115970bf18f65d..e5558b73c6159e4c1901d286535a7875 + int i = state.getValue(POWER); + int j = 0; + j = this.getPower(j, worldIn.getBlockState(pos2)); -+ this.setCanProvidePower(false); -+ int k = worldIn.isBlockIndirectlyGettingPowered(pos1); -+ this.setCanProvidePower(true); ++ this.shouldSignal = false; ++ int k = worldIn.getBestNeighborSignal(pos1); ++ this.shouldSignal = true; + + if (!worldIn.paperConfig.useEigencraftRedstone) { + // This code is totally redundant to if statements just below the loop. @@ -1119,16 +1101,15 @@ index 7318536fe89cddda305007a9ab115970bf18f65d..e5558b73c6159e4c1901d286535a7875 private void updatePowerStrength(Level world, BlockPos pos, BlockState state) { int i = this.calculateTargetStrength(world, pos); -@@ -305,6 +422,8 @@ public class RedStoneWireBlock extends Block { +@@ -325,6 +442,7 @@ public class RedStoneWireBlock extends Block { return Math.max(i, j - 1); } -+ private int getPower(int min, BlockState iblockdata) { return Math.max(min, getPower(iblockdata)); } // Paper - Optimize redstone -+ private int getPower(BlockState iblockdata) { return this.getWireSignal(iblockdata); } // Paper - OBFHELPER ++ private int getPower(int min, BlockState iblockdata) { return Math.max(min, getWireSignal(iblockdata)); } // Paper - Optimize redstone private int getWireSignal(BlockState state) { return state.is((Block) this) ? (Integer) state.getValue(RedStoneWireBlock.POWER) : 0; } -@@ -327,7 +446,7 @@ public class RedStoneWireBlock extends Block { +@@ -347,7 +465,7 @@ public class RedStoneWireBlock extends Block { @Override public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { if (!oldState.is(state.getBlock()) && !world.isClientSide) { @@ -1137,7 +1118,7 @@ index 7318536fe89cddda305007a9ab115970bf18f65d..e5558b73c6159e4c1901d286535a7875 Iterator iterator = Direction.Plane.VERTICAL.iterator(); while (iterator.hasNext()) { -@@ -354,7 +473,7 @@ public class RedStoneWireBlock extends Block { +@@ -374,7 +492,7 @@ public class RedStoneWireBlock extends Block { world.updateNeighborsAt(pos.relative(enumdirection), this); } @@ -1146,7 +1127,7 @@ index 7318536fe89cddda305007a9ab115970bf18f65d..e5558b73c6159e4c1901d286535a7875 this.updateNeighborsOfNeighboringWires(world, pos); } } -@@ -389,7 +508,7 @@ public class RedStoneWireBlock extends Block { +@@ -409,7 +527,7 @@ public class RedStoneWireBlock extends Block { public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { if (!world.isClientSide) { if (state.canSurvive(world, pos)) { diff --git a/patches/server-remapped/0561-Fix-hex-colors-not-working-in-some-kick-messages.patch b/patches/server/0505-Fix-hex-colors-not-working-in-some-kick-messages.patch similarity index 82% rename from patches/server-remapped/0561-Fix-hex-colors-not-working-in-some-kick-messages.patch rename to patches/server/0505-Fix-hex-colors-not-working-in-some-kick-messages.patch index dfda54388..b6d9c1b71 100644 --- a/patches/server-remapped/0561-Fix-hex-colors-not-working-in-some-kick-messages.patch +++ b/patches/server/0505-Fix-hex-colors-not-working-in-some-kick-messages.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Fix hex colors not working in some kick messages diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index 6f98be2b9b00f71dd041e7511c70166fdecf0749..c648b73a4c478f9d8020274205d6684f7c7c416f 100644 +index c09d3cdb3acb04b6a833c30a619ff2af5e8b6b18..2384ae5082afd01c4f28fe2f3f782cdce15ff3f2 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -50,7 +50,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - synchronized (throttleTracker) { - if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) { - throttleTracker.put(address, currentTime); + synchronized (ServerHandshakePacketListenerImpl.throttleTracker) { + if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) { + ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime); - TranslatableComponent chatmessage = new TranslatableComponent(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message + Component chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage, true)[0]; // Paper - Configurable connection throttle kick message // Paper - Fix hex colors not working in some kick messages this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage)); @@ -37,16 +37,16 @@ index 6f98be2b9b00f71dd041e7511c70166fdecf0749..c648b73a4c478f9d8020274205d6684f if (event.callEvent()) { // If we've failed somehow, let the client know so and go no further. if (event.isFailed()) { -- chatmessage = new TranslatableComponent(event.getFailMessage()); +- TranslatableComponent chatmessage = new TranslatableComponent(event.getFailMessage()); + Component chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(event.getFailMessage(), true)[0]; // Paper - Fix hex colors not working in some kick messages - this.getNetworkManager().send(new ClientboundLoginDisconnectPacket(chatmessage)); - this.getNetworkManager().disconnect(chatmessage); + this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage)); + this.connection.disconnect(chatmessage); return; diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 659bf14cf3c949b896d0333f893a3d5e16ab9c92..573963a09f15046cfcaab83aef906801ce70d75a 100644 +index 49308829885a473906d58fb17797127faabfcf31..21ed58d746cb0734cc45574888ed03886e7c411a 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -104,14 +104,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -106,14 +106,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // CraftBukkit start @Deprecated public void disconnect(String s) { diff --git a/patches/server-remapped/0562-PortalCreateEvent-needs-to-know-its-entity.patch b/patches/server/0506-PortalCreateEvent-needs-to-know-its-entity.patch similarity index 80% rename from patches/server-remapped/0562-PortalCreateEvent-needs-to-know-its-entity.patch rename to patches/server/0506-PortalCreateEvent-needs-to-know-its-entity.patch index 0287c9ed0..2f93746b8 100644 --- a/patches/server-remapped/0562-PortalCreateEvent-needs-to-know-its-entity.patch +++ b/patches/server/0506-PortalCreateEvent-needs-to-know-its-entity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PortalCreateEvent needs to know its entity diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 04b717326524f400da3562655c25db59e72814ec..a9256fc4a0bc3cd277cb372a9c090028e03482f5 100644 +index c1667fa43194a17eeeb2ac9c5d57daf5cb131958..a994dd9833ff66eef311b637c59f16a57ddcfe5f 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -366,7 +366,7 @@ public final class ItemStack { +@@ -407,7 +407,7 @@ public final class ItemStack { net.minecraft.world.level.block.state.BlockState block = world.getBlockState(newblockposition); if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically @@ -18,10 +18,10 @@ index 04b717326524f400da3562655c25db59e72814ec..a9256fc4a0bc3cd277cb372a9c090028 world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java -index cd005f7dbfcaf3cebae3a92da36e0d40c93dbf79..ad37261e716b15d62fc2083d137cdac818308cdd 100644 +index a36d31caa5bfc82a5fd9b16dc42334955fe7511d..177d1da44c83da5f99ae91891dec41dc210bd31d 100644 --- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java -@@ -7,6 +7,7 @@ import net.minecraft.world.damagesource.DamageSource; +@@ -11,6 +11,7 @@ import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.context.BlockPlaceContext; @@ -29,7 +29,7 @@ index cd005f7dbfcaf3cebae3a92da36e0d40c93dbf79..ad37261e716b15d62fc2083d137cdac8 import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; -@@ -66,20 +67,23 @@ public abstract class BaseFireBlock extends Block { +@@ -141,20 +142,23 @@ public abstract class BaseFireBlock extends Block { super.entityInside(state, world, pos, entity); } @@ -41,7 +41,7 @@ index cd005f7dbfcaf3cebae3a92da36e0d40c93dbf79..ad37261e716b15d62fc2083d137cdac8 + public void onPlace(BlockState iblockdata, Level world, BlockPos blockposition, BlockState iblockdata1, boolean flag, UseOnContext itemActionContext) { + // Paper end + if (!iblockdata1.is(iblockdata.getBlock())) { - if (inPortalDimension(world)) { + if (BaseFireBlock.inPortalDimension(world)) { - Optional optional = PortalShape.findEmptyPortalShape((LevelAccessor) world, pos, Direction.Axis.X); + Optional optional = PortalShape.findEmptyPortalShape((LevelAccessor) world, blockposition, Direction.Axis.X); @@ -53,41 +53,41 @@ index cd005f7dbfcaf3cebae3a92da36e0d40c93dbf79..ad37261e716b15d62fc2083d137cdac8 } - if (!state.canSurvive(world, pos)) { -- fireExtinguished(world, pos); // CraftBukkit - fuel block broke +- this.fireExtinguished(world, pos); // CraftBukkit - fuel block broke + if (!iblockdata.canSurvive(world, blockposition)) { + fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke } } diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java -index ac63c5bef5b35b158e57835d765bbdd15fc60664..e690e7c366fc087d3b28d61323dcc78bb7154aed 100644 +index c86bf175853197dceaa91a2287ef51de87b9d5f9..48d9174f88beb759966bfca4c5861aa25cdb2942 100644 --- a/src/main/java/net/minecraft/world/level/block/FireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java -@@ -15,6 +15,7 @@ import net.minecraft.core.Vec3i; - import net.minecraft.server.MCUtil; +@@ -13,6 +13,7 @@ import net.minecraft.core.Direction; + import net.minecraft.core.Vec3i; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; -@@ -363,9 +364,11 @@ public class FireBlock extends BaseFireBlock { +@@ -358,9 +359,11 @@ public class FireBlock extends BaseFireBlock { } @Override - public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { - super.onPlace(state, world, pos, oldState, notify); -- world.getBlockTicks().a(pos, this, getFireTickDelay(world.random)); +- world.getBlockTicks().scheduleTick(pos, this, FireBlock.getFireTickDelay(world.random)); + // Paper start - ItemActionContext param + public void onPlace(BlockState iblockdata, Level world, BlockPos blockposition, BlockState iblockdata1, boolean flag, UseOnContext itemActionContext) { + super.onPlace(iblockdata, world, blockposition, iblockdata1, flag, itemActionContext); + // Paper end -+ world.getBlockTicks().a(blockposition, this, getFireTickDelay(world.random)); ++ world.getBlockTicks().scheduleTick(blockposition, this, getFireTickDelay(world.random)); } private static int getFireTickDelay(Random random) { diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index df2836b071158729728411f5b228cc38dddd4d4e..f2fefdad26057c722085e60ba837fe2c117f55f7 100644 +index 6d4ef15842c6bd230543de19dd1053a4fe6ad270..597bb3b9b638c59c6ddc21095e4fe4503ef36cb1 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -32,6 +32,7 @@ import net.minecraft.world.item.DyeColor; @@ -98,7 +98,7 @@ index df2836b071158729728411f5b228cc38dddd4d4e..f2fefdad26057c722085e60ba837fe2c import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.EmptyBlockGetter; import net.minecraft.world.level.Level; -@@ -119,6 +120,12 @@ public abstract class BlockBehaviour { +@@ -128,6 +129,12 @@ public abstract class BlockBehaviour { DebugPackets.sendNeighborsUpdatePacket(world, pos); } @@ -112,7 +112,7 @@ index df2836b071158729728411f5b228cc38dddd4d4e..f2fefdad26057c722085e60ba837fe2c public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java -index 7a99adbe39ca2566d42ed67dc9d6f609005f3d6f..500744b6383390266efed9e35a000511210cb5b9 100644 +index b68fa6cb68bb8fa078d4572bad338f43f20e8dc7..c07b5d1f1ef8b5e6026c7555d476880c8802d6c5 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalShape.java @@ -11,6 +11,7 @@ import net.minecraft.tags.BlockTags; @@ -123,7 +123,7 @@ index 7a99adbe39ca2566d42ed67dc9d6f609005f3d6f..500744b6383390266efed9e35a000511 import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.NetherPortalBlock; -@@ -181,7 +182,10 @@ public class PortalShape { +@@ -185,7 +186,10 @@ public class PortalShape { } // CraftBukkit start - return boolean @@ -132,16 +132,15 @@ index 7a99adbe39ca2566d42ed67dc9d6f609005f3d6f..500744b6383390266efed9e35a000511 + @Deprecated public boolean createPortal() { return this.createPortal(null); } + public boolean createPortal(UseOnContext itemActionContext) { + // Paper end - org.bukkit.World bworld = this.level.getLevel().getWorld(); + org.bukkit.World bworld = this.level.getMinecraftWorld().getWorld(); // Copy below for loop -@@ -190,8 +194,7 @@ public class PortalShape { - BlockPos.betweenClosed(this.bottomLeft, this.bottomLeft.relative(Direction.UP, this.height - 1).relative(this.rightDir, this.width - 1)).forEach((blockposition) -> { - blocks.setBlock(blockposition, iblockdata, 18); +@@ -195,7 +199,7 @@ public class PortalShape { + this.blocks.setBlock(blockposition, iblockdata, 18); }); -- -- PortalCreateEvent event = new PortalCreateEvent((java.util.List) (java.util.List) blocks.getList(), bworld, null, PortalCreateEvent.CreateReason.FIRE); + +- PortalCreateEvent event = new PortalCreateEvent((java.util.List) (java.util.List) this.blocks.getList(), bworld, null, PortalCreateEvent.CreateReason.FIRE); + PortalCreateEvent event = new PortalCreateEvent((java.util.List) (java.util.List) blocks.getList(), bworld, itemActionContext == null || itemActionContext.getPlayer() == null ? null : itemActionContext.getPlayer().getBukkitEntity(), PortalCreateEvent.CreateReason.FIRE); // Paper - pass entity param - this.level.getLevel().getServer().server.getPluginManager().callEvent(event); + this.level.getMinecraftWorld().getServer().server.getPluginManager().callEvent(event); if (event.isCancelled()) { diff --git a/patches/server-remapped/0563-Fix-CraftTeam-null-check.patch b/patches/server/0507-Fix-CraftTeam-null-check.patch similarity index 84% rename from patches/server-remapped/0563-Fix-CraftTeam-null-check.patch rename to patches/server/0507-Fix-CraftTeam-null-check.patch index d30a89128..72439c7b4 100644 --- a/patches/server-remapped/0563-Fix-CraftTeam-null-check.patch +++ b/patches/server/0507-Fix-CraftTeam-null-check.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix CraftTeam null check diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java -index 7ebcba4ada42f5599d56cfdeb75dbf62f2a09b78..222e3d4e379fd5ca50c122f70e90ed11b2f5e1f7 100644 +index c2dc4d65170eba2d914cf2efdcc231254fec7c02..3d4d4ae34cfbe32a844c7a4bc6cd6fd32e252297 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java @@ -253,7 +253,7 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @@ -15,5 +15,5 @@ index 7ebcba4ada42f5599d56cfdeb75dbf62f2a09b78..222e3d4e379fd5ca50c122f70e90ed11 - Validate.notNull("Entry cannot be null"); + Validate.notNull(entry, "Entry cannot be null"); // Paper - CraftScoreboard scoreboard = checkState(); + CraftScoreboard scoreboard = this.checkState(); diff --git a/patches/server/0508-Add-more-Evoker-API.patch b/patches/server/0508-Add-more-Evoker-API.patch new file mode 100644 index 000000000..367e900e2 --- /dev/null +++ b/patches/server/0508-Add-more-Evoker-API.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sun, 23 Aug 2020 15:28:35 +0200 +Subject: [PATCH] Add more Evoker API + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java +index 91d07e6996e315734689ea25336992b0ed21cf25..7e861636710aa44ed36e7f20c6320dabb809c35d 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java +@@ -1,5 +1,6 @@ + package org.bukkit.craftbukkit.entity; + ++import net.minecraft.world.entity.animal.Sheep; + import net.minecraft.world.entity.monster.SpellcasterIllager; + import org.bukkit.craftbukkit.CraftServer; + import org.bukkit.entity.EntityType; +@@ -35,4 +36,17 @@ public class CraftEvoker extends CraftSpellcaster implements Evoker { + public void setCurrentSpell(Evoker.Spell spell) { + this.getHandle().setIsCastingSpell(spell == null ? SpellcasterIllager.IllagerSpell.NONE : SpellcasterIllager.IllagerSpell.byId(spell.ordinal())); + } ++ ++ // Paper start ++ @Override ++ public org.bukkit.entity.Sheep getWololoTarget() { ++ Sheep sheep = getHandle().getWololoTarget(); ++ return sheep == null ? null : (org.bukkit.entity.Sheep) sheep.getBukkitEntity(); ++ } ++ ++ @Override ++ public void setWololoTarget(org.bukkit.entity.Sheep sheep) { ++ getHandle().setWololoTarget(sheep == null ? null : ((org.bukkit.craftbukkit.entity.CraftSheep) sheep).getHandle()); ++ } ++ // Paper end + } diff --git a/patches/server-remapped/0565-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch b/patches/server/0509-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch similarity index 65% rename from patches/server-remapped/0565-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch rename to patches/server/0509-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch index 163eac24a..33a500d61 100644 --- a/patches/server-remapped/0565-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch +++ b/patches/server/0509-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add a way to get translation keys for blocks, entities and diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index ae50030df7512c56c552e800b74ef4c69ec6d6d2..d38828485d6deb08036e11d8bf16b3d63a60fbae 100644 +index 872f92ac1a6bc86ce54700dbf555ceea4fab2057..4a663a70235609d2f801b8c6bcecbe59d0ea2e27 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -278,6 +278,7 @@ public class EntityType { +@@ -291,6 +291,7 @@ public class EntityType implements EntityTypeTest { return Registry.ENTITY_TYPE.getKey(type); } @@ -17,7 +17,7 @@ index ae50030df7512c56c552e800b74ef4c69ec6d6d2..d38828485d6deb08036e11d8bf16b3d6 public static Optional> byString(String id) { return Registry.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(id)); } -@@ -431,6 +432,7 @@ public class EntityType { +@@ -445,6 +446,7 @@ public class EntityType implements EntityTypeTest { return this.category; } @@ -25,41 +25,12 @@ index ae50030df7512c56c552e800b74ef4c69ec6d6d2..d38828485d6deb08036e11d8bf16b3d6 public String getDescriptionId() { if (this.descriptionId == null) { this.descriptionId = Util.makeDescriptionId("entity", Registry.ENTITY_TYPE.getKey(this)); -diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java -index 6fce16e89c5492654c891d5754714360a7649bca..58400e84830c93675b0a1fe632be5e217c19a932 100644 ---- a/src/main/java/net/minecraft/world/item/Item.java -+++ b/src/main/java/net/minecraft/world/item/Item.java -@@ -56,7 +56,7 @@ public class Item implements ItemLike { - private final FoodProperties foodProperties; - - public static int getId(Item item) { -- return item == null ? 0 : Registry.ITEM.getId((Object) item); -+ return item == null ? 0 : Registry.ITEM.getId(item); // Paper - Fix Decompiler Issue - } - - public static Item byId(int id) { -@@ -152,6 +152,7 @@ public class Item implements ItemLike { - return Registry.ITEM.getKey(this).getPath(); - } - -+ public String getOrCreateDescriptionId() { return getOrCreateDescriptionId(); } // Paper - OBFHELPER - protected String getOrCreateDescriptionId() { - if (this.descriptionId == null) { - this.descriptionId = Util.makeDescriptionId("item", Registry.ITEM.getKey(this)); -@@ -164,6 +165,7 @@ public class Item implements ItemLike { - return this.getOrCreateDescriptionId(); - } - -+ public String getDescriptionId(ItemStack itemStack) { return getDescriptionId(itemStack); } // Paper - OBFHELPER - public String getDescriptionId(ItemStack stack) { - return this.getDescriptionId(); - } diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index 5b84ee4091e354c4b6500f58a31931f2a6827ffc..baa587e73a71d6324bb7817fa4702a7c3a2db726 100644 +index 878cdfc49253e7916d038495f79fec7cce75aa50..85fa2b26863e2da8f4de93aa10ffd77f7076b682 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -318,6 +318,7 @@ public class Block extends BlockBehaviour implements ItemLike { - return !this.material.isBuildable() && !this.material.isLiquid(); +@@ -427,6 +427,7 @@ public class Block extends BlockBehaviour implements ItemLike { + return new TranslatableComponent(this.getDescriptionId()); } + public String getOrCreateDescriptionId() { return getDescriptionId(); } // Paper - OBFHELPER @@ -67,10 +38,10 @@ index 5b84ee4091e354c4b6500f58a31931f2a6827ffc..baa587e73a71d6324bb7817fa4702a7c if (this.descriptionId == null) { this.descriptionId = Util.makeDescriptionId("block", Registry.BLOCK.getKey(this)); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 05f0833f762436bf8f5f5875c7e3cfed1da11e1c..e09f65f0b06c8fb9a965b921c2c8e68ae2ac1e55 100644 +index 64c304cab8c7c4c9c29f73465f99c11f224a72bd..b31eaa1459690d7f54989ba7a01f96a3f0d8d3b9 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -761,5 +761,10 @@ public class CraftBlock implements Block { +@@ -777,5 +777,10 @@ public class CraftBlock implements Block { public com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup() { return new com.destroystokyo.paper.block.CraftBlockSoundGroup(getNMSBlock().defaultBlockState().getSoundType()); } @@ -82,7 +53,7 @@ index 05f0833f762436bf8f5f5875c7e3cfed1da11e1c..e09f65f0b06c8fb9a965b921c2c8e68a // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index a5a5038a84434e69fda8f6b41d2f00b4989e25ae..de5d02a1345f9886200f0540ac08be0df5878708 100644 +index 88d5c7a0d7de2e896433d85fbd5425351f51b64d..1e387ba8552484b10ae276e1eea47d77d121e19d 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -43,6 +43,7 @@ import org.bukkit.Registry;