PaperMC/Spigot-Server-Patches/MC-Dev-fixes.patch
Aikar 133396a0c9 Configurable Alternative LootPool Luck Formula
Rewrites the Vanilla luck application formula so that luck can be
applied to items that do not have any quality defined.

See: https://luckformula.emc.gs for data and details
-----------

The rough summary is:
My goal was that in a pool, when luck was applied, the pool
rebalances so the percentages for bigger items is
lowered and smaller items is boosted.

Do this by boosting and then reducing the weight value,
so that larger numbers are penalized more than smaller numbers.
resulting in a larger reduction of entries for more common
items than the reduction on small weights,
giving smaller weights more of a chance

-----------

This work kind of obsoletes quality, but quality would be useful
for 2 items with same weight that you want luck to impact
in varying directions.

Fishing still falls into that as the weights are closer, so luck
will invalidate junk more.

This change will result in some major changes to fishing formulas.

-----------

I would love to see this change in Vanilla, so Mojang please pull :)
2018-06-15 00:32:35 -04:00

254 lines
No EOL
13 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 30 Mar 2016 19:36:20 -0400
Subject: [PATCH] MC Dev fixes
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
index d4f412742..d55e180d7 100644
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
return MoreObjects.toStringHelper(this).add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).toString();
}
- public int compareTo(Object object) {
+ public int compareTo(BaseBlockPosition object) { // Paper - decompile fix
return this.l((BaseBlockPosition) object);
}
}
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
index 62a9c92f8..1b7599769 100644
--- a/src/main/java/net/minecraft/server/BiomeBase.java
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
@@ -0,0 +0,0 @@ public abstract class BiomeBase {
protected List<BiomeBase.BiomeMeta> w;
public static int a(BiomeBase biomebase) {
- return BiomeBase.REGISTRY_ID.a((Object) biomebase);
+ return BiomeBase.REGISTRY_ID.a(biomebase); // Paper - decompile fix
}
@Nullable
diff --git a/src/main/java/net/minecraft/server/CommandAbstract.java b/src/main/java/net/minecraft/server/CommandAbstract.java
index 76bf04f56..a99d0f870 100644
--- a/src/main/java/net/minecraft/server/CommandAbstract.java
+++ b/src/main/java/net/minecraft/server/CommandAbstract.java
@@ -0,0 +0,0 @@ public abstract class CommandAbstract implements ICommand {
}
if (object != null && oclass.isAssignableFrom(object.getClass())) {
- return (Entity) object;
+ return (T) object; // Paper - fix decompile error
} else {
throw new ExceptionEntityNotFound(s);
}
@@ -0,0 +0,0 @@ public abstract class CommandAbstract implements ICommand {
}
private static <T extends Comparable<T>> IBlockData a(IBlockData iblockdata, IBlockState<T> iblockstate, Comparable<?> comparable) {
- return iblockdata.set(iblockstate, comparable);
+ return iblockdata.set(iblockstate, (T) comparable); // Paper - fix decompiler error
}
public static Predicate<IBlockData> b(final Block block, String s) throws ExceptionInvalidBlockState {
@@ -0,0 +0,0 @@ public abstract class CommandAbstract implements ICommand {
@Nullable
private static <T extends Comparable<T>> T a(IBlockState<T> iblockstate, String s) {
- return (Comparable) iblockstate.b(s).orNull();
+ return iblockstate.b(s).orNull(); // Paper - fix decompiler error
}
public static String a(Object[] aobject) {
@@ -0,0 +0,0 @@ public abstract class CommandAbstract implements ICommand {
return this.getCommand().compareTo(icommand.getCommand());
}
- public int compareTo(Object object) {
+ public int compareTo(ICommand object) { // Paper - fix decompile error
return this.a((ICommand) object);
}
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index 77b81a575..ba461ad48 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -0,0 +0,0 @@ public class EntityTypes {
@Nullable
public static String b(Entity entity) {
- int i = EntityTypes.b.a((Object) entity.getClass());
+ int i = EntityTypes.b.a(entity.getClass()); // Paper - Decompile fix
return i == -1 ? null : (String) EntityTypes.g.get(i);
}
@@ -0,0 +0,0 @@ public class EntityTypes {
EntityTypes.d.add(minecraftkey);
while (EntityTypes.g.size() <= i) {
- EntityTypes.g.add((Object) null);
+ EntityTypes.g.add(null); // Paper - Decompile fix
}
EntityTypes.g.set(i, s1);
diff --git a/src/main/java/net/minecraft/server/LotoSelectorEntry.java b/src/main/java/net/minecraft/server/LotoSelectorEntry.java
index a540167d6..b2860555d 100644
--- a/src/main/java/net/minecraft/server/LotoSelectorEntry.java
+++ b/src/main/java/net/minecraft/server/LotoSelectorEntry.java
@@ -0,0 +0,0 @@ public abstract class LotoSelectorEntry {
return jsonobject;
}
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
+ public JsonElement serialize(LotoSelectorEntry object, Type type, JsonSerializationContext jsonserializationcontext) {
return this.a((LotoSelectorEntry) object, type, jsonserializationcontext);
}
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ public LotoSelectorEntry deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
return this.a(jsonelement, type, jsondeserializationcontext);
}
}
diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java
index 58f47d0de..8860a0129 100644
--- a/src/main/java/net/minecraft/server/RegistryBlockID.java
+++ b/src/main/java/net/minecraft/server/RegistryBlockID.java
@@ -0,0 +0,0 @@ import java.util.Iterator;
import java.util.List;
import javax.annotation.Nullable;
-public class RegistryBlockID<T> implements Registry<T> {
+public class RegistryBlockID<T> implements Registry { // Paper - Fix decompile error
private final IdentityHashMap<T, Integer> a;
private final List<T> b;
@@ -0,0 +0,0 @@ public class RegistryBlockID<T> implements Registry<T> {
this.a.put(t0, Integer.valueOf(i));
while (this.b.size() <= i) {
- this.b.add((Object) null);
+ this.b.add(null); // Paper - Fix decompile error
}
this.b.set(i, t0);
diff --git a/src/main/java/net/minecraft/server/ServerPing.java b/src/main/java/net/minecraft/server/ServerPing.java
index 2179664a0..981582212 100644
--- a/src/main/java/net/minecraft/server/ServerPing.java
+++ b/src/main/java/net/minecraft/server/ServerPing.java
@@ -0,0 +0,0 @@ public class ServerPing {
public Serializer() {}
- public ServerPing a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ // Paper - decompile fix
+ public ServerPing deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
JsonObject jsonobject = ChatDeserializer.m(jsonelement, "status");
ServerPing serverping = new ServerPing();
@@ -0,0 +0,0 @@ public class ServerPing {
return serverping;
}
- public JsonElement a(ServerPing serverping, Type type, JsonSerializationContext jsonserializationcontext) {
+ // Paper - decompile fix
+ public JsonElement serialize(ServerPing serverping, Type type, JsonSerializationContext jsonserializationcontext) {
JsonObject jsonobject = new JsonObject();
if (serverping.a() != null) {
@@ -0,0 +0,0 @@ public class ServerPing {
return jsonobject;
}
-
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
- return this.a((ServerPing) object, type, jsonserializationcontext);
- }
-
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
- return this.a(jsonelement, type, jsondeserializationcontext);
- }
}
public static class ServerData {
@@ -0,0 +0,0 @@ public class ServerPing {
public Serializer() {}
- public ServerPing.ServerData a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ // Paper - decompile fix
+ public ServerPing.ServerData deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
JsonObject jsonobject = ChatDeserializer.m(jsonelement, "version");
return new ServerPing.ServerData(ChatDeserializer.h(jsonobject, "name"), ChatDeserializer.n(jsonobject, "protocol"));
}
- public JsonElement a(ServerPing.ServerData serverping_serverdata, Type type, JsonSerializationContext jsonserializationcontext) {
+ // Paper - decompile fix
+ public JsonElement serialize(ServerPing.ServerData serverping_serverdata, Type type, JsonSerializationContext jsonserializationcontext) {
JsonObject jsonobject = new JsonObject();
jsonobject.addProperty("name", serverping_serverdata.a());
jsonobject.addProperty("protocol", Integer.valueOf(serverping_serverdata.getProtocolVersion()));
return jsonobject;
}
-
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
- return this.a((ServerPing.ServerData) object, type, jsonserializationcontext);
- }
-
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
- return this.a(jsonelement, type, jsondeserializationcontext);
- }
}
}
@@ -0,0 +0,0 @@ public class ServerPing {
public Serializer() {}
- public ServerPing.ServerPingPlayerSample a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ // Paper - decompile fix
+ public ServerPing.ServerPingPlayerSample deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
JsonObject jsonobject = ChatDeserializer.m(jsonelement, "players");
ServerPing.ServerPingPlayerSample serverping_serverpingplayersample = new ServerPing.ServerPingPlayerSample(ChatDeserializer.n(jsonobject, "max"), ChatDeserializer.n(jsonobject, "online"));
@@ -0,0 +0,0 @@ public class ServerPing {
return serverping_serverpingplayersample;
}
- public JsonElement a(ServerPing.ServerPingPlayerSample serverping_serverpingplayersample, Type type, JsonSerializationContext jsonserializationcontext) {
+ // Paper - decompile fix
+ public JsonElement serialize(ServerPing.ServerPingPlayerSample serverping_serverpingplayersample, Type type, JsonSerializationContext jsonserializationcontext) {
JsonObject jsonobject = new JsonObject();
jsonobject.addProperty("max", Integer.valueOf(serverping_serverpingplayersample.a()));
@@ -0,0 +0,0 @@ public class ServerPing {
return jsonobject;
}
-
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
- return this.a((ServerPing.ServerPingPlayerSample) object, type, jsonserializationcontext);
- }
-
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
- return this.a(jsonelement, type, jsondeserializationcontext);
- }
}
}
}
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java
index f5bcbdbe1..3190cadfc 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java
@@ -0,0 +0,0 @@ public class ItemFactoryTest extends AbstractTestingBase {
@Test
public void testKnownAttributes() throws Throwable {
- final ZipInputStream nmsZipStream = new ZipInputStream(CommandAbstract.class/* Magic class that isn't imported! */.getProtectionDomain().getCodeSource().getLocation().openStream());
+ final ZipInputStream nmsZipStream = new ZipInputStream(net.minecraft.server.HttpUtilities.class/* Magic class that isn't imported! */.getProtectionDomain().getCodeSource().getLocation().openStream()); // Paper
final Collection<String> names = new HashSet<String>();
for (ZipEntry clazzEntry; (clazzEntry = nmsZipStream.getNextEntry()) != null; ) {
final String entryName = clazzEntry.getName();
--