mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: 7caed1a8 [CI-SKIP] Rebuild patches 777073a5 Check horse entity validity in container interactions (#2584) d69fe6c5 Fix zero-tick instant grow farms MC-113809 (#2559) c68dbb86 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#2576) 1e521994 Update Paperclip 30f9955e Fix race conditions in flush allowing for previously scheduled tasks to execute later than the flush call (#2548) 9e1620e3 Improve save logic (#2485) 72860501 [CI-SKIP] Fix duplicate patch number 87355875 Fix nether portal frame creation (#2546) 26acc9b7 Re-add flat bedrock config option
103 lines
5.0 KiB
Diff
103 lines
5.0 KiB
Diff
From 4e9868d14c78881570891be09193174eef4f0cac Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Thu, 1 Aug 2019 19:15:12 -0500
|
|
Subject: [PATCH] Add blacklist option for grindstone
|
|
|
|
---
|
|
.../minecraft/server/ContainerGrindstone.java | 17 +++++++++++++++++
|
|
.../java/net/minecraft/server/ItemStack.java | 6 ++++++
|
|
src/main/java/net/pl3x/purpur/PurpurConfig.java | 12 ++++++++++++
|
|
3 files changed, 35 insertions(+)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
|
index ed88e208d..0a5abd2e1 100644
|
|
--- a/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
|
+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
|
@@ -57,12 +57,24 @@ public class ContainerGrindstone extends Container {
|
|
this.a(new Slot(this.craftInventory, 0, 49, 19) {
|
|
@Override
|
|
public boolean isAllowed(ItemStack itemstack) {
|
|
+ // Purpur start
|
|
+ if (net.pl3x.purpur.PurpurConfig.grindstoneBlacklistDisallowPlacement && net.pl3x.purpur.PurpurConfig.grindstoneBlacklist.contains(itemstack.getId())) {
|
|
+ getBukkitView().getTopInventory().getViewers().forEach(viewer -> ((Player) viewer).updateInventory());
|
|
+ return false;
|
|
+ }
|
|
+ // Purpur end
|
|
return itemstack.e() || itemstack.getItem() == Items.ENCHANTED_BOOK || itemstack.hasEnchantments();
|
|
}
|
|
});
|
|
this.a(new Slot(this.craftInventory, 1, 49, 40) {
|
|
@Override
|
|
public boolean isAllowed(ItemStack itemstack) {
|
|
+ // Purpur start
|
|
+ if (net.pl3x.purpur.PurpurConfig.grindstoneBlacklistDisallowPlacement && net.pl3x.purpur.PurpurConfig.grindstoneBlacklist.contains(itemstack.getId())) {
|
|
+ getBukkitView().getTopInventory().getViewers().forEach(viewer -> ((Player) viewer).updateInventory());
|
|
+ return false;
|
|
+ }
|
|
+ // Purpur end
|
|
return itemstack.e() || itemstack.getItem() == Items.ENCHANTED_BOOK || itemstack.hasEnchantments();
|
|
}
|
|
});
|
|
@@ -106,6 +118,11 @@ public class ContainerGrindstone extends Container {
|
|
}
|
|
|
|
private int e(ItemStack itemstack) {
|
|
+ // Purpur start
|
|
+ if (net.pl3x.purpur.PurpurConfig.grindstoneBlacklistReturnsZeroExp && net.pl3x.purpur.PurpurConfig.grindstoneBlacklist.contains(itemstack.getId())) {
|
|
+ return 0;
|
|
+ }
|
|
+ // Purpur end
|
|
int j = 0;
|
|
Map<Enchantment, Integer> map = EnchantmentManager.a(itemstack);
|
|
Iterator iterator = map.entrySet().iterator();
|
|
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
|
|
index 43e89b99b..e538ba399 100644
|
|
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
|
@@ -538,6 +538,12 @@ public final class ItemStack {
|
|
return !this.e() ? this.doMaterialsMatch(itemstack) : !itemstack.isEmpty() && this.getItem() == itemstack.getItem();
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ public String getId() {
|
|
+ return IRegistry.ITEM.getKey(getItem()).toString();
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public String j() {
|
|
return this.getItem().f(this);
|
|
}
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
index 96461a1cf..973cf6586 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
@@ -1,6 +1,7 @@
|
|
package net.pl3x.purpur;
|
|
|
|
import com.google.common.base.Throwables;
|
|
+import com.google.common.collect.Lists;
|
|
import net.minecraft.server.Block;
|
|
import net.minecraft.server.IRegistry;
|
|
import net.minecraft.server.MinecraftKey;
|
|
@@ -171,6 +172,17 @@ public class PurpurConfig {
|
|
updatePermissionsOnWorldChange = getBoolean("settings.update-perms-on-world-change", updatePermissionsOnWorldChange);
|
|
}
|
|
|
|
+ public static boolean grindstoneBlacklistDisallowPlacement = true;
|
|
+ public static boolean grindstoneBlacklistReturnsZeroExp = true;
|
|
+ public static List<String> grindstoneBlacklist = Lists.newArrayList("minecraft:tripwire_hook");
|
|
+ private static void grindstoneBlacklist() {
|
|
+ grindstoneBlacklistDisallowPlacement = getBoolean("settings.grindstone.disallow-placement", grindstoneBlacklistDisallowPlacement);
|
|
+ grindstoneBlacklistReturnsZeroExp = getBoolean("settings.grindstone.returns-zero-exp", grindstoneBlacklistReturnsZeroExp);
|
|
+ List<String> blacklist = getList("settings.grindstone.blacklisted-items", grindstoneBlacklist);
|
|
+ grindstoneBlacklist.clear();
|
|
+ grindstoneBlacklist.addAll(blacklist);
|
|
+ }
|
|
+
|
|
public static boolean requireShiftToMount = true;
|
|
private static void requireShiftToMount() {
|
|
requireShiftToMount = getBoolean("settings.mobs.require-shift-to-mount", requireShiftToMount);
|
|
--
|
|
2.23.0.rc1
|
|
|