Files
2019-02-24 22:29:41 +08:00

92 lines
3.1 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/storage/loot/LootContext.java
+++ ../src-work/minecraft/net/minecraft/world/storage/loot/LootContext.java
@@ -74,7 +74,7 @@
}
@Nullable
- public Entity getEntity(LootContext.EntityTarget target)
+ public Entity getEntity(EntityTarget target)
{
switch (target)
{
@@ -89,6 +89,16 @@
}
}
+ public WorldServer getWorld()
+ {
+ return world;
+ }
+
+ public int getLootingModifier()
+ {
+ return net.minecraftforge.common.ForgeHooks.getLootingLevel(getLootedEntity(), getKiller(), damageSource);
+ }
+
public static class Builder
{
private final WorldServer world;
@@ -102,25 +112,25 @@
this.world = worldIn;
}
- public LootContext.Builder withLuck(float luckIn)
+ public Builder withLuck(float luckIn)
{
this.luck = luckIn;
return this;
}
- public LootContext.Builder withLootedEntity(Entity entityIn)
+ public Builder withLootedEntity(Entity entityIn)
{
this.lootedEntity = entityIn;
return this;
}
- public LootContext.Builder withPlayer(EntityPlayer playerIn)
+ public Builder withPlayer(EntityPlayer playerIn)
{
this.player = playerIn;
return this;
}
- public LootContext.Builder withDamageSource(DamageSource dmgSource)
+ public Builder withDamageSource(DamageSource dmgSource)
{
this.damageSource = dmgSource;
return this;
@@ -145,9 +155,9 @@
this.targetType = type;
}
- public static LootContext.EntityTarget fromString(String type)
+ public static EntityTarget fromString(String type)
{
- for (LootContext.EntityTarget lootcontext$entitytarget : values())
+ for (EntityTarget lootcontext$entitytarget : values())
{
if (lootcontext$entitytarget.targetType.equals(type))
{
@@ -158,16 +168,16 @@
throw new IllegalArgumentException("Invalid entity target " + type);
}
- public static class Serializer extends TypeAdapter<LootContext.EntityTarget>
+ public static class Serializer extends TypeAdapter<EntityTarget>
{
- public void write(JsonWriter p_write_1_, LootContext.EntityTarget p_write_2_) throws IOException
+ public void write(JsonWriter p_write_1_, EntityTarget p_write_2_) throws IOException
{
p_write_1_.value(p_write_2_.targetType);
}
- public LootContext.EntityTarget read(JsonReader p_read_1_) throws IOException
+ public EntityTarget read(JsonReader p_read_1_) throws IOException
{
- return LootContext.EntityTarget.fromString(p_read_1_.nextString());
+ return EntityTarget.fromString(p_read_1_.nextString());
}
}
}