more patches & fixes to existing patches
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 23 Nov 2020 12:58:51 -0800
|
||||
Subject: [PATCH] Added PlayerLecternPageChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -0,0 +0,0 @@ public abstract class AbstractContainerMenu {
|
||||
this.getSlot(slot).set(stack);
|
||||
}
|
||||
|
||||
+ public void setData(int index, int value) { this.setData(index, value); } // Paper - OBFHELPER
|
||||
public void setData(int id, int value) {
|
||||
((DataSlot) this.dataSlots.get(id)).set(value);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/LecternMenu.java b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/LecternMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTakeLecternBookEvent;
|
||||
// CraftBukkit end
|
||||
+import io.papermc.paper.event.player.PlayerLecternPageChangeEvent; // Paper
|
||||
|
||||
public class LecternMenu extends AbstractContainerMenu {
|
||||
|
||||
@@ -0,0 +0,0 @@ public class LecternMenu extends AbstractContainerMenu {
|
||||
@Override
|
||||
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
|
||||
int j;
|
||||
+ PlayerLecternPageChangeEvent playerLecternPageChangeEvent; CraftInventoryLectern bukkitView; // Paper
|
||||
|
||||
if (id >= 100) {
|
||||
j = id - 100;
|
||||
@@ -0,0 +0,0 @@ public class LecternMenu extends AbstractContainerMenu {
|
||||
switch (id) {
|
||||
case 1:
|
||||
j = this.lecternData.get(0);
|
||||
- this.setData(0, j - 1);
|
||||
+ // Paper start
|
||||
+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory();
|
||||
+ playerLecternPageChangeEvent = new PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), PlayerLecternPageChangeEvent.PageChangeDirection.LEFT, j, j - 1);
|
||||
+ if (!playerLecternPageChangeEvent.callEvent()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.setData(0, playerLecternPageChangeEvent.getNewPage());
|
||||
+ // Paper end
|
||||
return true;
|
||||
case 2:
|
||||
j = this.lecternData.get(0);
|
||||
- this.setData(0, j + 1);
|
||||
+ // Paper start
|
||||
+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory();
|
||||
+ playerLecternPageChangeEvent = new PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), PlayerLecternPageChangeEvent.PageChangeDirection.RIGHT, j, j + 1);
|
||||
+ if (!playerLecternPageChangeEvent.callEvent()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.setData(0, playerLecternPageChangeEvent.getNewPage());
|
||||
+ // Paper end
|
||||
return true;
|
||||
case 3:
|
||||
if (!player.mayBuild()) {
|
||||
@@ -1,63 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 25 Nov 2020 16:33:27 -0800
|
||||
Subject: [PATCH] Added PlayerLoomPatternSelectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryLoom;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
import org.bukkit.entity.Player;
|
||||
// CraftBukkit end
|
||||
+import io.papermc.paper.event.player.PlayerLoomPatternSelectEvent; // Paper
|
||||
|
||||
public class LoomMenu extends AbstractContainerMenu {
|
||||
|
||||
@@ -0,0 +0,0 @@ public class LoomMenu extends AbstractContainerMenu {
|
||||
}
|
||||
// CraftBukkit end
|
||||
private final ContainerLevelAccess access;
|
||||
- private final DataSlot selectedBannerPatternIndex;
|
||||
+ private final DataSlot selectedBannerPatternIndex; public final DataSlot getSelectedBannerPattern() { return this.selectedBannerPatternIndex; }; // Paper - OBFHELPER
|
||||
private Runnable slotUpdateListener;
|
||||
private final Slot bannerSlot;
|
||||
private final Slot dyeSlot;
|
||||
@@ -0,0 +0,0 @@ public class LoomMenu extends AbstractContainerMenu {
|
||||
@Override
|
||||
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
|
||||
if (id > 0 && id <= BannerPattern.AVAILABLE_PATTERNS) {
|
||||
- this.selectedBannerPatternIndex.set(id);
|
||||
+ // Paper start
|
||||
+ int enumBannerPatternTypeOrdinal = id;
|
||||
+ PlayerLoomPatternSelectEvent event = new PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.block.banner.PatternType.getByIdentifier(BannerPattern.values()[id].getIdentifier()));
|
||||
+ if (!event.callEvent()) {
|
||||
+ ((Player) player.getBukkitEntity()).updateInventory();
|
||||
+ return false;
|
||||
+ }
|
||||
+ for (BannerPattern nms : BannerPattern.values()) {
|
||||
+ if (event.getPatternType().getIdentifier().equals(nms.getIdentifier())) {
|
||||
+ enumBannerPatternTypeOrdinal = nms.ordinal();
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ ((Player) player.getBukkitEntity()).updateInventory();
|
||||
+ this.getSelectedBannerPattern().set(enumBannerPatternTypeOrdinal);
|
||||
+ // Paper end
|
||||
this.setupResultSlot();
|
||||
return true;
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerPattern.java b/src/main/java/net/minecraft/world/level/block/entity/BannerPattern.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BannerPattern.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BannerPattern.java
|
||||
@@ -0,0 +0,0 @@ public enum BannerPattern {
|
||||
this.hasPatternItem = flag;
|
||||
}
|
||||
|
||||
+ public String getIdentifier() { return this.getHashname(); } // Paper - OBFHELPER
|
||||
public String getHashname() {
|
||||
return this.hashname;
|
||||
}
|
||||
@@ -1,90 +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:04:01 -0800
|
||||
Subject: [PATCH] Added ServerResourcesReloadedEvent
|
||||
|
||||
|
||||
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 @@ package net.minecraft.server;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
-import co.aikar.timings.Timings;
|
||||
-import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
|
||||
-import com.google.common.base.Stopwatch;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -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
|
||||
+import io.papermc.paper.event.server.ServerResourcesReloadedEvent; // Paper
|
||||
|
||||
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements SnooperPopulator, CommandSource, AutoCloseable {
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
return this.functionManager;
|
||||
}
|
||||
|
||||
+ // Paper start - add cause
|
||||
+ @Deprecated
|
||||
public CompletableFuture<Void> reloadResources(Collection<String> datapacks) {
|
||||
+ return this.reloadServerResources(datapacks, ServerResourcesReloadedEvent.Cause.PLUGIN);
|
||||
+ }
|
||||
+ public CompletableFuture<Void> reloadServerResources(Collection<String> collection, ServerResourcesReloadedEvent.Cause cause) {
|
||||
+ // Paper end
|
||||
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
|
||||
- Stream<String> stream = datapacks.stream(); // CraftBukkit - decompile error
|
||||
+ Stream<String> stream = collection.stream(); // CraftBukkit - decompile error
|
||||
PackRepository resourcepackrepository = this.packRepository;
|
||||
|
||||
this.packRepository.getClass();
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.resources.close();
|
||||
this.resources = datapackresources;
|
||||
this.server.syncCommands(); // SPIGOT-5884: Lost on reload
|
||||
- this.packRepository.setSelected(datapacks);
|
||||
+ this.packRepository.setSelected(collection);
|
||||
this.worldData.setDataPackConfig(getSelectedPacks(this.packRepository));
|
||||
datapackresources.updateGlobals();
|
||||
+ new ServerResourcesReloadedEvent(cause).callEvent(); // Paper
|
||||
if (Thread.currentThread() != this.serverThread) return; // Paper
|
||||
//this.getPlayerList().savePlayers(); // Paper - we don't need to do this
|
||||
this.getPlayerList().reloadResources();
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/ReloadCommand.java b/src/main/java/net/minecraft/server/commands/ReloadCommand.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/ReloadCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/ReloadCommand.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.world.level.storage.WorldData;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+import io.papermc.paper.event.server.ServerResourcesReloadedEvent; // Paper
|
||||
|
||||
public class ReloadCommand {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
public static void reloadPacks(Collection<String> collection, CommandSourceStack commandlistenerwrapper) {
|
||||
- commandlistenerwrapper.getServer().reloadResources(collection).exceptionally((throwable) -> {
|
||||
- ReloadCommand.LOGGER.warn("Failed to execute reload", throwable);
|
||||
- commandlistenerwrapper.sendFailure(new TranslatableComponent("commands.reload.failure"));
|
||||
+ commandlistenerwrapper.getServer().reloadServerResources(collection, ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { // Paper
|
||||
+ CommandReload.LOGGER.warn("Failed to execute reload", throwable);
|
||||
+ commandlistenerwrapper.sendFailureMessage(new ChatMessage("commands.reload.failure"));
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ReloadCommand {
|
||||
WorldData savedata = minecraftserver.getWorldData();
|
||||
Collection<String> collection = resourcepackrepository.getSelectedIds();
|
||||
Collection<String> collection1 = discoverNewPacks(resourcepackrepository, savedata, collection);
|
||||
- minecraftserver.reloadResources(collection1);
|
||||
+ minecraftserver.reloadServerResources(collection1, ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 28 Nov 2020 18:43:52 -0800
|
||||
Subject: [PATCH] Added world settings for mobs picking up loot
|
||||
|
||||
|
||||
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 {
|
||||
log("Creeper lingering effect: " + disableCreeperLingeringEffect);
|
||||
}
|
||||
|
||||
+ public boolean zombiesAlwaysCanPickUpLoot;
|
||||
+ public boolean skeletonsAlwaysCanPickUpLoot;
|
||||
+ private void setMobsAlwaysCanPickUpLoot() {
|
||||
+ zombiesAlwaysCanPickUpLoot = getBoolean("mobs-can-always-pick-up-loot.zombies", false);
|
||||
+ skeletonsAlwaysCanPickUpLoot = getBoolean("mobs-can-always-pick-up-loot.skeletons", false);
|
||||
+ log("Zombies can always pick up loot: " + zombiesAlwaysCanPickUpLoot + ". Skeletons can always pick up loot: " + skeletonsAlwaysCanPickUpLoot + ".");
|
||||
+ }
|
||||
+
|
||||
public int expMergeMaxValue;
|
||||
private void expMergeMaxValue() {
|
||||
expMergeMaxValue = getInt("experience-merge-max-value", -1);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -0,0 +0,0 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
this.populateDefaultEquipmentSlots(difficulty);
|
||||
this.populateDefaultEquipmentEnchantments(difficulty);
|
||||
this.reassessWeaponGoal();
|
||||
- this.setCanPickUpLoot(this.random.nextFloat() < 0.55F * difficulty.getSpecialMultiplier());
|
||||
+ this.setCanPickUpLoot(this.level.paperConfig.skeletonsAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper
|
||||
if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) {
|
||||
LocalDate localdate = LocalDate.now();
|
||||
int i = localdate.get(ChronoField.DAY_OF_MONTH);
|
||||
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 {
|
||||
Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
|
||||
float f = difficulty.getSpecialMultiplier();
|
||||
|
||||
- this.setCanPickUpLoot(this.random.nextFloat() < 0.55F * f);
|
||||
+ this.setCanPickUpLoot(this.level.paperConfig.zombiesAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * f); // Paper
|
||||
if (object == null) {
|
||||
object = new Zombie.ZombieGroupData(getSpawnAsBabyOdds(world.getRandom()), true);
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 3 Jan 2021 22:27:43 -0800
|
||||
Subject: [PATCH] Configurable door breaking difficulty
|
||||
|
||||
|
||||
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 @@ import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
-
|
||||
+import java.util.stream.Collectors;
|
||||
+import net.minecraft.world.Difficulty;
|
||||
+import net.minecraft.world.entity.monster.Vindicator;
|
||||
+import net.minecraft.world.entity.monster.Zombie;
|
||||
import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path));
|
||||
}
|
||||
|
||||
+ private <T extends Enum<T>> List<T> getEnumList(String path, List<T> def, Class<T> type) {
|
||||
+ config.addDefault("world-settings.default." + path, def.stream().map(Enum::name).collect(Collectors.toList()));
|
||||
+ return ((List<String>) (config.getList("world-settings." + worldName + "." + path, config.getList("world-settings.default." + path)))).stream().map(s -> Enum.valueOf(type, s)).collect(Collectors.toList());
|
||||
+ }
|
||||
+
|
||||
public int cactusMaxHeight;
|
||||
public int reedMaxHeight;
|
||||
public int bambooMaxHeight;
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
private void disableMobSpawnerSpawnEggTransformation() {
|
||||
disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation);
|
||||
}
|
||||
+
|
||||
+ public List<Difficulty> zombieBreakDoors;
|
||||
+ public List<Difficulty> vindicatorBreakDoors;
|
||||
+ private void setupEntityBreakingDoors() {
|
||||
+ zombieBreakDoors = getEnumList(
|
||||
+ "door-breaking-difficulty.zombie",
|
||||
+ Arrays.stream(Difficulty.values())
|
||||
+ .filter(Zombie.getDoorBreakingPredicate())
|
||||
+ .collect(Collectors.toList()),
|
||||
+ Difficulty.class
|
||||
+ );
|
||||
+ vindicatorBreakDoors = getEnumList(
|
||||
+ "door-breaking-difficulty.vindicator",
|
||||
+ Arrays.stream(Difficulty.values())
|
||||
+ .filter(Vindicator.getDoorBreakingPredicate())
|
||||
+ .collect(Collectors.toList()),
|
||||
+ Difficulty.class
|
||||
+ );
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.world.level.ServerLevelAccessor;
|
||||
|
||||
public class Vindicator extends AbstractIllager {
|
||||
|
||||
+ public static final Predicate<Difficulty> getDoorBreakingPredicate() { return DOOR_BREAKING_PREDICATE; } // Paper - OBFHELPER
|
||||
private static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = (enumdifficulty) -> {
|
||||
return enumdifficulty == Difficulty.NORMAL || enumdifficulty == Difficulty.HARD;
|
||||
};
|
||||
@@ -0,0 +0,0 @@ public class Vindicator extends AbstractIllager {
|
||||
static class VindicatorBreakDoorGoal extends BreakDoorGoal {
|
||||
|
||||
public VindicatorBreakDoorGoal(Mob mob) {
|
||||
- super(mob, 6, Vindicator.DOOR_BREAKING_PREDICATE);
|
||||
+ super(mob, 6, com.google.common.base.Predicates.in(mob.level.paperConfig.vindicatorBreakDoors)); // Paper
|
||||
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
|
||||
}
|
||||
|
||||
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 {
|
||||
private static final EntityDataAccessor<Boolean> DATA_BABY_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN);
|
||||
private static final EntityDataAccessor<Integer> DATA_SPECIAL_TYPE_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Boolean> DATA_DROWNED_CONVERSION_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN);
|
||||
+ public static final Predicate<Difficulty> getDoorBreakingPredicate() { return DOOR_BREAKING_PREDICATE; } // Paper - OBFHELPER
|
||||
private static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = (enumdifficulty) -> {
|
||||
return enumdifficulty == Difficulty.HARD;
|
||||
};
|
||||
@@ -0,0 +0,0 @@ public class Zombie extends Monster {
|
||||
|
||||
public Zombie(EntityType<? extends Zombie> type, Level world) {
|
||||
super(type, world);
|
||||
- this.breakDoorGoal = new BreakDoorGoal(this, Zombie.DOOR_BREAKING_PREDICATE);
|
||||
+ this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig.zombieBreakDoors)); // Paper
|
||||
}
|
||||
|
||||
public Zombie(Level world) {
|
||||
@@ -1,18 +0,0 @@
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -0,0 +0,0 @@ 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());
|
||||
@@ -1,59 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
firedInteract = true;
|
||||
interactResult = event.useItemInHand() == Event.Result.DENY;
|
||||
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 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 @@ 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;
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
return 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);
|
||||
|
||||
@@ -0,0 +0,0 @@ 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);
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: TheViperShow <29604693+TheViperShow@users.noreply.github.com>
|
||||
Date: Wed, 22 Apr 2020 09:40:38 +0200
|
||||
Subject: [PATCH] Implemented BlockFailedDispenseEvent
|
||||
|
||||
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
|
||||
@@ -0,0 +0,0 @@ public class DispenserBlock extends BaseEntityBlock {
|
||||
int i = tileentitydispenser.getRandomSlot();
|
||||
|
||||
if (i < 0) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(worldserver, pos)) // Paper - BlockFailedDispenseEvent is called here
|
||||
worldserver.levelEvent(1001, pos, 0);
|
||||
} else {
|
||||
ItemStack itemstack = tileentitydispenser.getItem(i);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DropperBlock.java b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DropperBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
|
||||
@@ -0,0 +0,0 @@ public class DropperBlock extends DispenserBlock {
|
||||
int i = tileentitydispenser.getRandomSlot();
|
||||
|
||||
if (i < 0) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(worldserver, pos)) // Paper - BlockFailedDispenseEvent is called here
|
||||
worldserver.levelEvent(1001, pos, 0);
|
||||
} else {
|
||||
ItemStack itemstack = tileentitydispenser.getItem(i);
|
||||
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 @@ import com.google.common.base.Function;
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
+import io.papermc.paper.event.block.BlockFailedDispenseEvent;
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.Villager.Profession;
|
||||
-import org.bukkit.entity.ExperienceOrb; // Paper
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Result;
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
return event;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ public static boolean handleBlockFailedDispenseEvent(ServerLevel worldserver, BlockPos blockposition) {
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ BlockFailedDispenseEvent event = new BlockFailedDispenseEvent(block);
|
||||
+ return event.callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
||||
});
|
||||
optional1.ifPresent((villageplacetype) -> {
|
||||
this.getServer().execute(() -> {
|
||||
+ // Paper start
|
||||
+ if (!optional.isPresent() && this.getPoiStorage().test(blockposition1, com.google.common.base.Predicates.alwaysTrue())) {
|
||||
+ this.getPoiStorage().remove(blockposition1);
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.getPoiManager().add(blockposition1, villageplacetype);
|
||||
DebugPackets.sendPoiAddedPacket(this, blockposition1);
|
||||
});
|
||||
@@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
||||
}
|
||||
}
|
||||
|
||||
+ public final PoiManager getPoiStorage() { return this.getPoiManager(); } // Paper - OBFHELPER
|
||||
public PoiManager getPoiManager() {
|
||||
return this.getChunkSource().getPoiManager();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
||||
@@ -0,0 +0,0 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
((PoiSection) this.getOrCreate(SectionPos.of(pos).asLong())).add(pos, type);
|
||||
}
|
||||
|
||||
+ public void remove(BlockPos blockposition) { this.remove(blockposition); } // Paper - OBFHELPER
|
||||
public void remove(BlockPos pos) {
|
||||
((PoiSection) this.getOrCreate(SectionPos.of(pos).asLong())).remove(pos);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
return ((PoiSection) this.getOrCreate(SectionPos.of(pos).asLong())).release(pos);
|
||||
}
|
||||
|
||||
+ public final boolean test(BlockPos blockposition, Predicate<PoiType> predicate) { return this.exists(blockposition, predicate); } // Paper - OBFHELPER
|
||||
public boolean exists(BlockPos pos, Predicate<PoiType> predicate) {
|
||||
return (Boolean) this.getOrLoad(SectionPos.of(pos).asLong()).map((villageplacesection) -> {
|
||||
return villageplacesection.exists(pos, predicate);
|
||||
Reference in New Issue
Block a user