more patches
Dieser Commit ist enthalten in:
Ursprung
f72886c9a6
Commit
5dce4d9178
@ -5,7 +5,7 @@ Subject: [PATCH] Enable multi-release plugin jars
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
index 11e5618ff66385574ba04db0942a75227cf8eb0f..c833cee9fddd12afdfe6bde1435559819b9ad656 100644
|
||||
index 6b5d7c350c216b7a234d96ecacae1d39a1acd814..18cf36020bca7c174a775de75241f149ef4e45e7 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -58,7 +58,18 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
@ -9,10 +9,10 @@ process to do this in the Bukkit API
|
||||
Adds API for buildable, replaceable, burnable too.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 6933fd6ad353a2d008c4a64c52a64bf36bd8035c..0c72d00ad238ab69d7ae0941e3ecb6c86e71624d 100644
|
||||
index e759a03ccf7b341db36f455879e0004a6d6d4d07..b3c127a3d4c554c08e500497a54755e626342dd3 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -427,6 +427,42 @@ public interface Block extends Metadatable {
|
||||
@@ -428,6 +428,42 @@ public interface Block extends Metadatable {
|
||||
*/
|
||||
boolean isLiquid();
|
||||
|
@ -3,6 +3,7 @@ From: lukas <lukasalt98@gmail.com>
|
||||
Date: Sun, 27 Dec 2020 17:19:51 +0100
|
||||
Subject: [PATCH] Optimized tick ready check
|
||||
|
||||
1.17: Needs to be reworked or dropped
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 066d5f7ee93351bff67c0d39ee9d940ac51515d8..b89cefc8890774dbc64fd6bddeb038d2ee36d485 100644
|
@ -1,70 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 16 Nov 2020 12:01:52 -0800
|
||||
Subject: [PATCH] Added missing default perms for commands
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
||||
index d5f4ece060b61de9ca5292d1f2411c709de5ece2..f0a57d225b81a505ff12425155ba838d8fad990c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
||||
@@ -31,6 +31,59 @@ public final class CommandPermissions {
|
||||
DefaultPermissions.registerPermission(PREFIX + "effect", "Allows the user to add/remove effects on players", PermissionDefault.OP, commands);
|
||||
DefaultPermissions.registerPermission(PREFIX + "selector", "Allows the use of selectors", PermissionDefault.OP, commands);
|
||||
DefaultPermissions.registerPermission(PREFIX + "trigger", "Allows the use of the trigger command", PermissionDefault.TRUE, commands);
|
||||
+ // Paper start
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "attribute", "Allows the user to query, add, remove or set an entity attribute", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "advancement", "Allows the user to give, remove, or check player advancements", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "ban", "Allows the user to add players to banlist", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "ban-ip", "Allows the user to add ip address to banlist", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "banlist", "Allows the user to display banlist", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "bossbar", "Allows the user to create and modify bossbars", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "clear", "Allows the user to clear items from player inventory", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "clone", "Allows the user to copy blocks from one place to another", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "data", "Allows the user to get, merge, modify, and remove block entity and entity NBT data", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "datapack", "Allows the user to control loaded data packs", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "debug", "Allows the user to start or stop a debugging session", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "deop", "Allows the user to revoke operator status from a player", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "difficulty", "Allows the user to set the difficulty level", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "enchant", "Allows the user to enchant a player item", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "execute", "Allows the user to execute another command", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "fill", "Allows the user to fill a region with a specific block", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "forceload", "Allows the user to force chunks to be constantly loaded or not", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "function", "Allows the user to run a function", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "gamerule", "Allows a user to set or query a game rule value", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "locate", "Allows the user to locate the closest structure", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "locatebiome", "Allows the user to locate the closest biome", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "loot", "Allows the user to drop items from an inventory slot onto the ground", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "op", "Allows the user to grant operator status to a player", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "pardon", "Allows the user to remove entries from the banlist", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "particle", "Allows the user to create particles", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "playsound", "Allows the user to play a sound", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "recipe", "Allows the user to give or take recipes", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "reload", "Allows the user to reload loot tables, advancements, and functions from disk", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "replaceitem", "Allows the user to replace items in inventories", PermissionDefault.OP, commands); // Remove in 1.17 (replaced by /item)
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "save-all", "Allows the user to save the server to disk", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "save-off", "Allows the user disable automatic server saves", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "save-on", "Allows the user enable automatic server saves", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "schedule", "Allows the user to delay the execution of a function", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "scoreboard", "Allows the user manage scoreboard objectives and players", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "setblock", "Allows the user to change a block to another block", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "setidletimeout", "Allows the user to set the time before idle players are kicked", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "setworldspawn", "Allows the user to set the world spawn", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "spawnpoint", "Allows the user to set the spawn point for a player", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "spectate", "Allows the user to make one player in spectator mode spectate an entity", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "spreadplayers", "Allows the user to teleport entities to random locations", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "stopsound", "Allows the user to stop a sound", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "summon", "Allows the user to summon an entity", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "tag", "Allows the user to control entity tags", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "team", "Allows the user to control teams", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "teammsg", "Allows the user to specify the message to send to team", PermissionDefault.TRUE, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "tellraw", "Allows the user to display a JSON message to players", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "time", "Allows the user to change or query the world's game time", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "title", "Allows the user to manage screen titles", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "weather", "Allows the user to set the weather", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "whitelist", "Allows the user to manage the server whitelist", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(PREFIX + "worldborder", "Allows the user to manage the world border", PermissionDefault.OP, commands);
|
||||
+ // Paper end
|
||||
|
||||
DefaultPermissions.registerPermission("minecraft.admin.command_feedback", "Receive command broadcasts when sendCommandFeedback is true", PermissionDefault.OP, commands);
|
||||
|
@ -1,116 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JRoy <joshroy126@gmail.com>
|
||||
Date: Thu, 27 Aug 2020 15:02:48 -0400
|
||||
Subject: [PATCH] Add PlayerShearBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
||||
index 1a01937f5250f3a529932dc2fdd9e1ebd9ae896a..125e646b39ef4a59be3989df16b5625c5504aac1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.world.level.block;
|
||||
|
||||
+import io.papermc.paper.event.block.PlayerShearBlockEvent; // Paper - PlayerShearBlockEvent namespace conflicts
|
||||
+
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -10,6 +12,7 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
+import net.minecraft.server.MCUtil;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
@@ -116,8 +119,19 @@ public class BeehiveBlock extends BaseEntityBlock {
|
||||
|
||||
if (i >= 5) {
|
||||
if (itemstack.getItem() == Items.SHEARS) {
|
||||
+ // Paper start - Add PlayerShearBlockEvent
|
||||
+ PlayerShearBlockEvent event = new PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), MCUtil.toBukkitBlock(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (hand == InteractionHand.OFF_HAND ? org.bukkit.inventory.EquipmentSlot.OFF_HAND : org.bukkit.inventory.EquipmentSlot.HAND), new java.util.ArrayList<>());
|
||||
+ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.HONEYCOMB, 3)));
|
||||
+ if (!event.callEvent()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end
|
||||
world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.NEUTRAL, 1.0F, 1.0F);
|
||||
- dropHoneycomb(world, pos);
|
||||
+ // Paper start - Add PlayerShearBlockEvent
|
||||
+ for (org.bukkit.inventory.ItemStack item : event.getDrops()) {
|
||||
+ dropItem(world, pos, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item));
|
||||
+ }
|
||||
+ // Paper end
|
||||
itemstack.hurtAndBreak(1, player, (entityhuman1) -> {
|
||||
entityhuman1.broadcastBreakEvent(hand);
|
||||
});
|
||||
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 baa587e73a71d6324bb7817fa4702a7c3a2db726..5f1853c3f22661809437bdb49f002482da7195f2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -262,13 +262,13 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
|
||||
}
|
||||
|
||||
- public static void popResource(Level world, BlockPos pos, ItemStack stack) {
|
||||
- if (!world.isClientSide && !stack.isEmpty() && world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
|
||||
+ public static void popResource(Level world, BlockPos pos, ItemStack stack) { dropItem(world, pos, stack); } public static void dropItem(Level world, BlockPos blockposition, ItemStack itemstack) { // Paper - OBFHELPER
|
||||
+ if (!world.isClientSide && !itemstack.isEmpty() && world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
|
||||
float f = 0.5F;
|
||||
double d0 = (double) (world.random.nextFloat() * 0.5F) + 0.25D;
|
||||
double d1 = (double) (world.random.nextFloat() * 0.5F) + 0.25D;
|
||||
double d2 = (double) (world.random.nextFloat() * 0.5F) + 0.25D;
|
||||
- ItemEntity entityitem = new ItemEntity(world, (double) pos.getX() + d0, (double) pos.getY() + d1, (double) pos.getZ() + d2, stack);
|
||||
+ ItemEntity entityitem = new ItemEntity(world, (double) blockposition.getX() + d0, (double) blockposition.getY() + d1, (double) blockposition.getZ() + d2, itemstack);
|
||||
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
// CraftBukkit start
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
|
||||
index fe528f7dee693982285ce035abd9929cb4e0cbdf..7cac13ad06ee7acfc3bdcbf79318dbfbd2a31e02 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.world.level.block;
|
||||
|
||||
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.world.InteractionHand;
|
||||
@@ -14,6 +15,7 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
+import io.papermc.paper.event.block.PlayerShearBlockEvent; // Paper - PlayerShearBlockEvent namespace conflicts
|
||||
|
||||
public class PumpkinBlock extends StemGrownBlock {
|
||||
|
||||
@@ -27,15 +29,26 @@ public class PumpkinBlock extends StemGrownBlock {
|
||||
|
||||
if (itemstack.getItem() == Items.SHEARS) {
|
||||
if (!world.isClientSide) {
|
||||
+ // Paper start - Add PlayerShearBlockEvent
|
||||
+ PlayerShearBlockEvent event = new PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), MCUtil.toBukkitBlock(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (hand == InteractionHand.OFF_HAND ? org.bukkit.inventory.EquipmentSlot.OFF_HAND : org.bukkit.inventory.EquipmentSlot.HAND), new java.util.ArrayList<>());
|
||||
+ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.PUMPKIN_SEEDS, 4)));
|
||||
+ if (!event.callEvent()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end
|
||||
Direction enumdirection = hit.getDirection();
|
||||
Direction enumdirection1 = enumdirection.getAxis() == Direction.Axis.Y ? player.getDirection().getOpposite() : enumdirection;
|
||||
|
||||
world.playSound((Player) null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
world.setBlock(pos, (BlockState) Blocks.CARVED_PUMPKIN.defaultBlockState().setValue(CarvedPumpkinBlock.FACING, enumdirection1), 11);
|
||||
- ItemEntity entityitem = new ItemEntity(world, (double) pos.getX() + 0.5D + (double) enumdirection1.getStepX() * 0.65D, (double) pos.getY() + 0.1D, (double) pos.getZ() + 0.5D + (double) enumdirection1.getStepZ() * 0.65D, new ItemStack(Items.PUMPKIN_SEEDS, 4));
|
||||
+ // Paper start - Add PlayerShearBlockEvent
|
||||
+ for (org.bukkit.inventory.ItemStack item : event.getDrops()) {
|
||||
+ ItemEntity entityitem = new ItemEntity(world, (double) pos.getX() + 0.5D + (double) enumdirection1.getStepX() * 0.65D, (double) pos.getY() + 0.1D, (double) pos.getZ() + 0.5D + (double) enumdirection1.getStepZ() * 0.65D, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item));
|
||||
+ // Paper end
|
||||
|
||||
entityitem.setDeltaMovement(0.05D * (double) enumdirection1.getStepX() + world.random.nextDouble() * 0.02D, 0.05D, 0.05D * (double) enumdirection1.getStepZ() + world.random.nextDouble() * 0.02D);
|
||||
world.addFreshEntity(entityitem);
|
||||
+ } // Paper - Add PlayerShearBlockEvent
|
||||
itemstack.hurtAndBreak(1, player, (entityhuman1) -> {
|
||||
entityhuman1.broadcastBreakEvent(hand);
|
||||
});
|
@ -1,84 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 8 Dec 2020 20:24:52 -0600
|
||||
Subject: [PATCH] MC-4: Fix item position desync
|
||||
|
||||
This fixes item position desync (MC-4) by running the item coordinates
|
||||
through the encode/decode methods of the packet that causes the precision
|
||||
loss, which forces the server to lose the same precision as the client
|
||||
keeping them in sync.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 652d87fc5d566dba8018c81676329f0e0bca471b..c56e7fb18f9a56c8025eb70a524f028b5942da37 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -474,4 +474,9 @@ public class PaperConfig {
|
||||
private static void trackPluginScoreboards() {
|
||||
trackPluginScoreboards = getBoolean("settings.track-plugin-scoreboards", false);
|
||||
}
|
||||
+
|
||||
+ public static boolean fixEntityPositionDesync = true;
|
||||
+ private static void fixEntityPositionDesync() {
|
||||
+ fixEntityPositionDesync = getBoolean("settings.fix-entity-position-desync", fixEntityPositionDesync);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java
|
||||
index cb10c87728b5f9062c4bdd1fe5e4b2c7a558f323..6b97d60d923e772c7284e674bc3f2e9a5a0ddead 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java
|
||||
@@ -19,11 +19,11 @@ public class ClientboundMoveEntityPacket implements Packet<ClientGamePacketListe
|
||||
protected boolean hasPos;
|
||||
|
||||
public static long entityToPacket(double coord) {
|
||||
- return Mth.lfloor(coord * 4096.0D);
|
||||
+ return Mth.lfloor(coord * 4096.0D); // Paper - check EntityItem#setPositionRaw on update
|
||||
}
|
||||
|
||||
public static Vec3 packetToEntity(long x, long y, long z) {
|
||||
- return (new Vec3((double) x, (double) y, (double) z)).scale(2.44140625E-4D);
|
||||
+ return (new Vec3((double) x, (double) y, (double) z)).scale(2.44140625E-4D); // Paper - check EntityItem#setPositionRaw on update
|
||||
}
|
||||
|
||||
public ClientboundMoveEntityPacket() {}
|
||||
diff --git a/src/main/java/net/minecraft/util/Mth.java b/src/main/java/net/minecraft/util/Mth.java
|
||||
index a595617fb8efd8fd399f14b5f48ced7c040bb0f4..18cd1b6965ef042ecd4e3afc758ae046aee3bf22 100644
|
||||
--- a/src/main/java/net/minecraft/util/Mth.java
|
||||
+++ b/src/main/java/net/minecraft/util/Mth.java
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.core.Vec3i;
|
||||
public class Mth {
|
||||
|
||||
public static final float SQRT_OF_TWO = sqrt(2.0F);
|
||||
- private static final float[] SIN = (float[]) Util.make((Object) (new float[65536]), (afloat) -> {
|
||||
+ private static final float[] SIN = (float[]) Util.make((new float[65536]), (afloat) -> { // Paper - decompile error
|
||||
for (int i = 0; i < afloat.length; ++i) {
|
||||
afloat[i] = (float) Math.sin((double) i * 3.141592653589793D * 2.0D / 65536.0D);
|
||||
}
|
||||
@@ -49,6 +49,7 @@ public class Mth {
|
||||
return d0 < (double) i ? i - 1 : i;
|
||||
}
|
||||
|
||||
+ public static long floorLong(double d0) { return lfloor(d0); } // Paper - OBFHELPER
|
||||
public static long lfloor(double d0) {
|
||||
long i = (long) d0;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index 9311f9f411d09d4460f0be8235957fab9e195b7a..7476ae301fb4ee503944d39022cb25ccb19f1232 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -549,4 +549,16 @@ public class ItemEntity extends Entity {
|
||||
public Packet<?> getAddEntityPacket() {
|
||||
return new ClientboundAddEntityPacket(this);
|
||||
}
|
||||
+
|
||||
+ // Paper start - fix MC-4
|
||||
+ public void setPosRaw(double x, double y, double z) {
|
||||
+ if (com.destroystokyo.paper.PaperConfig.fixEntityPositionDesync) {
|
||||
+ // encode/decode from PacketPlayOutEntity
|
||||
+ x = Mth.floorLong(x * 4096.0D) * (1 / 4096.0D);
|
||||
+ y = Mth.floorLong(y * 4096.0D) * (1 / 4096.0D);
|
||||
+ z = Mth.floorLong(z * 4096.0D) * (1 / 4096.0D);
|
||||
+ }
|
||||
+ super.setPosRaw(x, y, z);
|
||||
+ }
|
||||
+ // Paper end - fix MC-4
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: ysl3000 <yannicklamprecht@live.de>
|
||||
Date: Mon, 5 Oct 2020 21:25:16 +0200
|
||||
Subject: [PATCH] Player Chunk Load/Unload Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 1b5f24920c46cd238a79f5a2857d26fa1c12b983..ff831ca0cbc0cabbf78178c609ccf70d78da7980 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -136,6 +136,8 @@ import net.minecraft.world.level.dimension.DimensionType;
|
||||
import net.minecraft.world.level.portal.PortalInfo;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
+import io.papermc.paper.event.packet.PlayerChunkLoadEvent; // Paper
|
||||
+import io.papermc.paper.event.packet.PlayerChunkUnloadEvent; // Paper
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import net.minecraft.world.Container;
|
||||
@@ -2095,11 +2097,21 @@ public class ServerPlayer extends Player implements ContainerListener {
|
||||
public void trackChunk(ChunkPos chunkcoordintpair, Packet<?> packet, Packet<?> packet1) {
|
||||
this.connection.send(packet1);
|
||||
this.connection.send(packet);
|
||||
+ // Paper start
|
||||
+ if(PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0){
|
||||
+ new PlayerChunkLoadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkcoordintpair.longKey), this.getBukkitEntity()).callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public void untrackChunk(ChunkPos chunkcoordintpair) {
|
||||
if (this.isAlive()) {
|
||||
this.connection.send(new ClientboundForgetLevelChunkPacket(chunkcoordintpair.x, chunkcoordintpair.z));
|
||||
+ // Paper start
|
||||
+ if(PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0){
|
||||
+ new PlayerChunkUnloadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkcoordintpair.longKey), this.getBukkitEntity()).callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||
Date: Sun, 13 Dec 2020 05:32:05 +0200
|
||||
Subject: [PATCH] Expose LivingEntity hurt direction
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 57b933afdbb2136ed48170da6945eb2b92edb4db..02ddb84c563b3149c4f1b0e24899ce8a21ad61bb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -160,7 +160,7 @@ public abstract class LivingEntity extends Entity {
|
||||
public int removeStingerTime;
|
||||
public int hurtTime;
|
||||
public int hurtDuration;
|
||||
- public float hurtDir;
|
||||
+ public float hurtDir; public final float getHurtDirection() { return hurtDir; } public final void setHurtDirection(float hurtDirection) { this.hurtDir = hurtDirection; } // Paper - OBFHELPER
|
||||
public int deathTime;
|
||||
public float oAttackAnim;
|
||||
public float attackAnim;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 170bb1124ee396a85dd64baed8110e39823ad849..a8d21382d5859edfd12e01a48924ce780790b4b7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -818,5 +818,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public void playPickupItemAnimation(org.bukkit.entity.Item item, int quantity) {
|
||||
getHandle().take(((CraftItem) item).getHandle(), quantity);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public float getHurtDirection() {
|
||||
+ return getHandle().getHurtDirection();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setHurtDirection(float hurtDirection) {
|
||||
+ getHandle().setHurtDirection(hurtDirection);
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 2 Jul 2020 16:12:10 -0700
|
||||
Subject: [PATCH] added PlayerTradeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 40ab66f888f30a5506e3aa96a4b32485452e8978..87dd6c012bf1ca6a1e8df44dc0957c4c67d02adc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -91,7 +91,7 @@ import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
public abstract class Mob extends LivingEntity {
|
||||
|
||||
private static final EntityDataAccessor<Byte> DATA_MOB_FLAGS_ID = SynchedEntityData.defineId(Mob.class, EntityDataSerializers.BYTE);
|
||||
- public int ambientSoundTime;
|
||||
+ public int ambientSoundTime;public void setAmbientSoundTime(int time) { this.ambientSoundTime = time; } // Paper - OBFHELPER
|
||||
protected int xpReward;
|
||||
protected LookControl lookControl;
|
||||
protected MoveControl moveControl;
|
||||
@@ -293,6 +293,7 @@ public abstract class Mob extends LivingEntity {
|
||||
this.entityData.define(Mob.DATA_MOB_FLAGS_ID, (byte) 0);
|
||||
}
|
||||
|
||||
+ public int getAmbientSoundInterval() { return getAmbientSoundInterval(); } // Paper - OBFHELPER
|
||||
public int getAmbientSoundInterval() {
|
||||
return 80;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
index 335000713279b7964c5172937483678c671bfed1..d31b773f8aff09c9f214662aa3aa0c904119e12c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
@@ -37,6 +37,9 @@ import org.bukkit.craftbukkit.inventory.CraftMerchant;
|
||||
import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe;
|
||||
import org.bukkit.event.entity.VillagerAcquireTradeEvent;
|
||||
// CraftBukkit end
|
||||
+// Paper start
|
||||
+import io.papermc.paper.event.player.PlayerTradeEvent;
|
||||
+// Paper end
|
||||
|
||||
public abstract class AbstractVillager extends AgableMob implements Npc, Merchant {
|
||||
|
||||
@@ -133,16 +136,27 @@ public abstract class AbstractVillager extends AgableMob implements Npc, Merchan
|
||||
|
||||
@Override
|
||||
public void notifyTrade(MerchantOffer offer) {
|
||||
- offer.increaseUses();
|
||||
- this.ambientSoundTime = -this.getAmbientSoundInterval();
|
||||
- this.rewardTradeXp(offer);
|
||||
+ // Paper - moved down
|
||||
+ // Paper start
|
||||
if (this.tradingPlayer instanceof ServerPlayer) {
|
||||
- CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, offer.getResult());
|
||||
+ PlayerTradeEvent event = new PlayerTradeEvent(((ServerPlayer) this.tradingPlayer).getBukkitEntity(), (org.bukkit.entity.AbstractVillager) this.getBukkitEntity(), offer.asBukkit(), true, true);
|
||||
+ event.callEvent();
|
||||
+ if (!event.isCancelled()) {
|
||||
+ MerchantOffer recipe = CraftMerchantRecipe.fromBukkit(event.getTrade()).toMinecraft();
|
||||
+ if (event.willIncreaseTradeUses()) recipe.increaseUses();
|
||||
+ this.setAmbientSoundTime(-getAmbientSoundInterval());
|
||||
+ if (event.isRewardingExp()) this.rewardTradeXp(recipe);
|
||||
+ CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, recipe.getResult());
|
||||
+ }
|
||||
+ } else {
|
||||
+ offer.increaseUses();
|
||||
+ this.setAmbientSoundTime(-getAmbientSoundInterval());
|
||||
+ this.rewardTradeXp(offer);
|
||||
}
|
||||
-
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
- protected abstract void rewardTradeXp(MerchantOffer offer);
|
||||
+ protected abstract void rewardTradeXp(MerchantOffer offer); public void rewardTradeXp(MerchantOffer merchantrecipe) { this.rewardTradeXp(merchantrecipe); } // Paper - OBFHELPER
|
||||
|
||||
@Override
|
||||
public boolean showProgressBar() {
|
@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: jmp <jasonpenilla2@me.com>
|
||||
Date: Wed, 25 Nov 2020 23:20:44 -0800
|
||||
Subject: [PATCH] Implement TargetHitEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TargetBlock.java b/src/main/java/net/minecraft/world/level/block/TargetBlock.java
|
||||
index bbaf90b30b07c97321541b8fe15d47975a34161d..a7215c9b9f0f191bbfe95cb1185c99a8d21ff785 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TargetBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TargetBlock.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.world.level.block;
|
||||
|
||||
+import io.papermc.paper.event.block.TargetHitEvent; // Paper - Need to import because 'io' class exists in nms
|
||||
import java.util.Random;
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -34,13 +35,17 @@ public class TargetBlock extends Block {
|
||||
@Override
|
||||
public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) {
|
||||
int i = updateRedstoneOutput((LevelAccessor) world, state, hit, (Entity) projectile);
|
||||
- Entity entity = projectile.getOwner();
|
||||
+ // Paper start
|
||||
+ }
|
||||
+ private static void awardTargetHitCriteria(Projectile iprojectile, BlockHitResult movingobjectpositionblock, int i) {
|
||||
+ // Paper end
|
||||
+ Entity entity = iprojectile.getOwner();
|
||||
|
||||
if (entity instanceof ServerPlayer) {
|
||||
ServerPlayer entityplayer = (ServerPlayer) entity;
|
||||
|
||||
entityplayer.awardStat(Stats.TARGET_HIT);
|
||||
- CriteriaTriggers.TARGET_BLOCK_HIT.trigger(entityplayer, projectile, hit.getLocation(), i);
|
||||
+ CriteriaTriggers.TARGET_BLOCK_HIT.trigger(entityplayer, iprojectile, movingobjectpositionblock.getLocation(), i);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,6 +54,20 @@ public class TargetBlock extends Block {
|
||||
int i = getRedstoneStrength(movingobjectpositionblock, movingobjectpositionblock.getLocation());
|
||||
int j = entity instanceof AbstractArrow ? 20 : 8;
|
||||
|
||||
+ // Paper start
|
||||
+ if (entity instanceof Projectile) {
|
||||
+ final Projectile projectile = (Projectile) entity;
|
||||
+ final org.bukkit.craftbukkit.block.CraftBlock craftBlock = org.bukkit.craftbukkit.block.CraftBlock.at(world, movingobjectpositionblock.getBlockPos());
|
||||
+ final org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(movingobjectpositionblock.getDirection());
|
||||
+ final TargetHitEvent targetHitEvent = new TargetHitEvent((org.bukkit.entity.Projectile) projectile.getBukkitEntity(), craftBlock, blockFace, i);
|
||||
+ if (targetHitEvent.callEvent()) {
|
||||
+ i = targetHitEvent.getSignalStrength();
|
||||
+ awardTargetHitCriteria(projectile, movingobjectpositionblock, i);
|
||||
+ } else {
|
||||
+ return i;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
if (!world.getBlockTicks().a(movingobjectpositionblock.getBlockPos(), state.getBlock())) {
|
||||
setOutputPower(world, state, i, movingobjectpositionblock.getBlockPos(), j);
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: lukas <lukasalt98@gmail.com>
|
||||
Date: Sun, 27 Dec 2020 16:47:00 +0100
|
||||
Subject: [PATCH] Cache burn durations
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index 4126a36dbc7750108a883f0be14dcb0d2e6d7ae8..f47b46cebd43faa509b8139d2a51cc8f87615893 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.world.level.block.entity;
|
||||
|
||||
+import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
|
||||
@@ -111,7 +112,15 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
this.recipeType = recipeType;
|
||||
}
|
||||
|
||||
+ private static Map<Item, Integer> cachedBurnDurations = null; // Paper - cache burn durations
|
||||
+
|
||||
+ public static Map<Item, Integer> getBurnDurations() { return getFuel(); } // Paper - OBFHELPER
|
||||
public static Map<Item, Integer> getFuel() {
|
||||
+ // Paper start - cache burn durations
|
||||
+ if(cachedBurnDurations != null) {
|
||||
+ return cachedBurnDurations;
|
||||
+ }
|
||||
+ // Paper end
|
||||
Map<Item, Integer> map = Maps.newLinkedHashMap();
|
||||
|
||||
add(map, (ItemLike) Items.LAVA_BUCKET, 20000);
|
||||
@@ -174,7 +183,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
add(map, (ItemLike) Blocks.FLETCHING_TABLE, 300);
|
||||
add(map, (ItemLike) Blocks.SMITHING_TABLE, 300);
|
||||
add(map, (ItemLike) Blocks.COMPOSTER, 300);
|
||||
- return map;
|
||||
+ // Paper start - cache burn durations
|
||||
+ cachedBurnDurations = ImmutableMap.copyOf(map);
|
||||
+ return cachedBurnDurations;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
// CraftBukkit start - add fields and methods
|
||||
@@ -428,7 +440,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
} else {
|
||||
Item item = fuel.getItem();
|
||||
|
||||
- return (Integer) getFuel().getOrDefault(item, 0);
|
||||
+ return getBurnDurations().getOrDefault(item, 0); // Paper - cache burn durations
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,7 +453,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
// Paper end
|
||||
|
||||
public static boolean isFuel(ItemStack stack) {
|
||||
- return getFuel().containsKey(stack.getItem());
|
||||
+ return getBurnDurations().containsKey(stack.getItem()); // Paper - cache burn durations
|
||||
}
|
||||
|
||||
@Override
|
@ -1,44 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 18 Nov 2020 11:32:46 -0800
|
||||
Subject: [PATCH] Zombie API - breaking doors
|
||||
|
||||
|
||||
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 4105c1763d25824aac35d305a793823c1604eee8..77634a1e8e7539000f7db0b96f4548137af1a819 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -137,10 +137,12 @@ public class Zombie extends Monster {
|
||||
return (Boolean) this.getEntityData().get(Zombie.DATA_DROWNED_CONVERSION_ID);
|
||||
}
|
||||
|
||||
+ public boolean canBreakDoors() { return this.canBreakDoors(); } // Paper - OBFHELPER
|
||||
public boolean canBreakDoors() {
|
||||
return this.canBreakDoors;
|
||||
}
|
||||
|
||||
+ public void setCanBreakDoors(boolean canBreakDoors) { this.setCanBreakDoors(canBreakDoors); } // Paper - OBFHELPER
|
||||
public void setCanBreakDoors(boolean canBreakDoors) {
|
||||
if (this.supportsBreakDoorGoal() && GoalUtils.hasGroundPathNavigation(this)) {
|
||||
if (this.canBreakDoors != canBreakDoors) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
||||
index 86f65c07806a118c49e900c59be86c2bd2eb124c..44f21b3b1c2f2fbc1f3f53931349b9a9426e97f8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
||||
@@ -128,6 +128,16 @@ public class CraftZombie extends CraftMonster implements Zombie {
|
||||
public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
||||
getHandle().setShouldBurnInDay(shouldBurnInDay);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canBreakDoors() {
|
||||
+ return getHandle().canBreakDoors();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCanBreakDoors(boolean canBreakDoors) {
|
||||
+ getHandle().setCanBreakDoors(canBreakDoors);
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@Override
|
@ -1,60 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JRoy <joshroy126@gmail.com>
|
||||
Date: Wed, 7 Oct 2020 12:04:01 -0400
|
||||
Subject: [PATCH] Add EntityLoadCrossbowEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
index e1e58b7035e6dbafdad0a04cc5333464fc4febb8..32e927375daeaf16f4ea763bc9f7c4a244797bba 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
@@ -3,6 +3,8 @@ package net.minecraft.world.item;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Quaternion;
|
||||
import com.mojang.math.Vector3f;
|
||||
+import org.bukkit.inventory.EquipmentSlot; // Paper
|
||||
+import io.papermc.paper.event.entity.EntityLoadCrossbowEvent; // Paper - EntityLoadCrossbowEvent namespace conflicts
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Predicate;
|
||||
@@ -73,7 +75,11 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
|
||||
int j = this.getUseDuration(stack) - remainingUseTicks;
|
||||
float f = getPowerForTime(j, stack);
|
||||
|
||||
- if (f >= 1.0F && !isCharged(stack) && tryLoadProjectiles(user, stack)) {
|
||||
+ // Paper start - EntityLoadCrossbowEvent
|
||||
+ if (f >= 1.0F && !isCharged(stack) /*&& a(entityliving, itemstack)*/) {
|
||||
+ final EntityLoadCrossbowEvent event = new EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), user.getUsedItemHand() == InteractionHand.MAIN_HAND ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND);
|
||||
+ if (!event.callEvent() || !attemptProjectileLoad(user, stack, event.shouldConsumeItem())) return;
|
||||
+ // Paper end
|
||||
setCharged(stack, true);
|
||||
SoundSource soundcategory = user instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE;
|
||||
|
||||
@@ -82,11 +88,14 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
|
||||
|
||||
}
|
||||
|
||||
- private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack projectile) {
|
||||
- int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, projectile);
|
||||
+ private static boolean attemptProjectileLoad(LivingEntity ent, ItemStack bow) { return tryLoadProjectiles(ent, bow); } // Paper - EntityLoadCrossbowEvent - OBFHELPER
|
||||
+ private static boolean attemptProjectileLoad(LivingEntity ent, ItemStack bow, boolean consume) { return a(ent, bow, consume); } // Paper - EntityLoadCrossbowEvent - OBFHELPER
|
||||
+ private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack projectile) { return a(shooter, projectile, true); };// Paper - add consume
|
||||
+ private static boolean a(LivingEntity entityliving, ItemStack itemstack, boolean consume) { // Paper - add consume
|
||||
+ int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, itemstack);
|
||||
int j = i == 0 ? 1 : 3;
|
||||
- boolean flag = shooter instanceof Player && ((Player) shooter).abilities.instabuild;
|
||||
- ItemStack itemstack1 = shooter.getProjectile(projectile);
|
||||
+ boolean flag = !consume || entityliving instanceof Player && ((Player) entityliving).abilities.instabuild; // Paper - add consme
|
||||
+ ItemStack itemstack1 = entityliving.getProjectile(itemstack);
|
||||
ItemStack itemstack2 = itemstack1.copy();
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
@@ -103,7 +112,7 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
- if (!loadProjectile(shooter, projectile, itemstack1, k > 0, flag)) {
|
||||
+ if (!loadProjectile(entityliving, itemstack, itemstack1, k > 0, flag)) {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Gabscap <git@gabscap.de>
|
||||
Date: Sat, 19 Mar 2016 22:25:11 +0100
|
||||
Subject: [PATCH] Guardian beam workaround
|
||||
|
||||
This patch is a workaround for MC-165595
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
|
||||
index a02f492c279f4e859b44d52e150a2990cbe8275a..4f177e7396db00db56f2106068fc02b9c2618407 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.network.protocol.Packet;
|
||||
|
||||
public class ClientboundSetTimePacket implements Packet<ClientGamePacketListener> {
|
||||
|
||||
- private long gameTime;
|
||||
+ private long gameTime; private final void setWorldAge(final long age) { this.gameTime = age; } private final long getWorldAge() { return this.gameTime; } // Paper - OBFHELPER
|
||||
private long dayTime;
|
||||
|
||||
public ClientboundSetTimePacket() {}
|
||||
@@ -21,6 +21,9 @@ public class ClientboundSetTimePacket implements Packet<ClientGamePacketListener
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ this.setWorldAge(this.getWorldAge() % 192000);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@Override
|
@ -1,110 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 20 Dec 2020 16:41:44 -0800
|
||||
Subject: [PATCH] Added WorldGameRuleChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java
|
||||
index 87b968019fa10647522121c7b29094ed3e0dcf6d..7f124784dd7876cdb26f16e83deddf07dd9a198e 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java
|
||||
@@ -31,7 +31,7 @@ public class GameRuleCommand {
|
||||
CommandSourceStack commandlistenerwrapper = (CommandSourceStack) context.getSource();
|
||||
T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(key); // CraftBukkit
|
||||
|
||||
- t0.setFromArgument(context, "value");
|
||||
+ t0.setValue(context, "value", key); // Paper
|
||||
commandlistenerwrapper.sendSuccess(new TranslatableComponent("commands.gamerule.set", new Object[]{key.getId(), t0.toString()}), true);
|
||||
return t0.getCommandResult();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
index 6c996d34ef34879db1d65c39adf99ce2d64e5499..1e6f299571a25729dbf8c5b0cd115c1e842a8a3c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+import io.papermc.paper.event.world.WorldGameRuleChangeEvent; // Paper
|
||||
|
||||
public class GameRules {
|
||||
|
||||
@@ -177,8 +178,11 @@ public class GameRules {
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name) {
|
||||
- this.value = BoolArgumentType.getBool(context, name);
|
||||
+ protected void a(CommandContext<CommandSourceStack> commandcontext, String s, GameRules.Key<BooleanValue> gameRuleKey) { // Paper start
|
||||
+ WorldGameRuleChangeEvent event = new WorldGameRuleChangeEvent(commandcontext.getSource().getBukkitWorld(), commandcontext.getSource().getBukkitSender(), (org.bukkit.GameRule<Boolean>) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(BoolArgumentType.getBool(commandcontext, s)));
|
||||
+ if (!event.callEvent()) return;
|
||||
+ this.value = Boolean.parseBoolean(event.getValue());
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public boolean get() {
|
||||
@@ -237,8 +241,11 @@ public class GameRules {
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name) {
|
||||
- this.value = IntegerArgumentType.getInteger(context, name);
|
||||
+ protected void a(CommandContext<CommandSourceStack> commandcontext, String s, GameRules.Key<IntegerValue> gameRuleKey) { // Paper start
|
||||
+ WorldGameRuleChangeEvent event = new WorldGameRuleChangeEvent(commandcontext.getSource().getBukkitWorld(), commandcontext.getSource().getBukkitSender(), (org.bukkit.GameRule<Integer>) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(IntegerArgumentType.getInteger(commandcontext, s)));
|
||||
+ if (!event.callEvent()) return;
|
||||
+ this.value = Integer.parseInt(event.getValue());
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public int get() {
|
||||
@@ -291,11 +298,13 @@ public class GameRules {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
- protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name);
|
||||
+ protected void updateValue(CommandContext<CommandSourceStack> commandcontext, String s, GameRules.Key<T> gameRuleKey) { this.a(commandcontext, s, gameRuleKey); } // Paper - OBFHELPER
|
||||
+ protected abstract void a(CommandContext<CommandSourceStack> commandcontext, String s, GameRules.Key<T> gameRuleKey); // Paper
|
||||
|
||||
- public void setFromArgument(CommandContext<CommandSourceStack> context, String name) {
|
||||
- this.updateFromArgument(context, name);
|
||||
- this.onChanged(((CommandSourceStack) context.getSource()).getServer());
|
||||
+ public void setValue(CommandContext<CommandSourceStack> commandcontext, String s, GameRules.Key<T> gameRuleKey) { this.b(commandcontext, s, gameRuleKey); } // Paper - OBFHELPER
|
||||
+ public void b(CommandContext<CommandSourceStack> commandcontext, String s, GameRules.Key<T> gameRuleKey) { // Paper
|
||||
+ this.updateValue(commandcontext, s, gameRuleKey); // Paper
|
||||
+ this.onChanged(((CommandSourceStack) commandcontext.getSource()).getServer());
|
||||
}
|
||||
|
||||
public void onChanged(@Nullable MinecraftServer server) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index aaf97c13babce3b0ffc639ef950d59d1eba1398a..f497b9e11a075a84ff0a2117eb79d0532e4a326f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -2345,8 +2345,13 @@ public class CraftWorld implements World {
|
||||
|
||||
if (!isGameRule(rule)) return false;
|
||||
|
||||
+ // Paper start
|
||||
+ GameRule<?> gameRule = GameRule.getByName(rule);
|
||||
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, gameRule, value);
|
||||
+ if (!event.callEvent()) return false;
|
||||
+ // Paper end
|
||||
GameRules.Value<?> handle = getHandle().getGameRules().getRule(getGameRulesNMS().get(rule));
|
||||
- handle.deserialize(value);
|
||||
+ handle.deserialize(event.getValue().toString()); // Paper
|
||||
handle.onChanged(getHandle().getServer());
|
||||
return true;
|
||||
}
|
||||
@@ -2381,8 +2386,12 @@ public class CraftWorld implements World {
|
||||
|
||||
if (!isGameRule(rule.getName())) return false;
|
||||
|
||||
+ // Paper start
|
||||
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, rule, String.valueOf(newValue));
|
||||
+ if (!event.callEvent()) return false;
|
||||
+ // Paper end
|
||||
GameRules.Value<?> handle = getHandle().getGameRules().getRule(getGameRulesNMS().get(rule.getName()));
|
||||
- handle.deserialize(newValue.toString());
|
||||
+ handle.deserialize(event.getValue().toString()); // Paper
|
||||
handle.onChanged(getHandle().getServer());
|
||||
return true;
|
||||
}
|
70
patches/server/0549-Added-missing-default-perms-for-commands.patch
Normale Datei
70
patches/server/0549-Added-missing-default-perms-for-commands.patch
Normale Datei
@ -0,0 +1,70 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 16 Nov 2020 12:01:52 -0800
|
||||
Subject: [PATCH] Added missing default perms for commands
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
||||
index ca30f9c590f792caa8f1b76d7219e9121d932673..6cc517b394bafefce50d877761e5b2eee8e14c78 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
||||
@@ -31,6 +31,59 @@ public final class CommandPermissions {
|
||||
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "effect", "Allows the user to add/remove effects on players", PermissionDefault.OP, commands);
|
||||
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "selector", "Allows the use of selectors", PermissionDefault.OP, commands);
|
||||
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "trigger", "Allows the use of the trigger command", PermissionDefault.TRUE, commands);
|
||||
+ // Paper start
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "attribute", "Allows the user to query, add, remove or set an entity attribute", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "advancement", "Allows the user to give, remove, or check player advancements", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "ban", "Allows the user to add players to banlist", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "ban-ip", "Allows the user to add ip address to banlist", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "banlist", "Allows the user to display banlist", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "bossbar", "Allows the user to create and modify bossbars", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "clear", "Allows the user to clear items from player inventory", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "clone", "Allows the user to copy blocks from one place to another", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "data", "Allows the user to get, merge, modify, and remove block entity and entity NBT data", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "datapack", "Allows the user to control loaded data packs", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "debug", "Allows the user to start or stop a debugging session", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "deop", "Allows the user to revoke operator status from a player", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "difficulty", "Allows the user to set the difficulty level", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "enchant", "Allows the user to enchant a player item", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "execute", "Allows the user to execute another command", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "fill", "Allows the user to fill a region with a specific block", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "forceload", "Allows the user to force chunks to be constantly loaded or not", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "function", "Allows the user to run a function", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "gamerule", "Allows a user to set or query a game rule value", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "locate", "Allows the user to locate the closest structure", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "locatebiome", "Allows the user to locate the closest biome", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "loot", "Allows the user to drop items from an inventory slot onto the ground", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "op", "Allows the user to grant operator status to a player", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "pardon", "Allows the user to remove entries from the banlist", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "particle", "Allows the user to create particles", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "playsound", "Allows the user to play a sound", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "recipe", "Allows the user to give or take recipes", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "reload", "Allows the user to reload loot tables, advancements, and functions from disk", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "item", "Allows the user to replace items in inventories", PermissionDefault.OP, commands); // Remove in 1.17 (replaced by /item)
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "save-all", "Allows the user to save the server to disk", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "save-off", "Allows the user disable automatic server saves", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "save-on", "Allows the user enable automatic server saves", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "schedule", "Allows the user to delay the execution of a function", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "scoreboard", "Allows the user manage scoreboard objectives and players", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "setblock", "Allows the user to change a block to another block", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "setidletimeout", "Allows the user to set the time before idle players are kicked", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "setworldspawn", "Allows the user to set the world spawn", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "spawnpoint", "Allows the user to set the spawn point for a player", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "spectate", "Allows the user to make one player in spectator mode spectate an entity", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "spreadplayers", "Allows the user to teleport entities to random locations", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "stopsound", "Allows the user to stop a sound", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "summon", "Allows the user to summon an entity", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "tag", "Allows the user to control entity tags", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "team", "Allows the user to control teams", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "teammsg", "Allows the user to specify the message to send to team", PermissionDefault.TRUE, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "tellraw", "Allows the user to display a JSON message to players", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "time", "Allows the user to change or query the world's game time", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "title", "Allows the user to manage screen titles", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "weather", "Allows the user to set the weather", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "whitelist", "Allows the user to manage the server whitelist", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "worldborder", "Allows the user to manage the world border", PermissionDefault.OP, commands);
|
||||
+ // Paper end
|
||||
|
||||
DefaultPermissions.registerPermission("minecraft.admin.command_feedback", "Receive command broadcasts when sendCommandFeedback is true", PermissionDefault.OP, commands);
|
||||
|
70
patches/server/0550-Add-PlayerShearBlockEvent.patch
Normale Datei
70
patches/server/0550-Add-PlayerShearBlockEvent.patch
Normale Datei
@ -0,0 +1,70 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JRoy <joshroy126@gmail.com>
|
||||
Date: Thu, 27 Aug 2020 15:02:48 -0400
|
||||
Subject: [PATCH] Add PlayerShearBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
||||
index 96bc2cc1e3005a5273b8834569f5dee5c3a08293..d3b85a29662d33d458cfd4d7942b8e2d2264b750 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
||||
@@ -115,7 +115,7 @@ public class BeehiveBlock extends BaseEntityBlock {
|
||||
}
|
||||
|
||||
public static void dropHoneycomb(Level world, BlockPos pos) {
|
||||
- popResource(world, pos, new ItemStack(Items.HONEYCOMB, 3));
|
||||
+ popResource(world, pos, new ItemStack(Items.HONEYCOMB, 3)); // Paper - conflict on change, item needs to be set below
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,8 +128,19 @@ public class BeehiveBlock extends BaseEntityBlock {
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
if (itemstack.is(Items.SHEARS)) {
|
||||
+ // Paper start - Add PlayerShearBlockEvent
|
||||
+ io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), net.minecraft.server.MCUtil.toBukkitBlock(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (hand == InteractionHand.OFF_HAND ? org.bukkit.inventory.EquipmentSlot.OFF_HAND : org.bukkit.inventory.EquipmentSlot.HAND), new java.util.ArrayList<>());
|
||||
+ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.HONEYCOMB, 3)));
|
||||
+ if (!event.callEvent()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end
|
||||
world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.NEUTRAL, 1.0F, 1.0F);
|
||||
- BeehiveBlock.dropHoneycomb(world, pos);
|
||||
+ // Paper start - Add PlayerShearBlockEvent
|
||||
+ for (org.bukkit.inventory.ItemStack itemDrop : event.getDrops()) {
|
||||
+ popResource(world, pos, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(itemDrop));
|
||||
+ }
|
||||
+ // Paper end
|
||||
itemstack.hurtAndBreak(1, player, (entityhuman1) -> {
|
||||
entityhuman1.broadcastBreakEvent(hand);
|
||||
});
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
|
||||
index 0e8cbe7a465edc31b78b7e47a928435f9c2b6bd9..f998598a34315389dd74b82e4b9c8448f0aae253 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
|
||||
@@ -27,13 +27,24 @@ public class PumpkinBlock extends StemGrownBlock {
|
||||
ItemStack itemStack = player.getItemInHand(hand);
|
||||
if (itemStack.is(Items.SHEARS)) {
|
||||
if (!world.isClientSide) {
|
||||
+ // Paper start - Add PlayerShearBlockEvent
|
||||
+ io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), net.minecraft.server.MCUtil.toBukkitBlock(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (hand == InteractionHand.OFF_HAND ? org.bukkit.inventory.EquipmentSlot.OFF_HAND : org.bukkit.inventory.EquipmentSlot.HAND), new java.util.ArrayList<>());
|
||||
+ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.PUMPKIN_SEEDS, 4)));
|
||||
+ if (!event.callEvent()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end
|
||||
Direction direction = hit.getDirection();
|
||||
Direction direction2 = direction.getAxis() == Direction.Axis.Y ? player.getDirection().getOpposite() : direction;
|
||||
world.playSound((Player)null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
world.setBlock(pos, Blocks.CARVED_PUMPKIN.defaultBlockState().setValue(CarvedPumpkinBlock.FACING, direction2), 11);
|
||||
- ItemEntity itemEntity = new ItemEntity(world, (double)pos.getX() + 0.5D + (double)direction2.getStepX() * 0.65D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D + (double)direction2.getStepZ() * 0.65D, new ItemStack(Items.PUMPKIN_SEEDS, 4));
|
||||
+ // Paper start - Add PlayerShearBlockEvent
|
||||
+ for (org.bukkit.inventory.ItemStack item : event.getDrops()) {
|
||||
+ ItemEntity itemEntity = new ItemEntity(world, (double) pos.getX() + 0.5D + (double) direction2.getStepX() * 0.65D, (double) pos.getY() + 0.1D, (double) pos.getZ() + 0.5D + (double) direction2.getStepZ() * 0.65D, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item));
|
||||
+ // Paper end
|
||||
itemEntity.setDeltaMovement(0.05D * (double)direction2.getStepX() + world.random.nextDouble() * 0.02D, 0.05D, 0.05D * (double)direction2.getStepZ() + world.random.nextDouble() * 0.02D);
|
||||
world.addFreshEntity(itemEntity);
|
||||
+ } // Paper - Add PlayerShearBlockEvent
|
||||
itemStack.hurtAndBreak(1, player, (playerx) -> {
|
||||
playerx.broadcastBreakEvent(hand);
|
||||
});
|
@ -59,22 +59,14 @@ index 0000000000000000000000000000000000000000..fdf3ff8894e5e202229d1be52fe3c92e
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 954dce690852da87a37e7797c6f9f549242e511a..c83f2636ae93d92381e019d5b13ac82c5a1d30bf 100644
|
||||
index 9bd2255d31bcfd4574f8d1caf598f9141aa9e3c1..c7432ccffc024f171a2868b4eb0dca4860b7f8c4 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -180,6 +180,7 @@ import org.bukkit.event.server.ServerLoadEvent;
|
||||
|
||||
import co.aikar.timings.MinecraftTimings; // Paper
|
||||
import org.spigotmc.SlackActivityAccountant; // Spigot
|
||||
+import io.papermc.paper.util.PaperJvmChecker; // Paper
|
||||
|
||||
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements SnooperPopulator, CommandSource, AutoCloseable {
|
||||
|
||||
@@ -1075,6 +1076,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1128,6 +1128,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
LOGGER.info("Done ({})! For help, type \"help\"", doneTime);
|
||||
// Paper end
|
||||
|
||||
+ PaperJvmChecker.checkJvm(); // Paper jvm version nag
|
||||
+ io.papermc.paper.util.PaperJvmChecker.checkJvm(); // Paper jvm version nag
|
||||
org.spigotmc.WatchdogThread.tick(); // Paper
|
||||
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
||||
Arrays.fill( recentTps, 20 );
|
@ -5,15 +5,15 @@ Subject: [PATCH] Set spigots verbose world setting to false by def
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 6b015c1f26facb4e82d75b252164dec05731ca6c..094a934c168d232b0550c3efe722f2ebfbdf8e24 100644
|
||||
index 308de0757c219c1e5fa8bde182343c4095301cde..9f1eba32776a687c6e324ee47a2c099e745db000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -20,7 +20,7 @@ public class SpigotWorldConfig
|
||||
|
||||
public void init()
|
||||
{
|
||||
- this.verbose = getBoolean( "verbose", true );
|
||||
+ this.verbose = getBoolean( "verbose", false ); // Paper
|
||||
- this.verbose = this.getBoolean( "verbose", true );
|
||||
+ this.verbose = this.getBoolean( "verbose", false ); // Paper
|
||||
|
||||
log( "-------- World Settings For [" + worldName + "] --------" );
|
||||
this.log( "-------- World Settings For [" + this.worldName + "] --------" );
|
||||
SpigotConfig.readConfig( SpigotWorldConfig.class, this );
|
@ -8,36 +8,26 @@ and curing a villager on repeat by simply resetting the relevant part of
|
||||
the reputation when it is cured.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 7d3207a9af8360ddad228281d6aa65e1a0d24157..a3b3e3e04b7a5e3a351992e06870cc91fbd8adc8 100644
|
||||
index 247b30b2b2edbb1043b6385039ba830dea877c55..618f47567ca9d4704f4686d7ca789286866f080a 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -717,4 +717,9 @@ public class PaperWorldConfig {
|
||||
private void fixClimbingBypassingCrammingRule() {
|
||||
@@ -82,6 +82,11 @@ public class PaperWorldConfig {
|
||||
fixClimbingBypassingCrammingRule = getBoolean("fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule);
|
||||
}
|
||||
+
|
||||
|
||||
+ public boolean fixCuringZombieVillagerDiscountExploit = true;
|
||||
+ private void fixCuringExploit() {
|
||||
+ fixCuringZombieVillagerDiscountExploit = getBoolean("game-mechanics.fix-curing-zombie-villager-discount-exploit", fixCuringZombieVillagerDiscountExploit);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
|
||||
index 57832c392910d22aa81ac2b4816d043dd7ac867a..9a68201bab4fcbad69c85e2469a103634b65d7b3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
|
||||
@@ -223,6 +223,7 @@ public class GossipContainer {
|
||||
|
||||
}
|
||||
|
||||
+ public final void removeReputationForType(GossipType reputationType) { this.remove(reputationType); } // Paper - OBFHELPER
|
||||
public void remove(GossipType gossipType) {
|
||||
this.entries.removeInt(gossipType);
|
||||
}
|
||||
+
|
||||
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/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
index 415fa3591add1f1ab22dd5866e110dbfccd0ec93..7817071b1964b962c8f4017d5bb39d74ca0ca3e4 100644
|
||||
index f534d3afaa20abacfd9e6e15d31d592855667c57..ee23149411a49f08d2eb4808ef78cb5a50785977 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -1013,6 +1013,15 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -1056,6 +1056,15 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@Override
|
||||
public void onReputationEventFrom(ReputationEventType interaction, Entity entity) {
|
||||
if (interaction == ReputationEventType.ZOMBIE_VILLAGER_CURED) {
|
||||
@ -45,8 +35,8 @@ index 415fa3591add1f1ab22dd5866e110dbfccd0ec93..7817071b1964b962c8f4017d5bb39d74
|
||||
+ if (level.paperConfig.fixCuringZombieVillagerDiscountExploit) {
|
||||
+ final GossipContainer.EntityGossips playerReputation = this.getReputation().getReputations().get(entity.getUUID());
|
||||
+ if (playerReputation != null) {
|
||||
+ playerReputation.removeReputationForType(GossipType.MAJOR_POSITIVE);
|
||||
+ playerReputation.removeReputationForType(GossipType.MINOR_POSITIVE);
|
||||
+ playerReputation.remove(GossipType.MAJOR_POSITIVE);
|
||||
+ playerReputation.remove(GossipType.MINOR_POSITIVE);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
@ -23,47 +23,32 @@ index 7d50aded88f5b7dfebaea1aebc86231f7b5c4e25..652d87fc5d566dba8018c81676329f0e
|
||||
public static boolean velocityOnlineMode;
|
||||
public static byte[] velocitySecretKey;
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index ccfe5a1ec1e9895f7462b7c676fee80903502a88..e50e42cce60c725cdd981d8927e379c5760d9200 100644
|
||||
index fa57095f0ddd5685f848ade5c0ec2e90e2a07e91..309b8e193ec67df0379d65ce77a2a095702fd024 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.server.network;
|
||||
|
||||
+import com.destroystokyo.paper.PaperConfig;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.primitives.Doubles;
|
||||
import com.google.common.primitives.Floats;
|
||||
@@ -174,6 +175,7 @@ import io.papermc.paper.adventure.ChatProcessor; // Paper
|
||||
import io.papermc.paper.adventure.PaperAdventure; // Paper
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
||||
+import org.bukkit.Bukkit; // Paper
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
@@ -232,6 +234,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
private volatile int chatSpamTickCount;
|
||||
private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(ServerGamePacketListenerImpl.class, "chatThrottle");
|
||||
@@ -232,6 +232,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
// CraftBukkit start - multithreaded fields
|
||||
private AtomicInteger chatSpamTickCount = new AtomicInteger();
|
||||
private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits
|
||||
+ private final java.util.concurrent.atomic.AtomicInteger recipeSpamPackets = new java.util.concurrent.atomic.AtomicInteger(); // Paper - auto recipe limit
|
||||
// CraftBukkit end
|
||||
private int dropSpamTickCount;
|
||||
private final Int2ShortMap expectedAcks = new Int2ShortOpenHashMap();
|
||||
@@ -380,6 +383,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
private double firstGoodX;
|
||||
@@ -377,6 +378,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
// CraftBukkit start
|
||||
for (int spam; (spam = this.chatSpamTickCount) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ;
|
||||
for (int spam; (spam = this.chatSpamTickCount.get()) > 0 && !this.chatSpamTickCount.compareAndSet(spam, spam - 1); ) ;
|
||||
if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable
|
||||
+ if (recipeSpamPackets.get() > 0) recipeSpamPackets.getAndDecrement(); // Paper
|
||||
/* Use thread-safe field access instead
|
||||
if (this.chatThrottle > 0) {
|
||||
--this.chatThrottle;
|
||||
@@ -2786,6 +2790,14 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
if (this.chatSpamTickCount > 0) {
|
||||
--this.chatSpamTickCount;
|
||||
@@ -2794,6 +2796,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
||||
@Override
|
||||
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
|
||||
+ // Paper start
|
||||
+ if (!Bukkit.isPrimaryThread()) {
|
||||
+ if (recipeSpamPackets.addAndGet(PaperConfig.autoRecipeIncrement) > PaperConfig.autoRecipeLimit) {
|
||||
+ if (!org.bukkit.Bukkit.isPrimaryThread()) {
|
||||
+ if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
|
||||
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper
|
||||
+ return;
|
||||
+ }
|
||||
@ -71,4 +56,4 @@ index ccfe5a1ec1e9895f7462b7c676fee80903502a88..e50e42cce60c725cdd981d8927e379c5
|
||||
+ // Paper end
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
this.player.resetLastActionTime();
|
||||
if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu.isSynched(this.player) && this.player.containerMenu instanceof RecipeBookMenu) {
|
||||
if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) {
|
63
patches/server/0556-MC-4-Fix-item-position-desync.patch
Normale Datei
63
patches/server/0556-MC-4-Fix-item-position-desync.patch
Normale Datei
@ -0,0 +1,63 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 8 Dec 2020 20:24:52 -0600
|
||||
Subject: [PATCH] MC-4: Fix item position desync
|
||||
|
||||
This fixes item position desync (MC-4) by running the item coordinates
|
||||
through the encode/decode methods of the packet that causes the precision
|
||||
loss, which forces the server to lose the same precision as the client
|
||||
keeping them in sync.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 652d87fc5d566dba8018c81676329f0e0bca471b..c56e7fb18f9a56c8025eb70a524f028b5942da37 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -474,4 +474,9 @@ public class PaperConfig {
|
||||
private static void trackPluginScoreboards() {
|
||||
trackPluginScoreboards = getBoolean("settings.track-plugin-scoreboards", false);
|
||||
}
|
||||
+
|
||||
+ public static boolean fixEntityPositionDesync = true;
|
||||
+ private static void fixEntityPositionDesync() {
|
||||
+ fixEntityPositionDesync = getBoolean("settings.fix-entity-position-desync", fixEntityPositionDesync);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java
|
||||
index b30c08bfb8c55161543a4ef09f2e462e0a1fe4ae..ec93f5300cc7d423ec0d292f0f8443f900d72dab 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java
|
||||
@@ -21,11 +21,11 @@ public abstract class ClientboundMoveEntityPacket implements Packet<ClientGamePa
|
||||
protected final boolean hasPos;
|
||||
|
||||
public static long entityToPacket(double coord) {
|
||||
- return Mth.lfloor(coord * 4096.0D);
|
||||
+ return Mth.lfloor(coord * 4096.0D); // Paper - check ItemEntity#setPosRaw on update
|
||||
}
|
||||
|
||||
public static double packetToEntity(long coord) {
|
||||
- return (double)coord / 4096.0D;
|
||||
+ return (double)coord / 4096.0D; // Paper - check ItemEntity#setPosRaw on update
|
||||
}
|
||||
|
||||
public Vec3 updateEntityPosition(Vec3 orig) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 785970057ceb7a58049f9d36ac0eaa122637430f..fec2a44c4a110407d33002a955fe5dacbccc840c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3731,6 +3731,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
}
|
||||
|
||||
public final void setPosRaw(double x, double y, double z) {
|
||||
+ // Paper start - fix MC-4
|
||||
+ if (this instanceof ItemEntity) {
|
||||
+ if (com.destroystokyo.paper.PaperConfig.fixEntityPositionDesync) {
|
||||
+ // encode/decode from PacketPlayOutEntity
|
||||
+ x = Mth.lfloor(x * 4096.0D) * (1 / 4096.0D);
|
||||
+ y = Mth.lfloor(y * 4096.0D) * (1 / 4096.0D);
|
||||
+ z = Mth.lfloor(z * 4096.0D) * (1 / 4096.0D);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - fix MC-4
|
||||
// Paper start - never allow AABB to become desynced from position
|
||||
// hanging has its own special logic
|
||||
if (!(this instanceof net.minecraft.world.entity.decoration.HangingEntity) && (this.position.x != x || this.position.y != y || this.position.z != z)) {
|
32
patches/server/0557-Player-Chunk-Load-Unload-Events.patch
Normale Datei
32
patches/server/0557-Player-Chunk-Load-Unload-Events.patch
Normale Datei
@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: ysl3000 <yannicklamprecht@live.de>
|
||||
Date: Mon, 5 Oct 2020 21:25:16 +0200
|
||||
Subject: [PATCH] Player Chunk Load/Unload Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 41e6164fc9f3aa54028e5db1331df743126e55e2..5a87875b03740053d8cde6d81c57703d0b0ef57e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2065,11 +2065,21 @@ public class ServerPlayer extends Player {
|
||||
public void trackChunk(ChunkPos chunkcoordintpair, Packet<?> packet, Packet<?> packet1) {
|
||||
this.connection.send(packet1);
|
||||
this.connection.send(packet);
|
||||
+ // Paper start
|
||||
+ if(io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0){
|
||||
+ new io.papermc.paper.event.packet.PlayerChunkLoadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkcoordintpair.longKey), this.getBukkitEntity()).callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public void untrackChunk(ChunkPos chunkPos) {
|
||||
if (this.isAlive()) {
|
||||
this.connection.send(new ClientboundForgetLevelChunkPacket(chunkPos.x, chunkPos.z));
|
||||
+ // Paper start
|
||||
+ if(io.papermc.paper.event.packet.PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0){
|
||||
+ new io.papermc.paper.event.packet.PlayerChunkUnloadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkPos.longKey), this.getBukkitEntity()).callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
}
|
26
patches/server/0559-Expose-LivingEntity-hurt-direction.patch
Normale Datei
26
patches/server/0559-Expose-LivingEntity-hurt-direction.patch
Normale Datei
@ -0,0 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||
Date: Sun, 13 Dec 2020 05:32:05 +0200
|
||||
Subject: [PATCH] Expose LivingEntity hurt direction
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 18635227a39c96e350fbb8ee9918c41c7a645aa6..2ca223324cc079e397852c30c969a05814585cde 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -818,5 +818,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public void playPickupItemAnimation(org.bukkit.entity.Item item, int quantity) {
|
||||
getHandle().take(((CraftItem) item).getHandle(), quantity);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public float getHurtDirection() {
|
||||
+ return getHandle().hurtDir;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setHurtDirection(float hurtDirection) {
|
||||
+ getHandle().hurtDir = hurtDirection;
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add OBSTRUCTED reason to BedEnterResult
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 64cfa14aa4e32430a6970fd4f3654a56146ba807..34c7b1213b3f83ff1a1f2d606a9c25e57fea8ef3 100644
|
||||
index fc9c63b73211d05321776648d6ba9c54f14ba83d..0f120d72816667ef8d50502b1e7e7dc3848f0ab4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -259,6 +259,10 @@ public class CraftEventFactory {
|
||||
@@ -257,6 +257,10 @@ public class CraftEventFactory {
|
||||
return BedEnterResult.TOO_FAR_AWAY;
|
||||
case NOT_SAFE:
|
||||
return BedEnterResult.NOT_SAFE;
|
@ -6,10 +6,10 @@ Subject: [PATCH] Do not crash from invalid ingredient lists in
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
index 407a68edf6408400f1a6c5bb1a6cbbfae08ac2cd..335000713279b7964c5172937483678c671bfed1 100644
|
||||
index 2610d9cd849aa38cc7a67aef21223707e85682ec..4a7b657265cbbc91ae85409abb3db29cfc555a2c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
@@ -270,7 +270,11 @@ public abstract class AbstractVillager extends AgableMob implements Npc, Merchan
|
||||
@@ -279,7 +279,11 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
}
|
||||
if (!event.isCancelled()) {
|
40
patches/server/0562-added-PlayerTradeEvent.patch
Normale Datei
40
patches/server/0562-added-PlayerTradeEvent.patch
Normale Datei
@ -0,0 +1,40 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 2 Jul 2020 16:12:10 -0700
|
||||
Subject: [PATCH] added PlayerTradeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
index 4a7b657265cbbc91ae85409abb3db29cfc555a2c..e59a77c80a1bbe62aaa61bd4792d21b12c895a5c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
@@ -140,13 +140,24 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
|
||||
|
||||
@Override
|
||||
public void notifyTrade(MerchantOffer offer) {
|
||||
- offer.increaseUses();
|
||||
- this.ambientSoundTime = -this.getAmbientSoundInterval();
|
||||
- this.rewardTradeXp(offer);
|
||||
+ // Paper - moved down
|
||||
+ // Paper start
|
||||
if (this.tradingPlayer instanceof ServerPlayer) {
|
||||
- CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, offer.getResult());
|
||||
+ io.papermc.paper.event.player.PlayerTradeEvent event = new io.papermc.paper.event.player.PlayerTradeEvent(((ServerPlayer) this.tradingPlayer).getBukkitEntity(), (org.bukkit.entity.AbstractVillager) this.getBukkitEntity(), offer.asBukkit(), true, true);
|
||||
+ event.callEvent();
|
||||
+ if (!event.isCancelled()) {
|
||||
+ MerchantOffer recipe = CraftMerchantRecipe.fromBukkit(event.getTrade()).toMinecraft();
|
||||
+ if (event.willIncreaseTradeUses()) recipe.increaseUses();
|
||||
+ this.ambientSoundTime = -this.getAmbientSoundInterval();
|
||||
+ if (event.isRewardingExp()) this.rewardTradeXp(recipe);
|
||||
+ CriteriaTriggers.TRADE.trigger((ServerPlayer) this.tradingPlayer, this, recipe.getResult());
|
||||
+ }
|
||||
+ } else {
|
||||
+ offer.increaseUses();
|
||||
+ this.ambientSoundTime = -getAmbientSoundInterval();
|
||||
+ this.rewardTradeXp(offer);
|
||||
}
|
||||
-
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
protected abstract void rewardTradeXp(MerchantOffer offer);
|
42
patches/server/0563-Implement-TargetHitEvent.patch
Normale Datei
42
patches/server/0563-Implement-TargetHitEvent.patch
Normale Datei
@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: jmp <jasonpenilla2@me.com>
|
||||
Date: Wed, 25 Nov 2020 23:20:44 -0800
|
||||
Subject: [PATCH] Implement TargetHitEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TargetBlock.java b/src/main/java/net/minecraft/world/level/block/TargetBlock.java
|
||||
index 3f29d7dec834fda549db938cd7f3dc3b9ad67de3..18e8dbd7971e83a69953d203b02d8cd8d456e434 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TargetBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TargetBlock.java
|
||||
@@ -35,6 +35,10 @@ public class TargetBlock extends Block {
|
||||
@Override
|
||||
public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) {
|
||||
int i = updateRedstoneOutput(world, state, hit, projectile);
|
||||
+ // Paper start
|
||||
+ }
|
||||
+ private static void awardTargetHitCriteria(Projectile projectile, BlockHitResult hit, int i) {
|
||||
+ // Paper end
|
||||
Entity entity = projectile.getOwner();
|
||||
if (entity instanceof ServerPlayer) {
|
||||
ServerPlayer serverPlayer = (ServerPlayer)entity;
|
||||
@@ -47,6 +51,20 @@ public class TargetBlock extends Block {
|
||||
private static int updateRedstoneOutput(LevelAccessor world, BlockState state, BlockHitResult hitResult, Entity entity) {
|
||||
int i = getRedstoneStrength(hitResult, hitResult.getLocation());
|
||||
int j = entity instanceof AbstractArrow ? 20 : 8;
|
||||
+ // Paper start
|
||||
+ if (entity instanceof Projectile) {
|
||||
+ final Projectile projectile = (Projectile) entity;
|
||||
+ final org.bukkit.craftbukkit.block.CraftBlock craftBlock = org.bukkit.craftbukkit.block.CraftBlock.at(world, hitResult.getBlockPos());
|
||||
+ final org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(hitResult.getDirection());
|
||||
+ final io.papermc.paper.event.block.TargetHitEvent targetHitEvent = new io.papermc.paper.event.block.TargetHitEvent((org.bukkit.entity.Projectile) projectile.getBukkitEntity(), craftBlock, blockFace, i);
|
||||
+ if (targetHitEvent.callEvent()) {
|
||||
+ i = targetHitEvent.getSignalStrength();
|
||||
+ awardTargetHitCriteria(projectile, hitResult, i);
|
||||
+ } else {
|
||||
+ return i;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
if (!world.getBlockTicks().hasScheduledTick(hitResult.getBlockPos(), state.getBlock())) {
|
||||
setOutputPower(world, state, i, hitResult.getBlockPos(), j);
|
||||
}
|
@ -9,21 +9,21 @@ process to do this in the Bukkit API
|
||||
Adds API for buildable, replaceable, burnable too.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 9defb202761296a825d035e27ddc51e17a311647..376b0497c28a35d7ea615397c87b2558b95c596a 100644
|
||||
index 597ac36c6f6748ecfbf64920da172758814b8061..f69ad3ccfe885f3acde930ea844d3bc471ce661b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -618,6 +618,25 @@ public class CraftBlock implements Block {
|
||||
return getNMS().getMaterial().isLiquid();
|
||||
@@ -623,6 +623,25 @@ public class CraftBlock implements Block {
|
||||
return this.getNMS().getMaterial().isLiquid();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean isBuildable() {
|
||||
+ return getNMS().getMaterial().isBuildable();
|
||||
+ return getNMS().getMaterial().isSolid(); // This is in fact isSolid, despite the fact that isSolid below returns blocksMotion
|
||||
+ }
|
||||
+ @Override
|
||||
+ public boolean isBurnable() {
|
||||
+ return getNMS().getMaterial().isBurnable();
|
||||
+ return getNMS().getMaterial().isFlammable();
|
||||
+ }
|
||||
+ @Override
|
||||
+ public boolean isReplaceable() {
|
||||
@ -37,4 +37,4 @@ index 9defb202761296a825d035e27ddc51e17a311647..376b0497c28a35d7ea615397c87b2558
|
||||
+
|
||||
@Override
|
||||
public PistonMoveReaction getPistonMoveReaction() {
|
||||
return PistonMoveReaction.getById(getNMS().getPistonPushReaction().ordinal());
|
||||
return PistonMoveReaction.getById(this.getNMS().getPistonPushReaction().ordinal());
|
@ -8,18 +8,10 @@ Before this patch, instant effects would be applied before the potion ItemStack
|
||||
This patch makes it so that instant effects are applied after the potion ItemStack is removed, and the glass bottle is only put into the player's inventory if the player is not dead. Otherwise, the glass bottle is dropped on the ground.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/PotionItem.java b/src/main/java/net/minecraft/world/item/PotionItem.java
|
||||
index 36ccec8ad2f605d5bceae476e26c2fbfbdae39d8..ba2bc044b259b0a5ba590d4ae6fd36e5c415ddff 100644
|
||||
index 9014bf545205504bee2d727399d39090ebe3d210..12a29323d99dcc7880fe3c7c9709a755d9cbf43e 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/PotionItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/PotionItem.java
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.alchemy.Potion;
|
||||
import net.minecraft.world.item.alchemy.PotionUtils;
|
||||
import net.minecraft.world.item.alchemy.Potions;
|
||||
+import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
public class PotionItem extends Item {
|
||||
@@ -36,6 +37,7 @@ public class PotionItem extends Item {
|
||||
@@ -42,6 +42,7 @@ public class PotionItem extends Item {
|
||||
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer) entityhuman, stack);
|
||||
}
|
||||
|
||||
@ -27,33 +19,31 @@ index 36ccec8ad2f605d5bceae476e26c2fbfbdae39d8..ba2bc044b259b0a5ba590d4ae6fd36e5
|
||||
if (!world.isClientSide) {
|
||||
List<MobEffectInstance> list = PotionUtils.getMobEffects(stack);
|
||||
Iterator iterator = list.iterator();
|
||||
@@ -44,7 +46,7 @@ public class PotionItem extends Item {
|
||||
@@ -50,7 +51,7 @@ public class PotionItem extends Item {
|
||||
MobEffectInstance mobeffect = (MobEffectInstance) iterator.next();
|
||||
|
||||
if (mobeffect.getMobEffect().isInstant()) {
|
||||
- mobeffect.getMobEffect().applyInstantEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D);
|
||||
if (mobeffect.getEffect().isInstantenous()) {
|
||||
- mobeffect.getEffect().applyInstantenousEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D);
|
||||
+ instantLater.add(mobeffect); // Paper - Fix harming potion dupe
|
||||
} else {
|
||||
user.addEffect(new MobEffectInstance(mobeffect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_DRINK); // CraftBukkit
|
||||
}
|
||||
@@ -58,7 +60,20 @@ public class PotionItem extends Item {
|
||||
@@ -64,7 +65,18 @@ public class PotionItem extends Item {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - Fix harming potion dupe
|
||||
+ for (MobEffectInstance mobeffect : instantLater) {
|
||||
+ mobeffect.getMobEffect().applyInstantEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D);
|
||||
+ mobeffect.getEffect().applyInstantenousEffect(entityhuman, entityhuman, user, mobeffect.getAmplifier(), 1.0D);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (entityhuman == null || !entityhuman.abilities.instabuild) {
|
||||
if (entityhuman == null || !entityhuman.getAbilities().instabuild) {
|
||||
+ // Paper start - Fix harming potion dupe
|
||||
+ if (user.getHealth() <= 0 && !user.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY)) {
|
||||
+ user.dropItem(new ItemStack(Items.GLASS_BOTTLE), 0);
|
||||
+ return ItemStack.NULL_ITEM;
|
||||
+ if (user.getHealth() <= 0 && !user.level.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_KEEPINVENTORY)) {
|
||||
+ user.spawnAtLocation(new ItemStack(Items.GLASS_BOTTLE), 0);
|
||||
+ return ItemStack.EMPTY;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (stack.isEmpty()) {
|
||||
return new ItemStack(Items.GLASS_BOTTLE);
|
||||
}
|
@ -4,40 +4,18 @@ Date: Thu, 31 Dec 2020 12:48:19 +1000
|
||||
Subject: [PATCH] Implement API to get Material from Boats and Minecarts
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
index 4f82c6797fe9bbb1a29420ea15277be50e44808c..6a9c18540886979b2212bf7917a21753c9a9db3c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
@@ -259,6 +259,7 @@ public class Boat extends Entity {
|
||||
|
||||
}
|
||||
|
||||
+ public final Item getBoatItem() { return this.getDropItem(); } // Paper - OBFHELPER
|
||||
public Item getDropItem() {
|
||||
switch (this.getBoatType()) {
|
||||
case OAK:
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
|
||||
index de8e9e8d18fb9cc6f49d98ab0c57faffec61e5b5..5928ab97b91062963e5cca0a8ec50f2bc3a7ff96 100644
|
||||
index 47f95fb26793fbf6c5c37187d4958ee5ba93f060..39e7aeb409a39bd8cd8200b18dd3da1e427519ab 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
+import org.bukkit.Material; // Paper
|
||||
import org.bukkit.TreeSpecies;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
+import org.bukkit.craftbukkit.util.CraftMagicNumbers; // Paper
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
@@ -65,6 +67,13 @@ public class CraftBoat extends CraftVehicle implements Boat {
|
||||
getHandle().landBoats = workOnLand;
|
||||
@@ -65,6 +65,13 @@ public class CraftBoat extends CraftVehicle implements Boat {
|
||||
this.getHandle().landBoats = workOnLand;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public Material getBoatMaterial() {
|
||||
+ return CraftMagicNumbers.getMaterial(getHandle().getBoatItem());
|
||||
+ public org.bukkit.Material getBoatMaterial() {
|
||||
+ return org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getHandle().getDropItem());
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@ -45,7 +23,7 @@ index de8e9e8d18fb9cc6f49d98ab0c57faffec61e5b5..5928ab97b91062963e5cca0a8ec50f2b
|
||||
public net.minecraft.world.entity.vehicle.Boat getHandle() {
|
||||
return (net.minecraft.world.entity.vehicle.Boat) entity;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
|
||||
index 55df92a4661e13a9085f325db0572a265a89948c..fb26b6125ad4090d87b2326add94ffaded82c8ef 100644
|
||||
index 053112d7411caa6f439bd344e74aff8c844d93ac..5b8a83b250987fe5c939ab06b1021621820ad56e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
|
||||
@@ -1,8 +1,10 @@
|
||||
@ -60,7 +38,7 @@ index 55df92a4661e13a9085f325db0572a265a89948c..fb26b6125ad4090d87b2326add94ffad
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
@@ -68,6 +70,38 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
|
||||
getHandle().setDerailedVelocityMod(derailed);
|
||||
this.getHandle().setDerailedVelocityMod(derailed);
|
||||
}
|
||||
|
||||
+ // Paper start
|
36
patches/server/0567-Cache-burn-durations.patch
Normale Datei
36
patches/server/0567-Cache-burn-durations.patch
Normale Datei
@ -0,0 +1,36 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: lukas <lukasalt98@gmail.com>
|
||||
Date: Sun, 27 Dec 2020 16:47:00 +0100
|
||||
Subject: [PATCH] Cache burn durations
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index 627551db52a0ac1aff9f65f9fce7b9e3c07ad475..f1e44b57f8c77ee279b4be0853923dcd95f71f0a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -124,7 +124,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
this.recipeType = recipeType;
|
||||
}
|
||||
|
||||
+ private static Map<Item, Integer> cachedBurnDurations = null; // Paper - cache burn durations
|
||||
public static Map<Item, Integer> getFuel() {
|
||||
+ // Paper start - cache burn durations
|
||||
+ if(cachedBurnDurations != null) {
|
||||
+ return cachedBurnDurations;
|
||||
+ }
|
||||
+ // Paper end
|
||||
Map<Item, Integer> map = Maps.newLinkedHashMap();
|
||||
|
||||
AbstractFurnaceBlockEntity.add(map, (ItemLike) Items.LAVA_BUCKET, 20000);
|
||||
@@ -189,7 +195,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.COMPOSTER, 300);
|
||||
AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.AZALEA, 100);
|
||||
AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.FLOWERING_AZALEA, 100);
|
||||
- return map;
|
||||
+ // Paper start - cache burn durations
|
||||
+ cachedBurnDurations = com.google.common.collect.ImmutableMap.copyOf(map);
|
||||
+ return cachedBurnDurations;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
// CraftBukkit start - add fields and methods
|
@ -5,24 +5,26 @@ Subject: [PATCH] Allow disabling mob spawner spawn egg transformation
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index a3b3e3e04b7a5e3a351992e06870cc91fbd8adc8..b48067c71f9de18ba40e970e2832f6245984a218 100644
|
||||
index 618f47567ca9d4704f4686d7ca789286866f080a..bedadfc8835fa0c834494eb10cef13fa1cdc5cf5 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -722,4 +722,9 @@ public class PaperWorldConfig {
|
||||
private void fixCuringExploit() {
|
||||
@@ -87,6 +87,11 @@ public class PaperWorldConfig {
|
||||
fixCuringZombieVillagerDiscountExploit = getBoolean("game-mechanics.fix-curing-zombie-villager-discount-exploit", fixCuringZombieVillagerDiscountExploit);
|
||||
}
|
||||
+
|
||||
|
||||
+ public boolean disableMobSpawnerSpawnEggTransformation = false;
|
||||
+ private void disableMobSpawnerSpawnEggTransformation() {
|
||||
+ disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
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/item/SpawnEggItem.java b/src/main/java/net/minecraft/world/item/SpawnEggItem.java
|
||||
index 9aae1435a271bb17d6355e4c75ccbce78cb9d449..7904a2176253eaf48b47e06dd2e19758a673873c 100644
|
||||
index dd69c9b132fb52c60c44b3e029924412ecc28133..32a9a752e1afdcdaffa5198f3577856f742c9136 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/SpawnEggItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/SpawnEggItem.java
|
||||
@@ -60,7 +60,7 @@ public class SpawnEggItem extends Item {
|
||||
@@ -61,7 +61,7 @@ public class SpawnEggItem extends Item {
|
||||
Direction enumdirection = context.getClickedFace();
|
||||
BlockState iblockdata = world.getBlockState(blockposition);
|
||||
|
@ -5,31 +5,23 @@ Subject: [PATCH] Implement PlayerFlowerPotManipulateEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
|
||||
index ae74e70457f8f46ee71bf0902ade3468da272e81..a1d1f3416df8e313688fedad47dd264444d7c465 100644
|
||||
index 9a8fc69de43fcfeebcb31c895fa4b5868952fa0a..db05c1ea847d60ad45d33cd798cb34ad3f5cfd75 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.world.level.pathfinder.PathComputationType;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
+import io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent; // Paper
|
||||
|
||||
public class FlowerPotBlock extends Block {
|
||||
|
||||
@@ -52,6 +53,27 @@ public class FlowerPotBlock extends Block {
|
||||
boolean flag1 = this.content == Blocks.AIR;
|
||||
|
||||
if (flag != flag1) {
|
||||
@@ -52,6 +52,26 @@ public class FlowerPotBlock extends Block {
|
||||
boolean bl = blockState.is(Blocks.AIR);
|
||||
boolean bl2 = this.isEmpty();
|
||||
if (bl != bl2) {
|
||||
+ // Paper start
|
||||
+ org.bukkit.entity.Player player1 = (org.bukkit.entity.Player) player.getBukkitEntity();
|
||||
+ boolean placing = flag1;
|
||||
+ boolean placing = bl2;
|
||||
+ org.bukkit.block.Block bukkitblock = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos);
|
||||
+ org.bukkit.inventory.ItemStack bukkititemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack);
|
||||
+ org.bukkit.inventory.ItemStack bukkititemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemStack);
|
||||
+ org.bukkit.Material mat = org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(content);
|
||||
+ org.bukkit.inventory.ItemStack bukkititemstack1 = new org.bukkit.inventory.ItemStack(mat, 1);
|
||||
+ org.bukkit.inventory.ItemStack whichitem = placing ? bukkititemstack : bukkititemstack1;
|
||||
+
|
||||
+ PlayerFlowerPotManipulateEvent event = new PlayerFlowerPotManipulateEvent(player1, bukkitblock, whichitem, placing);
|
||||
+ io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent event = new io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent(player1, bukkitblock, whichitem, placing);
|
||||
+ player1.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
@ -40,7 +32,6 @@ index ae74e70457f8f46ee71bf0902ade3468da272e81..a1d1f3416df8e313688fedad47dd2644
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (flag1) {
|
||||
world.setBlock(pos, block.defaultBlockState(), 3);
|
||||
if (bl2) {
|
||||
world.setBlock(pos, blockState, 3);
|
||||
player.awardStat(Stats.POT_FLOWER);
|
@ -6,24 +6,24 @@ Subject: [PATCH] Fix interact event not being called in adventure
|
||||
Call PlayerInteractEvent when left-clicking on a block in adventure mode
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index e50e42cce60c725cdd981d8927e379c5760d9200..cb6568b622abeb939a1195f4656accc8a1c3f1fc 100644
|
||||
index 309b8e193ec67df0379d65ce77a2a095702fd024..df80023e43e7872e32e7b958ea0a5e82d86d43f7 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1701,7 +1701,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{this.server.getMaxBuildHeight()})).withStyle(ChatFormatting.RED);
|
||||
@@ -1733,7 +1733,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED);
|
||||
|
||||
this.player.connection.send(new ClientboundChatPacket(ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID));
|
||||
this.player.sendMessage((Component) ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID);
|
||||
- } else if (enuminteractionresult.shouldSwing()) {
|
||||
+ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) {
|
||||
this.player.swing(enumhand, true);
|
||||
}
|
||||
}
|
||||
@@ -2202,7 +2202,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
@@ -2205,7 +2205,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
Vec3 vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
HitResult movingobjectposition = this.player.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player));
|
||||
HitResult movingobjectposition = this.player.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.player));
|
||||
|
||||
- if (movingobjectposition == null || movingobjectposition.getType() != HitResult.Type.BLOCK) {
|
||||
+ if (movingobjectposition == null || movingobjectposition.getType() != HitResult.Type.BLOCK || this.player.gameMode.getGameModeForPlayer() == GameType.ADVENTURE) { // Paper - call PlayerInteractEvent when left-clicking on a block in adventure mode
|
||||
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getSelected(), InteractionHand.MAIN_HAND);
|
||||
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
|
||||
}
|
||||
|
27
patches/server/0571-Zombie-API-breaking-doors.patch
Normale Datei
27
patches/server/0571-Zombie-API-breaking-doors.patch
Normale Datei
@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 18 Nov 2020 11:32:46 -0800
|
||||
Subject: [PATCH] Zombie API - breaking doors
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
||||
index 41b5059f6fde8a1afa8c70b983750854ac0207a6..0f6e26030807f5f3011a4bb0bcd598c4674fa772 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
||||
@@ -128,6 +128,16 @@ public class CraftZombie extends CraftMonster implements Zombie {
|
||||
public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
||||
getHandle().setShouldBurnInDay(shouldBurnInDay);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canBreakDoors() {
|
||||
+ return getHandle().canBreakDoors();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCanBreakDoors(boolean canBreakDoors) {
|
||||
+ getHandle().setCanBreakDoors(canBreakDoors);
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@Override
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix nerfed slime when splitting
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
index 120ceb28ee3aee8a09cf67b45ac95d3d6613c133..2f04543c1c0a197f22fb26b2a38c7c79e6b4a63a 100644
|
||||
index 6a199e148929d8df9b1f39733dd821c503380973..31ca6e693acb7f2db9ea75a38ec6286ea1ed2bd4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
@@ -242,6 +242,7 @@ public class Slime extends Mob implements Enemy {
|
||||
@@ -241,6 +241,7 @@ public class Slime extends Mob implements Enemy {
|
||||
entityslime.setPersistenceRequired();
|
||||
}
|
||||
|
39
patches/server/0573-Add-EntityLoadCrossbowEvent.patch
Normale Datei
39
patches/server/0573-Add-EntityLoadCrossbowEvent.patch
Normale Datei
@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JRoy <joshroy126@gmail.com>
|
||||
Date: Wed, 7 Oct 2020 12:04:01 -0400
|
||||
Subject: [PATCH] Add EntityLoadCrossbowEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
index 35f3f3887c0696b757553af9a5997506c97b24c0..d670ac2b57ecbdd6ff5426c233e23e634d4f665d 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
@@ -90,7 +90,11 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
|
||||
int j = this.getUseDuration(stack) - remainingUseTicks;
|
||||
float f = CrossbowItem.getPowerForTime(j, stack);
|
||||
|
||||
- if (f >= 1.0F && !CrossbowItem.isCharged(stack) && CrossbowItem.tryLoadProjectiles(user, stack)) {
|
||||
+ // Paper start - EntityLoadCrossbowEvent
|
||||
+ if (f >= 1.0F && !CrossbowItem.isCharged(stack) /*&& CrossbowItem.tryLoadProjectiles(entityliving, itemstack)*/) {
|
||||
+ final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), user.getUsedItemHand() == InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND);
|
||||
+ if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem())) return;
|
||||
+ // Paper end
|
||||
CrossbowItem.setCharged(stack, true);
|
||||
SoundSource soundcategory = user instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE;
|
||||
|
||||
@@ -100,9 +104,14 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
|
||||
}
|
||||
|
||||
private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack projectile) {
|
||||
+ // Paper start
|
||||
+ return CrossbowItem.tryLoadProjectiles(shooter, projectile, true);
|
||||
+ }
|
||||
+ private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack projectile, boolean consume) {
|
||||
+ // Paper end
|
||||
int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, projectile);
|
||||
int j = i == 0 ? 1 : 3;
|
||||
- boolean flag = shooter instanceof Player && ((Player) shooter).getAbilities().instabuild;
|
||||
+ boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - add consme
|
||||
ItemStack itemstack1 = shooter.getProjectile(projectile);
|
||||
ItemStack itemstack2 = itemstack1.copy();
|
||||
|
20
patches/server/0574-Guardian-beam-workaround.patch
Normale Datei
20
patches/server/0574-Guardian-beam-workaround.patch
Normale Datei
@ -0,0 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Gabscap <git@gabscap.de>
|
||||
Date: Sat, 19 Mar 2016 22:25:11 +0100
|
||||
Subject: [PATCH] Guardian beam workaround
|
||||
|
||||
This patch is a workaround for MC-165595
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
|
||||
index 9ec6145fe04ec64bbee8ec6a837719caebdbc6f5..c96b63355b38053b0f7ede313fb4bdf0e1089796 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
|
||||
@@ -8,7 +8,7 @@ public class ClientboundSetTimePacket implements Packet<ClientGamePacketListener
|
||||
private final long dayTime;
|
||||
|
||||
public ClientboundSetTimePacket(long time, long timeOfDay, boolean doDaylightCycle) {
|
||||
- this.gameTime = time;
|
||||
+ this.gameTime = time % 192000; // Paper - fix guardian bean
|
||||
long l = timeOfDay;
|
||||
if (!doDaylightCycle) {
|
||||
l = -timeOfDay;
|
98
patches/server/0575-Added-WorldGameRuleChangeEvent.patch
Normale Datei
98
patches/server/0575-Added-WorldGameRuleChangeEvent.patch
Normale Datei
@ -0,0 +1,98 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 20 Dec 2020 16:41:44 -0800
|
||||
Subject: [PATCH] Added WorldGameRuleChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java
|
||||
index f2e53fbb067a3909f386386eb3b89dfe090ee096..6f6292e7945cec1bdc69632dbfb950d6af53df42 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java
|
||||
@@ -33,7 +33,7 @@ public class GameRuleCommand {
|
||||
CommandSourceStack commandlistenerwrapper = (CommandSourceStack) context.getSource();
|
||||
T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(key); // CraftBukkit
|
||||
|
||||
- t0.setFromArgument(context, "value");
|
||||
+ t0.setFromArgument(context, "value", key); // Paper
|
||||
commandlistenerwrapper.sendSuccess(new TranslatableComponent("commands.gamerule.set", new Object[]{key.getId(), t0.toString()}), true);
|
||||
return t0.getCommandResult();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
index 888d812118c15c212284687ae5842a94f5715d52..e7ca5d6fb8922e7e8065864f736b06056be080a0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
@@ -261,10 +261,10 @@ public class GameRules {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
- protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name);
|
||||
+ protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey); // Paper
|
||||
|
||||
- public void setFromArgument(CommandContext<CommandSourceStack> context, String name) {
|
||||
- this.updateFromArgument(context, name);
|
||||
+ public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper
|
||||
+ this.updateFromArgument(context, name, gameRuleKey); // Paper
|
||||
this.onChanged(((CommandSourceStack) context.getSource()).getServer());
|
||||
}
|
||||
|
||||
@@ -322,8 +322,11 @@ public class GameRules {
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name) {
|
||||
- this.value = BoolArgumentType.getBool(context, name);
|
||||
+ protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<BooleanValue> gameRuleKey) { // Paper start
|
||||
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(context.getSource().getBukkitWorld(), context.getSource().getBukkitSender(), (org.bukkit.GameRule<Boolean>) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(BoolArgumentType.getBool(context, name)));
|
||||
+ if (!event.callEvent()) return;
|
||||
+ this.value = Boolean.parseBoolean(event.getValue());
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public boolean get() {
|
||||
@@ -387,8 +390,11 @@ public class GameRules {
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name) {
|
||||
- this.value = IntegerArgumentType.getInteger(context, name);
|
||||
+ protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<IntegerValue> gameRuleKey) { // Paper start
|
||||
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(context.getSource().getBukkitWorld(), context.getSource().getBukkitSender(), (org.bukkit.GameRule<Integer>) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(IntegerArgumentType.getInteger(context, name)));
|
||||
+ if (!event.callEvent()) return;
|
||||
+ this.value = Integer.parseInt(event.getValue());
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public int get() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index ed8c8b7ff07a58dfaf7bbb1e630a1e68cc0c29f3..fd01fc9708a62df9483c88ffeec6a0304f3708ca 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -2363,8 +2363,13 @@ public class CraftWorld implements World {
|
||||
|
||||
if (!this.isGameRule(rule)) return false;
|
||||
|
||||
+ // Paper start
|
||||
+ GameRule<?> gameRule = GameRule.getByName(rule);
|
||||
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, gameRule, value);
|
||||
+ if (!event.callEvent()) return false;
|
||||
+ // Paper end
|
||||
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule));
|
||||
- handle.deserialize(value);
|
||||
+ handle.deserialize(event.getValue()); // Paper
|
||||
handle.onChanged(this.getHandle().getServer());
|
||||
return true;
|
||||
}
|
||||
@@ -2399,8 +2404,12 @@ public class CraftWorld implements World {
|
||||
|
||||
if (!this.isGameRule(rule.getName())) return false;
|
||||
|
||||
+ // Paper start
|
||||
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, rule, String.valueOf(newValue));
|
||||
+ if (!event.callEvent()) return false;
|
||||
+ // Paper end
|
||||
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName()));
|
||||
- handle.deserialize(newValue.toString());
|
||||
+ handle.deserialize(event.getValue()); // Paper
|
||||
handle.onChanged(this.getHandle().getServer());
|
||||
return true;
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren