Fix #5612 add entity to ISelectionContext

This commit is contained in:
tterrag 2019-06-21 21:15:56 -04:00
parent 656ff25ae1
commit 5a3b375147
4 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,35 @@
--- a/net/minecraft/util/math/shapes/EntitySelectionContext.java
+++ b/net/minecraft/util/math/shapes/EntitySelectionContext.java
@@ -18,6 +18,11 @@
private final Item field_216382_d;
protected EntitySelectionContext(boolean p_i51181_1_, double p_i51181_2_, Item p_i51181_4_) {
+ this(null, p_i51181_1_, p_i51181_2_, p_i51181_4_);
+ }
+
+ protected EntitySelectionContext(@javax.annotation.Nullable Entity entityIn, boolean p_i51181_1_, double p_i51181_2_, Item p_i51181_4_) {
+ this.entity = entityIn;
this.field_216380_b = p_i51181_1_;
this.field_216381_c = p_i51181_2_;
this.field_216382_d = p_i51181_4_;
@@ -25,7 +30,7 @@
@Deprecated
protected EntitySelectionContext(Entity p_i51182_1_) {
- this(p_i51182_1_.func_70093_af(), p_i51182_1_.func_174813_aQ().field_72338_b, p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_).func_184614_ca().func_77973_b() : Items.field_190931_a);
+ this(p_i51182_1_, p_i51182_1_.func_70093_af(), p_i51182_1_.func_174813_aQ().field_72338_b, p_i51182_1_ instanceof LivingEntity ? ((LivingEntity)p_i51182_1_).func_184614_ca().func_77973_b() : Items.field_190931_a);
}
public boolean func_216375_a(Item p_216375_1_) {
@@ -39,4 +44,11 @@
public boolean func_216378_a(VoxelShape p_216378_1_, BlockPos p_216378_2_, boolean p_216378_3_) {
return this.field_216381_c > (double)p_216378_2_.func_177956_o() + p_216378_1_.func_197758_c(Direction.Axis.Y) - (double)1.0E-5F;
}
+
+ private final @javax.annotation.Nullable Entity entity;
+
+ @Override
+ public @javax.annotation.Nullable Entity getEntity() {
+ return entity;
+ }
}

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/util/math/shapes/ISelectionContext.java
+++ b/net/minecraft/util/math/shapes/ISelectionContext.java
@@ -4,7 +4,7 @@
import net.minecraft.item.Item;
import net.minecraft.util.math.BlockPos;
-public interface ISelectionContext {
+public interface ISelectionContext extends net.minecraftforge.common.extensions.IForgeSelectionContext {
static ISelectionContext func_216377_a() {
return EntitySelectionContext.field_216379_a;
}

View File

@ -0,0 +1,13 @@
package net.minecraftforge.common.extensions;
import javax.annotation.Nullable;
import net.minecraft.entity.Entity;
public interface IForgeSelectionContext
{
default @Nullable Entity getEntity()
{
return null;
}
}

View File

@ -75,3 +75,5 @@ net/minecraft/world/storage/loot/LootEntryEmpty.<init>(II[Lnet/minecraft/world/s
net/minecraft/world/storage/loot/LootEntryItem.<init>(Lnet/minecraft/item/Item;II[Lnet/minecraft/world/storage/loot/functions/LootFunction;[Lnet/minecraft/world/storage/loot/conditions/LootCondition;Ljava/lang/String;)V=|p_i46644_1_,p_i46644_2_,p_i46644_3_,p_i46644_4_,p_i46644_5_,entryName
net/minecraft/world/storage/loot/LootEntryTable.<init>(Lnet/minecraft/util/ResourceLocation;II[Lnet/minecraft/world/storage/loot/conditions/LootCondition;Ljava/lang/String;)V=|p_i46639_1_,p_i46639_2_,p_i46639_3_,p_i46639_4_,entryName
net/minecraft/world/storage/loot/LootPool.<init>([Lnet/minecraft/world/storage/loot/LootEntry;[Lnet/minecraft/world/storage/loot/conditions/LootCondition;Lnet/minecraft/world/storage/loot/RandomValueRange;Lnet/minecraft/world/storage/loot/RandomValueRange;Ljava/lang/String;)V=|p_i46643_1_,p_i46643_2_,p_i46643_3_,p_i46643_4_
net/minecraft/util/shapes/EntitySelectionContext.<init>(Lnet/minecraft/entity/Entity;ZDLnet/minecraft/item/Item;)V=|entity,p_i51181_1_,p_i51181_2_,p_i51181_4_