more patches
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Roy <10731363+JRoy@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
|
||||
@@ -0,0 +0,0 @@ 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) {
|
||||
@@ -0,0 +0,0 @@ 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,21 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 24 Dec 2020 12:43:39 -0800
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
return BedEnterResult.TOO_FAR_AWAY;
|
||||
case NOT_SAFE:
|
||||
return BedEnterResult.NOT_SAFE;
|
||||
+ // Paper start
|
||||
+ case OBSTRUCTED:
|
||||
+ return BedEnterResult.OBSTRUCTED;
|
||||
+ // Paper end
|
||||
default:
|
||||
return BedEnterResult.OTHER_PROBLEM;
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Roy <10731363+JRoy@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
|
||||
@@ -0,0 +0,0 @@
|
||||
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;
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
@@ -0,0 +0,0 @@ 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 {
|
||||
|
||||
@@ -0,0 +0,0 @@ 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,80 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Kyle Wood <kyle@denwav.dev>
|
||||
Date: Wed, 2 Dec 2020 21:58:45 -0800
|
||||
Subject: [PATCH] Add warning for servers not running on Java 16
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/PaperJvmChecker.java b/src/main/java/io/papermc/paper/util/PaperJvmChecker.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/util/PaperJvmChecker.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.util;
|
||||
+
|
||||
+import org.apache.logging.log4j.LogManager;
|
||||
+import org.apache.logging.log4j.Logger;
|
||||
+
|
||||
+import java.util.regex.Matcher;
|
||||
+import java.util.regex.Pattern;
|
||||
+
|
||||
+public class PaperJvmChecker {
|
||||
+
|
||||
+ private static int getJvmVersion() {
|
||||
+ String javaVersion = System.getProperty("java.version");
|
||||
+ final Matcher matcher = Pattern.compile("(?:1\\.)?(\\d+)").matcher(javaVersion);
|
||||
+ if (!matcher.find()) {
|
||||
+ LogManager.getLogger().warn("Failed to determine Java version; Could not parse: {}", javaVersion);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ final String version = matcher.group(1);
|
||||
+ try {
|
||||
+ return Integer.parseInt(version);
|
||||
+ } catch (final NumberFormatException e) {
|
||||
+ LogManager.getLogger().warn("Failed to determine Java version; Could not parse {} from {}", version, javaVersion, e);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void checkJvm() {
|
||||
+ if (getJvmVersion() < 16) {
|
||||
+ final Logger logger = LogManager.getLogger();
|
||||
+ logger.warn("************************************************************");
|
||||
+ logger.warn("* WARNING - YOU ARE RUNNING AN OUTDATED VERSION OF JAVA.");
|
||||
+ logger.warn("* PAPER WILL STOP BEING COMPATIBLE WITH THIS VERSION OF");
|
||||
+ logger.warn("* JAVA WHEN MINECRAFT 1.17 IS RELEASED.");
|
||||
+ logger.warn("*");
|
||||
+ logger.warn("* Please update the version of Java you use to run Paper");
|
||||
+ logger.warn("* to at least Java 16. When Paper for Minecraft 1.17 is");
|
||||
+ logger.warn("* released support for versions of Java before 16 will");
|
||||
+ logger.warn("* be dropped.");
|
||||
+ logger.warn("*");
|
||||
+ logger.warn("* Current Java version: {}", System.getProperty("java.version"));
|
||||
+ logger.warn("*");
|
||||
+ logger.warn("* Check this forum post for more information: ");
|
||||
+ logger.warn("* https://papermc.io/java16");
|
||||
+ logger.warn("************************************************************");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ 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 {
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
LOGGER.info("Done ({})! For help, type \"help\"", doneTime);
|
||||
// Paper end
|
||||
|
||||
+ PaperJvmChecker.checkJvm(); // Paper jvm version nag
|
||||
org.spigotmc.WatchdogThread.tick(); // Paper
|
||||
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
||||
Arrays.fill( recentTps, 20 );
|
||||
@@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
@@ -0,0 +0,0 @@ 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 {
|
||||
|
||||
@@ -0,0 +0,0 @@ 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() {
|
||||
@@ -0,0 +0,0 @@ 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() {
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
}
|
||||
@@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
||||
@@ -0,0 +0,0 @@ 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,40 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 30 Dec 2020 19:43:01 -0500
|
||||
Subject: [PATCH] Additional Block Material API's
|
||||
|
||||
Faster version for isSolid() that utilizes NMS's state for isSolid instead of the slower
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -0,0 +0,0 @@ public class CraftBlock implements Block {
|
||||
return getNMS().getMaterial().isLiquid();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean isBuildable() {
|
||||
+ return getNMS().getMaterial().isBuildable();
|
||||
+ }
|
||||
+ @Override
|
||||
+ public boolean isBurnable() {
|
||||
+ return getNMS().getMaterial().isBurnable();
|
||||
+ }
|
||||
+ @Override
|
||||
+ public boolean isReplaceable() {
|
||||
+ return getNMS().getMaterial().isReplaceable();
|
||||
+ }
|
||||
+ @Override
|
||||
+ public boolean isSolid() {
|
||||
+ return getNMS().getMaterial().blocksMotion();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public PistonMoveReaction getPistonMoveReaction() {
|
||||
return PistonMoveReaction.getById(getNMS().getPistonPushReaction().ordinal());
|
||||
@@ -1,33 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BrodyBeckwith <brody@beckwith.dev>
|
||||
Date: Fri, 9 Oct 2020 20:30:12 -0400
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
private void fixCuringExploit() {
|
||||
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);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/SpawnEggItem.java b/src/main/java/net/minecraft/world/item/SpawnEggItem.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/SpawnEggItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/SpawnEggItem.java
|
||||
@@ -0,0 +0,0 @@ public class SpawnEggItem extends Item {
|
||||
Direction enumdirection = context.getClickedFace();
|
||||
BlockState iblockdata = world.getBlockState(blockposition);
|
||||
|
||||
- if (iblockdata.is(Blocks.SPAWNER)) {
|
||||
+ if (!world.paperConfig.disableMobSpawnerSpawnEggTransformation && iblockdata.is(Blocks.SPAWNER)) { // Paper
|
||||
BlockEntity tileentity = world.getBlockEntity(blockposition);
|
||||
|
||||
if (tileentity instanceof SpawnerBlockEntity) {
|
||||
@@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
||||
@@ -0,0 +0,0 @@
|
||||
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;
|
||||
@@ -0,0 +0,0 @@ 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);
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ 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,24 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sun, 27 Dec 2020 11:31:06 +0000
|
||||
Subject: [PATCH] Do not crash from invalid ingredient lists in
|
||||
VillagerAcquireTradeEvent
|
||||
|
||||
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
@@ -0,0 +0,0 @@ public abstract class AbstractVillager extends AgableMob implements Npc, Merchan
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
}
|
||||
if (!event.isCancelled()) {
|
||||
- recipeList.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
|
||||
+ // Paper start
|
||||
+ final CraftMerchantRecipe craftMerchantRecipe = CraftMerchantRecipe.fromBukkit(event.getRecipe());
|
||||
+ if (craftMerchantRecipe.getIngredients().isEmpty()) return;
|
||||
+ recipeList.add(craftMerchantRecipe.toMinecraft());
|
||||
+ // Paper end
|
||||
}
|
||||
// CraftBukkit 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
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,21 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 17 Dec 2020 15:25:49 -0600
|
||||
Subject: [PATCH] Fix CraftSound backwards compatibility
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
@@ -0,0 +0,0 @@ public class CraftSound {
|
||||
public static Sound getBukkit(SoundEvent soundEffect) {
|
||||
return Registry.SOUNDS.get(CraftNamespacedKey.fromMinecraft(net.minecraft.core.Registry.SOUND_EVENT.getKey(soundEffect)));
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ public static String getSound(Sound sound) {
|
||||
+ return sound.getKey().getKey();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 8 Dec 2020 20:14:20 -0600
|
||||
Subject: [PATCH] Fix curing zombie villager discount exploit
|
||||
|
||||
This fixes the exploit used to gain absurd trading discounts with infecting
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
private void fixClimbingBypassingCrammingRule() {
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
||||
@@ -0,0 +0,0 @@ public class GossipContainer {
|
||||
|
||||
}
|
||||
|
||||
+ public final void removeReputationForType(GossipType reputationType) { this.remove(reputationType); } // Paper - OBFHELPER
|
||||
public void remove(GossipType gossipType) {
|
||||
this.entries.removeInt(gossipType);
|
||||
}
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -0,0 +0,0 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@Override
|
||||
public void onReputationEventFrom(ReputationEventType interaction, Entity entity) {
|
||||
if (interaction == ReputationEventType.ZOMBIE_VILLAGER_CURED) {
|
||||
+ // Paper start - fix MC-181190
|
||||
+ 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);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.gossips.add(entity.getUUID(), GossipType.MAJOR_POSITIVE, 20);
|
||||
this.gossips.add(entity.getUUID(), GossipType.MINOR_POSITIVE, 25);
|
||||
} else if (interaction == ReputationEventType.TRADE) {
|
||||
@@ -1,59 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com>
|
||||
Date: Thu, 23 Jul 2020 14:25:07 -0700
|
||||
Subject: [PATCH] Fix harming potion dupe
|
||||
|
||||
EntityLiving#applyInstantEffect() immediately kills the player and drops their inventory.
|
||||
Before this patch, instant effects would be applied before the potion ItemStack is removed and replaced with a glass bottle. This caused the potion ItemStack to be dropped before it was supposed to be removed from the inventory. It also caused the glass bottle to be put into a dead player's inventory.
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/PotionItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/PotionItem.java
|
||||
@@ -0,0 +0,0 @@ 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 {
|
||||
@@ -0,0 +0,0 @@ public class PotionItem extends Item {
|
||||
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer) entityhuman, stack);
|
||||
}
|
||||
|
||||
+ List<MobEffectInstance> instantLater = new java.util.ArrayList<>(); // Paper - Fix harming potion dupe
|
||||
if (!world.isClientSide) {
|
||||
List<MobEffectInstance> list = PotionUtils.getMobEffects(stack);
|
||||
Iterator iterator = list.iterator();
|
||||
@@ -0,0 +0,0 @@ public class PotionItem extends Item {
|
||||
MobEffectInstance mobeffect = (MobEffectInstance) iterator.next();
|
||||
|
||||
if (mobeffect.getMobEffect().isInstant()) {
|
||||
- mobeffect.getMobEffect().applyInstantEffect(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
|
||||
}
|
||||
@@ -0,0 +0,0 @@ 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);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (entityhuman == null || !entityhuman.abilities.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;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (stack.isEmpty()) {
|
||||
return new ItemStack(Items.GLASS_BOTTLE);
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: TheMolkaPL <themolkapl@gmail.com>
|
||||
Date: Sun, 21 Jun 2020 17:21:46 +0200
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{this.server.getMaxBuildHeight()})).withStyle(ChatFormatting.RED);
|
||||
|
||||
this.player.connection.send(new ClientboundChatPacket(ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID));
|
||||
- } else if (enuminteractionresult.shouldSwing()) {
|
||||
+ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) {
|
||||
this.player.swing(enumhand, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
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));
|
||||
|
||||
- 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);
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 24 Aug 2020 08:39:06 -0700
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
@@ -0,0 +0,0 @@ public class Slime extends Mob implements Enemy {
|
||||
entityslime.setPersistenceRequired();
|
||||
}
|
||||
|
||||
+ entityslime.aware = this.aware; // Paper
|
||||
entityslime.setCustomName(ichatbasecomponent);
|
||||
entityslime.setNoAi(flag);
|
||||
entityslime.setInvulnerable(this.isInvulnerable());
|
||||
@@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java
|
||||
@@ -0,0 +0,0 @@ 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() {}
|
||||
@@ -0,0 +0,0 @@ public class ClientboundSetTimePacket implements Packet<ClientGamePacketListener
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ this.setWorldAge(this.getWorldAge() % 192000);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,100 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Miller <mnmiller1@me.com>
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
@@ -0,0 +0,0 @@ public class Boat extends 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
|
||||
@@ -0,0 +0,0 @@
|
||||
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;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class CraftBoat extends CraftVehicle implements Boat {
|
||||
getHandle().landBoats = workOnLand;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public Material getBoatMaterial() {
|
||||
+ return CraftMagicNumbers.getMaterial(getHandle().getBoatItem());
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||
+import net.minecraft.world.item.Items; // Paper
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
+import org.bukkit.Material; // Paper
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
|
||||
getHandle().setDerailedVelocityMod(derailed);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public Material getMinecartMaterial() {
|
||||
+ net.minecraft.world.item.Item minecartItem;
|
||||
+ switch (getHandle().getMinecartType()) {
|
||||
+ case CHEST:
|
||||
+ minecartItem = Items.CHEST_MINECART;
|
||||
+ break;
|
||||
+ case FURNACE:
|
||||
+ minecartItem = Items.FURNACE_MINECART;
|
||||
+ break;
|
||||
+ case TNT:
|
||||
+ minecartItem = Items.TNT_MINECART;
|
||||
+ break;
|
||||
+ case HOPPER:
|
||||
+ minecartItem = Items.HOPPER_MINECART;
|
||||
+ break;
|
||||
+ case COMMAND_BLOCK:
|
||||
+ minecartItem = Items.COMMAND_BLOCK_MINECART;
|
||||
+ break;
|
||||
+ case RIDEABLE:
|
||||
+ case SPAWNER:
|
||||
+ minecartItem = Items.MINECART;
|
||||
+ break;
|
||||
+ default:
|
||||
+ throw new IllegalStateException("Unexpected value: " + getHandle().getMinecartType());
|
||||
+ }
|
||||
+
|
||||
+ return CraftMagicNumbers.getMaterial(minecartItem);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public AbstractMinecart getHandle() {
|
||||
return (AbstractMinecart) entity;
|
||||
@@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MisterVector <whizkid3000@hotmail.com>
|
||||
Date: Tue, 13 Aug 2019 19:45:06 -0700
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
|
||||
@@ -0,0 +0,0 @@ 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 {
|
||||
|
||||
@@ -0,0 +0,0 @@ public class FlowerPotBlock extends Block {
|
||||
boolean flag1 = this.content == Blocks.AIR;
|
||||
|
||||
if (flag != flag1) {
|
||||
+ // Paper start
|
||||
+ org.bukkit.entity.Player player1 = (org.bukkit.entity.Player) player.getBukkitEntity();
|
||||
+ boolean placing = flag1;
|
||||
+ 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.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);
|
||||
+ player1.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Update client
|
||||
+ player1.sendBlockChange(bukkitblock.getLocation(), bukkitblock.getBlockData());
|
||||
+ player1.updateInventory();
|
||||
+
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (flag1) {
|
||||
world.setBlock(pos, block.defaultBlockState(), 3);
|
||||
player.awardStat(Stats.POT_FLOWER);
|
||||
@@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TargetBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TargetBlock.java
|
||||
@@ -0,0 +0,0 @@
|
||||
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;
|
||||
@@ -0,0 +0,0 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +0,0 @@ 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,74 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sat, 12 Dec 2020 23:45:28 +0000
|
||||
Subject: [PATCH] Limit recipe packets
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit);
|
||||
}
|
||||
|
||||
+ public static int autoRecipeIncrement = 1;
|
||||
+ public static int autoRecipeLimit = 20;
|
||||
+ private static void autoRecipieLimiters() {
|
||||
+ autoRecipeIncrement = getInt("settings.spam-limiter.recipe-spam-increment", autoRecipeIncrement);
|
||||
+ autoRecipeLimit = getInt("settings.spam-limiter.recipe-spam-limit", autoRecipeLimit);
|
||||
+ }
|
||||
+
|
||||
public static boolean velocitySupport;
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@
|
||||
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;
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
private volatile int chatSpamTickCount;
|
||||
private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(ServerGamePacketListenerImpl.class, "chatThrottle");
|
||||
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();
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
// CraftBukkit start
|
||||
for (int spam; (spam = this.chatSpamTickCount) > 0 && !chatSpamField.compareAndSet(this, 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;
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
|
||||
@Override
|
||||
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
|
||||
+ // Paper start
|
||||
+ if (!Bukkit.isPrimaryThread()) {
|
||||
+ if (recipeSpamPackets.addAndGet(PaperConfig.autoRecipeIncrement) > PaperConfig.autoRecipeLimit) {
|
||||
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // 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) {
|
||||
@@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/util/Mth.java
|
||||
+++ b/src/main/java/net/minecraft/util/Mth.java
|
||||
@@ -0,0 +0,0 @@ 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);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -0,0 +0,0 @@ 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,34 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 21 Dec 2020 11:01:42 -0500
|
||||
Subject: [PATCH] Optimize Dynamic#get Missing Keys
|
||||
|
||||
get was calling toString() on every NBT object that was ever asked for an optional
|
||||
key from the object to build a string for the error text.
|
||||
|
||||
When done on large NBT objects, this was using a ton of computation time building the
|
||||
JSON representation of the NBT object.
|
||||
|
||||
Now we will just skip the value when 99.9999% of the time the text is never even printed.
|
||||
|
||||
diff --git a/src/main/java/com/mojang/serialization/Dynamic.java b/src/main/java/com/mojang/serialization/Dynamic.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/mojang/serialization/Dynamic.java
|
||||
+++ b/src/main/java/com/mojang/serialization/Dynamic.java
|
||||
@@ -0,0 +0,0 @@ import java.util.stream.Stream;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class Dynamic<T> extends DynamicLike<T> {
|
||||
+ private static final boolean DEBUG_MISSING_KEYS = Boolean.getBoolean("Paper.debugDynamicMissingKeys"); // Paper
|
||||
private final T value;
|
||||
|
||||
public Dynamic(final DynamicOps<T> ops) {
|
||||
@@ -0,0 +0,0 @@ public class Dynamic<T> extends DynamicLike<T> {
|
||||
return new OptionalDynamic<>(ops, ops.getMap(value).flatMap(m -> {
|
||||
final T value = m.get(key);
|
||||
if (value == null) {
|
||||
- return DataResult.error("key missing: " + key + " in " + this.value);
|
||||
+ return DataResult.error(DEBUG_MISSING_KEYS ? "key missing: " + key + " in " + this.value : "key missing: " + key); // Paper
|
||||
}
|
||||
return DataResult.success(new Dynamic<>(ops, value));
|
||||
}));
|
||||
@@ -1,51 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: lukas <lukasalt98@gmail.com>
|
||||
Date: Sun, 27 Dec 2020 17:19:51 +0100
|
||||
Subject: [PATCH] Optimized tick ready check
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (!tileentity.isRemoved() && tileentity.hasLevel()) {
|
||||
BlockPos blockposition = tileentity.getBlockPos();
|
||||
|
||||
- if (this.getChunkSource().isTickingChunk(blockposition) && this.getWorldBorder().isWithinBounds(blockposition)) {
|
||||
+ LevelChunk chunk; ChunkHolder playerChunk; if ((chunk = tileentity.getCurrentChunk()) != null && (playerChunk = chunk.playerChunk) != null && playerChunk.isTickingReady() && this.getWorldBorder().isInBounds(blockposition)) { // Paper - optimized tick ready check by inlining ChunkProviderServer.a(BlockPosition). Chunk lookup is no longer required and we can use the PlayerChunk directly available through the tile entity
|
||||
try {
|
||||
gameprofilerfiller.push(() -> {
|
||||
return String.valueOf(BlockEntityType.getKey(tileentity.getType()));
|
||||
});
|
||||
tileentity.tickTimer.startTiming(); // Spigot
|
||||
- if (tileentity.getType().isValid(this.getBlockState(blockposition).getBlock())) {
|
||||
+ if (tileentity.getType().isValid(chunk.getBlockState(blockposition).getBlock())) { // Paper - reuse the chunk from above, do not look it up again
|
||||
((TickableBlockEntity) tileentity).tick();
|
||||
} else {
|
||||
tileentity.logInvalidState();
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
this.tickableBlockEntities.remove(tileTickPosition--);
|
||||
// Spigot end
|
||||
//this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
||||
- if (this.hasChunkAt(tileentity.getBlockPos())) {
|
||||
- this.getChunkAt(tileentity.getBlockPos()).removeBlockEntity(tileentity.getBlockPos());
|
||||
+ // Paper - prevent double chunk lookups
|
||||
+ LevelChunk chunk; if ((chunk = this.getChunkIfLoaded(tileentity.getBlockPos())) != null) { // inlined contents of this.isLoaded(BlockPosition). Reuse the returned chunk instead of looking it up again
|
||||
+ chunk.removeBlockEntity(tileentity.getBlockPos());
|
||||
}
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
// CraftBukkit end */
|
||||
|
||||
- if (this.hasChunkAt(tileentity1.getBlockPos())) {
|
||||
- LevelChunk chunk = this.getChunkAt(tileentity1.getBlockPos());
|
||||
+ LevelChunk chunk; if ((chunk = this.getChunkIfLoaded(tileentity1.getBlockPos())) != null) { // Paper - inlined contents of this.isLoaded(BlockPosition). Reuse the returned chunk instead of looking it up again
|
||||
+ // Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition()); // Paper - already computed above
|
||||
BlockState iblockdata = chunk.getBlockState(tileentity1.getBlockPos());
|
||||
|
||||
chunk.setBlockEntity(tileentity1.getBlockPos(), tileentity1);
|
||||
@@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
@@ -0,0 +0,0 @@ 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,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 2 Dec 2020 20:17:54 -0800
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
|
||||
|
||||
public void init()
|
||||
{
|
||||
- this.verbose = getBoolean( "verbose", true );
|
||||
+ this.verbose = getBoolean( "verbose", false ); // Paper
|
||||
|
||||
log( "-------- World Settings For [" + worldName + "] --------" );
|
||||
SpigotConfig.readConfig( SpigotWorldConfig.class, this );
|
||||
@@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
|
||||
@@ -0,0 +0,0 @@ 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,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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
@@ -0,0 +0,0 @@ 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 {
|
||||
|
||||
@@ -0,0 +0,0 @@ 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() {
|
||||
Reference in New Issue
Block a user