2015-07-14 17:59:57 +02:00
|
|
|
From e1554354226977651da048151eaf50edbd8cb30a Mon Sep 17 00:00:00 2001
|
2014-12-01 01:59:49 +01:00
|
|
|
From: Byteflux <byte@byteflux.net>
|
|
|
|
Date: Sun, 30 Nov 2014 18:58:07 -0600
|
|
|
|
Subject: [PATCH] Allow specified ItemStacks to retain their invalid data
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
|
2015-07-14 17:59:57 +02:00
|
|
|
index dbef942..2fc2698 100644
|
2014-12-01 01:59:49 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
2015-03-20 01:41:36 +01:00
|
|
|
@@ -18,6 +18,8 @@ import org.bukkit.entity.Player;
|
2014-12-01 01:59:49 +01:00
|
|
|
import org.bukkit.event.world.StructureGrowEvent;
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
+import org.github.paperspigot.PaperSpigotConfig; // PaperSpigot
|
|
|
|
+
|
|
|
|
public final class ItemStack {
|
|
|
|
|
|
|
|
public static final DecimalFormat a = new DecimalFormat("#.###");
|
2015-07-14 17:59:57 +02:00
|
|
|
@@ -321,9 +323,13 @@ public final class ItemStack {
|
2014-12-01 01:59:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Is this a block?
|
|
|
|
- if (CraftMagicNumbers.getBlock(CraftMagicNumbers.getId(this.getItem())) != Blocks.AIR) {
|
|
|
|
+ // PaperSpigot start - Allow specific blocks to retain their data values
|
|
|
|
+ int id = CraftMagicNumbers.getId(this.getItem());
|
|
|
|
+ if (CraftMagicNumbers.getBlock(id) != Blocks.AIR) {
|
|
|
|
// If vanilla doesn't use data on it don't allow any
|
|
|
|
- if (!(this.usesData() || this.getItem().usesDurability())) {
|
|
|
|
+ if ((PaperSpigotConfig.dataValueAllowedItems == null || !PaperSpigotConfig.dataValueAllowedItems.contains(id)) &&
|
|
|
|
+ (!(this.usesData() || this.getItem().usesDurability()))) {
|
|
|
|
+ // PaperSpigot end
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
|
2015-07-14 17:59:57 +02:00
|
|
|
index 5ff1c26..ab21bbf 100644
|
2014-12-01 01:59:49 +01:00
|
|
|
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
|
|
|
|
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
|
|
|
|
@@ -6,11 +6,10 @@ import java.io.IOException;
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
import java.lang.reflect.Modifier;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
+import java.util.*;
|
|
|
|
import java.util.logging.Level;
|
|
|
|
import net.minecraft.server.MinecraftServer;
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.configuration.InvalidConfigurationException;
|
2015-05-28 07:11:18 +02:00
|
|
|
@@ -172,4 +171,11 @@ public class PaperSpigotConfig
|
2014-12-01 01:59:49 +01:00
|
|
|
strengthEffectModifier = getDouble( "effect-modifiers.strength", 1.3D );
|
|
|
|
weaknessEffectModifier = getDouble( "effect-modifiers.weakness", -0.5D );
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public static Set<Integer> dataValueAllowedItems;
|
|
|
|
+ private static void dataValueAllowedItems()
|
|
|
|
+ {
|
|
|
|
+ dataValueAllowedItems = new HashSet<Integer>( getList( "data-value-allowed-items", Collections.emptyList() ) );
|
|
|
|
+ Bukkit.getLogger().info( "Data value allowed items: " + StringUtils.join(dataValueAllowedItems, ", ") );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
2015-07-14 17:59:57 +02:00
|
|
|
1.9.5.msysgit.1
|
2014-12-01 01:59:49 +01:00
|
|
|
|