mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 10:46:05 +03:00
60 lines
2.6 KiB
Diff
60 lines
2.6 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/storage/loot/LootEntry.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/storage/loot/LootEntry.java
|
|
@@ -18,15 +18,17 @@
|
|
|
|
public abstract class LootEntry
|
|
{
|
|
+ protected final String entryName;
|
|
protected final int weight;
|
|
protected final int quality;
|
|
protected final LootCondition[] conditions;
|
|
|
|
- protected LootEntry(int weightIn, int qualityIn, LootCondition[] conditionsIn)
|
|
+ protected LootEntry(int weightIn, int qualityIn, LootCondition[] conditionsIn, String entryName)
|
|
{
|
|
this.weight = weightIn;
|
|
this.quality = qualityIn;
|
|
this.conditions = conditionsIn;
|
|
+ this.entryName = entryName;
|
|
}
|
|
|
|
public int getEffectiveWeight(float luck)
|
|
@@ -34,6 +36,8 @@
|
|
return Math.max(MathHelper.floor((float)this.weight + (float)this.quality * luck), 0);
|
|
}
|
|
|
|
+ public String getEntryName(){ return this.entryName; }
|
|
+
|
|
public abstract void addLoot(Collection<ItemStack> stacks, Random rand, LootContext context);
|
|
|
|
protected abstract void serialize(JsonObject json, JsonSerializationContext context);
|
|
@@ -57,6 +61,9 @@
|
|
alootcondition = new LootCondition[0];
|
|
}
|
|
|
|
+ LootEntry ret = net.minecraftforge.common.ForgeHooks.deserializeJsonLootEntry(s, jsonobject, i, j, alootcondition);
|
|
+ if (ret != null) return ret;
|
|
+
|
|
if ("item".equals(s))
|
|
{
|
|
return LootEntryItem.deserialize(jsonobject, p_deserialize_3_, i, j, alootcondition);
|
|
@@ -78,6 +85,8 @@
|
|
public JsonElement serialize(LootEntry p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_)
|
|
{
|
|
JsonObject jsonobject = new JsonObject();
|
|
+ if (p_serialize_1_.entryName != null && !p_serialize_1_.entryName.startsWith("custom#"))
|
|
+ jsonobject.addProperty("entryName", p_serialize_1_.entryName);
|
|
jsonobject.addProperty("weight", Integer.valueOf(p_serialize_1_.weight));
|
|
jsonobject.addProperty("quality", Integer.valueOf(p_serialize_1_.quality));
|
|
|
|
@@ -86,6 +95,9 @@
|
|
jsonobject.add("conditions", p_serialize_3_.serialize(p_serialize_1_.conditions));
|
|
}
|
|
|
|
+ String type = net.minecraftforge.common.ForgeHooks.getLootEntryType(p_serialize_1_);
|
|
+ if (type != null) jsonobject.addProperty("type", type);
|
|
+ else
|
|
if (p_serialize_1_ instanceof LootEntryItem)
|
|
{
|
|
jsonobject.addProperty("type", "item");
|