moar patches
This commit is contained in:
parent
3436ed93c2
commit
c280dbeed0
19 changed files with 47 additions and 72 deletions
|
@ -0,0 +1,18 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Wed, 6 Jan 2021 23:38:43 +0100
|
||||
Subject: [PATCH] Empty commands shall not be dispatched
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 6624045921ef64046b375ec787cadda1e8c8435b..e4cb8f2b8602650e26c21a856ed0d8c2ea8f6c28 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -239,6 +239,7 @@ public class Commands {
|
||||
command = event.getCommand();
|
||||
|
||||
String[] args = command.split(" ");
|
||||
+ if (args.length == 0) return 0; // Paper - empty commands shall not be dispatched
|
||||
|
||||
String cmd = args[0];
|
||||
if (cmd.startsWith("minecraft:")) cmd = cmd.substring("minecraft:".length());
|
|
@ -0,0 +1,59 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Madeline Miller <mnmiller1@me.com>
|
||||
Date: Mon, 4 Jan 2021 16:40:27 +1000
|
||||
Subject: [PATCH] Implement API to expose exact interaction point
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index 2ac2100b6ae006ab490742424b682395e7513156..9fbd88027933242348d9f4fea8b45e96fd01c343 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -497,7 +497,7 @@ public class ServerPlayerGameMode {
|
||||
cancelledBlock = true;
|
||||
}
|
||||
|
||||
- PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, blockposition, hitResult.getDirection(), stack, cancelledBlock, hand);
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, blockposition, hitResult.getDirection(), stack, cancelledBlock, hand, hitResult.getLocation()); // Paper
|
||||
this.firedInteract = true;
|
||||
this.interactResult = event.useItemInHand() == Event.Result.DENY;
|
||||
this.interactPosition = blockposition.immutable();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index fa46a33e34c4ebcf94a54cb597ff6bbb02cfcef9..419c5bd638230c31dd68ba37174c8057c0229a6a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -56,7 +56,9 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
+import net.minecraft.world.phys.Vec3;
|
||||
import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location; // Paper
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Server;
|
||||
@@ -482,7 +484,13 @@ public class CraftEventFactory {
|
||||
return CraftEventFactory.callPlayerInteractEvent(who, action, position, direction, itemstack, false, hand);
|
||||
}
|
||||
|
||||
+ // Paper start - Add interactionPoint
|
||||
public static PlayerInteractEvent callPlayerInteractEvent(net.minecraft.world.entity.player.Player who, Action action, BlockPos position, Direction direction, ItemStack itemstack, boolean cancelledBlock, InteractionHand hand) {
|
||||
+ return callPlayerInteractEvent(who, action, position, direction, itemstack, cancelledBlock, hand, null);
|
||||
+ }
|
||||
+
|
||||
+ public static PlayerInteractEvent callPlayerInteractEvent(net.minecraft.world.entity.player.Player who, Action action, BlockPos position, Direction direction, ItemStack itemstack, boolean cancelledBlock, InteractionHand hand, Vec3 hitVec) {
|
||||
+ // Paper end
|
||||
Player player = (who == null) ? null : (Player) who.getBukkitEntity();
|
||||
CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
|
||||
|
||||
@@ -508,7 +516,10 @@ public class CraftEventFactory {
|
||||
itemInHand = null;
|
||||
}
|
||||
|
||||
- PlayerInteractEvent event = new PlayerInteractEvent(player, action, itemInHand, blockClicked, blockFace, (hand == null) ? null : ((hand == InteractionHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND));
|
||||
+ // Paper start
|
||||
+ Location interactionPoint = hitVec == null ? null : new Location(craftWorld, hitVec.x, hitVec.y, hitVec.z);
|
||||
+ PlayerInteractEvent event = new PlayerInteractEvent(player, action, itemInHand, blockClicked, blockFace, (hand == null) ? null : ((hand == InteractionHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND), interactionPoint);
|
||||
+ // Paper end
|
||||
if (cancelledBlock) {
|
||||
event.setUseInteractedBlock(Event.Result.DENY);
|
||||
}
|
22
patches/server/0568-Remove-stale-POIs.patch
Normal file
22
patches/server/0568-Remove-stale-POIs.patch
Normal file
|
@ -0,0 +1,22 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sat, 9 Jan 2021 14:17:07 +0100
|
||||
Subject: [PATCH] Remove stale POIs
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index bc57099ffc447a713b92896a1348728702ef51b2..24ff621292d04d241f432e3a43e9dca92a35be55 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1768,6 +1768,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
});
|
||||
optional1.ifPresent((villageplacetype) -> {
|
||||
this.getServer().execute(() -> {
|
||||
+ // Paper start
|
||||
+ if (optional.isEmpty() && this.getPoiManager().exists(blockposition1, poiType -> true)) {
|
||||
+ this.getPoiManager().remove(blockposition1);
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.getPoiManager().add(blockposition1, villageplacetype);
|
||||
DebugPackets.sendPoiAddedPacket(this, blockposition1);
|
||||
});
|
25
patches/server/0569-Fix-villager-boat-exploit.patch
Normal file
25
patches/server/0569-Fix-villager-boat-exploit.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Mon, 11 Jan 2021 12:43:51 -0800
|
||||
Subject: [PATCH] Fix villager boat exploit
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 1d7e5d0f155dd92015dcf287b8a21d0337fc2af7..1c150913d4752d51d51640e0a5cf6d67182356b7 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -619,6 +619,14 @@ public abstract class PlayerList {
|
||||
PlayerList.LOGGER.debug("Removing player mount");
|
||||
entityplayer.stopRiding();
|
||||
entity.getPassengersAndSelf().forEach((entity1) -> {
|
||||
+ // Paper start
|
||||
+ if (entity1 instanceof net.minecraft.world.entity.npc.AbstractVillager villager) {
|
||||
+ final net.minecraft.world.entity.player.Player human = villager.getTradingPlayer();
|
||||
+ if (human != null) {
|
||||
+ villager.setTradingPlayer(null);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
entity1.setRemoved(Entity.RemovalReason.UNLOADED_WITH_PLAYER);
|
||||
});
|
||||
}
|
51
patches/server/0570-Add-sendOpLevel-API.patch
Normal file
51
patches/server/0570-Add-sendOpLevel-API.patch
Normal file
|
@ -0,0 +1,51 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Tue, 29 Dec 2020 15:03:03 +0100
|
||||
Subject: [PATCH] Add sendOpLevel API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 1c150913d4752d51d51640e0a5cf6d67182356b7..d300fc577a363e7884d1a176b6c282fe87008a8b 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1116,6 +1116,11 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
|
||||
+ // Paper start - add recalculatePermissions parameter
|
||||
+ this.sendPlayerPermissionLevel(player, permissionLevel, true);
|
||||
+ }
|
||||
+ public void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel, boolean recalculatePermissions) {
|
||||
+ // Paper end
|
||||
if (player.connection != null) {
|
||||
byte b0;
|
||||
|
||||
@@ -1130,8 +1135,10 @@ public abstract class PlayerList {
|
||||
player.connection.send(new ClientboundEntityEventPacket(player, b0));
|
||||
}
|
||||
|
||||
+ if (recalculatePermissions) { // Paper
|
||||
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
||||
this.server.getCommands().sendCommands(player);
|
||||
+ } // Paper
|
||||
}
|
||||
|
||||
// Paper start
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index f4a94bc00a8318af810c3c859decbf88decfa98d..87ed5271d623f239c94d18464458469c8e789bba 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -576,6 +576,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
? (org.bukkit.entity.Firework) entity.getBukkitEntity()
|
||||
: null;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendOpLevel(byte level) {
|
||||
+ Preconditions.checkArgument(level >= 0 && level <= 4, "Level must be within [0, 4]");
|
||||
+
|
||||
+ this.getHandle().getServer().getPlayerList().sendPlayerPermissionLevel(this.getHandle(), level, false);
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@Override
|
31
patches/server/0571-Add-StructureLocateEvent.patch
Normal file
31
patches/server/0571-Add-StructureLocateEvent.patch
Normal file
|
@ -0,0 +1,31 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: dfsek <dfsek@protonmail.com>
|
||||
Date: Wed, 16 Sep 2020 01:12:29 -0700
|
||||
Subject: [PATCH] Add StructureLocateEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
index 583b87b20490fd7254f5e966af3b6a627f53a7cb..13e789b3b7ea3be73ec73bb5357cb603da8d5e0d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -183,6 +183,20 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
|
||||
|
||||
@Nullable
|
||||
public BlockPos findNearestMapFeature(ServerLevel world, StructureFeature<?> structureFeature, BlockPos center, int radius, boolean skipExistingChunks) {
|
||||
+ // Paper start
|
||||
+ org.bukkit.World world1 = world.getWorld();
|
||||
+ org.bukkit.Location originLocation = new org.bukkit.Location(world1, center.getX(), center.getY(), center.getZ());
|
||||
+ io.papermc.paper.event.world.StructureLocateEvent event = new io.papermc.paper.event.world.StructureLocateEvent(world1, originLocation, org.bukkit.StructureType.getStructureTypes().get(structureFeature.getFeatureName()), radius, skipExistingChunks);
|
||||
+ if(!event.callEvent()) return null;
|
||||
+ // If event call set a final location, skip structure finding and just return set result.
|
||||
+ if(event.getResult() != null) return new BlockPos(event.getResult().getBlockX(), event.getResult().getBlockY(), event.getResult().getBlockZ());
|
||||
+ // Get origin location (re)defined by event call.
|
||||
+ center = new BlockPos(event.getOrigin().getBlockX(), event.getOrigin().getBlockY(), event.getOrigin().getBlockZ());
|
||||
+ // Get radius and whether to find unexplored structures (re)defined by event call.
|
||||
+ radius = event.getRadius();
|
||||
+ skipExistingChunks = event.shouldFindUnexplored();
|
||||
+ structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(event.getType().getName());
|
||||
+ // Paper end
|
||||
if (structureFeature == StructureFeature.STRONGHOLD) {
|
||||
this.generateStrongholds();
|
||||
BlockPos blockposition1 = null;
|
|
@ -0,0 +1,65 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Sat, 14 Nov 2020 16:48:37 +0100
|
||||
Subject: [PATCH] Collision option for requiring a player participant
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 4d723f5327a64cd8257bab502ae59a35b4a35cc1..e8f5ad4925b4d02bf79f9f56d0dac3f0cc410e71 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -82,6 +82,18 @@ public class PaperWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public boolean onlyPlayersCollide = false;
|
||||
+ public boolean allowVehicleCollisions = true;
|
||||
+ private void onlyPlayersCollide() {
|
||||
+ onlyPlayersCollide = getBoolean("only-players-collide", onlyPlayersCollide);
|
||||
+ allowVehicleCollisions = getBoolean("allow-vehicle-collisions", allowVehicleCollisions);
|
||||
+ if (onlyPlayersCollide && !allowVehicleCollisions) {
|
||||
+ log("Collisions will only work if a player is one of the two entities colliding.");
|
||||
+ } else if (onlyPlayersCollide) {
|
||||
+ log("Collisions will only work if a player OR a vehicle is one of the two entities colliding.");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public int wanderingTraderSpawnMinuteTicks = 1200;
|
||||
public int wanderingTraderSpawnDayTicks = 24000;
|
||||
public int wanderingTraderSpawnChanceFailureIncrement = 25;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index a6ef4b05daaa93ef333647cc00f8a708d466aaba..8725f949d643d21339caab19a914dc26eb515658 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1626,6 +1626,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
||||
public void push(Entity entity) {
|
||||
if (!this.isPassengerOfSameVehicle(entity)) {
|
||||
if (!entity.noPhysics && !this.noPhysics) {
|
||||
+ if (this.level.paperConfig.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper
|
||||
double d0 = entity.getX() - this.getX();
|
||||
double d1 = entity.getZ() - this.getZ();
|
||||
double d2 = Mth.absMax(d0, d1);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
index 75cff07051d3b81d37926fb1da50af5ba27c34dc..ad49dcc3473fbad306d21cbac4600574e80220a7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
@@ -832,6 +832,7 @@ public abstract class AbstractMinecart extends Entity {
|
||||
public void push(Entity entity) {
|
||||
if (!this.level.isClientSide) {
|
||||
if (!entity.noPhysics && !this.noPhysics) {
|
||||
+ if (!this.level.paperConfig.allowVehicleCollisions && this.level.paperConfig.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper
|
||||
if (!this.hasPassenger(entity)) {
|
||||
// CraftBukkit start
|
||||
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
||||
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 b4516094996c80886b8d7af599ba7c3d4229ba9d..c3d111204601270b57389e1f85456a9e2ada4629 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
@@ -240,6 +240,7 @@ public class Boat extends Entity {
|
||||
|
||||
@Override
|
||||
public void push(Entity entity) {
|
||||
+ if (!this.level.paperConfig.allowVehicleCollisions && this.level.paperConfig.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper
|
||||
if (entity instanceof Boat) {
|
||||
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
|
||||
// CraftBukkit start
|
|
@ -0,0 +1,21 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 16 Jan 2021 14:30:12 -0500
|
||||
Subject: [PATCH] Remove ProjectileHitEvent call when fireballs dead
|
||||
|
||||
The duplicate ProjectileHitEvent in EntityFireball was removed. The
|
||||
event was always called before the duplicate call.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||
index 3370f4d331637bf13c7912218041f23872971e25..0dc335b3003ae3cf11828cc849763e271a3b365b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||
@@ -97,7 +97,7 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||
|
||||
// CraftBukkit start - Fire ProjectileHitEvent
|
||||
if (this.isRemoved()) {
|
||||
- CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
|
||||
+ // CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // Paper - this is an undesired duplicate event
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: CDFN <codefun@protonmail.com>
|
||||
Date: Tue, 7 Jul 2020 17:53:23 +0200
|
||||
Subject: [PATCH] Return chat component with empty text instead of throwing
|
||||
exception
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index 49ac1e922c0c3b38ed48adda46870e1fc0fb09dc..1f4d3a48553a467bcbd4799735d1950c9c2dbe23 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.ReportedException;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.network.chat.Component;
|
||||
+import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.Mth;
|
||||
@@ -84,7 +85,12 @@ public abstract class AbstractContainerMenu {
|
||||
}
|
||||
private Component title;
|
||||
public final Component getTitle() {
|
||||
- Preconditions.checkState(this.title != null, "Title not set");
|
||||
+ // Paper start - return chat component with empty text instead of throwing error
|
||||
+ // Preconditions.checkState(this.title != null, "Title not set");
|
||||
+ if(this.title == null){
|
||||
+ return new TextComponent("");
|
||||
+ }
|
||||
+ // Paper end
|
||||
return this.title;
|
||||
}
|
||||
public final void setTitle(Component title) {
|
28
patches/server/0575-Make-schedule-command-per-world.patch
Normal file
28
patches/server/0575-Make-schedule-command-per-world.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 4 Jan 2021 19:52:44 -0800
|
||||
Subject: [PATCH] Make schedule command per-world
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
||||
index 210df39e99bfe0f373cbdf7e0cd45ff1db9cd4aa..c0127908a954d3a40ca8829e3f1f63112212f261 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
||||
@@ -31,7 +31,7 @@ public class ScheduleCommand {
|
||||
return new TranslatableComponent("commands.schedule.cleared.failure", new Object[]{object});
|
||||
});
|
||||
private static final SuggestionProvider<CommandSourceStack> SUGGEST_SCHEDULE = (commandcontext, suggestionsbuilder) -> {
|
||||
- return SharedSuggestionProvider.suggest((Iterable) ((CommandSourceStack) commandcontext.getSource()).getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), suggestionsbuilder);
|
||||
+ return SharedSuggestionProvider.suggest((Iterable) ((net.minecraft.commands.CommandSourceStack) commandcontext.getSource()).getLevel().serverLevelData.getScheduledEvents().getEventsIds(), suggestionsbuilder); // Paper
|
||||
};
|
||||
|
||||
public ScheduleCommand() {}
|
||||
@@ -82,7 +82,7 @@ public class ScheduleCommand {
|
||||
}
|
||||
|
||||
private static int remove(CommandSourceStack source, String eventName) throws CommandSyntaxException {
|
||||
- int i = source.getServer().getWorldData().overworldData().getScheduledEvents().remove(eventName);
|
||||
+ int i = source.getLevel().serverLevelData.getScheduledEvents().remove(eventName); // Paper
|
||||
|
||||
if (i == 0) {
|
||||
throw ScheduleCommand.ERROR_CANT_REMOVE.create(eventName);
|
45
patches/server/0576-Configurable-max-leash-distance.patch
Normal file
45
patches/server/0576-Configurable-max-leash-distance.patch
Normal file
|
@ -0,0 +1,45 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 3 Jan 2021 21:04:03 -0800
|
||||
Subject: [PATCH] Configurable max leash distance
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index e8f5ad4925b4d02bf79f9f56d0dac3f0cc410e71..6322748d2eabdf29a46c50166fad265b6c8053d5 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -287,6 +287,12 @@ public class PaperWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public float maxLeashDistance = 10f;
|
||||
+ private void maxLeashDistance() {
|
||||
+ maxLeashDistance = getFloat("max-leash-distance", maxLeashDistance);
|
||||
+ log("Max leash distance: " + maxLeashDistance);
|
||||
+ }
|
||||
+
|
||||
public boolean disableEndCredits;
|
||||
private void disableEndCredits() {
|
||||
disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
|
||||
index d1ab31d03ae421e628448fe2492ff138dc57c00f..999d18610666ec442bb038da5c452e3cd77e7428 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
|
||||
@@ -48,7 +48,7 @@ public abstract class PathfinderMob extends Mob {
|
||||
float f = this.distanceTo(entity);
|
||||
|
||||
if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) {
|
||||
- if (f > 10.0F) {
|
||||
+ if (f > entity.level.paperConfig.maxLeashDistance) { // Paper
|
||||
this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public abstract class PathfinderMob extends Mob {
|
||||
}
|
||||
|
||||
this.onLeashDistance(f);
|
||||
- if (f > 10.0F) {
|
||||
+ if (f > entity.level.paperConfig.maxLeashDistance) { // Paper
|
||||
this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
this.dropLeash(true, true);
|
||||
this.goalSelector.disableControlFlag(Goal.Flag.MOVE);
|
34
patches/server/0577-Implement-BlockPreDispenseEvent.patch
Normal file
34
patches/server/0577-Implement-BlockPreDispenseEvent.patch
Normal file
|
@ -0,0 +1,34 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Madeline Miller <mnmiller1@me.com>
|
||||
Date: Sun, 17 Jan 2021 13:16:09 +1000
|
||||
Subject: [PATCH] Implement BlockPreDispenseEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
index 07d357b5fcb30ed9ff074a196a19de1481fe3738..83ac86b3c1e7b9233f2db8e5488f97c5b44f8843 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
@@ -92,6 +92,7 @@ public class DispenserBlock extends BaseEntityBlock {
|
||||
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
|
||||
|
||||
if (idispensebehavior != DispenseItemBehavior.NOOP) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - BlockPreDispenseEvent is called here
|
||||
DispenserBlock.eventFired = false; // CraftBukkit - reset event status
|
||||
tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack));
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 419c5bd638230c31dd68ba37174c8057c0229a6a..eda17a60afd6cf03e58e66b2dbfe414b1cfac9d5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1848,5 +1848,11 @@ public class CraftEventFactory {
|
||||
io.papermc.paper.event.block.BlockFailedDispenseEvent event = new io.papermc.paper.event.block.BlockFailedDispenseEvent(block);
|
||||
return event.callEvent();
|
||||
}
|
||||
+
|
||||
+ public static boolean handleBlockPreDispenseEvent(ServerLevel serverLevel, BlockPos pos, ItemStack itemStack, int slot) {
|
||||
+ org.bukkit.block.Block block = serverLevel.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
+ io.papermc.paper.event.block.BlockPreDispenseEvent event = new io.papermc.paper.event.block.BlockPreDispenseEvent(block, org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), slot);
|
||||
+ return event.callEvent();
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue