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: a4f066cc Fix method profiler inbalance introduced in a2a9ffe (#3132) c65dcad3 Don't delay chunk unloads during entity ticking bc17ce69 Delay unsafe actions until after entity ticking is done - Fixes #3114 5553e6b3 Disable Sync Events firing Async errors during shutdown e12c51d9 Use better variable for isStopping() API 586ee2bb Remove patch for MC-111480, fixed in 1.14 09a94215 Remove streams from Mob AI System bb5c294e Fix Disabling Asynchronous Chunks 089d8356 Implement Chunk Priority / Urgency System for World Gen fce69af7 Use dedicated thread for main thread blocking chunk loads 588b62e4 Add tick times API and /mspt command (#3102) 11de41c7 Add API MinecraftServer#isStopping (#3129) 942ff3c2 My patches are under MIT (#3130)
103 lines
5.0 KiB
Diff
103 lines
5.0 KiB
Diff
From 7f2bd93c89a9c0a1465a0b794b35309e48bd95d1 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 ++++++
|
|
.../java/net/pl3x/purpur/PurpurWorldConfig.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 ed88e208d0..fcfb4abdc2 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 (containeraccess.getWorld().purpurConfig.grindstoneBlacklistDisallowPlacement && containeraccess.getWorld().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 (containeraccess.getWorld().purpurConfig.grindstoneBlacklistDisallowPlacement && containeraccess.getWorld().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 (containeraccess.getWorld().purpurConfig.grindstoneBlacklistReturnsZeroExp && containeraccess.getWorld().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 7b7a0a7cb1..6b45bc17cf 100644
|
|
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
|
@@ -541,6 +541,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/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 15f6113762..03c10d778e 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -8,6 +8,7 @@ import net.minecraft.server.MinecraftKey;
|
|
import org.bukkit.configuration.ConfigurationSection;
|
|
import org.spigotmc.SpigotWorldConfig;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
@@ -103,6 +104,17 @@ public class PurpurWorldConfig {
|
|
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
|
|
}
|
|
|
|
+ public List<String> grindstoneBlacklist = new ArrayList<>();
|
|
+ public boolean grindstoneBlacklistDisallowPlacement = true;
|
|
+ public boolean grindstoneBlacklistReturnsZeroExp = true;
|
|
+ private void grindstoneBlacklist() {
|
|
+ List<String> blacklist = getList("blocks.grindstone.blacklist.blacklisted-items", grindstoneBlacklist);
|
|
+ grindstoneBlacklistDisallowPlacement = getBoolean("blocks.grindstone.blacklist.disallow-placement", grindstoneBlacklistDisallowPlacement);
|
|
+ grindstoneBlacklistReturnsZeroExp = getBoolean("blocks.grindstone.blacklist.returns-zero-exp", grindstoneBlacklistReturnsZeroExp);
|
|
+ grindstoneBlacklist.clear();
|
|
+ grindstoneBlacklist.addAll(blacklist);
|
|
+ }
|
|
+
|
|
public boolean signAllowColors = false;
|
|
public boolean signRightClickEdit = false;
|
|
private void signSettings() {
|
|
--
|
|
2.24.0
|
|
|