Fix capability attach event not firing with base type

This commit is contained in:
tterrag 2019-01-24 21:04:50 -05:00
parent 66f816971f
commit 7c11fe1022
7 changed files with 150 additions and 122 deletions

View file

@ -5,11 +5,19 @@
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
-public abstract class Entity implements INameable, ICommandSource { -public abstract class Entity implements INameable, ICommandSource {
+public abstract class Entity extends net.minecraftforge.common.capabilities.CapabilityProvider implements INameable, ICommandSource, net.minecraftforge.common.extensions.IForgeEntity { +public abstract class Entity extends net.minecraftforge.common.capabilities.CapabilityProvider<Entity> implements INameable, ICommandSource, net.minecraftforge.common.extensions.IForgeEntity {
protected static final Logger field_184243_a = LogManager.getLogger(); protected static final Logger field_184243_a = LogManager.getLogger();
private static final List<ItemStack> field_190535_b = Collections.<ItemStack>emptyList(); private static final List<ItemStack> field_190535_b = Collections.<ItemStack>emptyList();
private static final AxisAlignedBB field_174836_a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); private static final AxisAlignedBB field_174836_a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
@@ -210,7 +210,7 @@ @@ -192,6 +192,7 @@
private long field_191506_aJ;
public Entity(EntityType<?> p_i48580_1_, World p_i48580_2_) {
+ super(Entity.class);
this.field_145783_c = field_70152_a++;
this.field_184244_h = Lists.<Entity>newArrayList();
this.field_70121_D = field_174836_a;
@@ -210,7 +211,7 @@
this.field_70170_p = p_i48580_2_; this.field_70170_p = p_i48580_2_;
this.func_70107_b(0.0D, 0.0D, 0.0D); this.func_70107_b(0.0D, 0.0D, 0.0D);
if (p_i48580_2_ != null) { if (p_i48580_2_ != null) {
@ -18,7 +26,7 @@
} }
this.field_70180_af = new EntityDataManager(this); this.field_70180_af = new EntityDataManager(this);
@@ -221,6 +221,8 @@ @@ -221,6 +222,8 @@
this.field_70180_af.func_187214_a(field_184234_aB, false); this.field_70180_af.func_187214_a(field_184234_aB, false);
this.field_70180_af.func_187214_a(field_189655_aD, false); this.field_70180_af.func_187214_a(field_189655_aD, false);
this.func_70088_a(); this.func_70088_a();
@ -27,7 +35,7 @@
} }
public EntityType<?> func_200600_R() { public EntityType<?> func_200600_R() {
@@ -324,6 +326,7 @@ @@ -324,6 +327,7 @@
this.field_70165_t = p_70107_1_; this.field_70165_t = p_70107_1_;
this.field_70163_u = p_70107_3_; this.field_70163_u = p_70107_3_;
this.field_70161_v = p_70107_5_; this.field_70161_v = p_70107_5_;
@ -35,7 +43,7 @@
float f = this.field_70130_N / 2.0F; float f = this.field_70130_N / 2.0F;
float f1 = this.field_70131_O; float f1 = this.field_70131_O;
this.func_174826_a(new AxisAlignedBB(p_70107_1_ - (double)f, p_70107_3_, p_70107_5_ - (double)f, p_70107_1_ + (double)f, p_70107_3_ + (double)f1, p_70107_5_ + (double)f)); this.func_174826_a(new AxisAlignedBB(p_70107_1_ - (double)f, p_70107_3_, p_70107_5_ - (double)f, p_70107_1_ + (double)f, p_70107_3_ + (double)f1, p_70107_5_ + (double)f));
@@ -794,6 +797,7 @@ @@ -794,6 +798,7 @@
this.field_70165_t = (axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D; this.field_70165_t = (axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D;
this.field_70163_u = axisalignedbb.field_72338_b; this.field_70163_u = axisalignedbb.field_72338_b;
this.field_70161_v = (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D; this.field_70161_v = (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D;
@ -43,7 +51,7 @@
} }
protected SoundEvent func_184184_Z() { protected SoundEvent func_184184_Z() {
@@ -845,7 +849,7 @@ @@ -845,7 +850,7 @@
protected void func_180429_a(BlockPos p_180429_1_, IBlockState p_180429_2_) { protected void func_180429_a(BlockPos p_180429_1_, IBlockState p_180429_2_) {
if (!p_180429_2_.func_185904_a().func_76224_d()) { if (!p_180429_2_.func_185904_a().func_76224_d()) {
@ -52,7 +60,7 @@
this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b()); this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b());
} }
} }
@@ -1040,6 +1044,7 @@ @@ -1040,6 +1045,7 @@
int k = MathHelper.func_76128_c(this.field_70161_v); int k = MathHelper.func_76128_c(this.field_70161_v);
BlockPos blockpos = new BlockPos(i, j, k); BlockPos blockpos = new BlockPos(i, j, k);
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
@ -60,7 +68,7 @@
if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) { if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) {
this.field_70170_p.func_195594_a(new BlockParticleData(Particles.field_197611_d, iblockstate), this.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, this.func_174813_aQ().field_72338_b + 0.1D, this.field_70161_v + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, -this.field_70159_w * 4.0D, 1.5D, -this.field_70179_y * 4.0D); this.field_70170_p.func_195594_a(new BlockParticleData(Particles.field_197611_d, iblockstate), this.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, this.func_174813_aQ().field_72338_b + 0.1D, this.field_70161_v + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, -this.field_70159_w * 4.0D, 1.5D, -this.field_70179_y * 4.0D);
} }
@@ -1053,7 +1058,7 @@ @@ -1053,7 +1059,7 @@
double d0 = this.field_70163_u + (double)this.func_70047_e(); double d0 = this.field_70163_u + (double)this.func_70047_e();
BlockPos blockpos = new BlockPos(this.field_70165_t, d0, this.field_70161_v); BlockPos blockpos = new BlockPos(this.field_70165_t, d0, this.field_70161_v);
IFluidState ifluidstate = this.field_70170_p.func_204610_c(blockpos); IFluidState ifluidstate = this.field_70170_p.func_204610_c(blockpos);
@ -69,7 +77,7 @@
} }
} }
@@ -1122,6 +1127,7 @@ @@ -1122,6 +1128,7 @@
this.field_70126_B -= 360.0F; this.field_70126_B -= 360.0F;
} }
@ -77,7 +85,7 @@
this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v);
this.func_70101_b(p_70080_7_, p_70080_8_); this.func_70101_b(p_70080_7_, p_70080_8_);
} }
@@ -1370,6 +1376,7 @@ @@ -1370,6 +1377,7 @@
if (this.field_184238_ar) { if (this.field_184238_ar) {
p_189511_1_.func_74757_a("Glowing", this.field_184238_ar); p_189511_1_.func_74757_a("Glowing", this.field_184238_ar);
} }
@ -85,7 +93,7 @@
if (!this.field_184236_aF.isEmpty()) { if (!this.field_184236_aF.isEmpty()) {
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
@@ -1381,6 +1388,9 @@ @@ -1381,6 +1389,9 @@
p_189511_1_.func_74782_a("Tags", nbttaglist); p_189511_1_.func_74782_a("Tags", nbttaglist);
} }
@ -95,7 +103,7 @@
this.func_70014_b(p_189511_1_); this.func_70014_b(p_189511_1_);
if (this.func_184207_aI()) { if (this.func_184207_aI()) {
NBTTagList nbttaglist1 = new NBTTagList(); NBTTagList nbttaglist1 = new NBTTagList();
@@ -1466,6 +1476,8 @@ @@ -1466,6 +1477,8 @@
this.func_174810_b(p_70020_1_.func_74767_n("Silent")); this.func_174810_b(p_70020_1_.func_74767_n("Silent"));
this.func_189654_d(p_70020_1_.func_74767_n("NoGravity")); this.func_189654_d(p_70020_1_.func_74767_n("NoGravity"));
this.func_184195_f(p_70020_1_.func_74767_n("Glowing")); this.func_184195_f(p_70020_1_.func_74767_n("Glowing"));
@ -104,7 +112,7 @@
if (p_70020_1_.func_150297_b("Tags", 9)) { if (p_70020_1_.func_150297_b("Tags", 9)) {
this.field_184236_aF.clear(); this.field_184236_aF.clear();
NBTTagList nbttaglist1 = p_70020_1_.func_150295_c("Tags", 8); NBTTagList nbttaglist1 = p_70020_1_.func_150295_c("Tags", 8);
@@ -1546,6 +1558,8 @@ @@ -1546,6 +1559,8 @@
} else { } else {
EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_); EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_);
entityitem.func_174869_p(); entityitem.func_174869_p();
@ -113,7 +121,7 @@
this.field_70170_p.func_72838_d(entityitem); this.field_70170_p.func_72838_d(entityitem);
return entityitem; return entityitem;
} }
@@ -1595,6 +1609,7 @@ @@ -1595,6 +1610,7 @@
this.field_70159_w = 0.0D; this.field_70159_w = 0.0D;
this.field_70181_x = 0.0D; this.field_70181_x = 0.0D;
this.field_70179_y = 0.0D; this.field_70179_y = 0.0D;
@ -121,7 +129,7 @@
this.func_70071_h_(); this.func_70071_h_();
if (this.func_184218_aH()) { if (this.func_184218_aH()) {
entity.func_184232_k(this); entity.func_184232_k(this);
@@ -1636,6 +1651,7 @@ @@ -1636,6 +1652,7 @@
} }
} }
@ -129,7 +137,7 @@
if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) { if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) {
if (this.func_184218_aH()) { if (this.func_184218_aH()) {
this.func_184210_p(); this.func_184210_p();
@@ -1663,6 +1679,7 @@ @@ -1663,6 +1680,7 @@
public void func_184210_p() { public void func_184210_p() {
if (this.field_184239_as != null) { if (this.field_184239_as != null) {
Entity entity = this.field_184239_as; Entity entity = this.field_184239_as;
@ -137,7 +145,7 @@
this.field_184239_as = null; this.field_184239_as = null;
entity.func_184225_p(this); entity.func_184225_p(this);
} }
@@ -1789,10 +1806,15 @@ @@ -1789,10 +1807,15 @@
return !this.func_184188_bt().isEmpty(); return !this.func_184188_bt().isEmpty();
} }
@ -153,7 +161,7 @@
public boolean func_70093_af() { public boolean func_70093_af() {
return this.func_70083_f(1); return this.func_70083_f(1);
} }
@@ -2053,6 +2075,14 @@ @@ -2053,6 +2076,14 @@
@Nullable @Nullable
public Entity func_184204_a(int p_184204_1_) { public Entity func_184204_a(int p_184204_1_) {
@ -168,7 +176,7 @@
if (!this.field_70170_p.field_72995_K && !this.field_70128_L) { if (!this.field_70170_p.field_72995_K && !this.field_70128_L) {
this.field_70170_p.field_72984_F.func_76320_a("changeDimension"); this.field_70170_p.field_72984_F.func_76320_a("changeDimension");
MinecraftServer minecraftserver = this.func_184102_h(); MinecraftServer minecraftserver = this.func_184102_h();
@@ -2060,7 +2090,7 @@ @@ -2060,7 +2091,7 @@
WorldServer worldserver = minecraftserver.func_71218_a(i); WorldServer worldserver = minecraftserver.func_71218_a(i);
WorldServer worldserver1 = minecraftserver.func_71218_a(p_184204_1_); WorldServer worldserver1 = minecraftserver.func_71218_a(p_184204_1_);
this.field_71093_bK = p_184204_1_; this.field_71093_bK = p_184204_1_;
@ -177,7 +185,7 @@
worldserver1 = minecraftserver.func_200667_a(DimensionType.OVERWORLD); worldserver1 = minecraftserver.func_200667_a(DimensionType.OVERWORLD);
this.field_71093_bK = 0; this.field_71093_bK = 0;
} }
@@ -2069,16 +2099,17 @@ @@ -2069,16 +2100,17 @@
this.field_70128_L = false; this.field_70128_L = false;
this.field_70170_p.field_72984_F.func_76320_a("reposition"); this.field_70170_p.field_72984_F.func_76320_a("reposition");
BlockPos blockpos; BlockPos blockpos;
@ -200,7 +208,7 @@
d0 = MathHelper.func_151237_a(d0 * 8.0D, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D); d0 = MathHelper.func_151237_a(d0 * 8.0D, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D);
d1 = MathHelper.func_151237_a(d1 * 8.0D, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D); d1 = MathHelper.func_151237_a(d1 * 8.0D, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D);
} }
@@ -2087,8 +2118,7 @@ @@ -2087,8 +2119,7 @@
d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872); d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872);
float f = this.field_70177_z; float f = this.field_70177_z;
this.func_70012_b(d0, this.field_70163_u, d1, 90.0F, 0.0F); this.func_70012_b(d0, this.field_70163_u, d1, 90.0F, 0.0F);
@ -210,7 +218,7 @@
blockpos = new BlockPos(this); blockpos = new BlockPos(this);
} }
@@ -2097,7 +2127,7 @@ @@ -2097,7 +2128,7 @@
Entity entity = this.func_200600_R().func_200721_a(worldserver1); Entity entity = this.func_200600_R().func_200721_a(worldserver1);
if (entity != null) { if (entity != null) {
entity.func_180432_n(this); entity.func_180432_n(this);
@ -219,7 +227,7 @@
BlockPos blockpos1 = worldserver1.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.func_175694_M()); BlockPos blockpos1 = worldserver1.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.func_175694_M());
entity.func_174828_a(blockpos1, entity.field_70177_z, entity.field_70125_A); entity.func_174828_a(blockpos1, entity.field_70177_z, entity.field_70125_A);
} else { } else {
@@ -2591,4 +2621,49 @@ @@ -2591,4 +2622,49 @@
public double func_212107_bY() { public double func_212107_bY() {
return this.field_211517_W; return this.field_211517_W;
} }

View file

@ -5,7 +5,7 @@
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
-public final class ItemStack { -public final class ItemStack {
+public final class ItemStack extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeItemStack { +public final class ItemStack extends net.minecraftforge.common.capabilities.CapabilityProvider<ItemStack> implements net.minecraftforge.common.extensions.IForgeItemStack {
private static final Logger field_199558_c = LogManager.getLogger(); private static final Logger field_199558_c = LogManager.getLogger();
public static final ItemStack field_190927_a = new ItemStack((Item)null); public static final ItemStack field_190927_a = new ItemStack((Item)null);
public static final DecimalFormat field_111284_a = func_208306_D(); public static final DecimalFormat field_111284_a = func_208306_D();
@ -19,13 +19,14 @@
private static DecimalFormat func_208306_D() { private static DecimalFormat func_208306_D() {
DecimalFormat decimalformat = new DecimalFormat("#.##"); DecimalFormat decimalformat = new DecimalFormat("#.##");
decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT));
@@ -89,10 +92,13 @@ @@ -89,10 +92,14 @@
this(p_i48203_1_, 1); this(p_i48203_1_, 1);
} }
- public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_) { - public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_) {
+ public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_){ this(p_i48204_1_, p_i48204_2_, null); } + public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_){ this(p_i48204_1_, p_i48204_2_, null); }
+ public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_, @Nullable NBTTagCompound capNBT) { + public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_, @Nullable NBTTagCompound capNBT) {
+ super(ItemStack.class);
+ this.capNBT = capNBT; + this.capNBT = capNBT;
this.field_151002_e = p_i48204_1_ == null ? null : p_i48204_1_.func_199767_j(); this.field_151002_e = p_i48204_1_ == null ? null : p_i48204_1_.func_199767_j();
this.field_77994_a = p_i48204_2_; this.field_77994_a = p_i48204_2_;
@ -34,15 +35,16 @@
} }
private void func_190923_F() { private void func_190923_F() {
@@ -101,6 +107,7 @@ @@ -101,6 +108,8 @@
} }
private ItemStack(NBTTagCompound p_i47263_1_) { private ItemStack(NBTTagCompound p_i47263_1_) {
+ super(ItemStack.class);
+ this.capNBT = p_i47263_1_.func_74764_b("ForgeCaps") ? p_i47263_1_.func_74775_l("ForgeCaps") : null; + this.capNBT = p_i47263_1_.func_74764_b("ForgeCaps") ? p_i47263_1_.func_74775_l("ForgeCaps") : null;
Item item = Item.field_150901_e.func_82594_a(new ResourceLocation(p_i47263_1_.func_74779_i("id"))); Item item = Item.field_150901_e.func_82594_a(new ResourceLocation(p_i47263_1_.func_74779_i("id")));
this.field_151002_e = item == null ? Items.field_190931_a : item; this.field_151002_e = item == null ? Items.field_190931_a : item;
this.field_77994_a = p_i47263_1_.func_74771_c("Count"); this.field_77994_a = p_i47263_1_.func_74771_c("Count");
@@ -114,6 +121,7 @@ @@ -114,6 +123,7 @@
} }
this.func_190923_F(); this.func_190923_F();
@ -50,7 +52,7 @@
} }
public static ItemStack func_199557_a(NBTTagCompound p_199557_0_) { public static ItemStack func_199557_a(NBTTagCompound p_199557_0_) {
@@ -128,7 +136,7 @@ @@ -128,7 +138,7 @@
public boolean func_190926_b() { public boolean func_190926_b() {
if (this == field_190927_a) { if (this == field_190927_a) {
return true; return true;
@ -59,7 +61,7 @@
return this.field_77994_a <= 0; return this.field_77994_a <= 0;
} else { } else {
return true; return true;
@@ -144,18 +152,27 @@ @@ -144,18 +154,27 @@
} }
public Item func_77973_b() { public Item func_77973_b() {
@ -93,7 +95,7 @@
if (entityplayer != null && enumactionresult == EnumActionResult.SUCCESS) { if (entityplayer != null && enumactionresult == EnumActionResult.SUCCESS) {
entityplayer.func_71029_a(StatList.field_75929_E.func_199076_b(item)); entityplayer.func_71029_a(StatList.field_75929_E.func_199076_b(item));
} }
@@ -183,12 +200,15 @@ @@ -183,12 +202,15 @@
if (this.field_77990_d != null) { if (this.field_77990_d != null) {
p_77955_1_.func_74782_a("tag", this.field_77990_d); p_77955_1_.func_74782_a("tag", this.field_77990_d);
} }
@ -111,7 +113,7 @@
} }
public boolean func_77985_e() { public boolean func_77985_e() {
@@ -196,7 +216,7 @@ @@ -196,7 +218,7 @@
} }
public boolean func_77984_f() { public boolean func_77984_f() {
@ -120,7 +122,7 @@
NBTTagCompound nbttagcompound = this.func_77978_p(); NBTTagCompound nbttagcompound = this.func_77978_p();
return nbttagcompound == null || !nbttagcompound.func_74767_n("Unbreakable"); return nbttagcompound == null || !nbttagcompound.func_74767_n("Unbreakable");
} else { } else {
@@ -205,7 +225,7 @@ @@ -205,7 +227,7 @@
} }
public boolean func_77951_h() { public boolean func_77951_h() {
@ -129,7 +131,7 @@
} }
public int func_77952_i() { public int func_77952_i() {
@@ -217,7 +237,7 @@ @@ -217,7 +239,7 @@
} }
public int func_77958_k() { public int func_77958_k() {
@ -138,7 +140,7 @@
} }
public boolean func_96631_a(int p_96631_1_, Random p_96631_2_, @Nullable EntityPlayerMP p_96631_3_) { public boolean func_96631_a(int p_96631_1_, Random p_96631_2_, @Nullable EntityPlayerMP p_96631_3_) {
@@ -285,7 +305,7 @@ @@ -285,7 +307,7 @@
} }
public boolean func_150998_b(IBlockState p_150998_1_) { public boolean func_150998_b(IBlockState p_150998_1_) {
@ -147,7 +149,7 @@
} }
public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_, EnumHand p_111282_3_) { public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_, EnumHand p_111282_3_) {
@@ -293,7 +313,7 @@ @@ -293,7 +315,7 @@
} }
public ItemStack func_77946_l() { public ItemStack func_77946_l() {
@ -156,7 +158,7 @@
itemstack.func_190915_d(this.func_190921_D()); itemstack.func_190915_d(this.func_190921_D());
if (this.field_77990_d != null) { if (this.field_77990_d != null) {
itemstack.field_77990_d = this.field_77990_d.func_74737_b(); itemstack.field_77990_d = this.field_77990_d.func_74737_b();
@@ -309,7 +329,7 @@ @@ -309,7 +331,7 @@
if (p_77970_0_.field_77990_d == null && p_77970_1_.field_77990_d != null) { if (p_77970_0_.field_77990_d == null && p_77970_1_.field_77990_d != null) {
return false; return false;
} else { } else {
@ -165,7 +167,7 @@
} }
} else { } else {
return false; return false;
@@ -332,7 +352,7 @@ @@ -332,7 +354,7 @@
} else if (this.field_77990_d == null && p_77959_1_.field_77990_d != null) { } else if (this.field_77990_d == null && p_77959_1_.field_77990_d != null) {
return false; return false;
} else { } else {
@ -174,7 +176,7 @@
} }
} }
@@ -633,6 +653,7 @@ @@ -633,6 +655,7 @@
} }
} }
@ -182,7 +184,7 @@
return list; return list;
} }
@@ -743,7 +764,7 @@ @@ -743,7 +766,7 @@
} }
} }
} else { } else {
@ -191,7 +193,7 @@
} }
return multimap; return multimap;
@@ -874,4 +895,89 @@ @@ -874,4 +897,89 @@
public void func_190918_g(int p_190918_1_) { public void func_190918_g(int p_190918_1_) {
this.func_190917_f(-p_190918_1_); this.func_190917_f(-p_190918_1_);
} }

