Final patching

Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
Anthony Anderson 2020-06-24 21:25:55 -04:00 committed by cpw
parent 80eb12e59d
commit ca2ed1ff7a
No known key found for this signature in database
GPG Key ID: 8EB3DF749553B1B7
139 changed files with 1034 additions and 4067 deletions

View File

@ -81,7 +81,7 @@
}
@OnlyIn(Dist.CLIENT)
@@ -419,6 +424,77 @@
@@ -419,6 +424,83 @@
return this;
}
@ -121,25 +121,31 @@
+ if (plantable instanceof BushBlock && ((BushBlock)plantable).func_200014_a_(state, world, pos))
+ return true;
+
+ switch (type) {
+ case Desert: return this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_150405_ch || this.getBlock() instanceof GlazedTerracottaBlock;
+ case Nether: return this.getBlock() == Blocks.field_150425_aM;
+ case Crop: return state.func_203425_a(Blocks.field_150458_ak);
+ case Cave: return Block.func_220056_d(state, world, pos, Direction.UP);
+ case Plains: return this.getBlock() == Blocks.field_196658_i || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || this.getBlock() == Blocks.field_150458_ak;
+ case Water: return state.func_185904_a() == net.minecraft.block.material.Material.field_151586_h; //&& state.getValue(BlockLiquidWrapper)
+ case Beach:
+ boolean isBeach = state.func_203425_a(Blocks.field_196658_i) || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || state.func_203425_a(Blocks.field_150354_m) || state.func_203425_a(Blocks.field_196611_F);
+ boolean hasWater = false;
+ for (Direction face : Direction.Plane.HORIZONTAL) {
+ BlockState blockState = world.func_180495_p(pos.func_177972_a(face));
+ net.minecraft.fluid.FluidState fluidState = world.func_204610_c(pos.func_177972_a(face));
+ hasWater |= blockState.func_203425_a(Blocks.field_185778_de);
+ hasWater |= fluidState.func_206884_a(net.minecraft.tags.FluidTags.field_206959_a);
+ if(hasWater) break; //No point continuing.
+ }
+ return isBeach && hasWater;
+ if (net.minecraftforge.common.PlantType.DESERT.equals(type)) {
+ return this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_150405_ch || this.getBlock() instanceof GlazedTerracottaBlock;
+ } else if (net.minecraftforge.common.PlantType.NETHER.equals(type)) {
+ return this.getBlock() == Blocks.field_150425_aM;
+ } else if (net.minecraftforge.common.PlantType.CROP.equals(type)) {
+ return state.func_203425_a(Blocks.field_150458_ak);
+ } else if (net.minecraftforge.common.PlantType.CAVE.equals(type)) {
+ return Block.func_220056_d(state, world, pos, Direction.UP);
+ } else if (net.minecraftforge.common.PlantType.PLAINS.equals(type)) {
+ return this.getBlock() == Blocks.field_196658_i || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || this.getBlock() == Blocks.field_150458_ak;
+ } else if (net.minecraftforge.common.PlantType.WATER.equals(type)) {
+ return state.func_185904_a() == net.minecraft.block.material.Material.field_151586_h; //&& state.getValue(BlockLiquidWrapper)
+ } else if (net.minecraftforge.common.PlantType.BEACH.equals(type)) {
+ boolean isBeach = state.func_203425_a(Blocks.field_196658_i) || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || state.func_203425_a(Blocks.field_150354_m) || state.func_203425_a(Blocks.field_196611_F);
+ boolean hasWater = false;
+ for (Direction face : Direction.Plane.HORIZONTAL) {
+ BlockState blockState = world.func_180495_p(pos.func_177972_a(face));
+ net.minecraft.fluid.FluidState fluidState = world.func_204610_c(pos.func_177972_a(face));
+ hasWater |= blockState.func_203425_a(Blocks.field_185778_de);
+ hasWater |= fluidState.func_206884_a(net.minecraft.tags.FluidTags.field_206959_a);
+ if (hasWater)
+ break; //No point continuing.
+ }
+ return isBeach && hasWater;
+ }
+ return false;
+ }
+

View File

@ -51,7 +51,7 @@
+
+ @Override
+ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) {
+ return net.minecraftforge.common.PlantType.Desert;
+ return net.minecraftforge.common.PlantType.DESERT;
+ }
+
+ @Override

View File

@ -5,7 +5,7 @@
import net.minecraft.world.IBlockReader;
-public class DeadBushBlock extends BushBlock {
+public class DeadBushBlock extends BushBlock implements net.minecraftforge.common.IShearable {
+public class DeadBushBlock extends BushBlock implements net.minecraftforge.common.IForgeShearable {
protected static final VoxelShape field_196397_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
protected DeadBushBlock(AbstractBlock.Properties p_i48418_1_) {

View File

@ -5,7 +5,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
-public class LeavesBlock extends Block {
+public class LeavesBlock extends Block implements net.minecraftforge.common.IShearable {
+public class LeavesBlock extends Block implements net.minecraftforge.common.IForgeShearable {
public static final IntegerProperty field_208494_a = BlockStateProperties.field_208514_aa;
public static final BooleanProperty field_208495_b = BlockStateProperties.field_208515_s;

View File

@ -5,7 +5,7 @@
import net.minecraft.world.server.ServerWorld;
-public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer {
+public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer, net.minecraftforge.common.IShearable {
+public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer, net.minecraftforge.common.IForgeShearable {
protected static final VoxelShape field_207798_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
protected SeaGrassBlock(AbstractBlock.Properties p_i48780_1_) {

View File

@ -37,6 +37,6 @@
+ //FORGE START
+ @Override
+ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) {
+ return net.minecraftforge.common.PlantType.Crop;
+ return net.minecraftforge.common.PlantType.CROP;
+ }
}

View File

@ -40,7 +40,7 @@
+
+ @Override
+ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) {
+ return net.minecraftforge.common.PlantType.Beach;
+ return net.minecraftforge.common.PlantType.BEACH;
+ }
+
+ @Override

View File

@ -5,7 +5,7 @@
import net.minecraft.world.server.ServerWorld;
-public class TallGrassBlock extends BushBlock implements IGrowable {
+public class TallGrassBlock extends BushBlock implements IGrowable, net.minecraftforge.common.IShearable {
+public class TallGrassBlock extends BushBlock implements IGrowable, net.minecraftforge.common.IForgeShearable {
protected static final VoxelShape field_196389_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
protected TallGrassBlock(AbstractBlock.Properties p_i48310_1_) {

View File

@ -5,7 +5,7 @@
import net.minecraft.world.server.ServerWorld;
-public class VineBlock extends Block {
+public class VineBlock extends Block implements net.minecraftforge.common.IShearable {
+public class VineBlock extends Block implements net.minecraftforge.common.IForgeShearable {
public static final BooleanProperty field_176277_a = SixWayBlock.field_196496_z;
public static final BooleanProperty field_176273_b = SixWayBlock.field_196488_a;
public static final BooleanProperty field_176278_M = SixWayBlock.field_196490_b;

View File

@ -5,7 +5,7 @@
import net.minecraft.world.World;
-public class WebBlock extends Block {
+public class WebBlock extends Block implements net.minecraftforge.common.IShearable {
+public class WebBlock extends Block implements net.minecraftforge.common.IForgeShearable {
public WebBlock(AbstractBlock.Properties p_i48296_1_) {
super(p_i48296_1_);
}

View File

@ -20,7 +20,24 @@
}
boolean flag = inestedguieventhandler == null || !(inestedguieventhandler.func_241217_q_() instanceof TextFieldWidget) || !((TextFieldWidget)inestedguieventhandler.func_241217_q_()).func_212955_f();
@@ -350,7 +354,7 @@
@@ -294,10 +298,14 @@
Screen.func_231153_a_(() -> {
if (p_197961_5_ != 1 && (p_197961_5_ != 2 || !this.field_197973_b)) {
if (p_197961_5_ == 0) {
- aboolean[0] = inestedguieventhandler.func_223281_a_(p_197961_3_, p_197961_4_, p_197961_6_);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_);
+ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.func_223281_a_(p_197961_3_, p_197961_4_, p_197961_6_);
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_);
}
} else {
- aboolean[0] = inestedguieventhandler.func_231046_a_(p_197961_3_, p_197961_4_, p_197961_6_);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_);
+ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.func_231046_a_(p_197961_3_, p_197961_4_, p_197961_6_);
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_);
}
}, "keyPressed event handler", inestedguieventhandler.getClass().getCanonicalName());
@@ -350,7 +358,7 @@
}
}
}
@ -29,3 +46,22 @@
}
}
@@ -360,12 +368,16 @@
if (iguieventlistener != null && this.field_197972_a.func_213250_au() == null) {
if (Character.charCount(p_197963_3_) == 1) {
Screen.func_231153_a_(() -> {
- iguieventlistener.func_231042_a_((char)p_197963_3_, p_197963_4_);
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_)) return;
+ if (iguieventlistener.func_231042_a_((char)p_197963_3_, p_197963_4_)) return;
+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_);
}, "charTyped event handler", iguieventlistener.getClass().getCanonicalName());
} else {
for(char c0 : Character.toChars(p_197963_3_)) {
Screen.func_231153_a_(() -> {
- iguieventlistener.func_231042_a_(c0, p_197963_4_);
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, c0, p_197963_4_)) return;
+ if (iguieventlistener.func_231042_a_(c0, p_197963_4_)) return;
+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.field_197972_a.field_71462_r, c0, p_197963_4_);
}, "charTyped event handler", iguieventlistener.getClass().getCanonicalName());
}
}

View File

@ -8,7 +8,25 @@
boolean[] aboolean = new boolean[]{false};
if (this.field_198036_a.field_213279_p == null) {
if (this.field_198036_a.field_71462_r == null) {
@@ -110,7 +111,7 @@
@@ -82,11 +83,15 @@
double d1 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n();
if (flag) {
Screen.func_231153_a_(() -> {
- aboolean[0] = this.field_198036_a.field_71462_r.func_231044_a_(d0, d1, i);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPre(this.field_198036_a.field_71462_r, d0, d1, i);
+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.func_231044_a_(d0, d1, i);
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.field_198036_a.field_71462_r, d0, d1, i);
}, "mouseClicked event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName());
} else {
Screen.func_231153_a_(() -> {
- aboolean[0] = this.field_198036_a.field_71462_r.func_231048_c_(d0, d1, i);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(this.field_198036_a.field_71462_r, d0, d1, i);
+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.func_231048_c_(d0, d1, i);
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.field_198036_a.field_71462_r, d0, d1, i);
}, "mouseReleased event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName());
}
}
@@ -110,7 +115,7 @@
}
}
}
@ -17,7 +35,18 @@
}
}
@@ -134,6 +135,7 @@
@@ -121,7 +126,9 @@
if (this.field_198036_a.field_71462_r != null) {
double d1 = this.field_198040_e * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m();
double d2 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n();
- this.field_198036_a.field_71462_r.func_231043_a_(d1, d2, d0);
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPre(this, this.field_198036_a.field_71462_r, d0)) return;
+ if (this.field_198036_a.field_71462_r.func_231043_a_(d1, d2, d0)) return;
+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPost(this, this.field_198036_a.field_71462_r, d0);
} else if (this.field_198036_a.field_71439_g != null) {
if (this.field_200542_o != 0.0D && Math.signum(d0) != Math.signum(this.field_200542_o)) {
this.field_200542_o = 0.0D;
@@ -134,6 +141,7 @@
}
this.field_200542_o -= (double)f1;
@ -25,7 +54,18 @@
if (this.field_198036_a.field_71439_g.func_175149_v()) {
if (this.field_198036_a.field_71456_v.func_175187_g().func_175262_a()) {
this.field_198036_a.field_71456_v.func_175187_g().func_195621_a((double)(-f1));
@@ -267,6 +269,10 @@
@@ -202,7 +210,9 @@
double d2 = (p_198022_3_ - this.field_198040_e) * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m();
double d3 = (p_198022_5_ - this.field_198041_f) * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n();
Screen.func_231153_a_(() -> {
- iguieventlistener.func_231045_a_(d0, d1, this.field_198042_g, d2, d3);
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPre(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3)) return;
+ if (iguieventlistener.func_231045_a_(d0, d1, this.field_198042_g, d2, d3)) return;
+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPost(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3);
}, "mouseDragged event handler", iguieventlistener.getClass().getCanonicalName());
}
}
@@ -267,6 +277,10 @@
return this.field_198039_d;
}
@ -36,7 +76,7 @@
public double func_198024_e() {
return this.field_198040_e;
}
@@ -275,6 +281,14 @@
@@ -275,6 +289,14 @@
return this.field_198041_f;
}

View File

@ -1,63 +1,64 @@
--- a/net/minecraft/client/renderer/FluidBlockRenderer.java
+++ b/net/minecraft/client/renderer/FluidBlockRenderer.java
@@ -57,8 +57,9 @@
@@ -70,9 +70,10 @@
public boolean func_228796_a_(ILightReader p_228796_1_, BlockPos p_228796_2_, IVertexBuilder p_228796_3_, IFluidState p_228796_4_) {
public boolean func_228796_a_(IBlockDisplayReader p_228796_1_, BlockPos p_228796_2_, IVertexBuilder p_228796_3_, FluidState p_228796_4_) {
boolean flag = p_228796_4_.func_206884_a(FluidTags.field_206960_b);
- TextureAtlasSprite[] atextureatlassprite = flag ? this.field_178272_a : this.field_178271_b;
- int i = flag ? 16777215 : BiomeColors.func_228363_c_(p_228796_1_, p_228796_2_);
+ TextureAtlasSprite[] atextureatlassprite = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_228796_1_, p_228796_2_, p_228796_4_);
BlockState blockstate = p_228796_1_.func_180495_p(p_228796_2_);
- int i = flag ? 16777215 : BiomeColors.func_228363_c_(p_228796_1_, p_228796_2_);
+ int i = p_228796_4_.func_206886_c().getAttributes().getColor(p_228796_1_, p_228796_2_);
+ float alpha = (float)(i >> 24 & 255) / 255.0F;
float f = (float)(i >> 16 & 255) / 255.0F;
float f1 = (float)(i >> 8 & 255) / 255.0F;
float f2 = (float)(i & 255) / 255.0F;
@@ -143,15 +144,15 @@
float f25 = 1.0F * f;
float f26 = 1.0F * f1;
float f27 = 1.0F * f2;
@@ -157,15 +158,15 @@
float f25 = f4 * f;
float f26 = f4 * f1;
float f27 = f4 * f2;
- this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, f13, f17, j);
- this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, f14, f18, j);
- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, f15, f19, j);
- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, f16, f20, j);
+ this.vertex(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, alpha, f13, f17, j);
+ this.vertex(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, alpha, f14, f18, j);
+ this.vertex(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, alpha, f15, f19, j);
+ this.vertex(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, alpha, f16, f20, j);
+ this.vertexVanilla(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, alpha, f13, f17, j);
+ this.vertexVanilla(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, alpha, f14, f18, j);
+ this.vertexVanilla(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, alpha, f15, f19, j);
+ this.vertexVanilla(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, alpha, f16, f20, j);
if (p_228796_4_.func_205586_a(p_228796_1_, p_228796_2_.func_177984_a())) {
- this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, f13, f17, j);
- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, f16, f20, j);
- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, f15, f19, j);
- this.func_228797_a_(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, f14, f18, j);
+ this.vertex(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, alpha, f13, f17, j);
+ this.vertex(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, alpha, f16, f20, j);
+ this.vertex(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, alpha, f15, f19, j);
+ this.vertex(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, alpha, f14, f18, j);
+ this.vertexVanilla(p_228796_3_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, alpha, f13, f17, j);
+ this.vertexVanilla(p_228796_3_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, alpha, f16, f20, j);
+ this.vertexVanilla(p_228796_3_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, alpha, f15, f19, j);
+ this.vertexVanilla(p_228796_3_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, alpha, f14, f18, j);
}
}
@@ -164,10 +165,10 @@
float f40 = 0.5F * f;
float f41 = 0.5F * f1;
float f42 = 0.5F * f2;
@@ -178,10 +179,10 @@
float f40 = f3 * f;
float f41 = f3 * f1;
float f42 = f3 * f2;
- this.func_228797_a_(p_228796_3_, d0, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, f34, f39, i1);
- this.func_228797_a_(p_228796_3_, d0, d1 + (double)f12, d2, f40, f41, f42, f34, f37, i1);
- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2, f40, f41, f42, f35, f37, i1);
- this.func_228797_a_(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, f35, f39, i1);
+ this.vertex(p_228796_3_, d0, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, alpha, f34, f39, i1);
+ this.vertex(p_228796_3_, d0, d1 + (double)f12, d2, f40, f41, f42, alpha, f34, f37, i1);
+ this.vertex(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2, f40, f41, f42, alpha, f35, f37, i1);
+ this.vertex(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, alpha, f35, f39, i1);
+ this.vertexVanilla(p_228796_3_, d0, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, alpha, f34, f39, i1);
+ this.vertexVanilla(p_228796_3_, d0, d1 + (double)f12, d2, f40, f41, f42, alpha, f34, f37, i1);
+ this.vertexVanilla(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2, f40, f41, f42, alpha, f35, f37, i1);
+ this.vertexVanilla(p_228796_3_, d0 + 1.0D, d1 + (double)f12, d2 + 1.0D, f40, f41, f42, alpha, f35, f39, i1);
flag7 = true;
}
@@ -222,10 +223,9 @@
@@ -236,10 +237,9 @@
flag7 = true;
BlockPos blockpos = p_228796_2_.func_177972_a(direction);
TextureAtlasSprite textureatlassprite2 = atextureatlassprite[1];
- if (!flag) {
- Block block = p_228796_1_.func_180495_p(blockpos).func_177230_c();
- if (block == Blocks.field_150359_w || block instanceof StainedGlassBlock) {
- if (block instanceof BreakableBlock || block instanceof LeavesBlock) {
- textureatlassprite2 = this.field_187501_d;
+ if (atextureatlassprite[2] != null) {
+ if (p_228796_1_.func_180495_p(blockpos).shouldDisplayFluidOverlay(p_228796_1_, blockpos, p_228796_4_)) {
@ -65,10 +66,10 @@
}
}
@@ -239,15 +239,15 @@
float f31 = 1.0F * f30 * f;
float f32 = 1.0F * f30 * f1;
float f33 = 1.0F * f30 * f2;
@@ -253,15 +253,15 @@
float f31 = f4 * f30 * f;
float f32 = f4 * f30 * f1;
float f33 = f4 * f30 * f2;
- this.func_228797_a_(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, f48, f50, k);
- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, f49, f28, k);
- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, f49, f29, k);
@ -78,32 +79,30 @@
- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, f49, f29, k);
- this.func_228797_a_(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, f49, f28, k);
- this.func_228797_a_(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, f48, f50, k);
+ this.vertex(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, alpha, f48, f50, k);
+ this.vertex(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, alpha, f49, f28, k);
+ this.vertex(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, alpha, f49, f29, k);
+ this.vertex(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, alpha, f48, f29, k);
+ this.vertexVanilla(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, alpha, f48, f50, k);
+ this.vertexVanilla(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, alpha, f49, f28, k);
+ this.vertexVanilla(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, alpha, f49, f29, k);
+ this.vertexVanilla(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, alpha, f48, f29, k);
+ if (textureatlassprite2 != atextureatlassprite[2]) {
+ this.vertex(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, alpha, f48, f29, k);
+ this.vertex(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, alpha, f49, f29, k);
+ this.vertex(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, alpha, f49, f28, k);
+ this.vertex(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, alpha, f48, f50, k);
+ this.vertexVanilla(p_228796_3_, d3, d1 + (double)f12, d4, f31, f32, f33, alpha, f48, f29, k);
+ this.vertexVanilla(p_228796_3_, d5, d1 + (double)f12, d6, f31, f32, f33, alpha, f49, f29, k);
+ this.vertexVanilla(p_228796_3_, d5, d1 + (double)f38, d6, f31, f32, f33, alpha, f49, f28, k);
+ this.vertexVanilla(p_228796_3_, d3, d1 + (double)f36, d4, f31, f32, f33, alpha, f48, f50, k);
}
}
}
@@ -256,10 +256,15 @@
@@ -270,9 +270,13 @@
}
}
+ @Deprecated
private void func_228797_a_(IVertexBuilder p_228797_1_, double p_228797_2_, double p_228797_4_, double p_228797_6_, float p_228797_8_, float p_228797_9_, float p_228797_10_, float p_228797_11_, float p_228797_12_, int p_228797_13_) {
- p_228797_1_.func_225582_a_(p_228797_2_, p_228797_4_, p_228797_6_).func_227885_a_(p_228797_8_, p_228797_9_, p_228797_10_, 1.0F).func_225583_a_(p_228797_11_, p_228797_12_).func_227886_a_(p_228797_13_).func_225584_a_(0.0F, 1.0F, 0.0F).func_181675_d();
+ vertex(p_228797_1_, p_228797_2_, p_228797_4_, p_228797_6_, p_228797_8_, p_228797_9_, p_228797_10_, 1.0F, p_228797_11_, p_228797_12_, p_228797_13_);
+ vertexVanilla(p_228797_1_, p_228797_2_, p_228797_4_, p_228797_6_, p_228797_8_, p_228797_9_, p_228797_10_, 1.0F, p_228797_11_, p_228797_12_, p_228797_13_);
}
+ private void vertex(IVertexBuilder p_228797_1_, double p_228797_2_, double p_228797_4_, double p_228797_6_, float p_228797_8_, float p_228797_9_, float p_228797_10_, float alpha, float p_228797_11_, float p_228797_12_, int p_228797_13_) {
+ p_228797_1_.func_225582_a_(p_228797_2_, p_228797_4_, p_228797_6_).func_227885_a_(p_228797_8_, p_228797_9_, p_228797_10_, alpha).func_225583_a_(p_228797_11_, p_228797_12_).func_227886_a_(p_228797_13_).func_225584_a_(0.0F, 1.0F, 0.0F).func_181675_d();
+ private void vertexVanilla(IVertexBuilder vertexBuilderIn, double x, double y, double z, float red, float green, float blue, float alpha, float u, float v, int packedLight) {
+ vertexBuilderIn.func_225582_a_(x, y, z).func_227885_a_(red, green, blue, alpha).func_225583_a_(u, v).func_227886_a_(packedLight).func_225584_a_(0.0F, 1.0F, 0.0F).func_181675_d();
+ }
+
private int func_228795_a_(ILightReader p_228795_1_, BlockPos p_228795_2_) {
private int func_228795_a_(IBlockDisplayReader p_228795_1_, BlockPos p_228795_2_) {
int i = WorldRenderer.func_228421_a_(p_228795_1_, p_228795_2_);
int j = WorldRenderer.func_228421_a_(p_228795_1_, p_228795_2_.func_177984_a());

View File

@ -94,12 +94,13 @@
return this.field_74512_d.equals(p_197983_1_.field_74512_d);
}
@@ -156,11 +176,12 @@
@@ -156,11 +176,13 @@
}
public ITextComponent func_238171_j_() {
+ //TODO eturn getKeyModifier().getLocalizedComboName needs to go here
+ return getKeyModifier().getCombinedName(field_74512_d, () -> {
return this.field_74512_d.func_237520_d_();
+ });
}
public boolean func_197985_l() {
@ -108,7 +109,7 @@
}
public String func_197982_m() {
@@ -170,4 +191,84 @@
@@ -170,4 +192,84 @@
public void func_225593_a_(boolean p_225593_1_) {
this.field_74513_e = p_225593_1_;
}

View File

@ -1,10 +1,33 @@
--- a/net/minecraft/client/shader/Framebuffer.java
+++ b/net/minecraft/client/shader/Framebuffer.java
@@ -280,4 +280,26 @@
@@ -118,7 +118,10 @@
GlStateManager.func_227677_b_(3553, 10242, 10496);
GlStateManager.func_227677_b_(3553, 10243, 10496);
GlStateManager.func_227677_b_(3553, 34892, 0);
+ if (!stencilEnabled)
GlStateManager.func_227647_a_(3553, 0, 6402, this.field_147622_a, this.field_147620_b, 0, 6402, 5126, (IntBuffer)null);
+ else
+ GlStateManager.func_227647_a_(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.field_147622_a, this.field_147620_b, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null);
}
this.func_147607_a(9728);
@@ -127,7 +130,10 @@
GlStateManager.func_227727_h_(FramebufferConstants.field_227592_a_, this.field_147616_f);
GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, FramebufferConstants.field_227594_c_, 3553, this.field_147617_g, 0);
if (this.field_147619_e) {
+ if(!stencilEnabled)
GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, FramebufferConstants.field_227595_d_, 3553, this.field_147624_h, 0);
+ else
+ GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL_ATTACHMENT, 3553, this.field_147624_h, 0);
}
this.func_147611_b();
@@ -280,4 +286,30 @@
GlStateManager.func_227658_a_(i, p_216493_1_);
this.func_147609_e();
}
+
+
+ /*================================ FORGE START ================================================*/
+ private boolean stencilEnabled = false;
+ /**
@ -13,16 +36,19 @@
+ * This is to prevent the default cause where graphics cards do not support stencil bits.
+ * <b>Make sure to call this on the main render thread!</b>
+ */
+ public void enableStencil() {
+ public void enableStencil()
+ {
+ if(stencilEnabled) return;
+ stencilEnabled = true;
+ this.func_216491_a(field_147621_c, field_147618_d, net.minecraft.client.Minecraft.field_142025_a);
+ }
+ /**
+
+ /**
+ * Returns wither or not this FBO has been successfully initialized with stencil bits.
+ * If not, and a modder wishes it to be, they must call enableStencil.
+ */
+ public boolean isStencilEnabled() {
+ public boolean isStencilEnabled()
+ {
+ return this.stencilEnabled;
+ }
+ /*================================ FORGE END ================================================*/

View File

@ -0,0 +1,22 @@
--- a/net/minecraft/command/impl/LocateCommand.java
+++ b/net/minecraft/command/impl/LocateCommand.java
@@ -25,12 +25,19 @@
return p_198533_0_.func_197034_c(2);
});
+ if (false)
for(Entry<String, Structure<?>> entry : Structure.field_236365_a_.entrySet()) {
literalargumentbuilder = literalargumentbuilder.then(Commands.func_197057_a(entry.getKey()).executes((p_241056_1_) -> {
return func_241053_a_(p_241056_1_.getSource(), entry.getValue());
}));
}
+ for (Structure<?> structureFeature : net.minecraftforge.registries.ForgeRegistries.STRUCTURE_FEATURES) {
+ String name = structureFeature.getRegistryName().toString().replace("minecraft:", "");
+ literalargumentbuilder = literalargumentbuilder.then(Commands.func_197057_a(name))
+ .executes(ctx -> func_241053_a_(ctx.getSource(), structureFeature));
+ }
+
p_198528_0_.register(literalargumentbuilder);
}

View File

@ -1,6 +1,26 @@
--- a/net/minecraft/data/TagsProvider.java
+++ b/net/minecraft/data/TagsProvider.java
@@ -53,6 +53,7 @@
@@ -28,11 +28,17 @@
protected final DataGenerator field_200433_a;
protected final Registry<T> field_200435_c;
protected final Map<ResourceLocation, ITag.Builder> field_200434_b = Maps.newLinkedHashMap();
+ protected String modId;
+ @Deprecated//Forge, Use ModID version.
protected TagsProvider(DataGenerator p_i49827_1_, Registry<T> p_i49827_2_) {
- this.field_200433_a = p_i49827_1_;
- this.field_200435_c = p_i49827_2_;
+ this(p_i49827_1_, p_i49827_2_, "vanilla");
}
+ protected TagsProvider(DataGenerator generatorIn, Registry<T> registryIn, String modId) {
+ this.field_200433_a = generatorIn;
+ this.field_200435_c = registryIn;
+ this.modId = modId;
+ }
protected abstract void func_200432_c();
@@ -53,6 +59,7 @@
} else {
JsonObject jsonobject = p_240524_5_.func_232965_c_();
Path path = this.func_200431_a(p_240524_4_);
@ -8,7 +28,16 @@
try {
String s = field_200437_e.toJson((JsonElement)jsonobject);
@@ -87,7 +88,7 @@
@@ -78,7 +85,7 @@
protected TagsProvider.Builder<T> func_240522_a_(ITag.INamedTag<T> p_240522_1_) {
ITag.Builder itag$builder = this.func_240525_b_(p_240522_1_);
- return new TagsProvider.Builder<>(itag$builder, this.field_200435_c, "vanilla");
+ return new TagsProvider.Builder<>(itag$builder, this.field_200435_c, modId);
}
protected ITag.Builder func_240525_b_(ITag.INamedTag<T> p_240525_1_) {
@@ -87,7 +94,7 @@
});
}
@ -17,3 +46,22 @@
private final ITag.Builder field_240528_a_;
private final Registry<T> field_240529_b_;
private final String field_240530_c_;
@@ -115,5 +122,18 @@
});
return this;
}
+
+ public TagsProvider.Builder<T> add(ITag.ITagEntry tag) {
+ field_240528_a_.func_232955_a_(tag, field_240530_c_);
+ return this;
+ }
+
+ public ITag.Builder getInternalBuilder() {
+ return field_240528_a_;
+ }
+
+ public String getModID() {
+ return field_240530_c_;
+ }
}
}

View File

@ -42,15 +42,6 @@
}
@OnlyIn(Dist.CLIENT)
@@ -292,7 +297,7 @@
@OnlyIn(Dist.CLIENT)
protected void func_70065_x() {
if (this.field_70170_p != null) {
- for(double d0 = this.func_226278_cu_(); d0 > 0.0D && d0 < 256.0D; ++d0) {
+ for(double d0 = this.func_226278_cu_(); d0 > 0.0D && d0 < 256.0D/*TODO this.world.getDimension().getHeight()*/; ++d0) {
this.func_70107_b(this.func_226277_ct_(), d0, this.func_226281_cx_());
if (this.field_70170_p.func_226669_j_(this)) {
break;
@@ -305,7 +310,13 @@
}

View File

@ -0,0 +1,14 @@
--- a/net/minecraft/entity/IShearable.java
+++ b/net/minecraft/entity/IShearable.java
@@ -2,8 +2,11 @@
import net.minecraft.util.SoundCategory;
+@Deprecated // Forge: Use IForgeShearable
public interface IShearable {
+ @Deprecated // Forge: Use IForgeShearable
void func_230263_a_(SoundCategory p_230263_1_);
+ @Deprecated // Forge: Use IForgeShearable
boolean func_230262_K__();
}

View File

@ -144,6 +144,19 @@
if (!this.field_70128_L && !this.field_70729_aU) {
Entity entity = p_70645_1_.func_76346_g();
LivingEntity livingentity = this.func_94060_bK();
@@ -1194,10 +1210,10 @@
if (!this.field_70170_p.field_72995_K) {
boolean flag = false;
if (p_226298_1_ instanceof WitherEntity) {
- if (this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) {
+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) {
BlockPos blockpos = this.func_233580_cy_();
BlockState blockstate = Blocks.field_222388_bz.func_176223_P();
- if (this.field_70170_p.func_180495_p(blockpos).func_196958_f() && blockstate.func_196955_c(this.field_70170_p, blockpos)) {
+ if (this.field_70170_p.func_175623_d(blockpos) && blockstate.func_196955_c(this.field_70170_p, blockpos)) {
this.field_70170_p.func_180501_a(blockpos, blockstate, 3);
flag = true;
}
@@ -1214,13 +1230,10 @@
protected void func_213345_d(DamageSource p_213345_1_) {
@ -180,15 +193,7 @@
while(i > 0) {
int j = ExperienceOrbEntity.func_70527_a(i);
i -= j;
@@ -1245,6 +1263,7 @@
}
}
+
}
protected void func_213333_a(DamageSource p_213333_1_, int p_213333_2_, boolean p_213333_3_) {
@@ -1258,7 +1277,8 @@
@@ -1258,7 +1276,8 @@
ResourceLocation resourcelocation = this.func_213346_cF();
LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(resourcelocation);
LootContext.Builder lootcontext$builder = this.func_213363_a(p_213354_2_, p_213354_1_);
@ -198,7 +203,7 @@
}
protected LootContext.Builder func_213363_a(boolean p_213363_1_, DamageSource p_213363_2_) {
@@ -1271,6 +1291,12 @@
@@ -1271,6 +1290,12 @@
}
public void func_233627_a_(float p_233627_1_, double p_233627_2_, double p_233627_4_) {
@ -211,7 +216,25 @@
p_233627_1_ = (float)((double)p_233627_1_ * (1.0D - this.func_233637_b_(Attributes.field_233820_c_)));
if (!(p_233627_1_ <= 0.0F)) {
this.field_70160_al = true;
@@ -1353,6 +1379,11 @@
@@ -1320,16 +1345,7 @@
} else {
BlockPos blockpos = this.func_233580_cy_();
BlockState blockstate = this.func_213339_cH();
- Block block = blockstate.func_177230_c();
- if (block.func_203417_a(BlockTags.field_232878_as_)) {
- this.field_233624_bE_ = Optional.of(blockpos);
- return true;
- } else if (block instanceof TrapDoorBlock && this.func_184604_a(blockpos, blockstate)) {
- this.field_233624_bE_ = Optional.of(blockpos);
- return true;
- } else {
- return false;
- }
+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(blockstate, field_70170_p, blockpos, this);
}
}
@@ -1353,6 +1369,11 @@
}
public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) {
@ -223,7 +246,7 @@
boolean flag = super.func_225503_b_(p_225503_1_, p_225503_2_);
int i = this.func_225508_e_(p_225503_1_, p_225503_2_);
if (i > 0) {
@@ -1376,9 +1407,10 @@
@@ -1376,9 +1397,10 @@
int i = MathHelper.func_76128_c(this.func_226277_ct_());
int j = MathHelper.func_76128_c(this.func_226278_cu_() - (double)0.2F);
int k = MathHelper.func_76128_c(this.func_226281_cx_());
@ -237,7 +260,7 @@
this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F);
}
@@ -1446,6 +1478,8 @@
@@ -1446,6 +1468,8 @@
protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) {
if (!this.func_180431_b(p_70665_1_)) {
@ -246,7 +269,7 @@
p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_);
p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_);
float f2 = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F);
@@ -1455,10 +1489,11 @@
@@ -1455,10 +1479,11 @@
((ServerPlayerEntity)p_70665_1_.func_76346_g()).func_195067_a(Stats.field_212735_F, Math.round(f * 10.0F));
}
@ -259,7 +282,7 @@
this.func_110149_m(this.func_110139_bj() - f2);
}
}
@@ -1512,6 +1547,8 @@
@@ -1512,6 +1537,8 @@
}
public void func_226292_a_(Hand p_226292_1_, boolean p_226292_2_) {
@ -268,7 +291,26 @@
if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) {
this.field_110158_av = -1;
this.field_82175_bq = true;
@@ -1868,11 +1905,15 @@
@@ -1846,15 +1873,16 @@
}
this.field_70160_al = true;
+ net.minecraftforge.common.ForgeHooks.onLivingJump(this);
}
@OnlyIn(Dist.CLIENT)
protected void func_203010_cG() {
- this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)-0.04F, 0.0D));
+ this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F * this.func_110148_a(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).func_111126_e(), 0.0D));
}
protected void func_180466_bG(ITag<Fluid> p_180466_1_) {
- this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F, 0.0D));
+ this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F * this.func_110148_a(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).func_111126_e(), 0.0D));
}
protected float func_189749_co() {
@@ -1868,16 +1896,20 @@
public void func_213352_e(Vector3d p_213352_1_) {
if (this.func_70613_aW() || this.func_184186_bw()) {
double d0 = 0.08D;
@ -285,7 +327,13 @@
FluidState fluidstate = this.field_70170_p.func_204610_c(this.func_233580_cy_());
if (this.func_70090_H() && this.func_241208_cS_() && !this.func_230285_a_(fluidstate.func_206886_c())) {
@@ -1897,6 +1938,7 @@
double d8 = this.func_226278_cu_();
- float f5 = this.func_70051_ag() ? 0.9F : this.func_189749_co();
+ float f5 = this.field_70170_p.func_180495_p(this.func_226270_aj_()).getSlipperiness(field_70170_p, this.func_226270_aj_(), this);
float f6 = 0.02F;
float f7 = (float)EnchantmentHelper.func_185294_d(this);
if (f7 > 3.0F) {
@@ -1897,6 +1929,7 @@
f5 = 0.96F;
}
@ -293,7 +341,7 @@
this.func_213309_a(f6, p_213352_1_);
this.func_213315_a(MoverType.SELF, this.func_213322_ci());
Vector3d vector3d6 = this.func_213322_ci();
@@ -2075,6 +2117,7 @@
@@ -2075,6 +2108,7 @@
}
public void func_70071_h_() {
@ -301,7 +349,35 @@
super.func_70071_h_();
this.func_184608_ct();
this.func_205014_p();
@@ -2707,8 +2750,10 @@
@@ -2230,6 +2264,8 @@
ItemStack itemstack1 = this.func_184582_a(equipmentslottype);
if (!ItemStack.func_77989_b(itemstack1, itemstack)) {
+ if (!itemstack1.equals(itemstack1, true))
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent(this, equipmentslottype, itemstack, itemstack1));
if (map == null) {
map = Maps.newEnumMap(EquipmentSlotType.class);
}
@@ -2658,8 +2694,16 @@
private void func_184608_ct() {
if (this.func_184587_cr()) {
- if (ItemStack.func_185132_d(this.func_184586_b(this.func_184600_cs()), this.field_184627_bm)) {
- this.field_184627_bm = this.func_184586_b(this.func_184600_cs());
+ ItemStack itemStack = this.func_184586_b(this.func_184600_cs());
+ if (net.minecraftforge.common.ForgeHooks.canContinueUsing(this.field_184627_bm, itemStack)) this.field_184627_bm = itemStack;
+ if (itemStack == this.field_184627_bm) {
+
+ if (!this.field_184627_bm.func_190926_b()) {
+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn);
+ if (field_184628_bn > 0)
+ field_184627_bm.onUsingTick(this, field_184628_bn);
+ }
+
this.field_184627_bm.func_222121_b(this.field_70170_p, this, this.func_184605_cv());
if (this.func_226299_p_()) {
this.func_226293_b_(this.field_184627_bm, 5);
@@ -2707,8 +2751,10 @@
public void func_184598_c(Hand p_184598_1_) {
ItemStack itemstack = this.func_184586_b(p_184598_1_);
if (!itemstack.func_190926_b() && !this.func_184587_cr()) {
@ -313,7 +389,7 @@
if (!this.field_70170_p.field_72995_K) {
this.func_204802_c(1, true);
this.func_204802_c(2, p_184598_1_ == Hand.OFF_HAND);
@@ -2768,6 +2813,9 @@
@@ -2768,6 +2814,9 @@
vector3d1 = vector3d1.func_178789_a(-this.field_70125_A * ((float)Math.PI / 180F));
vector3d1 = vector3d1.func_178785_b(-this.field_70177_z * ((float)Math.PI / 180F));
vector3d1 = vector3d1.func_72441_c(this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_());
@ -323,7 +399,7 @@
this.field_70170_p.func_195594_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vector3d1.field_72450_a, vector3d1.field_72448_b, vector3d1.field_72449_c, vector3d.field_72450_a, vector3d.field_72448_b + 0.05D, vector3d.field_72449_c);
}
@@ -2779,7 +2827,9 @@
@@ -2779,7 +2828,9 @@
} else {
if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) {
this.func_226293_b_(this.field_184627_bm, 16);
@ -334,7 +410,7 @@
this.func_184602_cy();
}
@@ -2800,7 +2850,11 @@
@@ -2800,7 +2851,11 @@
public void func_184597_cx() {
if (!this.field_184627_bm.func_190926_b()) {
@ -346,7 +422,24 @@
if (this.field_184627_bm.func_222122_m()) {
this.func_184608_ct();
}
@@ -2993,7 +3047,9 @@
@@ -2966,14 +3021,14 @@
private boolean func_213359_p() {
return this.func_213374_dv().map((p_241350_1_) -> {
- return this.field_70170_p.func_180495_p(p_241350_1_).func_177230_c() instanceof BedBlock;
+ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, p_241350_1_);
}).orElse(false);
}
public void func_213366_dy() {
this.func_213374_dv().filter(this.field_70170_p::func_175667_e).ifPresent((p_241348_1_) -> {
BlockState blockstate = this.field_70170_p.func_180495_p(p_241348_1_);
- if (blockstate.func_177230_c() instanceof BedBlock) {
+ if (blockstate.isBed(field_70170_p, func_226270_aj_(), this)) {
this.field_70170_p.func_180501_a(p_241348_1_, blockstate.func_206870_a(BedBlock.field_176471_b, Boolean.valueOf(false)), 3);
Vector3d vector3d1 = BedBlock.func_220172_a(this.func_200600_R(), this.field_70170_p, p_241348_1_, 0).orElseGet(() -> {
BlockPos blockpos = p_241348_1_.func_177984_a();
@@ -2993,7 +3048,9 @@
@OnlyIn(Dist.CLIENT)
public Direction func_213376_dz() {
BlockPos blockpos = this.func_213374_dv().orElse((BlockPos)null);
@ -357,7 +450,7 @@
}
public boolean func_70094_T() {
@@ -3062,4 +3118,58 @@
@@ -3062,4 +3119,58 @@
public void func_213334_d(Hand p_213334_1_) {
this.func_213361_c(p_213334_1_ == Hand.MAIN_HAND ? EquipmentSlotType.MAINHAND : EquipmentSlotType.OFFHAND);
}

View File

@ -14,7 +14,7 @@
p_212833_1_.func_180501_a(this.field_220422_a, Blocks.field_185773_cZ.func_176223_P(), 3);
flag = true;
+ } else if (itemstack.func_77973_b() instanceof net.minecraftforge.common.IPlantable) {
+ if (((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlantType(p_212833_1_, field_220422_a) == net.minecraftforge.common.PlantType.Crop) {
+ if (((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlantType(p_212833_1_, field_220422_a) == net.minecraftforge.common.PlantType.CROP) {
+ p_212833_1_.func_180501_a(field_220422_a, ((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlant(p_212833_1_, field_220422_a), 3);
+ flag = true;
+ }

View File

@ -0,0 +1,66 @@
--- a/net/minecraft/entity/passive/MooshroomEntity.java
+++ b/net/minecraft/entity/passive/MooshroomEntity.java
@@ -41,7 +41,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.commons.lang3.tuple.Pair;
-public class MooshroomEntity extends CowEntity implements IShearable {
+public class MooshroomEntity extends CowEntity implements IShearable, net.minecraftforge.common.IForgeShearable {
private static final DataParameter<String> field_213449_bz = EntityDataManager.func_187226_a(MooshroomEntity.class, DataSerializers.field_187194_d);
private Effect field_213450_bA;
private int field_213447_bB;
@@ -100,7 +100,7 @@
this.func_184185_a(soundevent, 1.0F, 1.0F);
return ActionResultType.func_233537_a_(this.field_70170_p.field_72995_K);
- } else if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_230262_K__()) {
+ } else if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_230262_K__()) { //Forge: Moved to onSheared
this.func_230263_a_(SoundCategory.PLAYERS);
if (!this.field_70170_p.field_72995_K) {
itemstack.func_222118_a(1, p_230254_1_, (p_213442_1_) -> {
@@ -235,6 +235,45 @@
return mooshroomentity$type2;
}
+ @Override
+ public boolean isShearable(@javax.annotation.Nonnull ItemStack item, World world, BlockPos pos) {
+ return func_230262_K__();
+ }
+
+ @javax.annotation.Nonnull
+ @Override
+ public java.util.List<ItemStack> onSheared(@javax.annotation.Nullable PlayerEntity player, @javax.annotation.Nonnull ItemStack item, World world, BlockPos pos, int fortune) {
+ world.func_217384_a(null, this, SoundEvents.field_187784_dt, player == null ? SoundCategory.BLOCKS : SoundCategory.PLAYERS, 1.0F, 1.0F);
+ if (!world.func_201670_d()) {
+ ((ServerWorld)this.field_70170_p).func_195598_a(ParticleTypes.field_197627_t, this.func_226277_ct_(), this.func_226283_e_(0.5D), this.func_226281_cx_(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
+ this.func_70106_y();
+ CowEntity cowentity = EntityType.field_200796_j.func_200721_a(this.field_70170_p);
+ cowentity.func_70012_b(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), this.field_70177_z, this.field_70125_A);
+ cowentity.func_70606_j(this.func_110143_aJ());
+ cowentity.field_70761_aq = this.field_70761_aq;
+ if (this.func_145818_k_()) {
+ cowentity.func_200203_b(this.func_200201_e());
+ cowentity.func_174805_g(this.func_174833_aM());
+ }
+
+ if (this.func_104002_bU()) {
+ cowentity.func_110163_bv();
+ }
+
+ cowentity.func_184224_h(this.func_190530_aW());
+ this.field_70170_p.func_217376_c(cowentity);
+
+ java.util.List<ItemStack> items = new java.util.ArrayList<>();
+ for (int i = 0; i < 5; ++i) {
+ items.add(new ItemStack(this.func_213444_dV().field_221099_d.func_177230_c()));
+ }
+
+ return items;
+ }
+ return java.util.Collections.emptyList();
+ }
+
+
public static enum Type {
RED("red", Blocks.field_150337_Q.func_176223_P()),
BROWN("brown", Blocks.field_150338_P.func_176223_P());

View File

@ -0,0 +1,47 @@
--- a/net/minecraft/entity/passive/SheepEntity.java
+++ b/net/minecraft/entity/passive/SheepEntity.java
@@ -60,7 +60,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class SheepEntity extends AnimalEntity implements IShearable {
+public class SheepEntity extends AnimalEntity implements IShearable, net.minecraftforge.common.IForgeShearable {
private static final DataParameter<Byte> field_184774_bv = EntityDataManager.func_187226_a(SheepEntity.class, DataSerializers.field_187191_a);
private static final Map<DyeColor, IItemProvider> field_200206_bz = Util.func_200696_a(Maps.newEnumMap(DyeColor.class), (p_203402_0_) -> {
p_203402_0_.put(DyeColor.WHITE, Blocks.field_196556_aL);
@@ -215,7 +215,7 @@
public ActionResultType func_230254_b_(PlayerEntity p_230254_1_, Hand p_230254_2_) {
ItemStack itemstack = p_230254_1_.func_184586_b(p_230254_2_);
- if (itemstack.func_77973_b() == Items.field_151097_aZ) {
+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ) { //Forge: Moved to onSheared
if (!this.field_70170_p.field_72995_K && this.func_230262_K__()) {
this.func_230263_a_(SoundCategory.PLAYERS);
itemstack.func_222118_a(1, p_230254_1_, (p_213613_1_) -> {
@@ -360,4 +360,26 @@
protected float func_213348_b(Pose p_213348_1_, EntitySize p_213348_2_) {
return 0.95F * p_213348_2_.field_220316_b;
}
+
+ @Override
+ public boolean isShearable(@javax.annotation.Nonnull ItemStack item, World world, BlockPos pos) {
+ return func_230262_K__();
+ }
+
+ @javax.annotation.Nonnull
+ @Override
+ public java.util.List<ItemStack> onSheared(@Nullable PlayerEntity player, @javax.annotation.Nonnull ItemStack item, World world, BlockPos pos, int fortune) {
+ world.func_217384_a(null, this, SoundEvents.field_187763_eJ, player == null ? SoundCategory.BLOCKS : SoundCategory.PLAYERS, 1.0F, 1.0F);
+ if (!world.field_72995_K) {
+ this.func_70893_e(true);
+ int i = 1 + this.field_70146_Z.nextInt(3);
+
+ java.util.List<ItemStack> items = new java.util.ArrayList<>();
+ for (int j = 0; j < i; ++j) {
+ items.add(new ItemStack(field_200206_bz.get(this.func_175509_cj())));
+ }
+ return items;
+ }
+ return java.util.Collections.emptyList();
+ }
}

View File

@ -1,5 +1,14 @@
--- a/net/minecraft/entity/passive/SnowGolemEntity.java
+++ b/net/minecraft/entity/passive/SnowGolemEntity.java
@@ -40,7 +40,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class SnowGolemEntity extends GolemEntity implements IShearable, IRangedAttackMob {
+public class SnowGolemEntity extends GolemEntity implements IShearable, IRangedAttackMob, net.minecraftforge.common.IForgeShearable {
private static final DataParameter<Byte> field_184749_a = EntityDataManager.func_187226_a(SnowGolemEntity.class, DataSerializers.field_187191_a);
public SnowGolemEntity(EntityType<? extends SnowGolemEntity> p_i50244_1_, World p_i50244_2_) {
@@ -93,7 +93,7 @@
this.func_70097_a(DamageSource.field_76370_b, 1.0F);
}
@ -18,3 +27,33 @@
this.field_70170_p.func_175656_a(blockpos, blockstate);
}
}
@@ -130,7 +130,7 @@
protected ActionResultType func_230254_b_(PlayerEntity p_230254_1_, Hand p_230254_2_) {
ItemStack itemstack = p_230254_1_.func_184586_b(p_230254_2_);
- if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_230262_K__()) {
+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_230262_K__()) { //Forge: Moved to onSheared
this.func_230263_a_(SoundCategory.PLAYERS);
if (!this.field_70170_p.field_72995_K) {
itemstack.func_222118_a(1, p_230254_1_, (p_213622_1_) -> {
@@ -190,4 +190,20 @@
public Vector3d func_241205_ce_() {
return new Vector3d(0.0D, (double)(0.75F * this.func_70047_e()), (double)(this.func_213311_cf() * 0.4F));
}
+
+ @Override
+ public boolean isShearable(@javax.annotation.Nonnull ItemStack item, World world, BlockPos pos) {
+ return func_230262_K__();
+ }
+
+ @javax.annotation.Nonnull
+ @Override
+ public java.util.List<ItemStack> onSheared(@Nullable PlayerEntity player, @javax.annotation.Nonnull ItemStack item, World world, BlockPos pos, int fortune) {
+ world.func_217384_a(null, this, SoundEvents.field_232843_op_, player == null ? SoundCategory.BLOCKS : SoundCategory.PLAYERS, 1.0F, 1.0F);
+ if (!world.func_201670_d()) {
+ func_184747_a(false);
+ return java.util.Collections.singletonList(new ItemStack(Items.field_221689_cG));
+ }
+ return java.util.Collections.emptyList();
+ }
}

View File

@ -11,6 +11,24 @@
if (!p_234600_1_.field_70128_L && p_234600_1_.func_70089_S() && (flag || flag1) && !(this.func_70068_e(p_234600_1_) > 1024.0D)) {
return false;
} else {
@@ -301,7 +301,7 @@
double d1 = (double)((float)MathHelper.func_76128_c(this.func_226278_cu_()) + 1.0F);
double d2 = this.func_226281_cx_() + (double)(f2 * (float)this.field_146038_az * 0.1F);
BlockState blockstate = serverworld.func_180495_p(new BlockPos(d0, d1 - 1.0D, d2));
- if (blockstate.func_203425_a(Blocks.field_150355_j)) {
+ if (serverworld.func_180495_p(new BlockPos((int)d0, (int)d1 - 1, (int)d2)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) {
if (this.field_70146_Z.nextFloat() < 0.15F) {
serverworld.func_195598_a(ParticleTypes.field_197612_e, d0, d1 - (double)0.1F, d2, 1, (double)f1, 0.1D, (double)f2, 0.0D);
}
@@ -337,7 +337,7 @@
double d5 = (double)((float)MathHelper.func_76128_c(this.func_226278_cu_()) + 1.0F);
double d6 = this.func_226281_cx_() + (double)(MathHelper.func_76134_b(f6) * f7 * 0.1F);
BlockState blockstate1 = serverworld.func_180495_p(new BlockPos(d4, d5 - 1.0D, d6));
- if (blockstate1.func_203425_a(Blocks.field_150355_j)) {
+ if (serverworld.func_180495_p(new BlockPos(d4, d5 - 1.0D, d6)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) {
serverworld.func_195598_a(ParticleTypes.field_218422_X, d4, d5, d6, 2 + this.field_70146_Z.nextInt(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D);
}
}
@@ -408,6 +408,7 @@
PlayerEntity playerentity = this.func_234606_i_();
if (!this.field_70170_p.field_72995_K && playerentity != null) {

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/entity/projectile/SmallFireballEntity.java
+++ b/net/minecraft/entity/projectile/SmallFireballEntity.java
@@ -49,7 +49,7 @@
super.func_230299_a_(p_230299_1_);
if (!this.field_70170_p.field_72995_K) {
Entity entity = this.func_234616_v_();
- if (entity == null || !(entity instanceof MobEntity) || this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) {
+ if (entity == null || !(entity instanceof MobEntity) || this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.getEntity())) {
BlockPos blockpos = p_230299_1_.func_216350_a().func_177972_a(p_230299_1_.func_216354_b());
if (this.field_70170_p.func_175623_d(blockpos)) {
this.field_70170_p.func_175656_a(blockpos, AbstractFireBlock.func_235326_a_(this.field_70170_p, blockpos));

View File

@ -9,3 +9,11 @@
public static final Codec<FluidState> field_237213_a_ = func_235897_a_(Registry.field_212619_h, Fluid::func_207188_f).stable();
public FluidState(Fluid p_i232145_1_, ImmutableMap<Property<?>, Comparable<?>> p_i232145_2_, MapCodec<FluidState> p_i232145_3_) {
@@ -101,6 +101,7 @@
return this.func_206886_c().func_207185_a(p_206884_1_);
}
+ @Deprecated //Forge: Use more sensitive version
public float func_210200_l() {
return this.func_206886_c().func_210195_d();
}

View File

@ -1,19 +1,18 @@
--- a/net/minecraft/item/ShearsItem.java
+++ b/net/minecraft/item/ShearsItem.java
@@ -34,4 +34,26 @@
@@ -34,4 +34,25 @@
return 15.0F;
}
}
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public net.minecraft.util.ActionResultType func_111207_a(ItemStack stack, net.minecraft.entity.player.PlayerEntity playerIn, LivingEntity entity, net.minecraft.util.Hand hand) {
+ if (entity.field_70170_p.field_72995_K) return net.minecraft.util.ActionResultType.PASS;
+ if (entity instanceof net.minecraftforge.common.IShearable) {
+ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity;
+ if (entity instanceof net.minecraftforge.common.IForgeShearable) {
+ net.minecraftforge.common.IForgeShearable target = (net.minecraftforge.common.IForgeShearable)entity;
+ BlockPos pos = new BlockPos(entity.func_226277_ct_(), entity.func_226278_cu_(), entity.func_226281_cx_());
+ if (target.isShearable(stack, entity.field_70170_p, pos)) {
+ java.util.List<ItemStack> drops = target.onSheared(stack, entity.field_70170_p, pos,
+ java.util.List<ItemStack> drops = target.onSheared(playerIn, stack, entity.field_70170_p, pos,
+ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantments.field_185308_t, stack));
+ java.util.Random rand = new java.util.Random();
+ drops.forEach(d -> {

View File

@ -30,7 +30,14 @@
ServerProperties serverproperties = this.field_71340_o.func_219034_a();
if (this.func_71264_H()) {
this.func_71189_e("127.0.0.1");
@@ -159,11 +159,13 @@
@@ -153,17 +153,20 @@
if (!PreYggdrasilConverter.func_219587_e(this)) {
return false;
} else {
+ net.minecraftforge.fml.server.ServerModLoader.end();
this.func_184105_a(new DedicatedPlayerList(this, this.field_240767_f_, this.field_240766_e_));
long i = Util.func_211178_c();
this.func_71191_d(serverproperties.field_219026_t);
SkullTileEntity.func_184293_a(this.func_152358_ax());
SkullTileEntity.func_184294_a(this.func_147130_as());
PlayerProfileCache.func_187320_a(this.func_71266_T());
@ -44,7 +51,7 @@
if (serverproperties.field_219027_u != null) {
this.func_200252_aR().func_223585_a(GameRules.field_223620_w).func_223570_a(serverproperties.field_219027_u, this);
}
@@ -175,6 +177,7 @@
@@ -175,6 +178,7 @@
}
if (serverproperties.field_219030_x) {
@ -52,17 +59,17 @@
field_155771_h.info("Starting remote control listener");
this.field_71339_n = new MainThread(this);
this.field_71339_n.func_72602_a();
@@ -306,7 +309,8 @@
}
@@ -193,7 +197,8 @@
ServerInfoMBean.func_233490_a_(this);
}
public boolean func_71262_S() {
- return true;
- return true;
+ // <3 you Grum for this, saves us ~30 patch files! --^
+ return net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(this);
}
}
public boolean func_181035_ah() {
@@ -506,6 +510,11 @@
@@ -506,6 +511,11 @@
return false;
}

View File

@ -61,7 +61,67 @@
return false;
} else {
TileEntity tileentity = this.field_73092_a.func_175625_s(p_180237_1_);
@@ -291,6 +301,8 @@
@@ -226,38 +236,52 @@
if ((block instanceof CommandBlockBlock || block instanceof StructureBlock || block instanceof JigsawBlock) && !this.field_73090_b.func_195070_dx()) {
this.field_73092_a.func_184138_a(p_180237_1_, blockstate, blockstate, 3);
return false;
+ } else if (field_73090_b.func_184614_ca().onBlockStartBreak(p_180237_1_, field_73090_b)) {
+ return false;
} else if (this.field_73090_b.func_223729_a(this.field_73092_a, p_180237_1_, this.field_73091_c)) {
return false;
} else {
- block.func_176208_a(this.field_73092_a, p_180237_1_, blockstate, this.field_73090_b);
- boolean flag = this.field_73092_a.func_217377_a(p_180237_1_, false);
- if (flag) {
- block.func_176206_d(this.field_73092_a, p_180237_1_, blockstate);
- }
-
if (this.func_73083_d()) {
+ removeBlock(p_180237_1_, false);
return true;
} else {
ItemStack itemstack = this.field_73090_b.func_184614_ca();
ItemStack itemstack1 = itemstack.func_77946_l();
- boolean flag1 = this.field_73090_b.func_234569_d_(blockstate);
+ boolean flag1 = blockstate.canHarvestBlock(this.field_73092_a, p_180237_1_, this.field_73090_b); // previously player.func_234569_d_(blockstate)
itemstack.func_179548_a(this.field_73092_a, blockstate, p_180237_1_, this.field_73090_b);
+ if (itemstack.func_190926_b() && !itemstack1.func_190926_b())
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_73090_b, itemstack1, Hand.MAIN_HAND);
+ boolean flag = removeBlock(p_180237_1_, flag1);
+
if (flag && flag1) {
block.func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, blockstate, tileentity, itemstack1);
}
+ if (flag && exp > 0)
+ blockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp);
+
return true;
}
}
}
}
+ private boolean removeBlock(BlockPos p_180235_1_, boolean canHarvest) {
+ BlockState state = this.field_73092_a.func_180495_p(p_180235_1_);
+ boolean removed = state.removedByPlayer(this.field_73092_a, p_180235_1_, this.field_73090_b, canHarvest, this.field_73092_a.func_204610_c(p_180235_1_));
+ if (removed)
+ state.func_177230_c().func_176206_d(this.field_73092_a, p_180235_1_, state);
+ return removed;
+ }
+
public ActionResultType func_187250_a(ServerPlayerEntity p_187250_1_, World p_187250_2_, ItemStack p_187250_3_, Hand p_187250_4_) {
if (this.field_73091_c == GameType.SPECTATOR) {
return ActionResultType.PASS;
} else if (p_187250_1_.func_184811_cZ().func_185141_a(p_187250_3_.func_77973_b())) {
return ActionResultType.PASS;
} else {
+ ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187250_1_, p_187250_4_);
+ if (cancelResult != null) return cancelResult;
int i = p_187250_3_.func_190916_E();
int j = p_187250_3_.func_77952_i();
ActionResult<ItemStack> actionresult = p_187250_3_.func_77957_a(p_187250_2_, p_187250_1_, p_187250_4_);
@@ -291,6 +315,8 @@
public ActionResultType func_219441_a(ServerPlayerEntity p_219441_1_, World p_219441_2_, ItemStack p_219441_3_, Hand p_219441_4_, BlockRayTraceResult p_219441_5_) {
BlockPos blockpos = p_219441_5_.func_216350_a();
BlockState blockstate = p_219441_2_.func_180495_p(blockpos);
@ -70,14 +130,14 @@
if (this.field_73091_c == GameType.SPECTATOR) {
INamedContainerProvider inamedcontainerprovider = blockstate.func_215699_b(p_219441_2_, blockpos);
if (inamedcontainerprovider != null) {
@@ -300,10 +312,15 @@
@@ -300,10 +326,15 @@
return ActionResultType.PASS;
}
} else {
+ ItemUseContext itemusecontext = new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_);
+ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
+ ActionResultType result = p_219441_3_.onItemUseFirst(itemusecontext);
+ if (result != ActionResultType.PASS) return result;
+ ActionResultType result = p_219441_3_.onItemUseFirst(itemusecontext);
+ if (result != ActionResultType.PASS) return result;
+ }
boolean flag = !p_219441_1_.func_184614_ca().func_190926_b() || !p_219441_1_.func_184592_cb().func_190926_b();
- boolean flag1 = p_219441_1_.func_226563_dT_() && flag;
@ -88,7 +148,7 @@
ActionResultType actionresulttype = blockstate.func_227031_a_(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_);
if (actionresulttype.func_226246_a_()) {
CriteriaTriggers.field_232607_M_.func_226695_a_(p_219441_1_, blockpos, itemstack);
@@ -312,7 +329,7 @@
@@ -312,7 +343,7 @@
}
if (!p_219441_3_.func_190926_b() && !p_219441_1_.func_184811_cZ().func_185141_a(p_219441_3_.func_77973_b())) {

View File

@ -0,0 +1,71 @@
--- a/net/minecraft/tags/ITag.java
+++ b/net/minecraft/tags/ITag.java
@@ -46,6 +46,7 @@
public static class Builder {
private final List<ITag.Proxy> field_232953_a_ = Lists.newArrayList();
+ private boolean replace = false;
public static ITag.Builder func_200047_a() {
return new ITag.Builder();
@@ -68,6 +69,15 @@
return this.func_232955_a_(new ITag.TagEntry(p_232964_1_), p_232964_2_);
}
+ public ITag.Builder replace(boolean value) {
+ this.replace = value;
+ return this;
+ }
+
+ public ITag.Builder replace() {
+ return replace(true);
+ }
+
public <T> Optional<ITag<T>> func_232959_a_(Function<ResourceLocation, ITag<T>> p_232959_1_, Function<ResourceLocation, T> p_232959_2_) {
ImmutableSet.Builder<T> builder = ImmutableSet.builder();
@@ -108,6 +118,7 @@
this.field_232953_a_.clear();
}
+ net.minecraftforge.common.ForgeHooks.deserializeTagAdditions(list, p_232956_1_, field_232953_a_);
list.forEach((p_232958_2_) -> {
this.field_232953_a_.add(new ITag.Proxy(p_232958_2_, p_232956_2_));
});
@@ -119,11 +130,20 @@
JsonArray jsonarray = new JsonArray();
for(ITag.Proxy itag$proxy : this.field_232953_a_) {
+ if(!(itag$proxy.field_232966_a_ instanceof net.minecraftforge.common.data.IOptionalTagEntry))
itag$proxy.func_232968_a_().func_230237_a_(jsonarray);
}
- jsonobject.addProperty("replace", false);
+ JsonArray optopnals = new JsonArray();
+ func_232962_b_()
+ .map(e -> e.field_232966_a_)
+ .filter(e -> e instanceof net.minecraftforge.common.data.IOptionalTagEntry)
+ .forEach(e -> e.func_230237_a_(optopnals));
+
+ jsonobject.addProperty("replace", replace);
jsonobject.add("values", jsonarray);
+ if (optopnals.size() > 0)
+ jsonobject.add("optional", optopnals);
return jsonobject;
}
}
@@ -162,6 +182,7 @@
public String toString() {
return this.field_232969_a_.toString();
}
+ @Override public boolean equals(Object o) { return o == this || (o instanceof ITag.ItemEntry && java.util.Objects.equals(this.field_232969_a_, ((ITag.ItemEntry) o).field_232969_a_)); }
}
public static class Proxy {
@@ -206,5 +227,6 @@
public String toString() {
return "#" + this.field_200163_a;
}
+ @Override public boolean equals(Object o) { return o == this || (o instanceof ITag.TagEntry && java.util.Objects.equals(this.field_200163_a, ((ITag.TagEntry) o).field_200163_a)); }
}
}

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/tileentity/ConduitTileEntity.java
+++ b/net/minecraft/tileentity/ConduitTileEntity.java
@@ -131,7 +131,7 @@
BlockState blockstate = this.field_145850_b.func_180495_p(blockpos1);
for(Block block : field_205042_e) {
- if (blockstate.func_203425_a(block)) {
+ if (blockstate.isConduitFrame(this.field_145850_b, blockpos1, func_174877_v())) {
this.field_205046_i.add(blockpos1);
}
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/tileentity/IChestLid.java
+++ b/net/minecraft/tileentity/IChestLid.java
@@ -3,7 +3,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-@OnlyIn(Dist.CLIENT)
public interface IChestLid {
+ @OnlyIn(Dist.CLIENT)
float func_195480_a(float p_195480_1_);
}

View File

@ -94,7 +94,7 @@
return ParticleTypes.field_197611_d;
});
public static final Registry<Codec<? extends BiomeProvider>> field_239689_aA_ = func_239742_a_(field_239665_C_, Lifecycle.stable(), () -> {
@@ -207,16 +211,16 @@
@@ -207,19 +211,19 @@
public static final Registry<Codec<? extends ChunkGenerator>> field_239690_aB_ = func_239742_a_(field_239666_D_, Lifecycle.stable(), () -> {
return ChunkGenerator.field_235948_a_;
});
@ -113,7 +113,11 @@
+ @Deprecated public static final DefaultedRegistry<ChunkStatus> field_218360_A = forgeDefaulted(field_239670_H_, ChunkStatus.class, () -> {
return ChunkStatus.field_223226_a_;
});
public static final Registry<Structure<?>> field_218361_B = func_239746_a_(field_239671_I_, () -> {
- public static final Registry<Structure<?>> field_218361_B = func_239746_a_(field_239671_I_, () -> {
+ @Deprecated public static final Registry<Structure<?>> field_218361_B = forge(field_239671_I_, Structure.class, () -> {
return Structure.field_236367_c_;
});
public static final Registry<IStructurePieceType> field_218362_C = func_239746_a_(field_239672_J_, () -> {
@@ -237,40 +241,40 @@
public static final Registry<IJigsawDeserializer<?>> field_218365_F = func_239746_a_(field_239676_N_, () -> {
return IJigsawDeserializer.field_214931_e;

View File

@ -26,6 +26,23 @@
}
public Chunk(World p_i49947_1_, ChunkPrimer p_i49947_2_) {
@@ -264,14 +265,14 @@
if (!this.field_76637_e.field_72995_K) {
blockstate.func_196947_b(this.field_76637_e, p_177436_1_, p_177436_2_, p_177436_3_);
- } else if (block1 != block && block1 instanceof ITileEntityProvider) {
+ } else if ((block1 != block || !p_177436_2_.hasTileEntity()) && blockstate.hasTileEntity()) {
this.field_76637_e.func_175713_t(p_177436_1_);
}
if (!chunksection.func_177485_a(i, j & 15, k).func_203425_a(block)) {
return null;
} else {
- if (block1 instanceof ITileEntityProvider) {
+ if (blockstate.hasTileEntity()) {
TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.CreateEntityType.CHECK);
if (tileentity != null) {
tileentity.func_145836_u();
@@ -282,10 +283,10 @@
p_177436_2_.func_215705_a(this.field_76637_e, p_177436_1_, blockstate, p_177436_3_);
}
@ -169,7 +186,19 @@
});
}
@@ -795,4 +810,30 @@
@@ -704,9 +719,8 @@
BlockState blockstate = this.func_180495_p(p_212815_1_);
TileEntity tileentity;
if ("DUMMY".equals(p_212815_2_.func_74779_i("id"))) {
- Block block = blockstate.func_177230_c();
- if (block instanceof ITileEntityProvider) {
- tileentity = ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e);
+ if (blockstate.hasTileEntity()) {
+ tileentity = blockstate.createTileEntity(this.field_76637_e);
} else {
tileentity = null;
field_150817_t.warn("Tried to load a DUMMY block entity @ {} but found not block entity block {} at location", p_212815_1_, blockstate);
@@ -795,4 +809,30 @@
QUEUED,
CHECK;
}

View File

@ -0,0 +1,15 @@
--- a/net/minecraft/world/gen/feature/structure/Structure.java
+++ b/net/minecraft/world/gen/feature/structure/Structure.java
@@ -32,10 +32,11 @@
import net.minecraft.world.gen.feature.StructureFeature;
import net.minecraft.world.gen.feature.template.TemplateManager;
import net.minecraft.world.gen.settings.StructureSeparationSettings;
+import net.minecraftforge.registries.ForgeRegistryEntry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public abstract class Structure<C extends IFeatureConfig> {
+public abstract class Structure<C extends IFeatureConfig> extends ForgeRegistryEntry<Structure<?>> {
public static final BiMap<String, Structure<?>> field_236365_a_ = HashBiMap.create();
private static final Map<Structure<?>, GenerationStage.Decoration> field_236385_u_ = Maps.newHashMap();
private static final Logger field_208204_b = LogManager.getLogger();

View File

@ -1,63 +0,0 @@
--- a/net/minecraft/client/GameSettings.java
+++ b/net/minecraft/client/GameSettings.java
@@ -171,6 +171,7 @@
public String field_74363_ab = "en_us";
public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) {
+ setForgeKeybindProperties();
this.field_74317_L = p_i46326_1_;
this.field_74354_ai = new File(p_i46326_2_, "options.txt");
if (p_i46326_1_.func_147111_S() && Runtime.getRuntime().maxMemory() >= 1000000000L) {
@@ -490,7 +491,11 @@
for(KeyBinding keybinding : this.field_74324_K) {
if (s.equals("key_" + keybinding.func_151464_g())) {
- keybinding.func_197979_b(InputMappings.func_197955_a(s1));
+ if (s1.indexOf(':') != -1) {
+ String[] pts = s1.split(":");
+ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputMappings.func_197955_a(pts[0]));
+ } else
+ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputMappings.func_197955_a(s1));
}
}
@@ -538,6 +543,7 @@
}
public void func_74303_b() {
+ if (net.minecraftforge.fml.client.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
try (PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.field_74354_ai), StandardCharsets.UTF_8))) {
printwriter.println("version:" + SharedConstants.func_215069_a().getWorldVersion());
printwriter.println("autoJump:" + AbstractOption.field_216719_z.func_216741_b(this));
@@ -615,7 +621,7 @@
printwriter.println("skipMultiplayerWarning:" + this.field_230152_Z_);
for(KeyBinding keybinding : this.field_74324_K) {
- printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m());
+ printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m() + (keybinding.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keybinding.getKeyModifier() : ""));
}
for(SoundCategory soundcategory : SoundCategory.values()) {
@@ -714,4 +720,22 @@
p_198017_1_.func_198985_a(set);
}
+
+ private void setForgeKeybindProperties() {
+ net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME;
+ field_74351_w.setKeyConflictContext(inGame);
+ field_74370_x.setKeyConflictContext(inGame);
+ field_74368_y.setKeyConflictContext(inGame);
+ field_74366_z.setKeyConflictContext(inGame);
+ field_74314_A.setKeyConflictContext(inGame);
+ field_228046_af_.setKeyConflictContext(inGame);
+ field_151444_V.setKeyConflictContext(inGame);
+ field_74312_F.setKeyConflictContext(inGame);
+ field_74310_D.setKeyConflictContext(inGame);
+ field_74321_H.setKeyConflictContext(inGame);
+ field_74323_J.setKeyConflictContext(inGame);
+ field_151457_aa.setKeyConflictContext(inGame);
+ field_151458_ab.setKeyConflictContext(inGame);
+ field_186718_X.setKeyConflictContext(inGame);
+ }
}

View File

@ -1,67 +0,0 @@
--- a/net/minecraft/client/KeyboardListener.java
+++ b/net/minecraft/client/KeyboardListener.java
@@ -251,7 +251,9 @@
}
INestedGuiEventHandler inestedguieventhandler = this.field_197972_a.field_71462_r;
- if (p_197961_5_ == 1 && (!(this.field_197972_a.field_71462_r instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).field_152177_g <= Util.func_211177_b() - 20L)) {
+
+ if ((!(this.field_197972_a.field_71462_r instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).field_152177_g <= Util.func_211177_b() - 20L)) {
+ if (p_197961_5_ == 1) {
if (this.field_197972_a.field_71474_y.field_152395_am.func_197976_a(p_197961_3_, p_197961_4_)) {
this.field_197972_a.func_228018_at_().func_198077_g();
this.field_197972_a.field_71474_y.field_74353_u = this.field_197972_a.func_228018_at_().func_198113_j();
@@ -270,6 +272,8 @@
});
return;
}
+ } else if (p_197961_5_ == 0 /*GLFW_RELEASE*/ && this.field_197972_a.field_71462_r instanceof ControlsScreen)
+ ((ControlsScreen)this.field_197972_a.field_71462_r).field_146491_f = null; //Forge: Unset pure modifiers.
}
boolean flag = inestedguieventhandler == null || !(inestedguieventhandler.getFocused() instanceof TextFieldWidget) || !((TextFieldWidget)inestedguieventhandler.getFocused()).func_212955_f();
@@ -289,10 +293,14 @@
Screen.wrapScreenError(() -> {
if (p_197961_5_ != 1 && (p_197961_5_ != 2 || !this.field_197973_b)) {
if (p_197961_5_ == 0) {
- aboolean[0] = inestedguieventhandler.func_223281_a_(p_197961_3_, p_197961_4_, p_197961_6_);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_);
+ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.func_223281_a_(p_197961_3_, p_197961_4_, p_197961_6_);
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_);
}
} else {
- aboolean[0] = inestedguieventhandler.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_);
+ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_);
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_);
}
}, "keyPressed event handler", inestedguieventhandler.getClass().getCanonicalName());
@@ -353,7 +361,7 @@
}
}
}
-
+ net.minecraftforge.client.ForgeHooksClient.fireKeyInput(p_197961_3_, p_197961_4_, p_197961_5_, p_197961_6_);
}
}
@@ -363,12 +371,16 @@
if (iguieventlistener != null && this.field_197972_a.func_213250_au() == null) {
if (Character.charCount(p_197963_3_) == 1) {
Screen.wrapScreenError(() -> {
- iguieventlistener.charTyped((char)p_197963_3_, p_197963_4_);
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_)) return;
+ if (iguieventlistener.charTyped((char)p_197963_3_, p_197963_4_)) return;
+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_);
}, "charTyped event handler", iguieventlistener.getClass().getCanonicalName());
} else {
for(char c0 : Character.toChars(p_197963_3_)) {
Screen.wrapScreenError(() -> {
- iguieventlistener.charTyped(c0, p_197963_4_);
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, c0, p_197963_4_)) return;
+ if (iguieventlistener.charTyped(c0, p_197963_4_)) return;
+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.field_197972_a.field_71462_r, c0, p_197963_4_);
}, "charTyped event handler", iguieventlistener.getClass().getCanonicalName());
}
}

View File

@ -1,93 +0,0 @@
--- a/net/minecraft/client/MouseHelper.java
+++ b/net/minecraft/client/MouseHelper.java
@@ -66,6 +66,7 @@
this.field_198042_g = -1;
}
+ if (net.minecraftforge.client.ForgeHooksClient.onRawMouseClicked(p_198023_3_, p_198023_4_, p_198023_5_)) return;
boolean[] aboolean = new boolean[]{false};
if (this.field_198036_a.field_213279_p == null) {
if (this.field_198036_a.field_71462_r == null) {
@@ -77,11 +78,15 @@
double d1 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n();
if (flag) {
Screen.wrapScreenError(() -> {
- aboolean[0] = this.field_198036_a.field_71462_r.mouseClicked(d0, d1, i);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPre(this.field_198036_a.field_71462_r, d0, d1, i);
+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.mouseClicked(d0, d1, i);
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.field_198036_a.field_71462_r, d0, d1, i);
}, "mouseClicked event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName());
} else {
Screen.wrapScreenError(() -> {
- aboolean[0] = this.field_198036_a.field_71462_r.mouseReleased(d0, d1, i);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(this.field_198036_a.field_71462_r, d0, d1, i);
+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.mouseReleased(d0, d1, i);
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.field_198036_a.field_71462_r, d0, d1, i);
}, "mouseReleased event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName());
}
}
@@ -105,7 +110,7 @@
}
}
}
-
+ net.minecraftforge.client.ForgeHooksClient.fireMouseInput(p_198023_3_, p_198023_4_, p_198023_5_);
}
}
@@ -116,7 +121,9 @@
if (this.field_198036_a.field_71462_r != null) {
double d1 = this.field_198040_e * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m();
double d2 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n();
- this.field_198036_a.field_71462_r.mouseScrolled(d1, d2, d0);
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPre(this, this.field_198036_a.field_71462_r, d0)) return;
+ if (this.field_198036_a.field_71462_r.mouseScrolled(d1, d2, d0)) return;
+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPost(this, this.field_198036_a.field_71462_r, d0);
} else if (this.field_198036_a.field_71439_g != null) {
if (this.field_200542_o != 0.0D && Math.signum(d0) != Math.signum(this.field_200542_o)) {
this.field_200542_o = 0.0D;
@@ -129,6 +136,7 @@
}
this.field_200542_o -= (double)f1;
+ if (net.minecraftforge.client.ForgeHooksClient.onMouseScroll(this, d0)) return;
if (this.field_198036_a.field_71439_g.func_175149_v()) {
if (this.field_198036_a.field_71456_v.func_175187_g().func_175262_a()) {
this.field_198036_a.field_71456_v.func_175187_g().func_195621_a((double)(-f1));
@@ -180,7 +188,9 @@
double d2 = (p_198022_3_ - this.field_198040_e) * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m();
double d3 = (p_198022_5_ - this.field_198041_f) * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n();
Screen.wrapScreenError(() -> {
- iguieventlistener.mouseDragged(d0, d1, this.field_198042_g, d2, d3);
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPre(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3)) return;
+ if (iguieventlistener.mouseDragged(d0, d1, this.field_198042_g, d2, d3)) return;
+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPost(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3);
}, "mouseDragged event handler", iguieventlistener.getClass().getCanonicalName());
}
}
@@ -245,6 +255,10 @@
return this.field_198039_d;
}
+ public boolean isMiddleDown() {
+ return this.field_198038_c;
+ }
+
public double func_198024_e() {
return this.field_198040_e;
}
@@ -253,6 +267,14 @@
return this.field_198041_f;
}
+ public double getXVelocity() {
+ return this.field_198048_m;
+ }
+
+ public double getYVelocity() {
+ return this.field_198049_n;
+ }
+
public void func_198021_g() {
this.field_198043_h = true;
}

View File

@ -1,18 +0,0 @@
--- a/net/minecraft/client/settings/KeyBinding.java
+++ b/net/minecraft/client/settings/KeyBinding.java
@@ -155,6 +175,7 @@
}
public String func_197978_k() {
+ return getKeyModifier().getLocalizedComboName(this.field_74512_d, () -> {
String s = this.field_74512_d.func_197935_d();
int i = this.field_74512_d.func_197937_c();
String s1 = null;
@@ -171,16 +192,97 @@
}
return s1 == null ? I18n.func_135052_a(s) : s1;
+ });
}
public boolean func_197985_l() {

View File

@ -1,47 +0,0 @@
--- a/net/minecraft/client/shader/Framebuffer.java
+++ b/net/minecraft/client/shader/Framebuffer.java
@@ -100,8 +100,14 @@
GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, FramebufferConstants.field_227594_c_, 3553, this.field_147617_g, 0);
if (this.field_147619_e) {
GlStateManager.func_227730_i_(FramebufferConstants.field_227593_b_, this.field_147624_h);
+ if (!stencilEnabled) {
GlStateManager.func_227678_b_(FramebufferConstants.field_227593_b_, 33190, this.field_147622_a, this.field_147620_b);
GlStateManager.func_227693_c_(FramebufferConstants.field_227592_a_, FramebufferConstants.field_227595_d_, FramebufferConstants.field_227593_b_, this.field_147624_h);
+ } else {
+ GlStateManager.func_227678_b_(FramebufferConstants.field_227593_b_, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.field_147622_a, this.field_147620_b);
+ GlStateManager.func_227693_c_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, FramebufferConstants.field_227593_b_, this.field_147624_h);
+ GlStateManager.func_227693_c_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, FramebufferConstants.field_227593_b_, this.field_147624_h);
+ }
}
this.func_147611_b();
@@ -254,4 +260,29 @@
GlStateManager.func_227658_a_(i, p_216493_1_);
this.func_147609_e();
}
+
+ /*================================ FORGE START ================================================*/
+ private boolean stencilEnabled = false;
+ /**
+ * Attempts to enable 8 bits of stencil buffer on this FrameBuffer.
+ * Modders must call this directly to set things up.
+ * This is to prevent the default cause where graphics cards do not support stencil bits.
+ * <b>Make sure to call this on the main render thread!</b>
+ */
+ public void enableStencil()
+ {
+ if(stencilEnabled) return;
+ stencilEnabled = true;
+ this.func_216491_a(field_147621_c, field_147618_d, net.minecraft.client.Minecraft.field_142025_a);
+ }
+
+ /**
+ * Returns wither or not this FBO has been successfully initialized with stencil bits.
+ * If not, and a modder wishes it to be, they must call enableStencil.
+ */
+ public boolean isStencilEnabled()
+ {
+ return this.stencilEnabled;
+ }
+ /*================================ FORGE END ================================================*/
}

View File

@ -1,17 +0,0 @@
--- a/net/minecraft/command/impl/LocateCommand.java
+++ b/net/minecraft/command/impl/LocateCommand.java
@@ -50,7 +50,13 @@
return func_198534_a(p_204758_0_.getSource(), "Shipwreck");
})).then(Commands.func_197057_a("Village").executes((p_218858_0_) -> {
return func_198534_a(p_218858_0_.getSource(), "Village");
- })));
+ // FORGE: Support modded structures via registry name
+ })).then(Commands.func_197056_a("structure_type", net.minecraft.command.arguments.ResourceLocationArgument.func_197197_a())
+ .suggests((ctx, sb) -> net.minecraft.command.ISuggestionProvider.func_197013_a(
+ net.minecraftforge.registries.GameData.getStructureFeatures().func_148742_b().stream()
+ .map(net.minecraft.util.ResourceLocation::toString), sb))
+ .executes(ctx -> func_198534_a(ctx.getSource(), ctx.getArgument("structure_type", net.minecraft.util.ResourceLocation.class).toString().replace("minecraft:", ""))
+ )));
}
private static int func_198534_a(CommandSource p_198534_0_, String p_198534_1_) throws CommandSyntaxException {

View File

@ -1,398 +0,0 @@
--- a/net/minecraft/entity/Entity.java
+++ b/net/minecraft/entity/Entity.java
@@ -105,12 +105,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public abstract class Entity implements INameable, ICommandSource {
+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();
private static final AtomicInteger field_213331_b = new AtomicInteger();
private static final List<ItemStack> field_190535_b = Collections.emptyList();
private static final AxisAlignedBB field_174836_a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
private static double field_70155_l = 1.0D;
+ @Deprecated // Forge: Use the getter to allow overriding in mods
private final EntityType<?> field_200606_g;
private int field_145783_c = field_213331_b.incrementAndGet();
public boolean field_70156_m;
@@ -138,6 +139,7 @@
public boolean field_70132_H;
public boolean field_70133_I;
protected Vec3d field_213328_B = Vec3d.field_186680_a;
+ @Deprecated //Forge: Use isAlive, remove(boolean) and revive() instead of directly accessing this field. To allow the entity to react to and better control this information.
public boolean field_70128_L;
public float field_70141_P;
public float field_70140_Q;
@@ -196,6 +198,7 @@
private float field_213326_aJ;
public Entity(EntityType<?> p_i48580_1_, World p_i48580_2_) {
+ super(Entity.class);
this.field_200606_g = p_i48580_1_;
this.field_70170_p = p_i48580_2_;
this.field_213325_aI = p_i48580_1_.func_220334_j();
@@ -213,7 +216,9 @@
this.field_70180_af.func_187214_a(field_189655_aD, false);
this.field_70180_af.func_187214_a(field_213330_X, Pose.STANDING);
this.func_70088_a();
- this.field_213326_aJ = this.func_213316_a(Pose.STANDING, this.field_213325_aI);
+ this.field_213326_aJ = getEyeHeightForge(Pose.STANDING, this.field_213325_aI);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this));
+ this.gatherCapabilities();
}
@OnlyIn(Dist.CLIENT)
@@ -292,7 +297,7 @@
@OnlyIn(Dist.CLIENT)
protected void func_70065_x() {
if (this.field_70170_p != null) {
- for(double d0 = this.func_226278_cu_(); d0 > 0.0D && d0 < 256.0D; ++d0) {
+ for(double d0 = this.func_226278_cu_(); d0 > 0.0D && d0 < this.field_70170_p.func_201675_m().getHeight(); ++d0) {
this.func_70107_b(this.func_226277_ct_(), d0, this.func_226281_cx_());
if (this.field_70170_p.func_226669_j_(this)) {
break;
@@ -305,7 +310,13 @@
}
public void func_70106_y() {
+ this.remove(false);
+ }
+
+ public void remove(boolean keepData) {
this.field_70128_L = true;
+ if (!keepData)
+ this.invalidateCaps();
}
protected void func_213301_b(Pose p_213301_1_) {
@@ -323,6 +334,7 @@
public void func_70107_b(double p_70107_1_, double p_70107_3_, double p_70107_5_) {
this.func_226288_n_(p_70107_1_, p_70107_3_, p_70107_5_);
+ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K && field_70170_p instanceof ServerWorld) ((ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving.
float f = this.field_213325_aI.field_220315_a / 2.0F;
float f1 = this.field_213325_aI.field_220316_b;
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));
@@ -523,7 +535,7 @@
this.field_70140_Q = (float)((double)this.field_70140_Q + (double)MathHelper.func_76133_a(func_213296_b(vec3d)) * 0.6D);
this.field_82151_R = (float)((double)this.field_82151_R + (double)MathHelper.func_76133_a(d0 * d0 + d1 * d1 + d2 * d2) * 0.6D);
- if (this.field_82151_R > this.field_70150_b && !blockstate.func_196958_f()) {
+ if (this.field_82151_R > this.field_70150_b && !blockstate.isAir(this.field_70170_p, blockpos)) {
this.field_70150_b = this.func_203009_ad();
if (this.func_70090_H()) {
Entity entity = this.func_184207_aI() && this.func_184179_bs() != null ? this.func_184179_bs() : this;
@@ -538,7 +550,7 @@
} else {
this.func_180429_a(blockpos, blockstate);
}
- } else if (this.field_82151_R > this.field_191959_ay && this.func_191957_ae() && blockstate.func_196958_f()) {
+ } else if (this.field_82151_R > this.field_191959_ay && this.func_191957_ae() && blockstate.isAir(this.field_70170_p, blockpos)) {
this.field_191959_ay = this.func_191954_d(this.field_82151_R);
}
}
@@ -582,11 +594,10 @@
int j = MathHelper.func_76128_c(this.field_70163_u - (double)0.2F);
int k = MathHelper.func_76128_c(this.field_70161_v);
BlockPos blockpos = new BlockPos(i, j, k);
- if (this.field_70170_p.func_180495_p(blockpos).func_196958_f()) {
+ if (this.field_70170_p.func_175623_d(blockpos)) {
BlockPos blockpos1 = blockpos.func_177977_b();
BlockState blockstate = this.field_70170_p.func_180495_p(blockpos1);
- Block block = blockstate.func_177230_c();
- if (block.func_203417_a(BlockTags.field_219748_G) || block.func_203417_a(BlockTags.field_219757_z) || block instanceof FenceGateBlock) {
+ if (blockstate.collisionExtendsVertically(this.field_70170_p, blockpos1, this)) {
return blockpos1;
}
}
@@ -770,6 +781,7 @@
public void func_174829_m() {
AxisAlignedBB axisalignedbb = this.func_174813_aQ();
this.func_226288_n_((axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D, axisalignedbb.field_72338_b, (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D);
+ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K && field_70170_p instanceof ServerWorld) ((ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving.
}
protected SoundEvent func_184184_Z() {
@@ -822,7 +834,7 @@
protected void func_180429_a(BlockPos p_180429_1_, BlockState p_180429_2_) {
if (!p_180429_2_.func_185904_a().func_76224_d()) {
BlockState blockstate = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a());
- SoundType soundtype = blockstate.func_177230_c() == Blocks.field_150433_aE ? blockstate.func_215695_r() : p_180429_2_.func_215695_r();
+ SoundType soundtype = blockstate.func_177230_c() == Blocks.field_150433_aE ? blockstate.getSoundType(field_70170_p, p_180429_1_, this) : p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this);
this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b());
}
}
@@ -1019,9 +1031,10 @@
int k = MathHelper.func_76128_c(this.func_226281_cx_());
BlockPos blockpos = new BlockPos(i, j, k);
BlockState blockstate = this.field_70170_p.func_180495_p(blockpos);
+ if (!blockstate.addRunningEffects(field_70170_p, blockpos, this))
if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE) {
Vec3d vec3d = this.func_213322_ci();
- this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate), this.func_226277_ct_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vec3d.field_72450_a * -4.0D, 1.5D, vec3d.field_72449_c * -4.0D);
+ this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate).setPos(blockpos), this.func_226277_ct_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.func_226278_cu_() + 0.1D, this.func_226281_cx_() + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vec3d.field_72450_a * -4.0D, 1.5D, vec3d.field_72449_c * -4.0D);
}
}
@@ -1040,7 +1053,7 @@
return false;
} else {
IFluidState ifluidstate = this.field_70170_p.func_204610_c(blockpos);
- return ifluidstate.func_206884_a(p_213290_1_) && d0 < (double)((float)blockpos.func_177956_o() + ifluidstate.func_215679_a(this.field_70170_p, blockpos) + 0.11111111F);
+ return ifluidstate.isEntityInside(field_70170_p, blockpos, this, d0, p_213290_1_, true);
}
}
}
@@ -1330,6 +1343,7 @@
if (this.field_184238_ar) {
p_189511_1_.func_74757_a("Glowing", this.field_184238_ar);
}
+ p_189511_1_.func_74757_a("CanUpdate", canUpdate);
if (!this.field_184236_aF.isEmpty()) {
ListNBT listnbt = new ListNBT();
@@ -1341,6 +1355,10 @@
p_189511_1_.func_218657_a("Tags", listnbt);
}
+ CompoundNBT caps = serializeCaps();
+ if (caps != null) p_189511_1_.func_218657_a("ForgeCaps", caps);
+ if (persistentData != null) p_189511_1_.func_218657_a("ForgeData", persistentData);
+
this.func_213281_b(p_189511_1_);
if (this.func_184207_aI()) {
ListNBT listnbt1 = new ListNBT();
@@ -1409,6 +1427,9 @@
this.func_174810_b(p_70020_1_.func_74767_n("Silent"));
this.func_189654_d(p_70020_1_.func_74767_n("NoGravity"));
this.func_184195_f(p_70020_1_.func_74767_n("Glowing"));
+ if (p_70020_1_.func_150297_b("ForgeData", 10)) persistentData = p_70020_1_.func_74775_l("ForgeData");
+ if (p_70020_1_.func_150297_b("CanUpdate", 99)) this.canUpdate(p_70020_1_.func_74767_n("CanUpdate"));
+ if (p_70020_1_.func_150297_b("ForgeCaps", 10)) deserializeCaps(p_70020_1_.func_74775_l("ForgeCaps"));
if (p_70020_1_.func_150297_b("Tags", 9)) {
this.field_184236_aF.clear();
ListNBT listnbt1 = p_70020_1_.func_150295_c("Tags", 8);
@@ -1497,6 +1518,8 @@
} else {
ItemEntity itementity = new ItemEntity(this.field_70170_p, this.func_226277_ct_(), this.func_226278_cu_() + (double)p_70099_2_, this.func_226281_cx_(), p_70099_1_);
itementity.func_174869_p();
+ if (captureDrops() != null) captureDrops().add(itementity);
+ else
this.field_70170_p.func_217376_c(itementity);
return itementity;
}
@@ -1540,6 +1563,7 @@
public void func_70098_U() {
this.func_213317_d(Vec3d.field_186680_a);
+ if (canUpdate())
this.func_70071_h_();
if (this.func_184218_aH()) {
this.func_184187_bx().func_184232_k(this);
@@ -1584,6 +1608,7 @@
}
}
+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_184205_1_, true)) return false;
if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) {
if (this.func_184218_aH()) {
this.func_184210_p();
@@ -1615,6 +1640,7 @@
public void func_184210_p() {
if (this.field_184239_as != null) {
Entity entity = this.field_184239_as;
+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entity, false)) return;
this.field_184239_as = null;
entity.func_184225_p(this);
}
@@ -1771,6 +1797,7 @@
return !this.func_184188_bt().isEmpty();
}
+ @Deprecated //Forge: Use rider sensitive version
public boolean func_205710_ba() {
return true;
}
@@ -1989,7 +2016,7 @@
}
protected ITextComponent func_225513_by_() {
- return this.field_200606_g.func_212546_e();
+ return this.func_200600_R().func_212546_e(); // Forge: Use getter to allow overriding by mods
}
public boolean func_70028_i(Entity p_70028_1_) {
@@ -2046,6 +2073,11 @@
@Nullable
public Entity func_212321_a(DimensionType p_212321_1_) {
+ return this.changeDimension(p_212321_1_, func_184102_h().func_71218_a(p_212321_1_).func_85176_s());
+ }
+ @Nullable
+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) {
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_212321_1_)) return null;
if (!this.field_70170_p.field_72995_K && !this.field_70128_L) {
this.field_70170_p.func_217381_Z().func_76320_a("changeDimension");
MinecraftServer minecraftserver = this.func_184102_h();
@@ -2055,6 +2087,7 @@
this.field_71093_bK = p_212321_1_;
this.func_213319_R();
this.field_70170_p.func_217381_Z().func_76320_a("reposition");
+ Entity transportedEntity = teleporter.placeEntity(this, serverworld, serverworld1, this.field_70177_z, spawnPortal -> { //Forge: Start vanilla logic
Vec3d vec3d = this.func_213322_ci();
float f = 0.0F;
BlockPos blockpos;
@@ -2063,16 +2096,9 @@
} else if (p_212321_1_ == DimensionType.field_223229_c_) {
blockpos = serverworld1.func_180504_m();
} else {
- double d0 = this.func_226277_ct_();
- double d1 = this.func_226281_cx_();
- double d2 = 8.0D;
- if (dimensiontype == DimensionType.field_223227_a_ && p_212321_1_ == DimensionType.field_223228_b_) {
- d0 /= 8.0D;
- d1 /= 8.0D;
- } else if (dimensiontype == DimensionType.field_223228_b_ && p_212321_1_ == DimensionType.field_223227_a_) {
- d0 *= 8.0D;
- d1 *= 8.0D;
- }
+ double movementFactor = serverworld.func_201675_m().getMovementFactor() / serverworld1.func_201675_m().getMovementFactor();
+ double d0 = this.func_226277_ct_() * movementFactor;
+ double d1 = this.func_226281_cx_() * movementFactor;
double d3 = Math.min(-2.9999872E7D, serverworld1.func_175723_af().func_177726_b() + 16.0D);
double d4 = Math.min(-2.9999872E7D, serverworld1.func_175723_af().func_177736_c() + 16.0D);
@@ -2082,6 +2108,7 @@
d1 = MathHelper.func_151237_a(d1, d4, d6);
Vec3d vec3d1 = this.func_181014_aG();
blockpos = new BlockPos(d0, this.func_226278_cu_(), d1);
+ if (spawnPortal) {
BlockPattern.PortalInfo blockpattern$portalinfo = serverworld1.func_85176_s().func_222272_a(blockpos, vec3d, this.func_181012_aH(), vec3d1.field_72450_a, vec3d1.field_72448_b, this instanceof PlayerEntity);
if (blockpattern$portalinfo == null) {
return null;
@@ -2090,6 +2117,7 @@
blockpos = new BlockPos(blockpattern$portalinfo.field_222505_a);
vec3d = blockpattern$portalinfo.field_222506_b;
f = (float)blockpattern$portalinfo.field_222507_c;
+ }
}
this.field_70170_p.func_217381_Z().func_219895_b("reloading");
@@ -2100,13 +2128,15 @@
entity.func_213317_d(vec3d);
serverworld1.func_217460_e(entity);
}
+ return entity;
+ });//Forge: End vanilla logic
- this.field_70128_L = true;
+ this.remove(false);
this.field_70170_p.func_217381_Z().func_76319_b();
serverworld.func_82742_i();
serverworld1.func_82742_i();
this.field_70170_p.func_217381_Z().func_76319_b();
- return entity;
+ return transportedEntity;
} else {
return null;
}
@@ -2129,10 +2159,12 @@
}
public Vec3d func_181014_aG() {
+ if (this.field_181017_ao == null) return Vec3d.field_186680_a;
return this.field_181017_ao;
}
public Direction func_181012_aH() {
+ if (this.field_181018_ap == null) return Direction.NORTH;
return this.field_181018_ap;
}
@@ -2261,7 +2293,7 @@
Pose pose = this.func_213283_Z();
EntitySize entitysize1 = this.func_213305_a(pose);
this.field_213325_aI = entitysize1;
- this.field_213326_aJ = this.func_213316_a(pose, entitysize1);
+ this.field_213326_aJ = getEyeHeightForge(pose, entitysize1);
if (entitysize1.field_220315_a < entitysize.field_220315_a) {
double d0 = (double)entitysize1.field_220315_a / 2.0D;
this.func_174826_a(new AxisAlignedBB(this.func_226277_ct_() - d0, this.func_226278_cu_(), this.func_226281_cx_() - d0, this.func_226277_ct_() + d0, this.func_226278_cu_() + (double)entitysize1.field_220316_b, this.func_226281_cx_() + d0));
@@ -2713,6 +2745,7 @@
this.field_70165_t = p_226288_1_;
this.field_70163_u = p_226288_3_;
this.field_70161_v = p_226288_5_;
+ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K && !this.field_70128_L) this.field_70170_p.func_212866_a_((int) Math.floor(this.field_70165_t) >> 4, (int) Math.floor(this.field_70161_v) >> 4); // Forge - ensure target chunk is loaded.
}
public void func_70623_bb() {
@@ -2726,4 +2759,69 @@
public interface IMoveCallback {
void accept(Entity p_accept_1_, double p_accept_2_, double p_accept_4_, double p_accept_6_);
}
+
+ /* ================================== Forge Start =====================================*/
+
+ private boolean canUpdate = true;
+ @Override
+ public void canUpdate(boolean value) {
+ this.canUpdate = value;
+ }
+ @Override
+ public boolean canUpdate() {
+ return this.canUpdate;
+ }
+ private Collection<ItemEntity> captureDrops = null;
+ @Override
+ public Collection<ItemEntity> captureDrops() {
+ return captureDrops;
+ }
+ @Override
+ public Collection<ItemEntity> captureDrops(Collection<ItemEntity> value) {
+ Collection<ItemEntity> ret = captureDrops;
+ this.captureDrops = value;
+ return ret;
+ }
+ private CompoundNBT persistentData;
+ @Override
+ public CompoundNBT getPersistentData() {
+ if (persistentData == null)
+ persistentData = new CompoundNBT();
+ return persistentData;
+ }
+ @Override
+ public boolean canTrample(BlockState state, BlockPos pos, float fallDistance) {
+ return field_70170_p.field_73012_v.nextFloat() < fallDistance - 0.5F
+ && this instanceof LivingEntity
+ && (this instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(field_70170_p, this))
+ && this.func_213311_cf() * this.func_213311_cf() * this.func_213302_cg() > 0.512F;
+ }
+
+ /**
+ * Internal use for keeping track of entities that are tracked by a world, to
+ * allow guarantees that entity position changes will force a chunk load, avoiding
+ * potential issues with entity desyncing and bad chunk data.
+ */
+ private boolean isAddedToWorld;
+
+ @Override
+ public final boolean isAddedToWorld() { return this.isAddedToWorld; }
+
+ @Override
+ public void onAddedToWorld() { this.isAddedToWorld = true; }
+
+ @Override
+ public void onRemovedFromWorld() { this.isAddedToWorld = false; }
+
+ @Override
+ public void revive() {
+ this.field_70128_L = false;
+ this.reviveCaps();
+ }
+
+ private float getEyeHeightForge(Pose pose, EntitySize size) {
+ net.minecraftforge.event.entity.EntityEvent.EyeHeight evt = new net.minecraftforge.event.entity.EntityEvent.EyeHeight(this, pose, size, this.func_213316_a(pose, size));
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(evt);
+ return evt.getNewHeight();
+ }
}

View File

@ -1,20 +0,0 @@
--- a/net/minecraft/entity/EntityClassification.java
+++ b/net/minecraft/entity/EntityClassification.java
@@ -4,7 +4,7 @@
import java.util.Map;
import java.util.stream.Collectors;
-public enum EntityClassification {
+public enum EntityClassification implements net.minecraftforge.common.IExtensibleEnum {
MONSTER("monster", 70, false, false),
CREATURE("creature", 10, true, true),
AMBIENT("ambient", 15, true, false),
@@ -41,4 +41,8 @@
public boolean func_82705_e() {
return this.field_82707_i;
}
+
+ public static EntityClassification create(String name, String p_i50381_3_, int p_i50381_4_, boolean p_i50381_5_, boolean p_i50381_6_) {
+ throw new IllegalStateException("Enum not extended");
+ }
}

View File

@ -1,21 +0,0 @@
--- a/net/minecraft/entity/FlyingEntity.java
+++ b/net/minecraft/entity/FlyingEntity.java
@@ -28,15 +28,16 @@
this.func_213315_a(MoverType.SELF, this.func_213322_ci());
this.func_213317_d(this.func_213322_ci().func_186678_a(0.5D));
} else {
+ BlockPos ground = new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_());
float f = 0.91F;
if (this.field_70122_E) {
- f = this.field_70170_p.func_180495_p(new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_())).func_177230_c().func_208618_m() * 0.91F;
+ f = this.field_70170_p.func_180495_p(ground).getSlipperiness(this.field_70170_p, ground, this) * 0.91F;
}
float f1 = 0.16277137F / (f * f * f);
f = 0.91F;
if (this.field_70122_E) {
- f = this.field_70170_p.func_180495_p(new BlockPos(this.func_226277_ct_(), this.func_226278_cu_() - 1.0D, this.func_226281_cx_())).func_177230_c().func_208618_m() * 0.91F;
+ f = this.field_70170_p.func_180495_p(ground).getSlipperiness(this.field_70170_p, ground, this) * 0.91F;
}
this.func_213309_a(this.field_70122_E ? 0.1F * f1 : 0.02F, p_213352_1_);

View File

@ -1,530 +0,0 @@
--- a/net/minecraft/entity/LivingEntity.java
+++ b/net/minecraft/entity/LivingEntity.java
@@ -109,7 +109,12 @@
public abstract class LivingEntity extends Entity {
private static final UUID field_110156_b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
+ private static final UUID SLOW_FALLING_ID = UUID.fromString("A5B6CF2A-2F7C-31EF-9022-7C3E7D5E6ABA");
private static final AttributeModifier field_110157_c = (new AttributeModifier(field_110156_b, "Sprinting speed boost", (double)0.3F, AttributeModifier.Operation.MULTIPLY_TOTAL)).func_111168_a(false);
+ private static final AttributeModifier SLOW_FALLING = new AttributeModifier(SLOW_FALLING_ID, "Slow falling acceleration reduction", -0.07, AttributeModifier.Operation.ADDITION).func_111168_a(false); // Add -0.07 to 0.08 so we get the vanilla default of 0.01
+ public static final net.minecraft.entity.ai.attributes.IAttribute SWIM_SPEED = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.swimSpeed", 1.0D, 0.0D, 1024.0D).func_111112_a(true);
+ public static final net.minecraft.entity.ai.attributes.IAttribute NAMETAG_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.nameTagDistance", 64.0D, 0.0D, Float.MAX_VALUE).func_111112_a(true);
+ public static final net.minecraft.entity.ai.attributes.IAttribute ENTITY_GRAVITY = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.entity_gravity", 0.08D, -8.0D, 8.0D).func_111112_a(true);
protected static final DataParameter<Byte> field_184621_as = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187191_a);
private static final DataParameter<Float> field_184632_c = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187193_c);
private static final DataParameter<Integer> field_184633_f = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187192_b);
@@ -235,6 +240,9 @@
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_111263_d);
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188791_g);
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_189429_h);
+ this.func_110140_aT().func_111150_b(SWIM_SPEED);
+ this.func_110140_aT().func_111150_b(NAMETAG_DISTANCE);
+ this.func_110140_aT().func_111150_b(ENTITY_GRAVITY);
}
protected void func_184231_a(double p_184231_1_, boolean p_184231_3_, BlockState p_184231_4_, BlockPos p_184231_5_) {
@@ -244,9 +252,10 @@
if (!this.field_70170_p.field_72995_K && this.field_70143_R > 3.0F && p_184231_3_) {
float f = (float)MathHelper.func_76123_f(this.field_70143_R - 3.0F);
- if (!p_184231_4_.func_196958_f()) {
+ if (!p_184231_4_.isAir(field_70170_p, p_184231_5_)) {
double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D);
int i = (int)(150.0D * d0);
+ if (!p_184231_4_.addLandingEffects((ServerWorld)this.field_70170_p, p_184231_5_, p_184231_4_, this, i))
((ServerWorld)this.field_70170_p).func_195598_a(new BlockParticleData(ParticleTypes.field_197611_d, p_184231_4_), this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), i, 0.0D, 0.0D, 0.0D, (double)0.15F);
}
}
@@ -310,7 +319,7 @@
}
}
- if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() != null && !this.func_184187_bx().func_205710_ba()) {
+ if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() != null && !this.func_184187_bx().canBeRiddenInWater(this)) {
this.func_184210_p();
}
} else if (this.func_70086_ai() < this.func_205010_bg()) {
@@ -392,7 +401,7 @@
protected void func_70609_aI() {
++this.field_70725_aQ;
if (this.field_70725_aQ == 20) {
- this.func_70106_y();
+ this.remove(this instanceof net.minecraft.entity.player.ServerPlayerEntity); //Forge keep data until we revive player
for(int i = 0; i < 20; ++i) {
double d0 = this.field_70146_Z.nextGaussian() * 0.02D;
@@ -573,7 +582,7 @@
if (!effectinstance.func_76455_a(this, () -> {
this.func_70695_b(effectinstance, true);
})) {
- if (!this.field_70170_p.field_72995_K) {
+ if (!this.field_70170_p.field_72995_K && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionExpiryEvent(this, effectinstance))) {
iterator.remove();
this.func_70688_c(effectinstance);
}
@@ -623,8 +632,10 @@
this.func_82142_c(false);
} else {
Collection<EffectInstance> collection = this.field_70713_bf.values();
- this.field_70180_af.func_187227_b(field_184634_g, func_184593_a(collection));
- this.field_70180_af.func_187227_b(field_184633_f, PotionUtils.func_185181_a(collection));
+ net.minecraftforge.event.entity.living.PotionColorCalculationEvent event = new net.minecraftforge.event.entity.living.PotionColorCalculationEvent(this, PotionUtils.func_185181_a(collection), func_184593_a(collection), collection);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
+ this.field_70180_af.func_187227_b(field_184634_g, event.areParticlesHidden());
+ this.field_70180_af.func_187227_b(field_184633_f, event.getColor());
this.func_82142_c(this.func_70644_a(Effects.field_76441_p));
}
@@ -688,7 +699,9 @@
boolean flag;
for(flag = false; iterator.hasNext(); flag = true) {
- this.func_70688_c(iterator.next());
+ EffectInstance effect = iterator.next();
+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, effect))) continue;
+ this.func_70688_c(effect);
iterator.remove();
}
@@ -718,6 +731,7 @@
return false;
} else {
EffectInstance effectinstance = this.field_70713_bf.get(p_195064_1_.func_188419_a());
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionAddedEvent(this, effectinstance, p_195064_1_));
if (effectinstance == null) {
this.field_70713_bf.put(p_195064_1_.func_188419_a(), p_195064_1_);
this.func_70670_a(p_195064_1_);
@@ -732,6 +746,9 @@
}
public boolean func_70687_e(EffectInstance p_70687_1_) {
+ net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent event = new net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent(this, p_70687_1_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
+ if (event.getResult() != net.minecraftforge.eventbus.api.Event.Result.DEFAULT) return event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW;
if (this.func_70668_bt() == CreatureAttribute.field_223223_b_) {
Effect effect = p_70687_1_.func_188419_a();
if (effect == Effects.field_76428_l || effect == Effects.field_76436_u) {
@@ -752,6 +769,7 @@
}
public boolean func_195063_d(Effect p_195063_1_) {
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, p_195063_1_))) return false;
EffectInstance effectinstance = this.func_184596_c(p_195063_1_);
if (effectinstance != null) {
this.func_70688_c(effectinstance);
@@ -788,6 +806,8 @@
}
public void func_70691_i(float p_70691_1_) {
+ p_70691_1_ = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, p_70691_1_);
+ if (p_70691_1_ <= 0) return;
float f = this.func_110143_aJ();
if (f > 0.0F) {
this.func_70606_j(f + p_70691_1_);
@@ -804,6 +824,7 @@
}
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, p_70097_1_, p_70097_2_)) return false;
if (this.func_180431_b(p_70097_1_)) {
return false;
} else if (this.field_70170_p.field_72995_K) {
@@ -870,8 +891,8 @@
if (entity1 instanceof PlayerEntity) {
this.field_70718_bc = 100;
this.field_70717_bb = (PlayerEntity)entity1;
- } else if (entity1 instanceof WolfEntity) {
- WolfEntity wolfentity = (WolfEntity)entity1;
+ } else if (entity1 instanceof net.minecraft.entity.passive.TameableEntity) {
+ net.minecraft.entity.passive.TameableEntity wolfentity = (net.minecraft.entity.passive.TameableEntity)entity1;
if (wolfentity.func_70909_n()) {
this.field_70718_bc = 100;
LivingEntity livingentity = wolfentity.func_70902_q();
@@ -1053,6 +1074,7 @@
}
public void func_70645_a(DamageSource p_70645_1_) {
+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return;
if (!this.field_70128_L && !this.field_70729_aU) {
Entity entity = p_70645_1_.func_76346_g();
LivingEntity livingentity = this.func_94060_bK();
@@ -1084,10 +1106,10 @@
if (!this.field_70170_p.field_72995_K) {
boolean flag = false;
if (p_226298_1_ instanceof WitherEntity) {
- if (this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) {
+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) {
BlockPos blockpos = new BlockPos(this);
BlockState blockstate = Blocks.field_222388_bz.func_176223_P();
- if (this.field_70170_p.func_180495_p(blockpos).func_196958_f() && blockstate.func_196955_c(this.field_70170_p, blockpos)) {
+ if (this.field_70170_p.func_175623_d(blockpos) && blockstate.func_196955_c(this.field_70170_p, blockpos)) {
this.field_70170_p.func_180501_a(blockpos, blockstate, 3);
flag = true;
}
@@ -1104,13 +1126,10 @@
protected void func_213345_d(DamageSource p_213345_1_) {
Entity entity = p_213345_1_.func_76346_g();
- int i;
- if (entity instanceof PlayerEntity) {
- i = EnchantmentHelper.func_185283_h((LivingEntity)entity);
- } else {
- i = 0;
- }
+ int i = net.minecraftforge.common.ForgeHooks.getLootingLevel(this, entity, p_213345_1_);
+ this.captureDrops(new java.util.ArrayList<>());
+
boolean flag = this.field_70718_bc > 0;
if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e)) {
this.func_213354_a(p_213345_1_, flag);
@@ -1119,6 +1138,10 @@
this.func_213337_cE();
this.func_226294_cV_();
+
+ Collection<ItemEntity> drops = captureDrops(null);
+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_213345_1_, drops, i, field_70718_bc > 0))
+ drops.forEach(e -> field_70170_p.func_217376_c(e));
}
protected void func_213337_cE() {
@@ -1128,6 +1151,7 @@
if (!this.field_70170_p.field_72995_K && (this.func_70684_aJ() || this.field_70718_bc > 0 && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e))) {
int i = this.func_70693_a(this.field_70717_bb);
+ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.field_70717_bb, i);
while(i > 0) {
int j = ExperienceOrbEntity.func_70527_a(i);
i -= j;
@@ -1135,6 +1159,7 @@
}
}
+
}
protected void func_213333_a(DamageSource p_213333_1_, int p_213333_2_, boolean p_213333_3_) {
@@ -1148,7 +1173,8 @@
ResourceLocation resourcelocation = this.func_213346_cF();
LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(resourcelocation);
LootContext.Builder lootcontext$builder = this.func_213363_a(p_213354_2_, p_213354_1_);
- loottable.func_216120_b(lootcontext$builder.func_216022_a(LootParameterSets.field_216263_d), this::func_199701_a_);
+ LootContext ctx = lootcontext$builder.func_216022_a(LootParameterSets.field_216263_d);
+ loottable.func_216113_a(ctx).forEach(this::func_199701_a_);
}
protected LootContext.Builder func_213363_a(boolean p_213363_1_, DamageSource p_213363_2_) {
@@ -1161,6 +1187,9 @@
}
public void func_70653_a(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_) {
+ net.minecraftforge.event.entity.living.LivingKnockBackEvent event = net.minecraftforge.common.ForgeHooks.onLivingKnockBack(this, p_70653_1_, p_70653_2_, p_70653_3_, p_70653_5_);
+ if(event.isCanceled()) return;
+ p_70653_2_ = event.getStrength(); p_70653_3_ = event.getRatioX(); p_70653_5_ = event.getRatioZ();
if (!(this.field_70146_Z.nextDouble() < this.func_110148_a(SharedMonsterAttributes.field_111266_c).func_111126_e())) {
this.field_70160_al = true;
Vec3d vec3d = this.func_213322_ci();
@@ -1196,12 +1225,7 @@
return false;
} else {
BlockState blockstate = this.func_213339_cH();
- Block block = blockstate.func_177230_c();
- if (block != Blocks.field_150468_ap && block != Blocks.field_150395_bd && block != Blocks.field_222420_lI) {
- return block instanceof TrapDoorBlock && this.func_184604_a(new BlockPos(this), blockstate);
- } else {
- return true;
- }
+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(blockstate, field_70170_p, new BlockPos(this), this);
}
}
@@ -1225,6 +1249,11 @@
}
public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) {
+ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, p_225503_1_, p_225503_2_);
+ if (ret == null) return false;
+ p_225503_1_ = ret[0];
+ p_225503_2_ = ret[1];
+
boolean flag = super.func_225503_b_(p_225503_1_, p_225503_2_);
int i = this.func_225508_e_(p_225503_1_, p_225503_2_);
if (i > 0) {
@@ -1248,9 +1277,10 @@
int i = MathHelper.func_76128_c(this.func_226277_ct_());
int j = MathHelper.func_76128_c(this.func_226278_cu_() - (double)0.2F);
int k = MathHelper.func_76128_c(this.func_226281_cx_());
- BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k));
- if (!blockstate.func_196958_f()) {
- SoundType soundtype = blockstate.func_215695_r();
+ BlockPos pos = new BlockPos(i, j, k);
+ BlockState blockstate = this.field_70170_p.func_180495_p(pos);
+ if (!blockstate.isAir(this.field_70170_p, pos)) {
+ SoundType soundtype = blockstate.getSoundType(field_70170_p, pos, this);
this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F);
}
@@ -1319,6 +1349,8 @@
protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) {
if (!this.func_180431_b(p_70665_1_)) {
+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_);
+ if (p_70665_2_ <= 0) return;
p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_);
p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_);
float f2 = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F);
@@ -1328,10 +1360,11 @@
((ServerPlayerEntity)p_70665_1_.func_76346_g()).func_195067_a(Stats.field_212735_F, Math.round(f * 10.0F));
}
+ f2 = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, f2);
if (f2 != 0.0F) {
float f1 = this.func_110143_aJ();
- this.func_70606_j(f1 - f2);
this.func_110142_aN().func_94547_a(p_70665_1_, f1, f2);
+ this.func_70606_j(f1 - f2); // Forge: moved to fix MC-121048
this.func_110149_m(this.func_110139_bj() - f2);
}
}
@@ -1385,6 +1418,8 @@
}
public void func_226292_a_(Hand p_226292_1_, boolean p_226292_2_) {
+ ItemStack stack = this.func_184586_b(p_226292_1_);
+ if (!stack.func_190926_b() && stack.onEntitySwing(this)) return;
if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) {
this.field_110158_av = -1;
this.field_82175_bq = true;
@@ -1771,15 +1806,16 @@
}
this.field_70160_al = true;
+ net.minecraftforge.common.ForgeHooks.onLivingJump(this);
}
@OnlyIn(Dist.CLIENT)
protected void func_203010_cG() {
- this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)-0.04F, 0.0D));
+ this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)-0.04F * this.func_110148_a(SWIM_SPEED).func_111126_e(), 0.0D));
}
protected void func_180466_bG(Tag<Fluid> p_180466_1_) {
- this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F, 0.0D));
+ this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F * this.func_110148_a(SWIM_SPEED).func_111126_e(), 0.0D));
}
protected float func_189749_co() {
@@ -1789,11 +1825,15 @@
public void func_213352_e(Vec3d p_213352_1_) {
if (this.func_70613_aW() || this.func_184186_bw()) {
double d0 = 0.08D;
+ IAttributeInstance gravity = this.func_110148_a(ENTITY_GRAVITY);
boolean flag = this.func_213322_ci().field_72448_b <= 0.0D;
if (flag && this.func_70644_a(Effects.field_204839_B)) {
- d0 = 0.01D;
+ if (!gravity.func_180374_a(SLOW_FALLING)) gravity.func_111121_a(SLOW_FALLING);
this.field_70143_R = 0.0F;
+ } else if (gravity.func_180374_a(SLOW_FALLING)) {
+ gravity.func_111124_b(SLOW_FALLING);
}
+ d0 = gravity.func_111126_e();
if (!this.func_70090_H() || this instanceof PlayerEntity && ((PlayerEntity)this).field_71075_bZ.field_75100_b) {
if (!this.func_180799_ab() || this instanceof PlayerEntity && ((PlayerEntity)this).field_71075_bZ.field_75100_b) {
@@ -1842,7 +1882,7 @@
}
} else {
BlockPos blockpos = this.func_226270_aj_();
- float f5 = this.field_70170_p.func_180495_p(blockpos).func_177230_c().func_208618_m();
+ float f5 = this.field_70170_p.func_180495_p(blockpos).getSlipperiness(field_70170_p, blockpos, this);
float f7 = this.field_70122_E ? f5 * 0.91F : 0.91F;
this.func_213309_a(this.func_213335_r(f5), p_213352_1_);
this.func_213317_d(this.func_213362_f(this.func_213322_ci()));
@@ -1904,6 +1944,7 @@
f = 0.96F;
}
+ f1 *= (float)this.func_110148_a(SWIM_SPEED).func_111126_e();
this.func_213309_a(f1, p_213352_1_);
this.func_213315_a(MoverType.SELF, this.func_213322_ci());
Vec3d vec3d1 = this.func_213322_ci();
@@ -1979,6 +2020,7 @@
}
public void func_70071_h_() {
+ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return;
super.func_70071_h_();
this.func_184608_ct();
this.func_205014_p();
@@ -2022,7 +2064,9 @@
ItemStack itemstack1 = this.func_184582_a(equipmentslottype);
if (!ItemStack.func_77989_b(itemstack1, itemstack)) {
+ if (!itemstack1.equals(itemstack, true))
((ServerWorld)this.field_70170_p).func_72863_F().func_217218_b(this, new SEntityEquipmentPacket(this.func_145782_y(), equipmentslottype, itemstack1));
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent(this, equipmentslottype, itemstack, itemstack1));
if (!itemstack.func_190926_b()) {
this.func_110140_aT().func_111148_a(itemstack.func_111283_C(equipmentslottype));
}
@@ -2474,13 +2518,22 @@
private void func_184608_ct() {
if (this.func_184587_cr()) {
- if (ItemStack.func_185132_d(this.func_184586_b(this.func_184600_cs()), this.field_184627_bm)) {
+ ItemStack itemstack = this.func_184586_b(this.func_184600_cs());
+ if (net.minecraftforge.common.ForgeHooks.canContinueUsing(this.field_184627_bm, itemstack)) this.field_184627_bm = itemstack;
+ if (itemstack == this.field_184627_bm) {
+
+ if (!this.field_184627_bm.func_190926_b()) {
+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn);
+ if (field_184628_bn > 0)
+ field_184627_bm.onUsingTick(this, field_184628_bn);
+ }
+
this.field_184627_bm.func_222121_b(this.field_70170_p, this, this.func_184605_cv());
if (this.func_226299_p_()) {
this.func_226293_b_(this.field_184627_bm, 5);
}
- if (--this.field_184628_bn == 0 && !this.field_70170_p.field_72995_K && !this.field_184627_bm.func_222122_m()) {
+ if (--this.field_184628_bn <= 0 && !this.field_70170_p.field_72995_K && !this.field_184627_bm.func_222122_m()) {
this.func_71036_o();
}
} else {
@@ -2522,8 +2575,10 @@
public void func_184598_c(Hand p_184598_1_) {
ItemStack itemstack = this.func_184586_b(p_184598_1_);
if (!itemstack.func_190926_b() && !this.func_184587_cr()) {
+ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.func_77988_m());
+ if (duration <= 0) return;
this.field_184627_bm = itemstack;
- this.field_184628_bn = itemstack.func_77988_m();
+ this.field_184628_bn = duration;
if (!this.field_70170_p.field_72995_K) {
this.func_204802_c(1, true);
this.func_204802_c(2, p_184598_1_ == Hand.OFF_HAND);
@@ -2583,6 +2638,9 @@
vec3d1 = vec3d1.func_178789_a(-this.field_70125_A * ((float)Math.PI / 180F));
vec3d1 = vec3d1.func_178785_b(-this.field_70177_z * ((float)Math.PI / 180F));
vec3d1 = vec3d1.func_72441_c(this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_());
+ if (this.field_70170_p instanceof ServerWorld) //Forge: Fix MC-2518 spawnParticle is nooped on server, need to use server specific variant
+ ((ServerWorld)this.field_70170_p).func_195598_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, 1, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c, 0.0D);
+ else
this.field_70170_p.func_195594_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c);
}
@@ -2594,7 +2652,9 @@
} else {
if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) {
this.func_226293_b_(this.field_184627_bm, 16);
- this.func_184611_a(this.func_184600_cs(), this.field_184627_bm.func_77950_b(this.field_70170_p, this));
+ ItemStack copy = this.field_184627_bm.func_77946_l();
+ ItemStack stack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, copy, func_184605_cv(), this.field_184627_bm.func_77950_b(this.field_70170_p, this));
+ this.func_184611_a(this.func_184600_cs(), stack);
this.func_184602_cy();
}
@@ -2615,7 +2675,11 @@
public void func_184597_cx() {
if (!this.field_184627_bm.func_190926_b()) {
+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv())) {
+ ItemStack copy = this instanceof PlayerEntity ? field_184627_bm.func_77946_l() : null;
this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv());
+ if (copy != null && field_184627_bm.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem((PlayerEntity)this, copy, func_184600_cs());
+ }
if (this.field_184627_bm.func_222122_m()) {
this.func_184608_ct();
}
@@ -2772,16 +2836,16 @@
private boolean func_213359_p() {
return this.func_213374_dv().map((p_213347_1_) -> {
- return this.field_70170_p.func_180495_p(p_213347_1_).func_177230_c() instanceof BedBlock;
+ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, p_213347_1_);
}).orElse(false);
}
public void func_213366_dy() {
this.func_213374_dv().filter(this.field_70170_p::func_175667_e).ifPresent((p_213368_1_) -> {
BlockState blockstate = this.field_70170_p.func_180495_p(p_213368_1_);
- if (blockstate.func_177230_c() instanceof BedBlock) {
- this.field_70170_p.func_180501_a(p_213368_1_, blockstate.func_206870_a(BedBlock.field_176471_b, Boolean.valueOf(false)), 3);
- Vec3d vec3d = BedBlock.func_220172_a(this.func_200600_R(), this.field_70170_p, p_213368_1_, 0).orElseGet(() -> {
+ if (blockstate.isBed(this.field_70170_p, p_213368_1_, this)) {
+ blockstate.setBedOccupied(field_70170_p, p_213368_1_, this, false);
+ Vec3d vec3d = blockstate.getBedSpawnPosition(this.func_200600_R(), field_70170_p, p_213368_1_, this).orElseGet(()-> {
BlockPos blockpos = p_213368_1_.func_177984_a();
return new Vec3d((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.1D, (double)blockpos.func_177952_p() + 0.5D);
});
@@ -2797,7 +2861,9 @@
@OnlyIn(Dist.CLIENT)
public Direction func_213376_dz() {
BlockPos blockpos = this.func_213374_dv().orElse((BlockPos)null);
- return blockpos != null ? BedBlock.func_220174_a(this.field_70170_p, blockpos) : null;
+ if (blockpos == null) return Direction.UP;
+ BlockState state = this.field_70170_p.func_180495_p(blockpos);
+ return !state.isBed(field_70170_p, blockpos, this) ? Direction.UP : state.getBedDirection(field_70170_p, blockpos);
}
public boolean func_70094_T() {
@@ -2866,4 +2932,58 @@
public void func_213334_d(Hand p_213334_1_) {
this.func_213361_c(p_213334_1_ == Hand.MAIN_HAND ? EquipmentSlotType.MAINHAND : EquipmentSlotType.OFFHAND);
}
+
+ /* ==== FORGE START ==== */
+ /***
+ * Removes all potion effects that have curativeItem as a curative item for its effect
+ * @param curativeItem The itemstack we are using to cure potion effects
+ */
+ public boolean curePotionEffects(ItemStack curativeItem) {
+ if (this.field_70170_p.field_72995_K)
+ return false;
+ boolean ret = false;
+ Iterator<EffectInstance> itr = this.field_70713_bf.values().iterator();
+ while (itr.hasNext()) {
+ EffectInstance effect = itr.next();
+ if (effect.isCurativeItem(curativeItem) && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, effect))) {
+ this.func_70688_c(effect);
+ itr.remove();
+ ret = true;
+ this.field_70752_e = true;
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted.
+ * currently only used in vanilla code by pigs.
+ *
+ * @param player The player who is riding the entity.
+ * @return If the player should orient the same direction as this entity.
+ */
+ public boolean shouldRiderFaceForward(PlayerEntity player) {
+ return this instanceof net.minecraft.entity.passive.PigEntity;
+ }
+
+ private final net.minecraftforge.common.util.LazyOptional<?>[] handlers = net.minecraftforge.items.wrapper.EntityEquipmentInvWrapper.create(this);
+
+ @Override
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
+ if (facing == null) return handlers[2].cast();
+ else if (facing.func_176740_k().func_200128_b()) return handlers[0].cast();
+ else if (facing.func_176740_k().func_176722_c()) return handlers[1].cast();
+ }
+ return super.getCapability(capability, facing);
+ }
+
+ @Override
+ public void remove(boolean keepData) {
+ super.remove(keepData);
+ if (!keepData) {
+ for (int x = 0; x < handlers.length; x++)
+ handlers[x].invalidate();
+ }
+ }
}

View File

@ -1,65 +0,0 @@
--- a/net/minecraft/entity/MobEntity.java
+++ b/net/minecraft/entity/MobEntity.java
@@ -176,6 +176,7 @@
public void func_70624_b(@Nullable LivingEntity p_70624_1_) {
this.field_70696_bz = p_70624_1_;
+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_);
}
public boolean func_213358_a(EntityType<?> p_213358_1_) {
@@ -460,7 +461,7 @@
public void func_70636_d() {
super.func_70636_d();
this.field_70170_p.func_217381_Z().func_76320_a("looting");
- if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && this.func_70089_S() && !this.field_70729_aU && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) {
+ if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && this.func_70089_S() && !this.field_70729_aU && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) {
for(ItemEntity itementity : this.field_70170_p.func_217357_a(ItemEntity.class, this.func_174813_aQ().func_72314_b(1.0D, 0.0D, 1.0D))) {
if (!itementity.field_70128_L && !itementity.func_92059_d().func_190926_b() && !itementity.func_174874_s()) {
this.func_175445_a(itementity);
@@ -556,6 +557,14 @@
this.func_70106_y();
} else if (!this.func_104002_bU() && !this.func_213392_I()) {
Entity entity = this.field_70170_p.func_217362_a(this, -1.0D);
+ net.minecraftforge.eventbus.api.Event.Result result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this);
+ if (result == net.minecraftforge.eventbus.api.Event.Result.DENY) {
+ field_70708_bq = 0;
+ entity = null;
+ } else if (result == net.minecraftforge.eventbus.api.Event.Result.ALLOW) {
+ this.func_70106_y();
+ entity = null;
+ }
if (entity != null) {
double d0 = entity.func_70068_e(this);
if (d0 > 16384.0D && this.func_213397_c(d0)) {
@@ -791,6 +800,8 @@
}
public static EquipmentSlotType func_184640_d(ItemStack p_184640_0_) {
+ final EquipmentSlotType slot = p_184640_0_.getEquipmentSlot();
+ if (slot != null) return slot; // FORGE: Allow modders to set a non-default equipment slot for a stack; e.g. a non-armor chestplate-slot item
Item item = p_184640_0_.func_77973_b();
if (item != Blocks.field_196625_cS.func_199767_j() && (!(item instanceof BlockItem) || !(((BlockItem)item).func_179223_d() instanceof AbstractSkullBlock))) {
if (item instanceof ArmorItem) {
@@ -798,7 +809,7 @@
} else if (item == Items.field_185160_cR) {
return EquipmentSlotType.CHEST;
} else {
- return item == Items.field_185159_cQ ? EquipmentSlotType.OFFHAND : EquipmentSlotType.MAINHAND;
+ return p_184640_0_.isShield(null) ? EquipmentSlotType.OFFHAND : EquipmentSlotType.MAINHAND;
}
} else {
return EquipmentSlotType.HEAD;
@@ -1178,10 +1189,10 @@
PlayerEntity playerentity = (PlayerEntity)p_70652_1_;
ItemStack itemstack = this.func_184614_ca();
ItemStack itemstack1 = playerentity.func_184587_cr() ? playerentity.func_184607_cu() : ItemStack.field_190927_a;
- if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.func_77973_b() instanceof AxeItem && itemstack1.func_77973_b() == Items.field_185159_cQ) {
+ if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.canDisableShield(itemstack1, playerentity, this) && itemstack1.isShield(playerentity)) {
float f2 = 0.25F + (float)EnchantmentHelper.func_185293_e(this) * 0.05F;
if (this.field_70146_Z.nextFloat() < f2) {
- playerentity.func_184811_cZ().func_185145_a(Items.field_185159_cQ, 100);
+ playerentity.func_184811_cZ().func_185145_a(itemstack.func_77973_b(), 100);
this.field_70170_p.func_72960_a(playerentity, (byte)30);
}
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/entity/SharedMonsterAttributes.java
+++ b/net/minecraft/entity/SharedMonsterAttributes.java
@@ -15,7 +15,7 @@
public class SharedMonsterAttributes {
private static final Logger field_151476_f = LogManager.getLogger();
- public static final IAttribute field_111267_a = (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)).func_111117_a("Max Health").func_111112_a(true);
+ public static final IAttribute field_111267_a = (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, Float.MIN_VALUE, 1024.0D)).func_111117_a("Max Health").func_111112_a(true); // Forge: set smallest max-health value to fix MC-119183. This gets rounded to float so we use the smallest positive float value.
public static final IAttribute field_111265_b = (new RangedAttribute((IAttribute)null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).func_111117_a("Follow Range");
public static final IAttribute field_111266_c = (new RangedAttribute((IAttribute)null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).func_111117_a("Knockback Resistance");
public static final IAttribute field_111263_d = (new RangedAttribute((IAttribute)null, "generic.movementSpeed", (double)0.7F, 0.0D, 1024.0D)).func_111117_a("Movement Speed").func_111112_a(true);

View File

@ -1,55 +0,0 @@
--- a/net/minecraft/entity/passive/MooshroomEntity.java
+++ b/net/minecraft/entity/passive/MooshroomEntity.java
@@ -33,7 +33,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.commons.lang3.tuple.Pair;
-public class MooshroomEntity extends CowEntity {
+public class MooshroomEntity extends CowEntity implements net.minecraftforge.common.IShearable {
private static final DataParameter<String> field_213449_bz = EntityDataManager.func_187226_a(MooshroomEntity.class, DataSerializers.field_187194_d);
private Effect field_213450_bA;
private int field_213447_bB;
@@ -97,7 +97,7 @@
this.func_184185_a(soundevent, 1.0F, 1.0F);
return true;
- } else if (itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70631_g_()) {
+ } else if (false && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70631_g_()) { //Forge: Moved to onSheared
this.field_70170_p.func_195594_a(ParticleTypes.field_197627_t, this.func_226277_ct_(), this.func_226283_e_(0.5D), this.func_226281_cx_(), 0.0D, 0.0D, 0.0D);
if (!this.field_70170_p.field_72995_K) {
this.func_70106_y();
@@ -209,6 +209,34 @@
return mooshroomentity$type2;
}
+ @Override
+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, net.minecraft.util.math.BlockPos pos) {
+ return !this.func_70631_g_();
+ }
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, net.minecraft.util.math.BlockPos pos, int fortune) {
+ java.util.List<ItemStack> ret = new java.util.ArrayList<>();
+ this.field_70170_p.func_195594_a(ParticleTypes.field_197627_t, this.func_226277_ct_(), this.func_226283_e_(0.5D), this.func_226281_cx_(), 0.0D, 0.0D, 0.0D);
+ if (!this.field_70170_p.field_72995_K) {
+ this.func_70106_y();
+ CowEntity cowentity = EntityType.field_200796_j.func_200721_a(this.field_70170_p);
+ cowentity.func_70012_b(this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), this.field_70177_z, this.field_70125_A);
+ cowentity.func_70606_j(this.func_110143_aJ());
+ cowentity.field_70761_aq = this.field_70761_aq;
+ if (this.func_145818_k_()) {
+ cowentity.func_200203_b(this.func_200201_e());
+ cowentity.func_174805_g(this.func_174833_aM());
+ }
+ this.field_70170_p.func_217376_c(cowentity);
+ for(int i = 0; i < 5; ++i) {
+ ret.add(new ItemStack(this.func_213444_dV().field_221099_d.func_177230_c()));
+ }
+ this.func_184185_a(SoundEvents.field_187784_dt, 1.0F, 1.0F);
+ }
+ return ret;
+ }
+
public static enum Type {
RED("red", Blocks.field_150337_Q.func_176223_P()),
BROWN("brown", Blocks.field_150338_P.func_176223_P());

View File

@ -1,53 +0,0 @@
--- a/net/minecraft/entity/passive/SheepEntity.java
+++ b/net/minecraft/entity/passive/SheepEntity.java
@@ -55,7 +55,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class SheepEntity extends AnimalEntity {
+public class SheepEntity extends AnimalEntity implements net.minecraftforge.common.IShearable {
private static final DataParameter<Byte> field_184774_bv = EntityDataManager.func_187226_a(SheepEntity.class, DataSerializers.field_187191_a);
private static final Map<DyeColor, IItemProvider> field_200206_bz = Util.func_200696_a(Maps.newEnumMap(DyeColor.class), (p_203402_0_) -> {
p_203402_0_.put(DyeColor.WHITE, Blocks.field_196556_aL);
@@ -212,7 +212,7 @@
public boolean func_184645_a(PlayerEntity p_184645_1_, Hand p_184645_2_) {
ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_);
- if (itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) {
+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) { //Forge: Moved to onSheared
this.func_213612_dV();
if (!this.field_70170_p.field_72995_K) {
itemstack.func_222118_a(1, p_184645_1_, (p_213613_1_) -> {
@@ -226,6 +226,7 @@
}
}
+ @Deprecated //Forge: Use Shearable interface
public void func_213612_dV() {
if (!this.field_70170_p.field_72995_K) {
this.func_70893_e(true);
@@ -354,4 +355,24 @@
protected float func_213348_b(Pose p_213348_1_, EntitySize p_213348_2_) {
return 0.95F * p_213348_2_.field_220316_b;
}
+
+ @Override
+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return !this.func_70892_o() && !this.func_70631_g_();
+ }
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
+ java.util.List<ItemStack> ret = new java.util.ArrayList<>();
+ if (!this.field_70170_p.field_72995_K) {
+ this.func_70893_e(true);
+ int i = 1 + this.field_70146_Z.nextInt(3);
+
+ for(int j = 0; j < i; ++j) {
+ ret.add(new ItemStack(field_200206_bz.get(this.func_175509_cj())));
+ }
+ }
+ this.func_184185_a(SoundEvents.field_187763_eJ, 1.0F, 1.0F);
+ return ret;
+ }
}

View File

@ -1,54 +0,0 @@
--- a/net/minecraft/entity/passive/SnowGolemEntity.java
+++ b/net/minecraft/entity/passive/SnowGolemEntity.java
@@ -33,7 +33,7 @@
import net.minecraft.world.GameRules;
import net.minecraft.world.World;
-public class SnowGolemEntity extends GolemEntity implements IRangedAttackMob {
+public class SnowGolemEntity extends GolemEntity implements IRangedAttackMob, net.minecraftforge.common.IShearable {
private static final DataParameter<Byte> field_184749_a = EntityDataManager.func_187226_a(SnowGolemEntity.class, DataSerializers.field_187191_a);
public SnowGolemEntity(EntityType<? extends SnowGolemEntity> p_i50244_1_, World p_i50244_2_) {
@@ -88,7 +88,7 @@
this.func_70097_a(DamageSource.field_76370_b, 1.0F);
}
- if (!this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) {
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) {
return;
}
@@ -99,7 +99,7 @@
j = MathHelper.func_76128_c(this.func_226278_cu_());
k = MathHelper.func_76128_c(this.func_226281_cx_() + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F));
BlockPos blockpos = new BlockPos(i, j, k);
- if (this.field_70170_p.func_180495_p(blockpos).func_196958_f() && this.field_70170_p.func_226691_t_(blockpos).func_225486_c(blockpos) < 0.8F && blockstate.func_196955_c(this.field_70170_p, blockpos)) {
+ if (this.field_70170_p.func_175623_d(blockpos) && this.field_70170_p.func_226691_t_(blockpos).func_225486_c(blockpos) < 0.8F && blockstate.func_196955_c(this.field_70170_p, blockpos)) {
this.field_70170_p.func_175656_a(blockpos, blockstate);
}
}
@@ -125,7 +125,7 @@
protected boolean func_184645_a(PlayerEntity p_184645_1_, Hand p_184645_2_) {
ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_);
- if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o()) {
+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o()) { //Forge: Moved to onSheared
if (!this.field_70170_p.field_72995_K) {
this.func_184747_a(false);
itemstack.func_222118_a(1, p_184645_1_, (p_213622_1_) -> {
@@ -167,4 +167,15 @@
protected SoundEvent func_184615_bR() {
return SoundEvents.field_187801_fC;
}
+
+ @Override
+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return this.func_184748_o();
+ }
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
+ this.func_184747_a(false);
+ return new java.util.ArrayList<>();
+ }
}

View File

@ -1,20 +0,0 @@
--- a/net/minecraft/entity/projectile/AbstractArrowEntity.java
+++ b/net/minecraft/entity/projectile/AbstractArrowEntity.java
@@ -160,7 +160,7 @@
BlockPos blockpos = new BlockPos(this);
BlockState blockstate = this.field_70170_p.func_180495_p(blockpos);
- if (!blockstate.func_196958_f() && !flag) {
+ if (!blockstate.isAir(this.field_70170_p, blockpos) && !flag) {
VoxelShape voxelshape = blockstate.func_196952_d(this.field_70170_p, blockpos);
if (!voxelshape.func_197766_b()) {
Vec3d vec3d1 = this.func_213303_ch();
@@ -218,7 +218,7 @@
}
}
- if (raytraceresult != null && !flag) {
+ if (raytraceresult != null && raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
this.func_184549_a(raytraceresult);
this.field_70160_al = true;
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/entity/projectile/DamagingProjectileEntity.java
+++ b/net/minecraft/entity/projectile/DamagingProjectileEntity.java
@@ -81,7 +81,7 @@
++this.field_70234_an;
RayTraceResult raytraceresult = ProjectileHelper.func_221266_a(this, true, this.field_70234_an >= 25, this.field_70235_a, RayTraceContext.BlockMode.COLLIDER);
- if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) {
+ if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
this.func_70227_a(raytraceresult);
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/entity/projectile/FireballEntity.java
+++ b/net/minecraft/entity/projectile/FireballEntity.java
@@ -38,7 +38,7 @@
this.func_174815_a(this.field_70235_a, entity);
}
- boolean flag = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b);
+ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a);
this.field_70170_p.func_217398_a((Entity)null, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), (float)this.field_92057_e, flag, flag ? Explosion.Mode.DESTROY : Explosion.Mode.NONE);
this.func_70106_y();
}

View File

@ -1,76 +0,0 @@
--- a/net/minecraft/entity/projectile/FishingBobberEntity.java
+++ b/net/minecraft/entity/projectile/FishingBobberEntity.java
@@ -207,8 +207,8 @@
private boolean func_190625_o() {
ItemStack itemstack = this.field_146042_b.func_184614_ca();
ItemStack itemstack1 = this.field_146042_b.func_184592_cb();
- boolean flag = itemstack.func_77973_b() == Items.field_151112_aM;
- boolean flag1 = itemstack1.func_77973_b() == Items.field_151112_aM;
+ boolean flag = itemstack.func_77973_b() instanceof net.minecraft.item.FishingRodItem;
+ boolean flag1 = itemstack1.func_77973_b() instanceof net.minecraft.item.FishingRodItem;
if (!this.field_146042_b.field_70128_L && this.field_146042_b.func_70089_S() && (flag || flag1) && !(this.func_70068_e(this.field_146042_b) > 1024.0D)) {
return false;
} else {
@@ -292,7 +292,7 @@
double d1 = (double)((float)MathHelper.func_76128_c(this.func_226278_cu_()) + 1.0F);
double d2 = this.func_226281_cx_() + (double)(f2 * (float)this.field_146038_az * 0.1F);
Block block = serverworld.func_180495_p(new BlockPos(d0, d1 - 1.0D, d2)).func_177230_c();
- if (block == Blocks.field_150355_j) {
+ if (serverworld.func_180495_p(new BlockPos((int)d0, (int)d1 - 1, (int)d2)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) {
if (this.field_70146_Z.nextFloat() < 0.15F) {
serverworld.func_195598_a(ParticleTypes.field_197612_e, d0, d1 - (double)0.1F, d2, 1, (double)f1, 0.1D, (double)f2, 0.0D);
}
@@ -329,7 +329,7 @@
double d5 = (double)((float)MathHelper.func_76128_c(this.func_226278_cu_()) + 1.0F);
double d6 = this.func_226281_cx_() + (double)(MathHelper.func_76134_b(f6) * f7 * 0.1F);
Block block1 = serverworld.func_180495_p(new BlockPos(d4, d5 - 1.0D, d6)).func_177230_c();
- if (block1 == Blocks.field_150355_j) {
+ if (serverworld.func_180495_p(new BlockPos(d4, d5 - 1.0D, d6)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) {
serverworld.func_195598_a(ParticleTypes.field_218422_X, d4, d5, d6, 2 + this.field_70146_Z.nextInt(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D);
}
}
@@ -354,6 +354,7 @@
public int func_146034_e(ItemStack p_146034_1_) {
if (!this.field_70170_p.field_72995_K && this.field_146042_b != null) {
int i = 0;
+ net.minecraftforge.event.entity.player.ItemFishedEvent event = null;
if (this.field_146043_c != null) {
this.func_184527_k();
CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)this.field_146042_b, p_146034_1_, this, Collections.emptyList());
@@ -361,8 +362,15 @@
i = this.field_146043_c instanceof ItemEntity ? 3 : 5;
} else if (this.field_146045_ax > 0) {
LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, new BlockPos(this)).func_216015_a(LootParameters.field_216289_i, p_146034_1_).func_216023_a(this.field_70146_Z).func_186469_a((float)this.field_191518_aw + this.field_146042_b.func_184817_da());
+ lootcontext$builder.func_216015_a(LootParameters.field_216284_d, this.field_146042_b).func_216015_a(LootParameters.field_216281_a, this);
LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(LootTables.field_186387_al);
List<ItemStack> list = loottable.func_216113_a(lootcontext$builder.func_216022_a(LootParameterSets.field_216262_c));
+ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.field_146051_au ? 2 : 1, this);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
+ if (event.isCanceled()) {
+ this.func_70106_y();
+ return event.getRodDamage();
+ }
CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)this.field_146042_b, p_146034_1_, this, list);
for(ItemStack itemstack : list) {
@@ -387,7 +395,7 @@
}
this.func_70106_y();
- return i;
+ return event == null ? i : event.getRodDamage();
} else {
return 0;
}
@@ -413,8 +421,9 @@
return false;
}
- public void func_70106_y() {
- super.func_70106_y();
+ @Override
+ public void remove(boolean keepData) {
+ super.remove(keepData);
if (this.field_146042_b != null) {
this.field_146042_b.field_71104_cf = null;
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/entity/projectile/LlamaSpitEntity.java
+++ b/net/minecraft/entity/projectile/LlamaSpitEntity.java
@@ -57,7 +57,7 @@
RayTraceResult raytraceresult = ProjectileHelper.func_221267_a(this, this.func_174813_aQ().func_216361_a(vec3d).func_186662_g(1.0D), (p_213879_1_) -> {
return !p_213879_1_.func_175149_v() && p_213879_1_ != this.field_190539_a;
}, RayTraceContext.BlockMode.OUTLINE, true);
- if (raytraceresult != null) {
+ if (raytraceresult != null && raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
this.func_190536_a(raytraceresult);
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/entity/projectile/ProjectileHelper.java
+++ b/net/minecraft/entity/projectile/ProjectileHelper.java
@@ -86,7 +86,7 @@
Vec3d vec3d1 = optional.get();
double d1 = p_221273_1_.func_72436_e(vec3d1);
if (d1 < d0 || d0 == 0.0D) {
- if (entity1.func_184208_bv() == p_221273_0_.func_184208_bv()) {
+ if (entity1.func_184208_bv() == p_221273_0_.func_184208_bv() && !entity1.canRiderInteract()) {
if (d0 == 0.0D) {
entity = entity1;
vec3d = vec3d1;

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/entity/projectile/ShulkerBulletEntity.java
+++ b/net/minecraft/entity/projectile/ShulkerBulletEntity.java
@@ -255,7 +255,7 @@
}
RayTraceResult raytraceresult = ProjectileHelper.func_221266_a(this, true, false, this.field_184570_a, RayTraceContext.BlockMode.COLLIDER);
- if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) {
+ if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
this.func_184567_a(raytraceresult);
}
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/entity/projectile/SmallFireballEntity.java
+++ b/net/minecraft/entity/projectile/SmallFireballEntity.java
@@ -41,7 +41,7 @@
entity.func_223308_g(i);
}
}
- } else if (this.field_70235_a == null || !(this.field_70235_a instanceof MobEntity) || this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b)) {
+ } else if (this.field_70235_a == null || !(this.field_70235_a instanceof MobEntity) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a)) {
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)p_70227_1_;
BlockPos blockpos = blockraytraceresult.func_216350_a().func_177972_a(blockraytraceresult.func_216354_b());
if (this.field_70170_p.func_175623_d(blockpos)) {

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/entity/projectile/ThrowableEntity.java
+++ b/net/minecraft/entity/projectile/ThrowableEntity.java
@@ -130,7 +130,7 @@
if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) {
if (raytraceresult.func_216346_c() == RayTraceResult.Type.BLOCK && this.field_70170_p.func_180495_p(((BlockRayTraceResult)raytraceresult).func_216350_a()).func_177230_c() == Blocks.field_150427_aO) {
this.func_181015_d(((BlockRayTraceResult)raytraceresult).func_216350_a());
- } else {
+ } else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)){
this.func_70184_a(raytraceresult);
}
}

View File

@ -1,20 +0,0 @@
--- a/net/minecraft/entity/projectile/WitherSkullEntity.java
+++ b/net/minecraft/entity/projectile/WitherSkullEntity.java
@@ -48,7 +48,7 @@
}
public float func_180428_a(Explosion p_180428_1_, IBlockReader p_180428_2_, BlockPos p_180428_3_, BlockState p_180428_4_, IFluidState p_180428_5_, float p_180428_6_) {
- return this.func_82342_d() && WitherEntity.func_181033_a(p_180428_4_) ? Math.min(0.8F, p_180428_6_) : p_180428_6_;
+ return this.func_82342_d() && p_180428_4_.canEntityDestroy(p_180428_2_, p_180428_3_, this) ? Math.min(0.8F, p_180428_6_) : p_180428_6_;
}
protected void func_70227_a(RayTraceResult p_70227_1_) {
@@ -82,7 +82,7 @@
}
}
- Explosion.Mode explosion$mode = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE;
+ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE;
this.field_70170_p.func_217398_a(this, this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), 1.0F, false, explosion$mode);
this.func_70106_y();
}

View File

@ -1,38 +0,0 @@
--- a/net/minecraft/fluid/Fluid.java
+++ b/net/minecraft/fluid/Fluid.java
@@ -18,7 +18,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public abstract class Fluid {
+public abstract class Fluid extends net.minecraftforge.registries.ForgeRegistryEntry<Fluid> implements net.minecraftforge.common.extensions.IForgeFluid {
public static final ObjectIntIdentityMap<IFluidState> field_207201_d = new ObjectIntIdentityMap<>();
protected final StateContainer<Fluid, IFluidState> field_207202_e;
private IFluidState field_207200_b;
@@ -98,4 +98,26 @@
}
public abstract VoxelShape func_215664_b(IFluidState p_215664_1_, IBlockReader p_215664_2_, BlockPos p_215664_3_);
+
+ private final net.minecraftforge.common.util.ReverseTagWrapper<Fluid> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.FluidTags::getGeneration, net.minecraft.tags.FluidTags::func_226157_a_);
+ @Override
+ public java.util.Set<net.minecraft.util.ResourceLocation> getTags() {
+ return reverseTags.getTagNames();
+ }
+
+ /**
+ * Creates the fluid attributes object, which will contain all the extended values for the fluid that aren't part of the vanilla system.
+ * Do not call this from outside. To retrieve the values use {@link Fluid#getAttributes()}
+ */
+ protected net.minecraftforge.fluids.FluidAttributes createAttributes()
+ {
+ return net.minecraftforge.common.ForgeHooks.createVanillaFluidAttributes(this);
+ }
+
+ private net.minecraftforge.fluids.FluidAttributes forgeFluidAttributes;
+ public final net.minecraftforge.fluids.FluidAttributes getAttributes() {
+ if (forgeFluidAttributes == null)
+ forgeFluidAttributes = createAttributes();
+ return forgeFluidAttributes;
+ }
}

View File

@ -1,19 +0,0 @@
--- a/net/minecraft/fluid/IFluidState.java
+++ b/net/minecraft/fluid/IFluidState.java
@@ -26,7 +26,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public interface IFluidState extends IStateHolder<IFluidState> {
+public interface IFluidState extends IStateHolder<IFluidState>, net.minecraftforge.common.extensions.IForgeFluidState {
Fluid func_206886_c();
default boolean func_206889_d() {
@@ -99,6 +99,7 @@
return this.func_206886_c().func_207185_a(p_206884_1_);
}
+ @Deprecated //Forge: Use more sensitive version.
default float func_210200_l() {
return this.func_206886_c().func_210195_d();
}

View File

@ -1,29 +0,0 @@
--- a/net/minecraft/fluid/LavaFluid.java
+++ b/net/minecraft/fluid/LavaFluid.java
@@ -70,7 +70,7 @@
BlockState blockstate = p_207186_1_.func_180495_p(blockpos);
if (blockstate.func_196958_f()) {
if (this.func_176369_e(p_207186_1_, blockpos)) {
- p_207186_1_.func_175656_a(blockpos, Blocks.field_150480_ab.func_176223_P());
+ p_207186_1_.func_175656_a(blockpos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_207186_1_, blockpos, p_207186_2_, Blocks.field_150480_ab.func_176223_P()));
return;
}
} else if (blockstate.func_185904_a().func_76230_c()) {
@@ -85,7 +85,7 @@
}
if (p_207186_1_.func_175623_d(blockpos1.func_177984_a()) && this.func_176368_m(p_207186_1_, blockpos1)) {
- p_207186_1_.func_175656_a(blockpos1.func_177984_a(), Blocks.field_150480_ab.func_176223_P());
+ p_207186_1_.func_175656_a(blockpos1.func_177984_a(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_207186_1_, blockpos1.func_177984_a(), p_207186_2_, Blocks.field_150480_ab.func_176223_P()));
}
}
}
@@ -163,7 +163,7 @@
IFluidState ifluidstate = p_205574_1_.func_204610_c(p_205574_2_);
if (this.func_207185_a(FluidTags.field_206960_b) && ifluidstate.func_206884_a(FluidTags.field_206959_a)) {
if (p_205574_3_.func_177230_c() instanceof FlowingFluidBlock) {
- p_205574_1_.func_180501_a(p_205574_2_, Blocks.field_150348_b.func_176223_P(), 3);
+ p_205574_1_.func_180501_a(p_205574_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_205574_1_, p_205574_2_, p_205574_2_, Blocks.field_150348_b.func_176223_P()), 3);
}
this.func_205581_a(p_205574_1_, p_205574_2_);

View File

@ -1,60 +0,0 @@
--- a/net/minecraft/network/NetworkManager.java
+++ b/net/minecraft/network/NetworkManager.java
@@ -74,6 +74,7 @@
private float field_211397_t;
private int field_211398_u;
private boolean field_211399_v;
+ private java.util.function.Consumer<NetworkManager> activationHandler;
public NetworkManager(PacketDirection p_i46004_1_) {
this.field_179294_g = p_i46004_1_;
@@ -83,6 +84,7 @@
super.channelActive(p_channelActive_1_);
this.field_150746_k = p_channelActive_1_.channel();
this.field_150743_l = this.field_150746_k.remoteAddress();
+ if (activationHandler != null) activationHandler.accept(this);
try {
this.func_150723_a(ProtocolType.HANDSHAKING);
@@ -173,7 +175,7 @@
++this.field_211395_r;
if (protocoltype1 != protocoltype) {
field_150735_g.debug("Disabled auto read");
- this.field_150746_k.config().setAutoRead(false);
+ this.field_150746_k.eventLoop().execute(()->this.field_150746_k.config().setAutoRead(false));
}
if (this.field_150746_k.eventLoop().inEventLoop()) {
@@ -257,7 +259,9 @@
@OnlyIn(Dist.CLIENT)
public static NetworkManager func_181124_a(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_) {
+ if (p_181124_0_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false");
final NetworkManager networkmanager = new NetworkManager(PacketDirection.CLIENTBOUND);
+ networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel;
Class<? extends SocketChannel> oclass;
LazyValue<? extends EventLoopGroup> lazyvalue;
if (Epoll.isAvailable() && p_181124_2_) {
@@ -285,6 +289,7 @@
@OnlyIn(Dist.CLIENT)
public static NetworkManager func_150722_a(SocketAddress p_150722_0_) {
final NetworkManager networkmanager = new NetworkManager(PacketDirection.CLIENTBOUND);
+ networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel;
(new Bootstrap()).group(field_179296_e.func_179281_c()).handler(new ChannelInitializer<Channel>() {
protected void initChannel(Channel p_initChannel_1_) throws Exception {
p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager);
@@ -376,6 +381,14 @@
return this.field_211397_t;
}
+ public Channel channel() {
+ return field_150746_k;
+ }
+
+ public PacketDirection getDirection() {
+ return this.field_179294_g;
+ }
+
static class QueuedPacket {
private final IPacket<?> field_150774_a;
@Nullable

View File

@ -1,34 +0,0 @@
--- a/net/minecraft/network/NetworkSystem.java
+++ b/net/minecraft/network/NetworkSystem.java
@@ -42,11 +42,12 @@
public class NetworkSystem {
private static final Logger field_151275_b = LogManager.getLogger();
+ private static final int READ_TIMEOUT = Integer.parseInt(System.getProperty("forge.readTimeout", "30"));
public static final LazyValue<NioEventLoopGroup> field_151276_c = new LazyValue<>(() -> {
- return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).build());
+ return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).setThreadFactory(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER).build());
});
public static final LazyValue<EpollEventLoopGroup> field_181141_b = new LazyValue<>(() -> {
- return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).build());
+ return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).setThreadFactory(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER).build());
});
private final MinecraftServer field_151273_d;
public volatile boolean field_151277_a;
@@ -59,6 +60,7 @@
}
public void func_151265_a(@Nullable InetAddress p_151265_1_, int p_151265_2_) throws IOException {
+ if (p_151265_1_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false");
synchronized(this.field_151274_e) {
Class<? extends ServerSocketChannel> oclass;
LazyValue<? extends EventLoopGroup> lazyvalue;
@@ -80,7 +82,7 @@
;
}
- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(PacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(PacketDirection.CLIENTBOUND));
+ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(READ_TIMEOUT)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(PacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(PacketDirection.CLIENTBOUND));
NetworkManager networkmanager = new NetworkManager(PacketDirection.SERVERBOUND);
NetworkSystem.this.field_151272_f.add(networkmanager);
p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager);

View File

@ -1,45 +0,0 @@
--- a/net/minecraft/network/PacketBuffer.java
+++ b/net/minecraft/network/PacketBuffer.java
@@ -35,7 +35,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class PacketBuffer extends ByteBuf {
+public class PacketBuffer extends ByteBuf implements net.minecraftforge.common.extensions.IForgePacketBuffer {
private final ByteBuf field_150794_a;
public PacketBuffer(ByteBuf p_i45154_1_) {
@@ -265,6 +265,15 @@
}
public PacketBuffer func_150788_a(ItemStack p_150788_1_) {
+ return writeItemStack(p_150788_1_, true);
+ }
+
+ /**
+ * Most ItemStack serialization is Server to Client,and doesn't need to know the FULL tag details.
+ * One exception is items from the creative menu, which must be sent from Client to Server with their full NBT.
+ * If you want to send the FULL tag set limitedTag to false
+ */
+ public PacketBuffer writeItemStack(ItemStack p_150788_1_, boolean limitedTag) {
if (p_150788_1_.func_190926_b()) {
this.writeBoolean(false);
} else {
@@ -274,7 +283,7 @@
this.writeByte(p_150788_1_.func_190916_E());
CompoundNBT compoundnbt = null;
if (item.func_77645_m() || item.func_77651_p()) {
- compoundnbt = p_150788_1_.func_77978_p();
+ compoundnbt = limitedTag ? p_150788_1_.getShareTag() : p_150788_1_.func_77978_p();
}
this.func_150786_a(compoundnbt);
@@ -290,7 +299,7 @@
int i = this.func_150792_a();
int j = this.readByte();
ItemStack itemstack = new ItemStack(Item.func_150899_d(i), j);
- itemstack.func_77982_d(this.func_150793_b());
+ itemstack.readShareTag(this.func_150793_b());
return itemstack;
}
}

View File

@ -1,109 +0,0 @@
--- a/net/minecraft/network/ServerStatusResponse.java
+++ b/net/minecraft/network/ServerStatusResponse.java
@@ -19,13 +19,24 @@
private ServerStatusResponse.Players field_151324_b;
private ServerStatusResponse.Version field_151325_c;
private String field_151323_d;
+ private transient net.minecraftforge.fml.network.FMLStatusPing forgeData;
+ public net.minecraftforge.fml.network.FMLStatusPing getForgeData() {
+ return this.forgeData;
+ }
+
+ public void setForgeData(net.minecraftforge.fml.network.FMLStatusPing data){
+ this.forgeData = data;
+ invalidateJson();
+ }
+
public ITextComponent func_151317_a() {
return this.field_151326_a;
}
public void func_151315_a(ITextComponent p_151315_1_) {
this.field_151326_a = p_151315_1_;
+ invalidateJson();
}
public ServerStatusResponse.Players func_151318_b() {
@@ -34,6 +45,7 @@
public void func_151319_a(ServerStatusResponse.Players p_151319_1_) {
this.field_151324_b = p_151319_1_;
+ invalidateJson();
}
public ServerStatusResponse.Version func_151322_c() {
@@ -42,16 +54,51 @@
public void func_151321_a(ServerStatusResponse.Version p_151321_1_) {
this.field_151325_c = p_151321_1_;
+ invalidateJson();
}
public void func_151320_a(String p_151320_1_) {
this.field_151323_d = p_151320_1_;
+ invalidateJson();
}
public String func_151316_d() {
return this.field_151323_d;
}
+ private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1);
+ private String json = null;
+ /**
+ * Returns this object as a Json string.
+ * Converting to JSON if a cached version is not available.
+ *
+ * Also to prevent potentially large memory allocations on the server
+ * this is moved from the SPacketServerInfo writePacket function
+ *
+ * As this method is called from the network threads so thread safety is important!
+ */
+ public String getJson() {
+ String ret = this.json;
+ if (ret == null) {
+ mutex.acquireUninterruptibly();
+ ret = this.json;
+ if (ret == null) {
+ ret = net.minecraft.network.status.server.SServerInfoPacket.field_149297_a.toJson(this);
+ this.json = ret;
+ }
+ mutex.release();
+ }
+ return ret;
+ }
+
+ /**
+ * Invalidates the cached json, causing the next call to getJson to rebuild it.
+ * This is needed externally because PlayerCountData.setPlayer's is public.
+ */
+ public void invalidateJson() {
+ this.json = null;
+ }
+
public static class Players {
private final int field_151336_a;
private final int field_151334_b;
@@ -143,6 +190,10 @@
serverstatusresponse.func_151320_a(JSONUtils.func_151200_h(jsonobject, "favicon"));
}
+ if (jsonobject.has("forgeData")) {
+ serverstatusresponse.setForgeData(net.minecraftforge.fml.network.FMLStatusPing.Serializer.deserialize(JSONUtils.func_152754_s(jsonobject, "forgeData"), p_deserialize_3_));
+ }
+
return serverstatusresponse;
}
@@ -164,6 +215,10 @@
jsonobject.addProperty("favicon", p_serialize_1_.func_151316_d());
}
+ if(p_serialize_1_.getForgeData() != null){
+ jsonobject.add("forgeData", net.minecraftforge.fml.network.FMLStatusPing.Serializer.serialize(p_serialize_1_.getForgeData(), p_serialize_3_));
+ }
+
return jsonobject;
}
}

View File

@ -1,22 +0,0 @@
--- a/net/minecraft/network/datasync/DataSerializers.java
+++ b/net/minecraft/network/datasync/DataSerializers.java
@@ -301,16 +301,16 @@
};
public static void func_187189_a(IDataSerializer<?> p_187189_0_) {
- field_187204_n.func_186808_c(p_187189_0_);
+ if (field_187204_n.func_186808_c(p_187189_0_) >= 256) throw new RuntimeException("Vanilla DataSerializer ID limit exceeded");
}
@Nullable
public static IDataSerializer<?> func_187190_a(int p_187190_0_) {
- return field_187204_n.func_148745_a(p_187190_0_);
+ return net.minecraftforge.common.ForgeHooks.getSerializer(p_187190_0_, field_187204_n);
}
public static int func_187188_b(IDataSerializer<?> p_187188_0_) {
- return field_187204_n.func_186815_a(p_187188_0_);
+ return net.minecraftforge.common.ForgeHooks.getSerializerId(p_187188_0_, field_187204_n);
}
static {

View File

@ -1,18 +0,0 @@
--- a/net/minecraft/network/datasync/EntityDataManager.java
+++ b/net/minecraft/network/datasync/EntityDataManager.java
@@ -36,11 +36,13 @@
}
public static <T> DataParameter<T> func_187226_a(Class<? extends Entity> p_187226_0_, IDataSerializer<T> p_187226_1_) {
- if (field_190303_a.isDebugEnabled()) {
+ if (true || field_190303_a.isDebugEnabled()) { // Forge: This is very useful for mods that register keys on classes that are not their own
try {
Class<?> oclass = Class.forName(Thread.currentThread().getStackTrace()[2].getClassName());
if (!oclass.equals(p_187226_0_)) {
- field_190303_a.debug("defineId called for: {} from {}", p_187226_0_, oclass, new RuntimeException());
+ // Forge: log at warn, mods should not add to classes that they don't own, and only add stacktrace when in debug is enabled as it is mostly not needed and consumes time
+ if (field_190303_a.isDebugEnabled()) field_190303_a.warn("defineId called for: {} from {}", p_187226_0_, oclass, new RuntimeException());
+ else field_190303_a.warn("defineId called for: {} from {}", p_187226_0_, oclass);
}
} catch (ClassNotFoundException var5) {
;

View File

@ -1,10 +0,0 @@
--- a/net/minecraft/network/handshake/ServerHandshakeNetHandler.java
+++ b/net/minecraft/network/handshake/ServerHandshakeNetHandler.java
@@ -21,6 +21,7 @@
}
public void func_147383_a(CHandshakePacket p_147383_1_) {
+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(p_147383_1_, this.field_147386_b)) return;
switch(p_147383_1_.func_149594_c()) {
case LOGIN:
this.field_147386_b.func_150723_a(ProtocolType.LOGIN);

View File

@ -1,34 +0,0 @@
--- a/net/minecraft/network/handshake/client/CHandshakePacket.java
+++ b/net/minecraft/network/handshake/client/CHandshakePacket.java
@@ -14,6 +14,7 @@
private String field_149598_b;
private int field_149599_c;
private ProtocolType field_149597_d;
+ private String fmlVersion = net.minecraftforge.fml.network.FMLNetworkConstants.NETVERSION;
public CHandshakePacket() {
}
@@ -31,11 +32,13 @@
this.field_149598_b = p_148837_1_.func_150789_c(255);
this.field_149599_c = p_148837_1_.readUnsignedShort();
this.field_149597_d = ProtocolType.func_150760_a(p_148837_1_.func_150792_a());
+ this.fmlVersion = net.minecraftforge.fml.network.NetworkHooks.getFMLVersion(this.field_149598_b);
+ this.field_149598_b = this.field_149598_b.split("\0")[0];
}
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException {
p_148840_1_.func_150787_b(this.field_149600_a);
- p_148840_1_.func_180714_a(this.field_149598_b);
+ p_148840_1_.func_180714_a(this.field_149598_b + "\0"+net.minecraftforge.fml.network.FMLNetworkConstants.NETVERSION+"\0");
p_148840_1_.writeShort(this.field_149599_c);
p_148840_1_.func_150787_b(this.field_149597_d.func_150759_c());
}
@@ -51,4 +54,8 @@
public int func_149595_d() {
return this.field_149600_a;
}
+
+ public String getFMLVersion() {
+ return this.fmlVersion;
+ }
}

View File

@ -1,66 +0,0 @@
--- a/net/minecraft/network/login/ServerLoginNetHandler.java
+++ b/net/minecraft/network/login/ServerLoginNetHandler.java
@@ -53,7 +53,13 @@
}
public void func_73660_a() {
- if (this.field_147328_g == ServerLoginNetHandler.State.READY_TO_ACCEPT) {
+ if (this.field_147328_g == State.NEGOTIATING) {
+ // We force the state into "NEGOTIATING" which is otherwise unused. Once we're completed we move the negotiation onto "READY_TO_ACCEPT"
+ // Might want to promote player object creation to here as well..
+ boolean negotiationComplete = net.minecraftforge.fml.network.NetworkHooks.tickNegotiation(this, this.field_147333_a, this.field_181025_l);
+ if (negotiationComplete)
+ this.field_147328_g = State.READY_TO_ACCEPT;
+ } else if (this.field_147328_g == ServerLoginNetHandler.State.READY_TO_ACCEPT) {
this.func_147326_c();
} else if (this.field_147328_g == ServerLoginNetHandler.State.DELAY_ACCEPT) {
ServerPlayerEntity serverplayerentity = this.field_147327_f.func_184103_al().func_177451_a(this.field_147337_i.getId());
@@ -128,7 +134,7 @@
this.field_147328_g = ServerLoginNetHandler.State.KEY;
this.field_147333_a.func_179290_a(new SEncryptionRequestPacket("", this.field_147327_f.func_71250_E().getPublic(), this.field_147330_e));
} else {
- this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT;
+ this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING;
}
}
@@ -142,7 +148,7 @@
this.field_147335_k = p_147315_1_.func_149300_a(privatekey);
this.field_147328_g = ServerLoginNetHandler.State.AUTHENTICATING;
this.field_147333_a.func_150727_a(this.field_147335_k);
- Thread thread = new Thread("User Authenticator #" + field_147331_b.incrementAndGet()) {
+ Thread thread = new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, "User Authenticator #" + field_147331_b.incrementAndGet()) {
public void run() {
GameProfile gameprofile = ServerLoginNetHandler.this.field_147337_i;
@@ -151,11 +157,11 @@
ServerLoginNetHandler.this.field_147337_i = ServerLoginNetHandler.this.field_147327_f.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.func_191235_a());
if (ServerLoginNetHandler.this.field_147337_i != null) {
ServerLoginNetHandler.field_147332_c.info("UUID of player {} is {}", ServerLoginNetHandler.this.field_147337_i.getName(), ServerLoginNetHandler.this.field_147337_i.getId());
- ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT;
+ ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING;
} else if (ServerLoginNetHandler.this.field_147327_f.func_71264_H()) {
ServerLoginNetHandler.field_147332_c.warn("Failed to verify username but will let them in anyway!");
ServerLoginNetHandler.this.field_147337_i = ServerLoginNetHandler.this.func_152506_a(gameprofile);
- ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT;
+ ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING;
} else {
ServerLoginNetHandler.this.func_194026_b(new TranslationTextComponent("multiplayer.disconnect.unverified_username"));
ServerLoginNetHandler.field_147332_c.error("Username '{}' tried to join with an invalid session", (Object)gameprofile.getName());
@@ -164,7 +170,7 @@
if (ServerLoginNetHandler.this.field_147327_f.func_71264_H()) {
ServerLoginNetHandler.field_147332_c.warn("Authentication servers are down but will let them in anyway!");
ServerLoginNetHandler.this.field_147337_i = ServerLoginNetHandler.this.func_152506_a(gameprofile);
- ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT;
+ ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING;
} else {
ServerLoginNetHandler.this.func_194026_b(new TranslationTextComponent("multiplayer.disconnect.authservers_down"));
ServerLoginNetHandler.field_147332_c.error("Couldn't verify username because servers are unavailable");
@@ -185,6 +191,7 @@
}
public void func_209526_a(CCustomPayloadLoginPacket p_209526_1_) {
+ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209526_1_, this.field_147333_a))
this.func_194026_b(new TranslationTextComponent("multiplayer.disconnect.unexpected_query_response"));
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java
+++ b/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java
@@ -8,7 +8,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class CCustomPayloadLoginPacket implements IPacket<IServerLoginNetHandler> {
+public class CCustomPayloadLoginPacket implements IPacket<IServerLoginNetHandler>, net.minecraftforge.fml.network.ICustomPacket<CCustomPayloadLoginPacket> {
private int field_209922_a;
private PacketBuffer field_209923_b;

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java
+++ b/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java
@@ -8,7 +8,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class SCustomPayloadLoginPacket implements IPacket<IClientLoginNetHandler> {
+public class SCustomPayloadLoginPacket implements IPacket<IClientLoginNetHandler>, net.minecraftforge.fml.network.ICustomPacket<SCustomPayloadLoginPacket> {
private int field_209919_a;
private ResourceLocation field_209920_b;
private PacketBuffer field_209921_c;

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/network/login/server/SLoginSuccessPacket.java
+++ b/net/minecraft/network/login/server/SLoginSuccessPacket.java
@@ -22,7 +22,7 @@
public void func_148837_a(PacketBuffer p_148837_1_) throws IOException {
String s = p_148837_1_.func_150789_c(36);
String s1 = p_148837_1_.func_150789_c(16);
- UUID uuid = UUID.fromString(s);
+ UUID uuid = s.length() > 0 ? UUID.fromString(s) : null; // Forge: prevent exception with bad data.
this.field_149602_a = new GameProfile(uuid, s1);
}

View File

@ -1,62 +0,0 @@
--- a/net/minecraft/network/play/ServerPlayNetHandler.java
+++ b/net/minecraft/network/play/ServerPlayNetHandler.java
@@ -336,9 +336,11 @@
}
entity.func_70080_a(d3, d4, d5, f, f1);
+ this.field_147369_b.func_70080_a(d3, d4, d5, this.field_147369_b.field_70177_z, this.field_147369_b.field_70125_A); // Forge - Resync player position on vehicle moving
boolean flag2 = serverworld.func_226665_a__(entity, entity.func_174813_aQ().func_186664_h(0.0625D));
if (flag && (flag1 || !flag2)) {
entity.func_70080_a(d0, d1, d2, f, f1);
+ this.field_147369_b.func_70080_a(d3, d4, d5, this.field_147369_b.field_70177_z, this.field_147369_b.field_70125_A); // Forge - Resync player position on vehicle moving
this.field_147371_a.func_179290_a(new SMoveVehiclePacket(entity));
return;
}
@@ -845,7 +847,9 @@
Direction direction = blockraytraceresult.func_216354_b();
this.field_147369_b.func_143004_u();
if (blockpos.func_177956_o() < this.field_147367_d.func_71207_Z() - 1 || direction != Direction.UP && blockpos.func_177956_o() < this.field_147367_d.func_71207_Z()) {
- if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < 64.0D && serverworld.func_175660_a(this.field_147369_b, blockpos)) {
+ double dist = field_147369_b.func_110148_a(net.minecraft.entity.player.PlayerEntity.REACH_DISTANCE).func_111126_e() + 3;
+ dist *= dist;
+ if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < dist && serverworld.func_175660_a(this.field_147369_b, blockpos)) {
ActionResultType actionresulttype = this.field_147369_b.field_71134_c.func_219441_a(this.field_147369_b, serverworld, itemstack, hand, blockraytraceresult);
if (actionresulttype.func_226247_b_()) {
this.field_147369_b.func_226292_a_(hand, true);
@@ -968,7 +972,9 @@
if (s.startsWith("/")) {
this.func_147361_d(s);
} else {
- ITextComponent itextcomponent = new TranslationTextComponent("chat.type.text", this.field_147369_b.func_145748_c_(), s);
+ ITextComponent itextcomponent = new TranslationTextComponent("chat.type.text", this.field_147369_b.func_145748_c_(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s));
+ itextcomponent = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, itextcomponent);
+ if (itextcomponent == null) return;
this.field_147367_d.func_184103_al().func_148544_a(itextcomponent, false);
}
@@ -1061,6 +1067,7 @@
this.field_147369_b.func_190775_a(entity, hand);
} else if (p_147340_1_.func_149565_c() == CUseEntityPacket.Action.INTERACT_AT) {
Hand hand1 = p_147340_1_.func_186994_b();
+ if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(field_147369_b, entity, p_147340_1_.func_179712_b(), hand1) != null) return;
ActionResultType actionresulttype = entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), hand1);
if (actionresulttype.func_226247_b_()) {
this.field_147369_b.func_226292_a_(hand1, true);
@@ -1094,7 +1101,7 @@
return;
}
- this.field_147369_b = this.field_147367_d.func_184103_al().func_72368_a(this.field_147369_b, DimensionType.field_223227_a_, false);
+ this.field_147369_b = this.field_147367_d.func_184103_al().func_72368_a(this.field_147369_b, this.field_147369_b.field_71093_bK, false);
if (this.field_147367_d.func_71199_h()) {
this.field_147369_b.func_71033_a(GameType.SPECTATOR);
this.field_147369_b.func_71121_q().func_82736_K().func_223585_a(GameRules.field_223613_p).func_223570_a(false, this.field_147367_d);
@@ -1268,6 +1275,8 @@
}
public void func_147349_a(CCustomPayloadPacket p_147349_1_) {
+ PacketThreadUtil.func_218796_a(p_147349_1_, this, this.field_147369_b.func_71121_q());
+ net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147349_1_, this.field_147371_a);
}
public void func_217263_a(CSetDifficultyPacket p_217263_1_) {

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/network/play/client/CClickWindowPacket.java
+++ b/net/minecraft/network/play/client/CClickWindowPacket.java
@@ -49,7 +49,7 @@
p_148840_1_.writeByte(this.field_149553_c);
p_148840_1_.writeShort(this.field_149550_d);
p_148840_1_.func_179249_a(this.field_149549_f);
- p_148840_1_.func_150788_a(this.field_149551_e);
+ p_148840_1_.writeItemStack(this.field_149551_e, false); //Forge: Include full tag for C->S
}
public int func_149548_c() {

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java
+++ b/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java
@@ -32,7 +32,7 @@
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException {
p_148840_1_.writeShort(this.field_149629_a);
- p_148840_1_.func_150788_a(this.field_149628_b);
+ p_148840_1_.writeItemStack(this.field_149628_b, false); //Forge: Include full tag for C->S
}
public int func_149627_c() {

View File

@ -1,20 +0,0 @@
--- a/net/minecraft/network/play/client/CCustomPayloadPacket.java
+++ b/net/minecraft/network/play/client/CCustomPayloadPacket.java
@@ -9,7 +9,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class CCustomPayloadPacket implements IPacket<IServerPlayNetHandler> {
+public class CCustomPayloadPacket implements IPacket<IServerPlayNetHandler>, net.minecraftforge.fml.network.ICustomPacket<CCustomPayloadPacket> {
public static final ResourceLocation field_210344_a = new ResourceLocation("brand");
private ResourceLocation field_149562_a;
private PacketBuffer field_149561_c;
@@ -35,7 +35,7 @@
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException {
p_148840_1_.func_192572_a(this.field_149562_a);
- p_148840_1_.writeBytes((ByteBuf)this.field_149561_c);
+ p_148840_1_.writeBytes((ByteBuf)this.field_149561_c.copy()); //This may be access multiple times, from multiple threads, lets be safe like the S->C packet
}
public void func_148833_a(IServerPlayNetHandler p_148833_1_) {

View File

@ -1,12 +0,0 @@
--- a/net/minecraft/network/play/server/SCommandListPacket.java
+++ b/net/minecraft/network/play/server/SCommandListPacket.java
@@ -110,6 +110,9 @@
String s = p_197695_1_.func_150789_c(32767);
ArgumentType<?> argumenttype = ArgumentTypes.func_197486_a(p_197695_1_);
if (argumenttype == null) {
+ if ((p_197695_2_ & 16) != 0) { // FORGE: Flush unused suggestion data
+ p_197695_1_.func_192575_l();
+ }
return null;
} else {
RequiredArgumentBuilder<ISuggestionProvider, ?> requiredargumentbuilder = RequiredArgumentBuilder.argument(s, argumenttype);

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java
+++ b/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java
@@ -8,7 +8,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class SCustomPayloadPlayPacket implements IPacket<IClientPlayNetHandler> {
+public class SCustomPayloadPlayPacket implements IPacket<IClientPlayNetHandler>, net.minecraftforge.fml.network.ICustomPacket<SCustomPayloadPlayPacket> {
public static final ResourceLocation field_209911_b = new ResourceLocation("brand");
public static final ResourceLocation field_209913_d = new ResourceLocation("debug/path");
public static final ResourceLocation field_209914_e = new ResourceLocation("debug/neighbors_update");

View File

@ -1,28 +0,0 @@
--- a/net/minecraft/network/play/server/SJoinGamePacket.java
+++ b/net/minecraft/network/play/server/SJoinGamePacket.java
@@ -21,6 +21,7 @@
private int field_218729_g;
private boolean field_179745_h;
private boolean field_229741_j_;
+ private int dimensionInt;
public SJoinGamePacket() {
}
@@ -44,7 +45,7 @@
this.field_149204_b = (i & 8) == 8;
i = i & -9;
this.field_149205_c = GameType.func_77146_a(i);
- this.field_149202_d = DimensionType.func_186069_a(p_148837_1_.readInt());
+ this.dimensionInt = p_148837_1_.readInt();
this.field_229740_b_ = p_148837_1_.readLong();
this.field_149200_f = p_148837_1_.readUnsignedByte();
this.field_149201_g = WorldType.func_77130_a(p_148837_1_.func_150789_c(16));
@@ -100,7 +101,7 @@
@OnlyIn(Dist.CLIENT)
public DimensionType func_212642_e() {
- return this.field_149202_d;
+ return this.field_149202_d == null ? this.field_149202_d = net.minecraftforge.fml.network.NetworkHooks.getDummyDimType(this.dimensionInt) : this.field_149202_d;
}
@OnlyIn(Dist.CLIENT)

View File

@ -1,28 +0,0 @@
--- a/net/minecraft/network/play/server/SRespawnPacket.java
+++ b/net/minecraft/network/play/server/SRespawnPacket.java
@@ -15,6 +15,7 @@
private long field_229746_b_;
private GameType field_149087_c;
private WorldType field_149085_d;
+ private int dimensionInt;
public SRespawnPacket() {
}
@@ -31,7 +32,7 @@
}
public void func_148837_a(PacketBuffer p_148837_1_) throws IOException {
- this.field_149088_a = DimensionType.func_186069_a(p_148837_1_.readInt());
+ this.dimensionInt = p_148837_1_.readInt();
this.field_229746_b_ = p_148837_1_.readLong();
this.field_149087_c = GameType.func_77146_a(p_148837_1_.readUnsignedByte());
this.field_149085_d = WorldType.func_77130_a(p_148837_1_.func_150789_c(16));
@@ -50,7 +51,7 @@
@OnlyIn(Dist.CLIENT)
public DimensionType func_212643_b() {
- return this.field_149088_a;
+ return this.field_149088_a == null ? this.field_149088_a = net.minecraftforge.fml.network.NetworkHooks.getDummyDimType(this.dimensionInt) : this.field_149088_a;
}
@OnlyIn(Dist.CLIENT)

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/network/status/server/SServerInfoPacket.java
+++ b/net/minecraft/network/status/server/SServerInfoPacket.java
@@ -30,7 +30,7 @@
}
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException {
- p_148840_1_.func_180714_a(field_149297_a.toJson(this.field_149296_b));
+ p_148840_1_.func_180714_a(this.field_149296_b.getJson()); //Forge: Let the response cache the JSON
}
public void func_148833_a(IClientStatusNetHandler p_148833_1_) {

View File

@ -1,64 +0,0 @@
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -97,6 +97,7 @@
public boolean func_71197_b() throws IOException {
Thread thread = new Thread("Server console handler") {
public void run() {
+ if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return;
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
String s3;
@@ -118,7 +119,9 @@
field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
+ net.minecraftforge.fml.server.ServerModLoader.begin(this);
field_155771_h.info("Loading properties");
+ this.field_71340_o.func_219033_a(properties -> ServerProperties.func_218985_a(java.nio.file.Paths.get("server.properties")));
ServerProperties serverproperties = this.field_71340_o.func_219034_a();
if (this.func_71264_H()) {
this.func_71189_e("127.0.0.1");
@@ -175,6 +178,7 @@
if (!PreYggdrasilConverter.func_219587_e(this)) {
return false;
} else {
+ net.minecraftforge.fml.server.ServerModLoader.end();
this.func_184105_a(new DedicatedPlayerList(this));
long i = Util.func_211178_c();
String s = serverproperties.field_219022_p;
@@ -196,6 +200,7 @@
SkullTileEntity.func_184293_a(this.func_152358_ax());
SkullTileEntity.func_184294_a(this.func_147130_as());
PlayerProfileCache.func_187320_a(this.func_71266_T());
+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false;
field_155771_h.info("Preparing level \"{}\"", (Object)this.func_71270_I());
JsonObject jsonobject = new JsonObject();
if (worldtype == WorldType.field_77138_c) {
@@ -208,6 +213,7 @@
long l = Util.func_211178_c() - i;
String s2 = String.format(Locale.ROOT, "%.3fs", (double)l / 1.0E9D);
field_155771_h.info("Done ({})! For help, type \"help\"", (Object)s2);
+ this.field_211151_aa = Util.func_211177_b(); //Forge: Update server time to prevent watchdog/spaming during long load.
if (serverproperties.field_219027_u != null) {
this.func_200252_aR().func_223585_a(GameRules.field_223620_w).func_223570_a(serverproperties.field_219027_u, this);
}
@@ -233,7 +239,8 @@
}
Items.field_190931_a.func_150895_a(ItemGroup.field_78027_g, NonNullList.func_191196_a());
- return true;
+ // <3 you Grum for this, saves us ~30 patch files! --^
+ return net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(this);
}
}
@@ -547,4 +554,9 @@
public boolean func_213199_b(GameProfile p_213199_1_) {
return false;
}
+
+ @Override //Forge: Enable formated text for colors in console.
+ public void func_145747_a(net.minecraft.util.text.ITextComponent message) {
+ field_155771_h.info(message.func_150254_d());
+ }
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/server/dedicated/PropertyManager.java
+++ b/net/minecraft/server/dedicated/PropertyManager.java
@@ -38,7 +38,7 @@
public void func_218970_c(Path p_218970_1_) {
try (OutputStream outputstream = Files.newOutputStream(p_218970_1_)) {
- this.field_73672_b.store(outputstream, "Minecraft server properties");
+ net.minecraftforge.common.util.SortedProperties.store(field_73672_b, outputstream, "Minecraft server properties");
} catch (IOException var15) {
field_164440_a.error("Failed to store properties to file: " + p_218970_1_);
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/server/dedicated/ServerHangWatchdog.java
+++ b/net/minecraft/server/dedicated/ServerHangWatchdog.java
@@ -36,7 +36,7 @@
ThreadMXBean threadmxbean = ManagementFactory.getThreadMXBean();
ThreadInfo[] athreadinfo = threadmxbean.dumpAllThreads(true, true);
StringBuilder stringbuilder = new StringBuilder();
- Error error = new Error();
+ Error error = new Error(String.format("ServerHangWatchdog detected that a single server tick took %.2f seconds (should be max 0.05)", k / 1000F)); // Forge: don't just make a crash report with a seemingly-inexplicable Error
for(ThreadInfo threadinfo : athreadinfo) {
if (threadinfo.getThreadId() == this.field_180249_b.func_213170_ax().getId()) {

View File

@ -1,23 +0,0 @@
--- a/net/minecraft/server/gui/MinecraftServerGui.java
+++ b/net/minecraft/server/gui/MinecraftServerGui.java
@@ -138,8 +138,10 @@
return jpanel;
}
+ private java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1);
public void func_206931_a() {
this.field_206932_d.start();
+ latch.countDown();
}
public void func_219050_b() {
@@ -154,6 +156,9 @@
}
public void func_164247_a(JTextArea p_164247_1_, JScrollPane p_164247_2_, String p_164247_3_) {
+ try {
+ latch.await();
+ } catch (InterruptedException e){} //Prevent logging until after constructor has ended.
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(() -> {
this.func_164247_a(p_164247_1_, p_164247_2_, p_164247_3_);

View File

@ -1,159 +0,0 @@
--- a/net/minecraft/server/management/PlayerInteractionManager.java
+++ b/net/minecraft/server/management/PlayerInteractionManager.java
@@ -77,7 +77,7 @@
++this.field_73100_i;
if (this.field_73097_j) {
BlockState blockstate = this.field_73092_a.func_180495_p(this.field_180241_i);
- if (blockstate.func_196958_f()) {
+ if (blockstate.isAir(field_73092_a, field_180241_i)) {
this.field_73097_j = false;
} else {
float f = this.func_229859_a_(blockstate, this.field_180241_i, this.field_73093_n);
@@ -88,7 +88,7 @@
}
} else if (this.field_73088_d) {
BlockState blockstate1 = this.field_73092_a.func_180495_p(this.field_180240_f);
- if (blockstate1.func_196958_f()) {
+ if (blockstate1.isAir(field_73092_a, field_180240_f)) {
this.field_73092_a.func_175715_c(this.field_73090_b.func_145782_y(), this.field_180240_f, -1);
this.field_73094_o = -1;
this.field_73088_d = false;
@@ -116,7 +116,15 @@
double d1 = this.field_73090_b.func_226278_cu_() - ((double)p_225416_1_.func_177956_o() + 0.5D) + 1.5D;
double d2 = this.field_73090_b.func_226281_cx_() - ((double)p_225416_1_.func_177952_p() + 0.5D);
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
- if (d3 > 36.0D) {
+ double dist = field_73090_b.func_110148_a(net.minecraft.entity.player.PlayerEntity.REACH_DISTANCE).func_111126_e() + 1;
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(field_73090_b, p_225416_1_, p_225416_3_);
+ if (event.isCanceled() || (!this.func_73083_d() && event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY)) { // Restore block and te data
+ field_73090_b.field_71135_a.func_147359_a(new SPlayerDiggingPacket(p_225416_1_, field_73092_a.func_180495_p(p_225416_1_), p_225416_2_, false, "mod canceled"));
+ field_73092_a.func_184138_a(p_225416_1_, field_73092_a.func_180495_p(p_225416_1_), field_73092_a.func_180495_p(p_225416_1_), 3);
+ return;
+ }
+ dist *= dist;
+ if (d3 > dist) {
this.field_73090_b.field_71135_a.func_147359_a(new SPlayerDiggingPacket(p_225416_1_, this.field_73092_a.func_180495_p(p_225416_1_), p_225416_2_, false, "too far"));
} else if (p_225416_1_.func_177956_o() >= p_225416_4_) {
this.field_73090_b.field_71135_a.func_147359_a(new SPlayerDiggingPacket(p_225416_1_, this.field_73092_a.func_180495_p(p_225416_1_), p_225416_2_, false, "too high"));
@@ -146,12 +154,13 @@
this.field_73089_e = this.field_73100_i;
float f = 1.0F;
BlockState blockstate = this.field_73092_a.func_180495_p(p_225416_1_);
- if (!blockstate.func_196958_f()) {
+ if (!blockstate.isAir(field_73092_a, p_225416_1_)) {
+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY)
blockstate.func_196942_a(this.field_73092_a, p_225416_1_, this.field_73090_b);
f = blockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_225416_1_);
}
- if (!blockstate.func_196958_f() && f >= 1.0F) {
+ if (!blockstate.isAir(field_73092_a, p_225416_1_) && f >= 1.0F) {
this.func_229860_a_(p_225416_1_, p_225416_2_, "insta mine");
} else {
if (this.field_73088_d) {
@@ -214,7 +223,8 @@
public boolean func_180237_b(BlockPos p_180237_1_) {
BlockState blockstate = this.field_73092_a.func_180495_p(p_180237_1_);
- if (!this.field_73090_b.func_184614_ca().func_77973_b().func_195938_a(blockstate, this.field_73092_a, p_180237_1_, this.field_73090_b)) {
+ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(field_73092_a, field_73091_c, field_73090_b, p_180237_1_);
+ if (exp == -1) {
return false;
} else {
TileEntity tileentity = this.field_73092_a.func_175625_s(p_180237_1_);
@@ -222,38 +232,53 @@
if ((block instanceof CommandBlockBlock || block instanceof StructureBlock || block instanceof JigsawBlock) && !this.field_73090_b.func_195070_dx()) {
this.field_73092_a.func_184138_a(p_180237_1_, blockstate, blockstate, 3);
return false;
+ } else if (field_73090_b.func_184614_ca().onBlockStartBreak(p_180237_1_, field_73090_b)) {
+ return false;
} else if (this.field_73090_b.func_223729_a(this.field_73092_a, p_180237_1_, this.field_73091_c)) {
return false;
} else {
- block.func_176208_a(this.field_73092_a, p_180237_1_, blockstate, this.field_73090_b);
- boolean flag = this.field_73092_a.func_217377_a(p_180237_1_, false);
- if (flag) {
- block.func_176206_d(this.field_73092_a, p_180237_1_, blockstate);
- }
-
if (this.func_73083_d()) {
+ removeBlock(p_180237_1_, false);
return true;
} else {
ItemStack itemstack = this.field_73090_b.func_184614_ca();
ItemStack itemstack1 = itemstack.func_77946_l();
- boolean flag1 = this.field_73090_b.func_184823_b(blockstate);
+
+ boolean flag1 = blockstate.canHarvestBlock(this.field_73092_a, p_180237_1_, this.field_73090_b);
itemstack.func_179548_a(this.field_73092_a, blockstate, p_180237_1_, this.field_73090_b);
+ if (itemstack.func_190926_b() && !itemstack1.func_190926_b())
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_73090_b, itemstack1, Hand.MAIN_HAND);
+ boolean flag = removeBlock(p_180237_1_, flag1);
+
if (flag && flag1) {
block.func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, blockstate, tileentity, itemstack1);
}
+ if (flag && exp > 0)
+ blockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp);
+
return true;
}
}
}
}
+ private boolean removeBlock(BlockPos p_180235_1_, boolean canHarvest) {
+ BlockState state = this.field_73092_a.func_180495_p(p_180235_1_);
+ boolean removed = state.removedByPlayer(this.field_73092_a, p_180235_1_, this.field_73090_b, canHarvest, this.field_73092_a.func_204610_c(p_180235_1_));
+ if (removed)
+ state.func_177230_c().func_176206_d(this.field_73092_a, p_180235_1_, state);
+ return removed;
+ }
+
public ActionResultType func_187250_a(PlayerEntity p_187250_1_, World p_187250_2_, ItemStack p_187250_3_, Hand p_187250_4_) {
if (this.field_73091_c == GameType.SPECTATOR) {
return ActionResultType.PASS;
} else if (p_187250_1_.func_184811_cZ().func_185141_a(p_187250_3_.func_77973_b())) {
return ActionResultType.PASS;
} else {
+ ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187250_1_, p_187250_4_);
+ if (cancelResult != null) return cancelResult;
int i = p_187250_3_.func_190916_E();
int j = p_187250_3_.func_77952_i();
ActionResult<ItemStack> actionresult = p_187250_3_.func_77957_a(p_187250_2_, p_187250_1_, p_187250_4_);
@@ -287,6 +312,8 @@
public ActionResultType func_219441_a(PlayerEntity p_219441_1_, World p_219441_2_, ItemStack p_219441_3_, Hand p_219441_4_, BlockRayTraceResult p_219441_5_) {
BlockPos blockpos = p_219441_5_.func_216350_a();
BlockState blockstate = p_219441_2_.func_180495_p(blockpos);
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks.onRightClickBlock(p_219441_1_, p_219441_4_, blockpos, p_219441_5_.func_216354_b());
+ if (event.isCanceled()) return event.getCancellationResult();
if (this.field_73091_c == GameType.SPECTATOR) {
INamedContainerProvider inamedcontainerprovider = blockstate.func_215699_b(p_219441_2_, blockpos);
if (inamedcontainerprovider != null) {
@@ -296,9 +323,14 @@
return ActionResultType.PASS;
}
} else {
ItemUseContext itemusecontext = new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_);
if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
ActionResultType result = p_219441_3_.onItemUseFirst(itemusecontext);
if (result != ActionResultType.PASS) return result;
}
boolean flag = !p_219441_1_.func_184614_ca().func_190926_b() || !p_219441_1_.func_184592_cb().func_190926_b();
- boolean flag1 = p_219441_1_.func_226563_dT_() && flag;
- if (!flag1) {
+ boolean flag1 = (p_219441_1_.func_226563_dT_() && flag) && !(p_219441_1_.func_184614_ca().doesSneakBypassUse(p_219441_2_, blockpos, p_219441_1_) && p_219441_1_.func_184592_cb().doesSneakBypassUse(p_219441_2_, blockpos, p_219441_1_));
+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1) {
ActionResultType actionresulttype = blockstate.func_227031_a_(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_);
if (actionresulttype.func_226246_a_()) {
return actionresulttype;
@@ -306,7 +338,7 @@
}
if (!p_219441_3_.func_190926_b() && !p_219441_1_.func_184811_cZ().func_185141_a(p_219441_3_.func_77973_b())) {
- ItemUseContext itemusecontext = new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_);
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return ActionResultType.PASS;
if (this.func_73083_d()) {
int i = p_219441_3_.func_190916_E();
ActionResultType actionresulttype1 = p_219441_3_.func_196084_a(itemusecontext);

View File

@ -1,181 +0,0 @@
--- a/net/minecraft/server/management/PlayerList.java
+++ b/net/minecraft/server/management/PlayerList.java
@@ -94,6 +94,7 @@
private GameType field_72410_m;
private boolean field_72407_n;
private int field_72408_o;
+ private final List<ServerPlayerEntity> playersView = java.util.Collections.unmodifiableList(field_72404_b);
public PlayerList(MinecraftServer p_i50688_1_, int p_i50688_2_) {
this.field_72400_f = p_i50688_1_;
@@ -109,7 +110,15 @@
String s = gameprofile1 == null ? gameprofile.getName() : gameprofile1.getName();
playerprofilecache.func_152649_a(gameprofile);
CompoundNBT compoundnbt = this.func_72380_a(p_72355_2_);
- ServerWorld serverworld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK);
+
+ //Forge: Make sure the dimension hasn't been deleted, if so stick them in the overworld.
+ ServerWorld serverworld = p_72355_2_.field_71093_bK != null ? this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK) : null ;
+ if (serverworld == null) {
+ p_72355_2_.field_71093_bK = DimensionType.field_223227_a_;
+ serverworld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK);
+ p_72355_2_.func_70107_b(serverworld.func_72912_H().func_76079_c(), serverworld.func_72912_H().func_76075_d(), serverworld.func_72912_H().func_76074_e());
+ }
+
p_72355_2_.func_70029_a(serverworld);
p_72355_2_.field_71134_c.func_73080_a((ServerWorld)p_72355_2_.field_70170_p);
String s1 = "local";
@@ -121,6 +130,8 @@
WorldInfo worldinfo = serverworld.func_72912_H();
this.func_72381_a(p_72355_2_, (ServerPlayerEntity)null, serverworld);
ServerPlayNetHandler serverplaynethandler = new ServerPlayNetHandler(this.field_72400_f, p_72355_1_, p_72355_2_);
+ net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(p_72355_1_, "PLAY_TO_CLIENT");
+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(p_72355_1_, p_72355_2_);
GameRules gamerules = serverworld.func_82736_K();
boolean flag = gamerules.func_223586_b(GameRules.field_226683_z_);
boolean flag1 = gamerules.func_223586_b(GameRules.field_223612_o);
@@ -145,7 +156,7 @@
this.func_148539_a(itextcomponent.func_211708_a(TextFormatting.YELLOW));
serverplaynethandler.func_147364_a(p_72355_2_.func_226277_ct_(), p_72355_2_.func_226278_cu_(), p_72355_2_.func_226281_cx_(), p_72355_2_.field_70177_z, p_72355_2_.field_70125_A);
- this.field_72404_b.add(p_72355_2_);
+ this.addPlayer(p_72355_2_);
this.field_177454_f.put(p_72355_2_.func_110124_au(), p_72355_2_);
this.func_148540_a(new SPlayerListItemPacket(SPlayerListItemPacket.Action.ADD_PLAYER, p_72355_2_));
@@ -166,8 +177,9 @@
if (compoundnbt != null && compoundnbt.func_150297_b("RootVehicle", 10)) {
CompoundNBT compoundnbt1 = compoundnbt.func_74775_l("RootVehicle");
+ final ServerWorld worldf = serverworld;
Entity entity1 = EntityType.func_220335_a(compoundnbt1.func_74775_l("Entity"), serverworld, (p_217885_1_) -> {
- return !serverworld.func_217470_d(p_217885_1_) ? null : p_217885_1_;
+ return !worldf.func_217470_d(p_217885_1_) ? null : p_217885_1_;
});
if (entity1 != null) {
UUID uuid = compoundnbt1.func_186857_a("Attach");
@@ -194,6 +206,7 @@
}
p_72355_2_.func_71116_b();
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerLoggedIn( p_72355_2_ );
}
protected void func_96456_a(ServerScoreboard p_96456_1_, ServerPlayerEntity p_96456_2_) {
@@ -255,6 +268,7 @@
compoundnbt1 = compoundnbt;
p_72380_1_.func_70020_e(compoundnbt);
field_148546_d.debug("loading single player");
+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_72380_1_, this.field_72412_k, p_72380_1_.func_110124_au().toString());
} else {
compoundnbt1 = this.field_72412_k.func_75752_b(p_72380_1_);
}
@@ -263,6 +277,7 @@
}
protected void func_72391_b(ServerPlayerEntity p_72391_1_) {
+ if (p_72391_1_.field_71135_a == null) return;
this.field_72412_k.func_75753_a(p_72391_1_);
ServerStatisticsManager serverstatisticsmanager = this.field_148547_k.get(p_72391_1_.func_110124_au());
if (serverstatisticsmanager != null) {
@@ -277,6 +292,7 @@
}
public void func_72367_e(ServerPlayerEntity p_72367_1_) {
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerLoggedOut(p_72367_1_);
ServerWorld serverworld = p_72367_1_.func_71121_q();
p_72367_1_.func_195066_a(Stats.field_75947_j);
this.func_72391_b(p_72367_1_);
@@ -298,7 +314,7 @@
p_72367_1_.func_213319_R();
serverworld.func_217434_e(p_72367_1_);
p_72367_1_.func_192039_O().func_192745_a();
- this.field_72404_b.remove(p_72367_1_);
+ this.removePlayer(p_72367_1_);
this.field_72400_f.func_201300_aS().func_201382_b(p_72367_1_);
UUID uuid = p_72367_1_.func_110124_au();
ServerPlayerEntity serverplayerentity = this.field_177454_f.get(uuid);
@@ -367,10 +383,18 @@
}
public ServerPlayerEntity func_72368_a(ServerPlayerEntity p_72368_1_, DimensionType p_72368_2_, boolean p_72368_3_) {
- this.field_72404_b.remove(p_72368_1_);
- p_72368_1_.func_71121_q().func_217434_e(p_72368_1_);
- BlockPos blockpos = p_72368_1_.func_180470_cg();
- boolean flag = p_72368_1_.func_82245_bX();
+ ServerWorld world = field_72400_f.func_71218_a(p_72368_2_);
+ if (world == null)
+ p_72368_2_ = p_72368_1_.getSpawnDimension();
+ else if (!world.func_201675_m().func_76567_e())
+ p_72368_2_ = world.func_201675_m().getRespawnDimension(p_72368_1_);
+ if (field_72400_f.func_71218_a(p_72368_2_) == null)
+ p_72368_2_ = DimensionType.field_223227_a_;
+
+ this.removePlayer(p_72368_1_);
+ p_72368_1_.func_71121_q().removePlayer(p_72368_1_, true); // Forge: keep data until copyFrom called
+ BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_);
+ boolean flag = p_72368_1_.isSpawnForced(p_72368_2_);
p_72368_1_.field_71093_bK = p_72368_2_;
PlayerInteractionManager playerinteractionmanager;
if (this.field_72400_f.func_71242_L()) {
@@ -382,6 +406,8 @@
ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), playerinteractionmanager);
serverplayerentity.field_71135_a = p_72368_1_.field_71135_a;
serverplayerentity.func_193104_a(p_72368_1_, p_72368_3_);
+ p_72368_1_.remove(false); // Forge: clone event had a chance to see old data, now discard it
+ serverplayerentity.field_71093_bK = p_72368_2_;
serverplayerentity.func_145769_d(p_72368_1_.func_145782_y());
serverplayerentity.func_184819_a(p_72368_1_.func_184591_cq());
@@ -396,7 +422,7 @@
if (optional.isPresent()) {
Vec3d vec3d = optional.get();
serverplayerentity.func_70012_b(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c, 0.0F, 0.0F);
- serverplayerentity.func_226560_a_(blockpos, flag, false);
+ serverplayerentity.setSpawnPoint(blockpos, flag, false, p_72368_2_);
} else {
serverplayerentity.field_71135_a.func_147359_a(new SChangeGameStatePacket(0, 0.0F));
}
@@ -407,6 +433,7 @@
}
WorldInfo worldinfo = serverplayerentity.field_70170_p.func_72912_H();
+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(serverplayerentity.field_71135_a.field_147371_a, serverplayerentity);
serverplayerentity.field_71135_a.func_147359_a(new SRespawnPacket(serverplayerentity.field_71093_bK, WorldInfo.func_227498_c_(worldinfo.func_76063_b()), worldinfo.func_76067_t(), serverplayerentity.field_71134_c.func_73081_b()));
BlockPos blockpos1 = serverworld.func_175694_M();
serverplayerentity.field_71135_a.func_147364_a(serverplayerentity.func_226277_ct_(), serverplayerentity.func_226278_cu_(), serverplayerentity.func_226281_cx_(), serverplayerentity.field_70177_z, serverplayerentity.field_70125_A);
@@ -416,10 +443,11 @@
this.func_72354_b(serverplayerentity, serverworld);
this.func_187243_f(serverplayerentity);
serverworld.func_217433_d(serverplayerentity);
- this.field_72404_b.add(serverplayerentity);
+ this.addPlayer(serverplayerentity);
this.field_177454_f.put(serverplayerentity.func_110124_au(), serverplayerentity);
serverplayerentity.func_71116_b();
serverplayerentity.func_70606_j(serverplayerentity.func_110143_aJ());
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerRespawnEvent(serverplayerentity, p_72368_3_);
return serverplayerentity;
}
@@ -739,7 +767,7 @@
}
public List<ServerPlayerEntity> func_181057_v() {
- return this.field_72404_b;
+ return this.playersView; //Unmodifiable view, we don't want people removing things without us knowing.
}
@Nullable
@@ -769,4 +797,12 @@
public boolean func_206257_x() {
return this.field_72407_n;
}
+
+ public boolean addPlayer(ServerPlayerEntity player) {
+ return net.minecraftforge.common.DimensionManager.rebuildPlayerMap(this, this.field_72404_b.add(player));
+ }
+
+ public boolean removePlayer(ServerPlayerEntity player) {
+ return net.minecraftforge.common.DimensionManager.rebuildPlayerMap(this, this.field_72404_b.remove(player));
+ }
}

View File

@ -1,13 +0,0 @@
--- a/net/minecraft/tags/BlockTags.java
+++ b/net/minecraft/tags/BlockTags.java
@@ -76,6 +76,10 @@
return field_199899_c;
}
+ public static int getGeneration() {
+ return field_199900_d;
+ }
+
private static Tag<Block> func_199894_a(String p_199894_0_) {
return new BlockTags.Wrapper(new ResourceLocation(p_199894_0_));
}

View File

@ -1,13 +0,0 @@
--- a/net/minecraft/tags/FluidTags.java
+++ b/net/minecraft/tags/FluidTags.java
@@ -22,6 +22,10 @@
return field_206961_c;
}
+ public static int getGeneration() {
+ return field_206962_d;
+ }
+
private static Tag<Fluid> func_206956_a(String p_206956_0_) {
return new FluidTags.Wrapper(new ResourceLocation(p_206956_0_));
}

View File

@ -1,13 +0,0 @@
--- a/net/minecraft/tags/ItemTags.java
+++ b/net/minecraft/tags/ItemTags.java
@@ -62,6 +62,10 @@
return field_199906_c;
}
+ public static int getGeneration() {
+ return field_199907_d;
+ }
+
private static Tag<Item> func_199901_a(String p_199901_0_) {
return new ItemTags.Wrapper(new ResourceLocation(p_199901_0_));
}

View File

@ -1,10 +0,0 @@
--- a/net/minecraft/tags/NetworkTagManager.java
+++ b/net/minecraft/tags/NetworkTagManager.java
@@ -69,6 +69,7 @@
ItemTags.func_199902_a(this.field_199720_b);
FluidTags.func_206953_a(this.field_205705_c);
EntityTypeTags.func_219759_a(this.field_215299_d);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this));
}, p_215226_6_);
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/tags/TagCollection.java
+++ b/net/minecraft/tags/TagCollection.java
@@ -154,4 +154,8 @@
public Map<ResourceLocation, Tag<T>> func_200039_c() {
return this.field_199921_d;
}
+
+ public Function<ResourceLocation, Optional<T>> getEntryLookup() {
+ return this.field_200040_e;
+ }
}

View File

@ -1,26 +0,0 @@
--- a/net/minecraft/tileentity/BannerPattern.java
+++ b/net/minecraft/tileentity/BannerPattern.java
@@ -14,7 +14,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
import org.apache.commons.lang3.tuple.Pair;
-public enum BannerPattern {
+public enum BannerPattern implements net.minecraftforge.common.IExtensibleEnum {
BASE("base", "b"),
SQUARE_BOTTOM_LEFT("square_bottom_left", "bl", " ", " ", "# "),
SQUARE_BOTTOM_RIGHT("square_bottom_right", "br", " ", " ", " #"),
@@ -107,6 +107,14 @@
return null;
}
+ public static BannerPattern create(String enumName, String p_i47246_3_, String p_i47246_4_, ItemStack p_i47246_5_) {
+ throw new IllegalStateException("Enum not extended");
+ }
+
+ public static BannerPattern create(String enumName, String p_i47247_3_, String p_i47247_4_, String p_i47247_5_, String p_i47247_6_, String p_i47247_7_) {
+ throw new IllegalStateException("Enum not extended");
+ }
+
public static class Builder {
private final List<Pair<BannerPattern, DyeColor>> field_222478_a = Lists.newArrayList();

View File

@ -1,76 +0,0 @@
--- a/net/minecraft/tileentity/BrewingStandTileEntity.java
+++ b/net/minecraft/tileentity/BrewingStandTileEntity.java
@@ -146,6 +146,7 @@
private boolean func_145934_k() {
ItemStack itemstack = this.field_145945_j.get(3);
+ if (!itemstack.func_190926_b()) return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(field_145945_j, itemstack, field_145947_i); // divert to VanillaBrewingRegistry
if (itemstack.func_190926_b()) {
return false;
} else if (!PotionBrewing.func_185205_a(itemstack)) {
@@ -163,16 +164,16 @@
}
private void func_145940_l() {
+ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBrew(field_145945_j)) return;
ItemStack itemstack = this.field_145945_j.get(3);
- for(int i = 0; i < 3; ++i) {
- this.field_145945_j.set(i, PotionBrewing.func_185212_d(itemstack, this.field_145945_j.get(i)));
- }
+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(field_145945_j, itemstack, field_145947_i);
itemstack.func_190918_g(1);
+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(field_145945_j);
BlockPos blockpos = this.func_174877_v();
- if (itemstack.func_77973_b().func_77634_r()) {
- ItemStack itemstack1 = new ItemStack(itemstack.func_77973_b().func_77668_q());
+ if (itemstack.hasContainerItem()) {
+ ItemStack itemstack1 = itemstack.getContainerItem();
if (itemstack.func_190926_b()) {
itemstack = itemstack1;
} else if (!this.field_145850_b.field_72995_K) {
@@ -229,13 +230,13 @@
public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) {
if (p_94041_1_ == 3) {
- return PotionBrewing.func_185205_a(p_94041_2_);
+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_94041_2_);
} else {
Item item = p_94041_2_.func_77973_b();
if (p_94041_1_ == 4) {
return item == Items.field_151065_br;
} else {
- return (item == Items.field_151068_bn || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.field_151069_bo) && this.func_70301_a(p_94041_1_).func_190926_b();
+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_94041_2_) && this.func_70301_a(p_94041_1_).func_190926_b();
}
}
}
@@ -267,4 +268,27 @@
protected Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_) {
return new BrewingStandContainer(p_213906_1_, p_213906_2_, this, this.field_213954_a);
}
+
+ net.minecraftforge.common.util.LazyOptional<? extends net.minecraftforge.items.IItemHandler>[] handlers =
+ net.minecraftforge.items.wrapper.SidedInvWrapper.create(this, Direction.UP, Direction.DOWN, Direction.NORTH);
+
+ @Override
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
+ if (!this.field_145846_f && facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
+ if (facing == Direction.UP)
+ return handlers[0].cast();
+ else if (facing == Direction.DOWN)
+ return handlers[1].cast();
+ else
+ return handlers[2].cast();
+ }
+ return super.getCapability(capability, facing);
+ }
+
+ @Override
+ public void func_145843_s() {
+ super.func_145843_s();
+ for (int x = 0; x < handlers.length; x++)
+ handlers[x].invalidate();
+ }
}

View File

@ -1,14 +0,0 @@
--- a/net/minecraft/tileentity/ConduitTileEntity.java
+++ b/net/minecraft/tileentity/ConduitTileEntity.java
@@ -131,10 +131,8 @@
BlockPos blockpos1 = this.field_174879_c.func_177982_a(j1, k1, l1);
BlockState blockstate = this.field_145850_b.func_180495_p(blockpos1);
- for(Block block : field_205042_e) {
- if (blockstate.func_177230_c() == block) {
+ if (blockstate.isConduitFrame(this.field_145850_b, blockpos1, func_174877_v())) {
this.field_205046_i.add(blockpos1);
- }
}
}
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/tileentity/IChestLid.java
+++ b/net/minecraft/tileentity/IChestLid.java
@@ -3,7 +3,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-@OnlyIn(Dist.CLIENT)
public interface IChestLid {
+ @OnlyIn(Dist.CLIENT)
float func_195480_a(float p_195480_1_);
}

Some files were not shown because too many files have changed in this diff Show More