View file

@ -9,11 +9,11 @@
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
-public abstract class TileEntity { -public abstract class TileEntity {
+public abstract class TileEntity extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeTileEntity { +public abstract class TileEntity extends net.minecraftforge.common.capabilities.CapabilityProvider<TileEntity> implements net.minecraftforge.common.extensions.IForgeTileEntity {
private static final Logger field_145852_a = LogManager.getLogger(); private static final Logger field_145852_a = LogManager.getLogger();
private final TileEntityType<?> field_200663_e; private final TileEntityType<?> field_200663_e;
protected World field_145850_b; protected World field_145850_b;
@@ -23,9 +24,12 @@ @@ -23,9 +24,13 @@
protected boolean field_145846_f; protected boolean field_145846_f;
@Nullable @Nullable
private IBlockState field_195045_e; private IBlockState field_195045_e;
@ -21,12 +21,13 @@
+ +
public TileEntity(TileEntityType<?> p_i48289_1_) { public TileEntity(TileEntityType<?> p_i48289_1_) {
+ super(TileEntity.class);
this.field_200663_e = p_i48289_1_; this.field_200663_e = p_i48289_1_;
+ this.gatherCapabilities(); + this.gatherCapabilities();
} }
@Nullable @Nullable
@@ -43,6 +47,8 @@ @@ -43,6 +48,8 @@
public void func_145839_a(NBTTagCompound p_145839_1_) { public void func_145839_a(NBTTagCompound p_145839_1_) {
this.field_174879_c = new BlockPos(p_145839_1_.func_74762_e("x"), p_145839_1_.func_74762_e("y"), p_145839_1_.func_74762_e("z")); this.field_174879_c = new BlockPos(p_145839_1_.func_74762_e("x"), p_145839_1_.func_74762_e("y"), p_145839_1_.func_74762_e("z"));
@ -35,7 +36,7 @@
} }
public NBTTagCompound func_189515_b(NBTTagCompound p_189515_1_) { public NBTTagCompound func_189515_b(NBTTagCompound p_189515_1_) {
@@ -58,6 +64,8 @@ @@ -58,6 +65,8 @@
p_189516_1_.func_74768_a("x", this.field_174879_c.func_177958_n()); p_189516_1_.func_74768_a("x", this.field_174879_c.func_177958_n());
p_189516_1_.func_74768_a("y", this.field_174879_c.func_177956_o()); p_189516_1_.func_74768_a("y", this.field_174879_c.func_177956_o());
p_189516_1_.func_74768_a("z", this.field_174879_c.func_177952_p()); p_189516_1_.func_74768_a("z", this.field_174879_c.func_177952_p());
@ -44,7 +45,7 @@
return p_189516_1_; return p_189516_1_;
} }
} }
@@ -91,14 +99,13 @@ @@ -91,14 +100,13 @@
if (this.field_145850_b != null) { if (this.field_145850_b != null) {
this.field_195045_e = this.field_145850_b.func_180495_p(this.field_174879_c); this.field_195045_e = this.field_145850_b.func_180495_p(this.field_174879_c);
this.field_145850_b.func_175646_b(this.field_174879_c, this); this.field_145850_b.func_175646_b(this.field_174879_c, this);
@ -60,7 +61,7 @@
public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) { public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) {
double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_; double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_;
double d1 = (double)this.field_174879_c.func_177956_o() + 0.5D - p_145835_3_; double d1 = (double)this.field_174879_c.func_177956_o() + 0.5D - p_145835_3_;
@@ -179,4 +186,11 @@ @@ -179,4 +187,11 @@
public TileEntityType<?> func_200662_C() { public TileEntityType<?> func_200662_C() {
return this.field_200663_e; return this.field_200663_e;
} }

View file

@ -5,11 +5,11 @@
import net.minecraft.world.World; import net.minecraft.world.World;
-public class Village { -public class Village {
+public class Village extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeVillage { +public class Village extends net.minecraftforge.common.capabilities.CapabilityProvider<Village> implements net.minecraftforge.common.extensions.IForgeVillage {
private World field_75586_a; private World field_75586_a;
private final List<VillageDoorInfo> field_75584_b = Lists.<VillageDoorInfo>newArrayList(); private final List<VillageDoorInfo> field_75584_b = Lists.<VillageDoorInfo>newArrayList();
private BlockPos field_75585_c = BlockPos.field_177992_a; private BlockPos field_75585_c = BlockPos.field_177992_a;
@@ -40,15 +40,17 @@ @@ -40,15 +40,18 @@
private int field_75581_g; private int field_75581_g;
private int field_75588_h; private int field_75588_h;
private int field_82694_i; private int field_82694_i;
@ -19,16 +19,17 @@
private int field_75587_j; private int field_75587_j;
public Village() { public Village() {
+ this.gatherCapabilities(); + this(null);
} }
public Village(World p_i1675_1_) { public Village(World p_i1675_1_) {
+ super(Village.class);
this.field_75586_a = p_i1675_1_; this.field_75586_a = p_i1675_1_;
+ this.gatherCapabilities(); + this.gatherCapabilities();
} }
public void func_82691_a(World p_82691_1_) { public void func_82691_a(World p_82691_1_) {
@@ -237,9 +239,9 @@ @@ -237,9 +240,9 @@
double d0 = Double.MAX_VALUE; double d0 = Double.MAX_VALUE;
EntityPlayer entityplayer = null; EntityPlayer entityplayer = null;
@ -41,7 +42,7 @@
if (entityplayer1 != null) { if (entityplayer1 != null) {
double d1 = entityplayer1.func_70068_e(p_82685_1_); double d1 = entityplayer1.func_70068_e(p_82685_1_);
if (!(d1 > d0)) { if (!(d1 > d0)) {
@@ -317,22 +319,47 @@ @@ -317,22 +320,47 @@
} }
} }
@ -91,7 +92,7 @@
public void func_82690_a(NBTTagCompound p_82690_1_) { public void func_82690_a(NBTTagCompound p_82690_1_) {
this.field_75588_h = p_82690_1_.func_74762_e("PopSize"); this.field_75588_h = p_82690_1_.func_74762_e("PopSize");
this.field_75583_e = p_82690_1_.func_74762_e("Radius"); this.field_75583_e = p_82690_1_.func_74762_e("Radius");
@@ -354,17 +381,14 @@ @@ -354,17 +382,14 @@
for(int j = 0; j < nbttaglist1.size(); ++j) { for(int j = 0; j < nbttaglist1.size(); ++j) {
NBTTagCompound nbttagcompound1 = nbttaglist1.func_150305_b(j); NBTTagCompound nbttagcompound1 = nbttaglist1.func_150305_b(j);
@ -114,7 +115,7 @@
} }
public void func_82689_b(NBTTagCompound p_82689_1_) { public void func_82689_b(NBTTagCompound p_82689_1_) {
@@ -396,14 +420,12 @@ @@ -396,14 +421,12 @@
p_82689_1_.func_74782_a("Doors", nbttaglist); p_82689_1_.func_74782_a("Doors", nbttaglist);
NBTTagList nbttaglist1 = new NBTTagList(); NBTTagList nbttaglist1 = new NBTTagList();
@ -132,7 +133,7 @@
nbttagcompound1.func_74768_a("S", this.field_82693_j.get(s)); nbttagcompound1.func_74768_a("S", this.field_82693_j.get(s));
nbttaglist1.add((INBTBase)nbttagcompound1); nbttaglist1.add((INBTBase)nbttagcompound1);
} }
@@ -413,6 +435,8 @@ @@ -413,6 +436,8 @@
} }
p_82689_1_.func_74782_a("Players", nbttaglist1); p_82689_1_.func_74782_a("Players", nbttaglist1);
@ -141,7 +142,7 @@
} }
public void func_82692_h() { public void func_82692_h() {
@@ -424,8 +448,8 @@ @@ -424,8 +449,8 @@
} }
public void func_82683_b(int p_82683_1_) { public void func_82683_b(int p_82683_1_) {

View file

@ -5,11 +5,11 @@
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
-public abstract class World implements IWorld, IWorldReader, AutoCloseable { -public abstract class World implements IWorld, IWorldReader, AutoCloseable {
+public abstract class World extends net.minecraftforge.common.capabilities.CapabilityProvider implements IWorld, IWorldReader, AutoCloseable, net.minecraftforge.common.extensions.IForgeWorld { +public abstract class World extends net.minecraftforge.common.capabilities.CapabilityProvider<World> implements IWorld, IWorldReader, AutoCloseable, net.minecraftforge.common.extensions.IForgeWorld {
protected static final Logger field_195596_d = LogManager.getLogger(); protected static final Logger field_195596_d = LogManager.getLogger();
private static final EnumFacing[] field_200007_a = EnumFacing.values(); private static final EnumFacing[] field_200007_a = EnumFacing.values();
private int field_181546_a = 63; private int field_181546_a = 63;
@@ -110,6 +110,12 @@ @@ -110,7 +110,14 @@
private final WorldBorder field_175728_M; private final WorldBorder field_175728_M;
int[] field_72994_J; int[] field_72994_J;
@ -20,9 +20,11 @@
+ private net.minecraftforge.common.util.WorldCapabilityData capabilityData; + private net.minecraftforge.common.util.WorldCapabilityData capabilityData;
+ +
protected World(ISaveHandler p_i45749_1_, WorldInfo p_i45749_2_, Dimension p_i45749_3_, Profiler p_i45749_4_, boolean p_i45749_5_) { protected World(ISaveHandler p_i45749_1_, WorldInfo p_i45749_2_, Dimension p_i45749_3_, Profiler p_i45749_4_, boolean p_i45749_5_) {
+ super(World.class);
this.field_73021_x = Lists.newArrayList(this.field_184152_t); this.field_73021_x = Lists.newArrayList(this.field_184152_t);
this.field_72985_G = true; this.field_72985_G = true;
@@ -121,6 +127,7 @@ this.field_72992_H = true;
@@ -121,6 +128,7 @@
this.field_73011_w = p_i45749_3_; this.field_73011_w = p_i45749_3_;
this.field_72995_K = p_i45749_5_; this.field_72995_K = p_i45749_5_;
this.field_175728_M = p_i45749_3_.func_177501_r(); this.field_175728_M = p_i45749_3_.func_177501_r();
@ -30,7 +32,7 @@
} }
public IWorld func_175643_b() { public IWorld func_175643_b() {
@@ -128,21 +135,25 @@ @@ -128,21 +136,25 @@
} }
public Biome func_180494_b(BlockPos p_180494_1_) { public Biome func_180494_b(BlockPos p_180494_1_) {
@ -61,7 +63,7 @@
} }
} }
@@ -184,7 +195,7 @@ @@ -184,7 +196,7 @@
} }
public boolean func_175623_d(BlockPos p_175623_1_) { public boolean func_175623_d(BlockPos p_175623_1_) {
@ -70,7 +72,7 @@
} }
public Chunk func_175726_f(BlockPos p_175726_1_) { public Chunk func_175726_f(BlockPos p_175726_1_) {
@@ -203,42 +214,67 @@ @@ -203,42 +215,67 @@
} else { } else {
Chunk chunk = this.func_175726_f(p_180501_1_); Chunk chunk = this.func_175726_f(p_180501_1_);
Block block = p_180501_2_.func_177230_c(); Block block = p_180501_2_.func_177230_c();
@ -154,7 +156,7 @@
} }
} }
} }
@@ -250,7 +286,7 @@ @@ -250,7 +287,7 @@
public boolean func_175655_b(BlockPos p_175655_1_, boolean p_175655_2_) { public boolean func_175655_b(BlockPos p_175655_1_, boolean p_175655_2_) {
IBlockState iblockstate = this.func_180495_p(p_175655_1_); IBlockState iblockstate = this.func_180495_p(p_175655_1_);
@ -163,7 +165,7 @@
return false; return false;
} else { } else {
IFluidState ifluidstate = this.func_204610_c(p_175655_1_); IFluidState ifluidstate = this.func_204610_c(p_175655_1_);
@@ -309,6 +345,8 @@ @@ -309,6 +346,8 @@
} }
public void func_195593_d(BlockPos p_195593_1_, Block p_195593_2_) { public void func_195593_d(BlockPos p_195593_1_, Block p_195593_2_) {
@ -172,7 +174,7 @@
this.func_190524_a(p_195593_1_.func_177976_e(), p_195593_2_, p_195593_1_); this.func_190524_a(p_195593_1_.func_177976_e(), p_195593_2_, p_195593_1_);
this.func_190524_a(p_195593_1_.func_177974_f(), p_195593_2_, p_195593_1_); this.func_190524_a(p_195593_1_.func_177974_f(), p_195593_2_, p_195593_1_);
this.func_190524_a(p_195593_1_.func_177977_b(), p_195593_2_, p_195593_1_); this.func_190524_a(p_195593_1_.func_177977_b(), p_195593_2_, p_195593_1_);
@@ -318,6 +356,11 @@ @@ -318,6 +357,11 @@
} }
public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, EnumFacing p_175695_3_) { public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, EnumFacing p_175695_3_) {
@ -184,7 +186,7 @@
if (p_175695_3_ != EnumFacing.WEST) { if (p_175695_3_ != EnumFacing.WEST) {
this.func_190524_a(p_175695_1_.func_177976_e(), p_175695_2_, p_175695_1_); this.func_190524_a(p_175695_1_.func_177976_e(), p_175695_2_, p_175695_1_);
} }
@@ -355,9 +398,9 @@ @@ -355,9 +399,9 @@
CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block being updated"); CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block being updated");
crashreportcategory.func_189529_a("Source block type", () -> { crashreportcategory.func_189529_a("Source block type", () -> {
try { try {
@ -196,7 +198,7 @@
} }
}); });
CrashReportCategory.func_175750_a(crashreportcategory, p_190524_1_, iblockstate); CrashReportCategory.func_175750_a(crashreportcategory, p_190524_1_, iblockstate);
@@ -515,7 +558,7 @@ @@ -515,7 +559,7 @@
} }
public boolean func_72935_r() { public boolean func_72935_r() {
@ -205,7 +207,7 @@
} }
@Nullable @Nullable
@@ -695,6 +738,12 @@ @@ -695,6 +739,12 @@
} }
public void func_184148_a(@Nullable EntityPlayer p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) { public void func_184148_a(@Nullable EntityPlayer p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) {
@ -218,7 +220,7 @@
for(int i = 0; i < this.field_73021_x.size(); ++i) { for(int i = 0; i < this.field_73021_x.size(); ++i) {
((IWorldEventListener)this.field_73021_x.get(i)).func_184375_a(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_); ((IWorldEventListener)this.field_73021_x.get(i)).func_184375_a(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_);
} }
@@ -739,6 +788,8 @@ @@ -739,6 +789,8 @@
} }
public boolean func_72838_d(Entity p_72838_1_) { public boolean func_72838_d(Entity p_72838_1_) {
@ -227,7 +229,7 @@
int i = MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D); int i = MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D);
int j = MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D); int j = MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D);
boolean flag = p_72838_1_.field_98038_p; boolean flag = p_72838_1_.field_98038_p;
@@ -755,6 +806,7 @@ @@ -755,6 +807,7 @@
this.func_72854_c(); this.func_72854_c();
} }
@ -235,7 +237,7 @@
this.func_72964_e(i, j).func_76612_a(p_72838_1_); this.func_72964_e(i, j).func_76612_a(p_72838_1_);
this.field_72996_f.add(p_72838_1_); this.field_72996_f.add(p_72838_1_);
this.func_72923_a(p_72838_1_); this.func_72923_a(p_72838_1_);
@@ -766,14 +818,14 @@ @@ -766,14 +819,14 @@
for(int i = 0; i < this.field_73021_x.size(); ++i) { for(int i = 0; i < this.field_73021_x.size(); ++i) {
((IWorldEventListener)this.field_73021_x.get(i)).func_72703_a(p_72923_1_); ((IWorldEventListener)this.field_73021_x.get(i)).func_72703_a(p_72923_1_);
} }
@ -252,7 +254,7 @@
} }
public void func_72900_e(Entity p_72900_1_) { public void func_72900_e(Entity p_72900_1_) {
@@ -816,52 +868,62 @@ @@ -816,52 +869,62 @@
this.field_73021_x.add(p_72954_1_); this.field_73021_x.add(p_72954_1_);
} }
@ -332,7 +334,7 @@
if (f6 > 0.0F) { if (f6 > 0.0F) {
float f7 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.6F; float f7 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.6F;
float f8 = 1.0F - f6 * 0.75F; float f8 = 1.0F - f6 * 0.75F;
@@ -870,7 +932,7 @@ @@ -870,7 +933,7 @@
f5 = f5 * f8 + f7 * (1.0F - f8); f5 = f5 * f8 + f7 * (1.0F - f8);
} }
@ -341,7 +343,7 @@
if (f10 > 0.0F) { if (f10 > 0.0F) {
float f11 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.2F; float f11 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.2F;
float f9 = 1.0F - f10 * 0.75F; float f9 = 1.0F - f10 * 0.75F;
@@ -880,7 +942,7 @@ @@ -880,7 +943,7 @@
} }
if (this.field_73016_r > 0) { if (this.field_73016_r > 0) {
@ -350,7 +352,7 @@
if (f12 > 1.0F) { if (f12 > 1.0F) {
f12 = 1.0F; f12 = 1.0F;
} }
@@ -901,13 +963,17 @@ @@ -901,13 +964,17 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public Vec3d func_72824_f(float p_72824_1_) { public Vec3d func_72824_f(float p_72824_1_) {
@ -370,7 +372,7 @@
if (f5 > 0.0F) { if (f5 > 0.0F) {
float f6 = (f2 * 0.3F + f3 * 0.59F + f4 * 0.11F) * 0.6F; float f6 = (f2 * 0.3F + f3 * 0.59F + f4 * 0.11F) * 0.6F;
float f7 = 1.0F - f5 * 0.95F; float f7 = 1.0F - f5 * 0.95F;
@@ -919,7 +985,7 @@ @@ -919,7 +986,7 @@
f2 = f2 * (f1 * 0.9F + 0.1F); f2 = f2 * (f1 * 0.9F + 0.1F);
f3 = f3 * (f1 * 0.9F + 0.1F); f3 = f3 * (f1 * 0.9F + 0.1F);
f4 = f4 * (f1 * 0.85F + 0.15F); f4 = f4 * (f1 * 0.85F + 0.15F);
@ -379,7 +381,7 @@
if (f9 > 0.0F) { if (f9 > 0.0F) {
float f10 = (f2 * 0.3F + f3 * 0.59F + f4 * 0.11F) * 0.2F; float f10 = (f2 * 0.3F + f3 * 0.59F + f4 * 0.11F) * 0.2F;
float f8 = 1.0F - f9 * 0.95F; float f8 = 1.0F - f9 * 0.95F;
@@ -939,10 +1005,7 @@ @@ -939,10 +1006,7 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public float func_72880_h(float p_72880_1_) { public float func_72880_h(float p_72880_1_) {
@ -391,7 +393,7 @@
} }
public void func_72939_s() { public void func_72939_s() {
@@ -953,6 +1016,7 @@ @@ -953,6 +1017,7 @@
Entity entity = this.field_73007_j.get(i); Entity entity = this.field_73007_j.get(i);
try { try {
@ -399,7 +401,7 @@
++entity.field_70173_aa; ++entity.field_70173_aa;
entity.func_70071_h_(); entity.func_70071_h_();
} catch (Throwable throwable2) { } catch (Throwable throwable2) {
@@ -964,6 +1028,10 @@ @@ -964,6 +1029,10 @@
entity.func_85029_a(crashreportcategory); entity.func_85029_a(crashreportcategory);
} }
@ -410,7 +412,7 @@
throw new ReportedException(crashreport); throw new ReportedException(crashreport);
} }
@@ -1006,11 +1074,17 @@ @@ -1006,11 +1075,17 @@
this.field_72984_F.func_76320_a("tick"); this.field_72984_F.func_76320_a("tick");
if (!entity2.field_70128_L && !(entity2 instanceof EntityPlayerMP)) { if (!entity2.field_70128_L && !(entity2 instanceof EntityPlayerMP)) {
try { try {
@ -428,7 +430,7 @@
throw new ReportedException(crashreport1); throw new ReportedException(crashreport1);
} }
} }
@@ -1032,30 +1106,41 @@ @@ -1032,30 +1107,41 @@
} }
this.field_72984_F.func_76318_c("blockEntities"); this.field_72984_F.func_76318_c("blockEntities");
@ -474,7 +476,7 @@
throw new ReportedException(crashreport2); throw new ReportedException(crashreport2);
} }
} }
@@ -1065,7 +1150,10 @@ @@ -1065,7 +1151,10 @@
iterator.remove(); iterator.remove();
this.field_147482_g.remove(tileentity); this.field_147482_g.remove(tileentity);
if (this.func_175667_e(tileentity.func_174877_v())) { if (this.func_175667_e(tileentity.func_174877_v())) {
@ -486,7 +488,7 @@
} }
} }
} }
@@ -1100,10 +1188,15 @@ @@ -1100,10 +1189,15 @@
} }
public boolean func_175700_a(TileEntity p_175700_1_) { public boolean func_175700_a(TileEntity p_175700_1_) {
@ -502,7 +504,7 @@
if (this.field_72995_K) { if (this.field_72995_K) {
BlockPos blockpos = p_175700_1_.func_174877_v(); BlockPos blockpos = p_175700_1_.func_174877_v();
@@ -1116,6 +1209,11 @@ @@ -1116,6 +1210,11 @@
public void func_147448_a(Collection<TileEntity> p_147448_1_) { public void func_147448_a(Collection<TileEntity> p_147448_1_) {
if (this.field_147481_N) { if (this.field_147481_N) {
@ -514,7 +516,7 @@
this.field_147484_a.addAll(p_147448_1_); this.field_147484_a.addAll(p_147448_1_);
} else { } else {
for(TileEntity tileentity : p_147448_1_) { for(TileEntity tileentity : p_147448_1_) {
@@ -1134,7 +1232,11 @@ @@ -1134,7 +1233,11 @@
int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t); int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t);
int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v); int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v);
int k = 32; int k = 32;
@ -527,7 +529,7 @@
return; return;
} }
} }
@@ -1197,6 +1299,7 @@ @@ -1197,6 +1300,7 @@
if (p_72866_2_ && p_72866_1_.field_70175_ag) { if (p_72866_2_ && p_72866_1_.field_70175_ag) {
for(Entity entity : p_72866_1_.func_184188_bt()) { for(Entity entity : p_72866_1_.func_184188_bt()) {
if (!entity.field_70128_L && entity.func_184187_bx() == p_72866_1_) { if (!entity.field_70128_L && entity.func_184187_bx() == p_72866_1_) {
@ -535,7 +537,7 @@
this.func_72870_g(entity); this.func_72870_g(entity);
} else { } else {
entity.func_184210_p(); entity.func_184210_p();
@@ -1236,7 +1339,7 @@ @@ -1236,7 +1340,7 @@
for(int l1 = k; l1 < l; ++l1) { for(int l1 = k; l1 < l; ++l1) {
for(int i2 = i1; i2 < j1; ++i2) { for(int i2 = i1; i2 < j1; ++i2) {
IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2)); IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2));
@ -544,7 +546,7 @@
boolean flag = true; boolean flag = true;
return flag; return flag;
} }
@@ -1260,10 +1363,13 @@ @@ -1260,10 +1364,13 @@
for(int k1 = i; k1 < j; ++k1) { for(int k1 = i; k1 < j; ++k1) {
for(int l1 = k; l1 < l; ++l1) { for(int l1 = k; l1 < l; ++l1) {
for(int i2 = i1; i2 < j1; ++i2) { for(int i2 = i1; i2 < j1; ++i2) {
@ -559,7 +561,7 @@
} }
} }
} }
@@ -1343,6 +1449,7 @@ @@ -1343,6 +1450,7 @@
if (p_211529_2_ != null) { if (p_211529_2_ != null) {
explosion.func_199592_a(p_211529_2_); explosion.func_199592_a(p_211529_2_);
} }
@ -567,7 +569,7 @@
explosion.func_77278_a(); explosion.func_77278_a();
explosion.func_77279_a(true); explosion.func_77279_a(true);
@@ -1436,10 +1543,13 @@ @@ -1436,10 +1544,13 @@
} }
public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_) { public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_) {
@ -581,7 +583,7 @@
Iterator<TileEntity> iterator = this.field_147484_a.iterator(); Iterator<TileEntity> iterator = this.field_147484_a.iterator();
while(iterator.hasNext()) { while(iterator.hasNext()) {
@@ -1452,7 +1562,8 @@ @@ -1452,7 +1563,8 @@
this.field_147484_a.add(p_175690_2_); this.field_147484_a.add(p_175690_2_);
} else { } else {
@ -591,7 +593,7 @@
this.func_175700_a(p_175690_2_); this.func_175700_a(p_175690_2_);
} }
} }
@@ -1465,6 +1576,8 @@ @@ -1465,6 +1577,8 @@
if (tileentity != null && this.field_147481_N) { if (tileentity != null && this.field_147481_N) {
tileentity.func_145843_s(); tileentity.func_145843_s();
this.field_147484_a.remove(tileentity); this.field_147484_a.remove(tileentity);
@ -600,7 +602,7 @@
} else { } else {
if (tileentity != null) { if (tileentity != null) {
this.field_147484_a.remove(tileentity); this.field_147484_a.remove(tileentity);
@@ -1474,6 +1587,7 @@ @@ -1474,6 +1588,7 @@
this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_); this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_);
} }
@ -608,7 +610,7 @@
} }
@@ -1495,7 +1609,7 @@ @@ -1495,7 +1610,7 @@
} }
public boolean func_195595_w(BlockPos p_195595_1_) { public boolean func_195595_w(BlockPos p_195595_1_) {
@ -617,7 +619,7 @@
} }
public void func_72966_v() { public void func_72966_v() {
@@ -1509,6 +1623,7 @@ @@ -1509,6 +1624,7 @@
public void func_72891_a(boolean p_72891_1_, boolean p_72891_2_) { public void func_72891_a(boolean p_72891_1_, boolean p_72891_2_) {
this.field_72985_G = p_72891_1_; this.field_72985_G = p_72891_1_;
this.field_72992_H = p_72891_2_; this.field_72992_H = p_72891_2_;
@ -625,7 +627,7 @@
} }
public void func_72835_b() { public void func_72835_b() {
@@ -1516,6 +1631,10 @@ @@ -1516,6 +1632,10 @@
} }
protected void func_72947_a() { protected void func_72947_a() {
@ -636,7 +638,7 @@
if (this.field_72986_A.func_76059_o()) { if (this.field_72986_A.func_76059_o()) {
this.field_73004_o = 1.0F; this.field_73004_o = 1.0F;
if (this.field_72986_A.func_76061_m()) { if (this.field_72986_A.func_76061_m()) {
@@ -1530,6 +1649,10 @@ @@ -1530,6 +1650,10 @@
} }
protected void func_72979_l() { protected void func_72979_l() {
@ -647,7 +649,7 @@
if (this.field_73011_w.func_191066_m()) { if (this.field_73011_w.func_191066_m()) {
if (!this.field_72995_K) { if (!this.field_72995_K) {
boolean flag = this.func_82736_K().func_82766_b("doWeatherCycle"); boolean flag = this.func_82736_K().func_82766_b("doWeatherCycle");
@@ -1616,9 +1739,9 @@ @@ -1616,9 +1740,9 @@
return 15; return 15;
} else { } else {
IBlockState iblockstate = this.func_180495_p(p_175638_1_); IBlockState iblockstate = this.func_180495_p(p_175638_1_);
@ -659,7 +661,7 @@
j = 1; j = 1;
} }
@@ -1627,7 +1750,7 @@ @@ -1627,7 +1751,7 @@
} }
if (j >= 15) { if (j >= 15) {
@ -668,7 +670,7 @@
} else if (i >= 14) { } else if (i >= 14) {
return i; return i;
} else { } else {
@@ -1652,11 +1775,12 @@ @@ -1652,11 +1776,12 @@
} }
public boolean func_180500_c(EnumLightType p_180500_1_, BlockPos p_180500_2_) { public boolean func_180500_c(EnumLightType p_180500_1_, BlockPos p_180500_2_) {
@ -682,7 +684,7 @@
this.field_72984_F.func_76320_a("getBrightness"); this.field_72984_F.func_76320_a("getBrightness");
int k = this.func_175642_b(p_180500_1_, p_180500_2_); int k = this.func_175642_b(p_180500_1_, p_180500_2_);
int l = this.func_175638_a(p_180500_2_, p_180500_1_); int l = this.func_175638_a(p_180500_2_, p_180500_1_);
@@ -1682,7 +1806,7 @@ @@ -1682,7 +1807,7 @@
int j3 = MathHelper.func_76130_a(i2 - i1); int j3 = MathHelper.func_76130_a(i2 - i1);
int k3 = MathHelper.func_76130_a(j2 - j1); int k3 = MathHelper.func_76130_a(j2 - j1);
int l3 = MathHelper.func_76130_a(k2 - k1); int l3 = MathHelper.func_76130_a(k2 - k1);
@ -691,7 +693,7 @@
try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.func_185346_s()) { try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.func_185346_s()) {
for(EnumFacing enumfacing : field_200007_a) { for(EnumFacing enumfacing : field_200007_a) {
int i4 = i2 + enumfacing.func_82601_c(); int i4 = i2 + enumfacing.func_82601_c();
@@ -1722,7 +1846,7 @@ @@ -1722,7 +1847,7 @@
int l6 = Math.abs(k5 - j1); int l6 = Math.abs(k5 - j1);
int i7 = Math.abs(l5 - k1); int i7 = Math.abs(l5 - k1);
boolean flag = j < this.field_72994_J.length - 6; boolean flag = j < this.field_72994_J.length - 6;
@ -700,7 +702,7 @@
if (this.func_175642_b(p_180500_1_, blockpos1.func_177976_e()) < j6) { if (this.func_175642_b(p_180500_1_, blockpos1.func_177976_e()) < j6) {
this.field_72994_J[j++] = j5 - 1 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 - k1 + 32 << 12); this.field_72994_J[j++] = j5 - 1 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 - k1 + 32 << 12);
} }
@@ -1762,10 +1886,10 @@ @@ -1762,10 +1887,10 @@
public List<Entity> func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate<? super Entity> p_175674_3_) { public List<Entity> func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate<? super Entity> p_175674_3_) {
List<Entity> list = Lists.<Entity>newArrayList(); List<Entity> list = Lists.<Entity>newArrayList();
@ -715,7 +717,7 @@
for(int i1 = i; i1 <= j; ++i1) { for(int i1 = i; i1 <= j; ++i1) {
for(int j1 = k; j1 <= l; ++j1) { for(int j1 = k; j1 <= l; ++j1) {
@@ -1807,10 +1931,10 @@ @@ -1807,10 +1932,10 @@
} }
public <T extends Entity> List<T> func_175647_a(Class<? extends T> p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate<? super T> p_175647_3_) { public <T extends Entity> List<T> func_175647_a(Class<? extends T> p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate<? super T> p_175647_3_) {
@ -730,7 +732,7 @@
List<T> list = Lists.<T>newArrayList(); List<T> list = Lists.<T>newArrayList();
for(int i1 = i; i1 < j; ++i1) { for(int i1 = i; i1 < j; ++i1) {
@@ -1874,10 +1998,12 @@ @@ -1874,10 +1999,12 @@
} }
public void func_175650_b(Collection<Entity> p_175650_1_) { public void func_175650_b(Collection<Entity> p_175650_1_) {
@ -744,7 +746,7 @@
} }
} }
@@ -1943,7 +2069,7 @@ @@ -1943,7 +2070,7 @@
public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_) { public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_) {
IBlockState iblockstate = this.func_180495_p(p_175651_1_); IBlockState iblockstate = this.func_180495_p(p_175651_1_);
@ -753,7 +755,7 @@
} }
public boolean func_175640_z(BlockPos p_175640_1_) { public boolean func_175640_z(BlockPos p_175640_1_) {
@@ -2049,6 +2175,8 @@ @@ -2049,6 +2176,8 @@
d2 *= MoreObjects.firstNonNull(p_184150_11_.apply(entityplayer1), 1.0D); d2 *= MoreObjects.firstNonNull(p_184150_11_.apply(entityplayer1), 1.0D);
} }
@ -762,7 +764,7 @@
if ((p_184150_9_ < 0.0D || Math.abs(entityplayer1.field_70163_u - p_184150_3_) < p_184150_9_ * p_184150_9_) && (p_184150_7_ < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0)) { if ((p_184150_9_ < 0.0D || Math.abs(entityplayer1.field_70163_u - p_184150_3_) < p_184150_9_ * p_184150_9_) && (p_184150_7_ < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0)) {
d0 = d1; d0 = d1;
entityplayer = entityplayer1; entityplayer = entityplayer1;
@@ -2097,7 +2225,7 @@ @@ -2097,7 +2226,7 @@
} }
public long func_72905_C() { public long func_72905_C() {
@ -771,7 +773,7 @@
} }
public long func_82737_E() { public long func_82737_E() {
@@ -2105,15 +2233,15 @@ @@ -2105,15 +2234,15 @@
} }
public long func_72820_D() { public long func_72820_D() {
@ -790,7 +792,7 @@
if (!this.func_175723_af().func_177746_a(blockpos)) { if (!this.func_175723_af().func_177746_a(blockpos)) {
blockpos = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, new BlockPos(this.func_175723_af().func_177731_f(), 0.0D, this.func_175723_af().func_177721_g())); blockpos = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, new BlockPos(this.func_175723_af().func_177731_f(), 0.0D, this.func_175723_af().func_177721_g()));
} }
@@ -2122,7 +2250,7 @@ @@ -2122,7 +2251,7 @@
} }
public void func_175652_B(BlockPos p_175652_1_) { public void func_175652_B(BlockPos p_175652_1_) {
@ -799,7 +801,7 @@
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@@ -2138,12 +2266,17 @@ @@ -2138,12 +2267,17 @@
} }
if (!this.field_72996_f.contains(p_72897_1_)) { if (!this.field_72996_f.contains(p_72897_1_)) {
@ -817,7 +819,7 @@
return true; return true;
} }
@@ -2218,8 +2351,7 @@ @@ -2218,8 +2352,7 @@
} }
public boolean func_180502_D(BlockPos p_180502_1_) { public boolean func_180502_D(BlockPos p_180502_1_) {
@ -827,7 +829,7 @@
} }
@Nullable @Nullable
@@ -2269,16 +2401,15 @@ @@ -2269,16 +2402,15 @@
} }
public int func_72800_K() { public int func_72800_K() {
@ -847,7 +849,7 @@
} }
public CrashReportCategory func_72914_a(CrashReport p_72914_1_) { public CrashReportCategory func_72914_a(CrashReport p_72914_1_) {
@@ -2315,16 +2446,16 @@ @@ -2315,16 +2447,16 @@
public abstract Scoreboard func_96441_U(); public abstract Scoreboard func_96441_U();
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) { public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) {
@ -869,7 +871,7 @@
iblockstate.func_189546_a(this, blockpos, p_175666_2_, p_175666_1_); iblockstate.func_189546_a(this, blockpos, p_175666_2_, p_175666_1_);
} }
} }
@@ -2397,4 +2528,30 @@ @@ -2397,4 +2529,30 @@
public abstract RecipeManager func_199532_z(); public abstract RecipeManager func_199532_z();
public abstract NetworkTagManager func_205772_D(); public abstract NetworkTagManager func_205772_D();

View file

@ -5,11 +5,19 @@
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
-public class Chunk implements IChunk { -public class Chunk implements IChunk {
+public class Chunk extends net.minecraftforge.common.capabilities.CapabilityProvider implements IChunk, net.minecraftforge.common.extensions.IForgeChunk { +public class Chunk extends net.minecraftforge.common.capabilities.CapabilityProvider<Chunk> implements IChunk, net.minecraftforge.common.extensions.IForgeChunk {
private static final Logger field_150817_t = LogManager.getLogger(); private static final Logger field_150817_t = LogManager.getLogger();
public static final ChunkSection field_186036_a = null; public static final ChunkSection field_186036_a = null;
private final ChunkSection[] field_76652_q; private final ChunkSection[] field_76652_q;
@@ -125,6 +125,7 @@ @@ -93,6 +93,7 @@
}
public Chunk(World p_i49379_1_, int p_i49379_2_, int p_i49379_3_, Biome[] p_i49379_4_, UpgradeData p_i49379_5_, ITickList<Block> p_i49379_6_, ITickList<Fluid> p_i49379_7_, long p_i49379_8_) {
+ super(Chunk.class);
this.field_76652_q = new ChunkSection[16];
this.field_76639_c = new boolean[256];
this.field_201618_i = Maps.<BlockPos, NBTTagCompound>newHashMap();
@@ -125,6 +126,7 @@
this.field_201621_s = p_i49379_6_; this.field_201621_s = p_i49379_6_;
this.field_205325_u = p_i49379_7_; this.field_205325_u = p_i49379_7_;
this.field_111204_q = p_i49379_8_; this.field_111204_q = p_i49379_8_;
@ -17,7 +25,7 @@
} }
public Chunk(World p_i48703_1_, ChunkPrimer p_i48703_2_, int p_i48703_3_, int p_i48703_4_) { public Chunk(World p_i48703_1_, ChunkPrimer p_i48703_2_, int p_i48703_3_, int p_i48703_4_) {
@@ -593,6 +594,7 @@ @@ -593,6 +595,7 @@
p_76612_1_.field_70162_ai = k; p_76612_1_.field_70162_ai = k;
p_76612_1_.field_70164_aj = this.field_76647_h; p_76612_1_.field_70164_aj = this.field_76647_h;
this.field_76645_j[k].add(p_76612_1_); this.field_76645_j[k].add(p_76612_1_);
@ -25,7 +33,7 @@
} }
public void func_201607_a(Heightmap.Type p_201607_1_, long[] p_201607_2_) { public void func_201607_a(Heightmap.Type p_201607_1_, long[] p_201607_2_) {
@@ -613,6 +615,7 @@ @@ -613,6 +616,7 @@
} }
this.field_76645_j[p_76608_2_].remove(p_76608_1_); this.field_76645_j[p_76608_2_].remove(p_76608_1_);
@ -33,7 +41,7 @@
} }
public boolean func_177444_d(BlockPos p_177444_1_) { public boolean func_177444_d(BlockPos p_177444_1_) {
@@ -1164,4 +1167,30 @@ @@ -1164,4 +1168,30 @@
QUEUED, QUEUED,
CHECK; CHECK;
} }

View file

@ -30,15 +30,21 @@ import net.minecraftforge.event.ForgeEventFactory;
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
public abstract class CapabilityProvider implements ICapabilityProvider public abstract class CapabilityProvider<B extends CapabilityProvider<B>> implements ICapabilityProvider
{ {
private final @Nonnull Class<B> baseClass;
private @Nullable CapabilityDispatcher capabilities; private @Nullable CapabilityDispatcher capabilities;
protected CapabilityProvider(Class<B> baseClass)
{
this.baseClass = baseClass;
}
protected final void gatherCapabilities() { gatherCapabilities(null); } protected final void gatherCapabilities() { gatherCapabilities(null); }
protected final void gatherCapabilities(@Nullable ICapabilityProvider parent) protected final void gatherCapabilities(@Nullable ICapabilityProvider parent)
{ {
this.capabilities = ForgeEventFactory.gatherCapabilities(getClass(), this, parent); this.capabilities = ForgeEventFactory.gatherCapabilities(baseClass, this, parent);
} }
protected final @Nullable CapabilityDispatcher getCapabilities() protected final @Nullable CapabilityDispatcher getCapabilities()
@ -46,7 +52,7 @@ public abstract class CapabilityProvider implements ICapabilityProvider
return this.capabilities; return this.capabilities;
} }
public final boolean areCapsCompatible(CapabilityProvider other) public final boolean areCapsCompatible(CapabilityProvider<B> other)
{ {
return areCapsCompatible(other.getCapabilities()); return areCapsCompatible(other.getCapabilities());
} }