Compiling fixes - IN GAME!

This commit is contained in:
covers1624 2020-06-24 19:14:47 +09:30 committed by cpw
parent 631230b298
commit 80eb12e59d
No known key found for this signature in database
GPG Key ID: 8EB3DF749553B1B7
364 changed files with 1170 additions and 9853 deletions

View File

@ -0,0 +1,10 @@
--- a/net/minecraft/advancements/Advancement.java
+++ b/net/minecraft/advancements/Advancement.java
@@ -309,6 +309,7 @@
}
public static Advancement.Builder func_241043_a_(JsonObject p_241043_0_, ConditionArrayParser p_241043_1_) {
+ if (!net.minecraftforge.common.crafting.ConditionalAdvancement.processConditions(p_241043_0_)) return null;
ResourceLocation resourcelocation = p_241043_0_.has("parent") ? new ResourceLocation(JSONUtils.func_151200_h(p_241043_0_, "parent")) : null;
DisplayInfo displayinfo = p_241043_0_.has("display") ? DisplayInfo.func_192294_a(JSONUtils.func_152754_s(p_241043_0_, "display")) : null;
AdvancementRewards advancementrewards = p_241043_0_.has("rewards") ? AdvancementRewards.func_241096_a_(JSONUtils.func_152754_s(p_241043_0_, "rewards")) : AdvancementRewards.field_192114_a;

View File

@ -0,0 +1,13 @@
--- a/net/minecraft/advancements/AdvancementManager.java
+++ b/net/minecraft/advancements/AdvancementManager.java
@@ -36,6 +36,10 @@
try {
JsonObject jsonobject = JSONUtils.func_151210_l(p_240923_3_, "advancement");
Advancement.Builder advancement$builder = Advancement.Builder.func_241043_a_(jsonobject, new ConditionArrayParser(p_240923_2_, this.field_240922_d_));
+ if (advancement$builder == null) {
+ field_192782_a.debug("Skipping loading advancement {} as it's conditions were not met", p_240923_2_);
+ return;
+ }
map.put(p_240923_2_, advancement$builder);
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
field_192782_a.error("Parsing error loading custom advancement {}: {}", p_240923_2_, jsonparseexception.getMessage());

View File

@ -1,11 +1,11 @@
--- a/net/minecraft/advancements/AdvancementRewards.java
+++ b/net/minecraft/advancements/AdvancementRewards.java
@@ -43,7 +43,7 @@
@@ -39,7 +39,7 @@
public void func_192113_a(ServerPlayerEntity p_192113_1_) {
p_192113_1_.func_195068_e(this.field_192115_b);
- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_216286_f, new BlockPos(p_192113_1_)).func_216023_a(p_192113_1_.func_70681_au()).func_216022_a(LootParameterSets.field_216265_f);
+ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_216286_f, new BlockPos(p_192113_1_)).func_216023_a(p_192113_1_.func_70681_au()).func_186469_a(p_192113_1_.func_184817_da()).func_216022_a(LootParameterSets.field_216265_f); // FORGE: luck to LootContext
- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_216286_f, p_192113_1_.func_233580_cy_()).func_216023_a(p_192113_1_.func_70681_au()).func_216022_a(LootParameterSets.field_216265_f);
+ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_216286_f, p_192113_1_.func_233580_cy_()).func_216023_a(p_192113_1_.func_70681_au()).func_186469_a(p_192113_1_.func_184817_da()).func_216022_a(LootParameterSets.field_216265_f); // FORGE: luck to LootContext
boolean flag = false;
for(ResourceLocation resourcelocation : this.field_192116_c) {

View File

@ -82,7 +82,25 @@
public abstract static class AbstractBlockState extends StateHolder<Block, BlockState> {
private final int field_215708_d;
private final boolean field_215709_e;
@@ -786,6 +794,7 @@
@@ -427,6 +435,8 @@
return this.field_215708_d;
}
+ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos) */
+ @Deprecated
public boolean func_196958_f() {
return this.field_235702_f_;
}
@@ -435,6 +445,8 @@
return this.field_235704_h_;
}
+ /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation) */
+ @Deprecated
public BlockState func_185907_a(Rotation p_185907_1_) {
return this.func_177230_c().func_185499_a(this.func_230340_p_(), p_185907_1_);
}
@@ -786,6 +798,7 @@
private ResourceLocation field_222381_j;
private boolean field_226895_m_ = true;
private boolean field_235813_o_;

View File

@ -0,0 +1,15 @@
--- a/net/minecraft/block/AbstractTopPlantBlock.java
+++ b/net/minecraft/block/AbstractTopPlantBlock.java
@@ -39,10 +39,11 @@
}
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
- if (p_225542_1_.func_177229_b(field_235502_d_) < 25 && p_225542_4_.nextDouble() < this.field_235503_e_) {
+ if (p_225542_1_.func_177229_b(field_235502_d_) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_.func_177972_a(this.field_235498_a_), p_225542_2_.func_180495_p(p_225542_3_.func_177972_a(this.field_235498_a_)),p_225542_4_.nextDouble() < this.field_235503_e_)) {
BlockPos blockpos = p_225542_3_.func_177972_a(this.field_235498_a_);
if (this.func_230334_h_(p_225542_2_.func_180495_p(blockpos))) {
p_225542_2_.func_175656_a(blockpos, p_225542_1_.func_235896_a_(field_235502_d_));
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, blockpos, p_225542_2_.func_180495_p(blockpos));
}
}

View File

@ -1,16 +1,18 @@
--- a/net/minecraft/block/Block.java
+++ b/net/minecraft/block/Block.java
@@ -52,8 +52,9 @@
@@ -52,9 +52,10 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public class Block extends AbstractBlock implements IItemProvider {
+public class Block extends AbstractBlock implements IItemProvider, net.minecraftforge.common.extensions.IForgeBlock {
protected static final Logger field_196273_d = LogManager.getLogger();
- public static final ObjectIntIdentityMap<BlockState> field_176229_d = new ObjectIntIdentityMap<>();
+ @Deprecated //Forge: Do not use, use GameRegistry
public static final ObjectIntIdentityMap<BlockState> field_176229_d = new ObjectIntIdentityMap<>();
+ public static final ObjectIntIdentityMap<BlockState> field_176229_d = net.minecraftforge.registries.GameData.getBlockStateIDMap();
private static final LoadingCache<VoxelShape, Boolean> field_223006_b = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader<VoxelShape, Boolean>() {
public Boolean load(VoxelShape p_load_1_) {
return !VoxelShapes.func_197879_c(VoxelShapes.func_197868_b(), p_load_1_, IBooleanFunction.field_223236_g_);
@@ -270,7 +271,7 @@
}
@ -79,7 +81,7 @@
}
@OnlyIn(Dist.CLIENT)
@@ -419,6 +424,73 @@
@@ -419,6 +424,77 @@
return this;
}
@ -111,7 +113,7 @@
+ net.minecraftforge.common.PlantType type = plantable.getPlantType(world, pos.func_177972_a(facing));
+
+ if (plant.func_177230_c() == Blocks.field_150434_aF)
+ return this.getBlock() == Blocks.field_150434_aF || this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_196611_F;
+ return state.func_203425_a(Blocks.field_150434_aF) || state.func_203425_a(Blocks.field_150354_m) || state.func_203425_a(Blocks.field_196611_F);
+
+ if (plant.func_177230_c() == Blocks.field_196608_cF && this == Blocks.field_196608_cF)
+ return true;
@ -122,16 +124,20 @@
+ 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 this.getBlock() == Blocks.field_150458_ak;
+ 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 = this.getBlock() == Blocks.field_196658_i || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || this.getBlock() == Blocks.field_150354_m;
+ boolean hasWater = (world.func_180495_p(pos.func_177974_f()).func_185904_a() == net.minecraft.block.material.Material.field_151586_h ||
+ world.func_180495_p(pos.func_177976_e()).func_185904_a() == net.minecraft.block.material.Material.field_151586_h ||
+ world.func_180495_p(pos.func_177978_c()).func_185904_a() == net.minecraft.block.material.Material.field_151586_h ||
+ world.func_180495_p(pos.func_177968_d()).func_185904_a() == net.minecraft.block.material.Material.field_151586_h);
+ 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

@ -8,3 +8,28 @@
public class Blocks {
public static final Block field_150350_a = func_222382_a("air", new AirBlock(AbstractBlock.Properties.func_200945_a(Material.field_151579_a).func_200942_a().func_222380_e().func_235859_g_()));
public static final Block field_150348_b = func_222382_a("stone", new Block(AbstractBlock.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151665_m).func_235861_h_().func_200948_a(1.5F, 6.0F)));
@@ -120,7 +121,7 @@
public static final Block field_196601_az = func_222382_a("green_bed", func_235422_a_(DyeColor.GREEN));
public static final Block field_196550_aA = func_222382_a("red_bed", func_235422_a_(DyeColor.RED));
public static final Block field_196551_aB = func_222382_a("black_bed", func_235422_a_(DyeColor.BLACK));
- public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e)));
+ public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e), true));
public static final Block field_150319_E = func_222382_a("detector_rail", new DetectorRailBlock(AbstractBlock.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e)));
public static final Block field_150320_F = func_222382_a("sticky_piston", func_235432_a_(true));
public static final Block field_196553_aF = func_222382_a("cobweb", new WebBlock(AbstractBlock.Properties.func_200945_a(Material.field_151569_G).func_200942_a().func_235861_h_().func_200943_b(4.0F)));
@@ -938,15 +939,4 @@
public static void func_235419_a_() {
Block.field_176229_d.forEach(AbstractBlock.AbstractBlockState::func_215692_c);
}
-
- static {
- for(Block block : Registry.field_212618_g) {
- for(BlockState blockstate : block.func_176194_O().func_177619_a()) {
- Block.field_176229_d.func_195867_b(blockstate);
- }
-
- block.func_220068_i();
- }
-
- }
}

View File

@ -35,6 +35,15 @@
}
}
}
@@ -84,7 +87,7 @@
}
BlockState blockstate1 = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
- return (blockstate1.func_203425_a(Blocks.field_150434_aF) || blockstate1.func_203425_a(Blocks.field_150354_m) || blockstate1.func_203425_a(Blocks.field_196611_F)) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
+ return blockstate1.canSustainPlant(p_196260_2_, p_196260_3_, Direction.UP, this) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
}
public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
@@ -98,4 +101,14 @@
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return false;

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/block/CampfireBlock.java
+++ b/net/minecraft/block/CampfireBlock.java
@@ -181,7 +181,7 @@
public void func_220066_a(World p_220066_1_, BlockState p_220066_2_, BlockRayTraceResult p_220066_3_, ProjectileEntity p_220066_4_) {
if (!p_220066_1_.field_72995_K && p_220066_4_.func_70027_ad()) {
Entity entity = p_220066_4_.func_234616_v_();
- boolean flag = entity == null || entity instanceof PlayerEntity || p_220066_1_.func_82736_K().func_223586_b(GameRules.field_223599_b);
+ boolean flag = entity == null || entity instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_220066_1_, entity);
if (flag && !p_220066_2_.func_177229_b(field_220101_b) && !p_220066_2_.func_177229_b(field_220103_d)) {
BlockPos blockpos = p_220066_3_.func_216350_a();
p_220066_1_.func_180501_a(blockpos, p_220066_2_.func_206870_a(BlockStateProperties.field_208190_q, Boolean.valueOf(true)), 11);

View File

@ -0,0 +1,16 @@
--- a/net/minecraft/block/CocoaBlock.java
+++ b/net/minecraft/block/CocoaBlock.java
@@ -35,10 +35,11 @@
}
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
- if (p_225542_2_.field_73012_v.nextInt(5) == 0) {
+ if (true) {
int i = p_225542_1_.func_177229_b(field_176501_a);
- if (i < 2) {
+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_2_.field_73012_v.nextInt(5) == 0)) {
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176501_a, Integer.valueOf(i + 1)), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}

View File

@ -1,6 +1,34 @@
--- a/net/minecraft/block/CropsBlock.java
+++ b/net/minecraft/block/CropsBlock.java
@@ -133,7 +133,7 @@
@@ -61,12 +61,14 @@
}
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
+ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
if (p_225542_2_.func_226659_b_(p_225542_3_, 0) >= 9) {
int i = this.func_185527_x(p_225542_1_);
if (i < this.func_185526_g()) {
float f = func_180672_a(this, p_225542_2_, p_225542_3_);
- if (p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0) {
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0)) {
p_225542_2_.func_180501_a(p_225542_3_, this.func_185528_e(i + 1), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}
}
@@ -95,9 +97,9 @@
for(int j = -1; j <= 1; ++j) {
float f1 = 0.0F;
BlockState blockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j));
- if (blockstate.func_203425_a(Blocks.field_150458_ak)) {
+ if (blockstate.canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.Direction.UP, (net.minecraftforge.common.IPlantable) p_180672_0_)) {
f1 = 1.0F;
- if (blockstate.func_177229_b(FarmlandBlock.field_176531_a) > 0) {
+ if (blockstate.isFertile(p_180672_1_, p_180672_2_.func_177982_a(i, 0, j))) {
f1 = 3.0F;
}
}
@@ -133,7 +135,7 @@
}
public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {

View File

@ -1,14 +1,5 @@
--- a/net/minecraft/block/DoublePlantBlock.java
+++ b/net/minecraft/block/DoublePlantBlock.java
@@ -39,7 +39,7 @@
@Nullable
public BlockState func_196258_a(BlockItemUseContext p_196258_1_) {
BlockPos blockpos = p_196258_1_.func_195995_a();
- return blockpos.func_177956_o() < 255 && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null;
+ return blockpos.func_177956_o() < 255 /*TODO context.getWorld().getDimension().getHeight() - 1*/ && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null;
}
public void func_180633_a(World p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
@@ -51,6 +51,7 @@
return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_);
} else {

View File

@ -4,8 +4,8 @@
if (p_180655_4_.nextInt(16) == 0) {
for(int k = 0; k <= 1; ++k) {
BlockPos blockpos = p_180655_3_.func_177982_a(i, k, j);
- if (p_180655_2_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150342_X) {
+ if (p_180655_2_.func_180495_p(blockpos).getEnchantPowerBonus(p_180655_2_, p_180655_3_) > 0) {
- if (p_180655_2_.func_180495_p(blockpos).func_203425_a(Blocks.field_150342_X)) {
+ if (p_180655_2_.func_180495_p(blockpos).getEnchantPowerBonus(p_180655_2_, blockpos) > 0) {
if (!p_180655_2_.func_175623_d(p_180655_3_.func_177982_a(i / 2, 0, j / 2))) {
break;
}

View File

@ -43,6 +43,22 @@
return this.field_212565_c.get(Math.min(i, 8));
}
@@ -122,13 +137,13 @@
BlockPos blockpos = p_204515_2_.func_177972_a(direction);
if (p_204515_1_.func_204610_c(blockpos).func_206884_a(FluidTags.field_206959_a)) {
Block block = p_204515_1_.func_204610_c(p_204515_2_).func_206889_d() ? Blocks.field_150343_Z : Blocks.field_150347_e;
- p_204515_1_.func_175656_a(p_204515_2_, block.func_176223_P());
+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, block.func_176223_P()));
this.func_180688_d(p_204515_1_, p_204515_2_);
return false;
}
if (flag && p_204515_1_.func_180495_p(blockpos).func_203425_a(Blocks.field_205164_gk)) {
- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_235337_cO_.func_176223_P());
+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_235337_cO_.func_176223_P()));
this.func_180688_d(p_204515_1_, p_204515_2_);
return false;
}
@@ -166,4 +181,23 @@
}

View File

@ -9,3 +9,39 @@
netherportalblock$size.func_150859_c();
return true;
} else {
@@ -241,12 +241,12 @@
int i;
for(i = 0; i < 22; ++i) {
BlockPos blockpos = p_180120_1_.func_177967_a(p_180120_2_, i);
- if (!this.func_196900_a(this.field_150867_a.func_180495_p(blockpos)) || !this.field_150867_a.func_180495_p(blockpos.func_177977_b()).func_203425_a(Blocks.field_150343_Z)) {
+ if (!this.func_196900_a(this.field_150867_a.func_180495_p(blockpos)) || !this.field_150867_a.func_180495_p(blockpos.func_177977_b()).isPortalFrame(field_150867_a, blockpos.func_177977_b())) {
break;
}
}
- return this.field_150867_a.func_180495_p(p_180120_1_.func_177967_a(p_180120_2_, i)).func_203425_a(Blocks.field_150343_Z) ? i : 0;
+ return this.field_150867_a.func_180495_p(p_180120_1_.func_177967_a(p_180120_2_, i)).isPortalFrame(field_150867_a, p_180120_1_.func_177967_a(p_180120_2_, i)) ? i : 0;
}
public int func_181100_a() {
@@ -272,17 +272,17 @@
}
if (i == 0) {
- if (!this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150863_d)).func_203425_a(Blocks.field_150343_Z)) {
+ if (!this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150863_d)).isPortalFrame(field_150867_a, blockpos.func_177972_a(this.field_150863_d))) {
break label56;
}
- } else if (i == this.field_150868_h - 1 && !this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150866_c)).func_203425_a(Blocks.field_150343_Z)) {
+ } else if (i == this.field_150868_h - 1 && !this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150866_c)).isPortalFrame(field_150867_a, blockpos.func_177972_a(this.field_150866_c))) {
break label56;
}
}
}
for(int j = 0; j < this.field_150868_h; ++j) {
- if (!this.field_150867_a.func_180495_p(this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g)).func_203425_a(Blocks.field_150343_Z)) {
+ if (!this.field_150867_a.func_180495_p(this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g)).isPortalFrame(field_150867_a, this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g))) {
this.field_150862_g = 0;
break;
}

View File

@ -9,7 +9,18 @@
p_196482_1_.func_175641_c(p_196482_2_, this, 0, 0);
}
@@ -76,6 +76,9 @@
@@ -60,7 +60,9 @@
if (p_225533_2_.field_72995_K) {
return ActionResultType.SUCCESS;
} else {
- p_225533_1_ = p_225533_1_.func_235896_a_(field_196485_c);
+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_225533_2_, p_225533_3_, p_225533_1_, p_225533_1_.func_177229_b(field_196485_c), p_225533_1_.func_235896_a_(field_196485_c).func_177229_b(field_196485_c));
+ if (_new == -1) return ActionResultType.FAIL;
+ p_225533_1_ = p_225533_1_.func_206870_a(field_196485_c, _new);
p_225533_2_.func_180501_a(p_225533_3_, p_225533_1_, 3);
this.func_196482_a(p_225533_2_, p_225533_3_);
p_225533_4_.func_195066_a(Stats.field_188087_U);
@@ -76,6 +78,9 @@
}
public boolean func_189539_a(BlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) {

View File

@ -8,11 +8,11 @@
this.func_226942_a_(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_);
}
@@ -39,6 +40,7 @@
@@ -38,6 +39,7 @@
if (p_226942_3_.func_177229_b(field_176479_b) == 0) {
p_226942_1_.func_180501_a(p_226942_2_, p_226942_3_.func_235896_a_(field_176479_b), 4);
} else {
this.field_196387_c.func_230339_a_(p_226942_1_, p_226942_1_.func_72863_F().func_201711_g(), p_226942_2_, p_226942_3_, p_226942_4_);
+ if (!net.minecraftforge.event.ForgeEventFactory.saplingGrowTree(p_226942_1_, p_226942_4_, p_226942_2_)) return;
this.field_196387_c.func_230339_a_(p_226942_1_, p_226942_1_.func_72863_F().func_201711_g(), p_226942_2_, p_226942_3_, p_226942_4_);
}
}

View File

@ -9,7 +9,22 @@
public static final IntegerProperty field_176355_a = BlockStateProperties.field_208171_X;
protected static final VoxelShape field_196503_b = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 16.0D, 14.0D);
@@ -63,6 +63,8 @@
@@ -43,12 +43,14 @@
if (i < 3) {
int j = p_225542_1_.func_177229_b(field_176355_a);
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, true)) {
if (j == 15) {
p_225542_2_.func_175656_a(p_225542_3_.func_177984_a(), this.func_176223_P());
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176355_a, Integer.valueOf(0)), 4);
} else {
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176355_a, Integer.valueOf(j + 1)), 4);
}
+ }
}
}
@@ -63,6 +65,8 @@
}
public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
@ -18,7 +33,7 @@
BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
if (blockstate.func_177230_c() == this) {
return true;
@@ -86,4 +88,14 @@
@@ -86,4 +90,14 @@
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.func_206894_a(field_176355_a);
}

View File

@ -0,0 +1,13 @@
--- a/net/minecraft/block/SweetBerryBushBlock.java
+++ b/net/minecraft/block/SweetBerryBushBlock.java
@@ -52,8 +52,9 @@
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
int i = p_225542_1_.func_177229_b(field_220125_a);
- if (i < 3 && p_225542_4_.nextInt(5) == 0 && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) {
+ if (i < 3 && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_,p_225542_4_.nextInt(5) == 0)) {
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_220125_a, Integer.valueOf(i + 1)), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}

View File

@ -1,6 +1,22 @@
--- a/net/minecraft/block/TNTBlock.java
+++ b/net/minecraft/block/TNTBlock.java
@@ -41,7 +41,7 @@
@@ -29,10 +29,14 @@
this.func_180632_j(this.func_176223_P().func_206870_a(field_212569_a, Boolean.valueOf(false)));
}
+ public void catchFire(BlockState state, World world, BlockPos pos, @Nullable net.minecraft.util.Direction face, @Nullable LivingEntity igniter) {
+ func_196535_a(world, pos, igniter);
+ }
+
public void func_220082_b(BlockState p_220082_1_, World p_220082_2_, BlockPos p_220082_3_, BlockState p_220082_4_, boolean p_220082_5_) {
if (!p_220082_4_.func_203425_a(p_220082_1_.func_177230_c())) {
if (p_220082_2_.func_175640_z(p_220082_3_)) {
- func_196534_a(p_220082_2_, p_220082_3_);
+ catchFire(p_220082_1_, p_220082_2_, p_220082_3_, null, null);
p_220082_2_.func_217377_a(p_220082_3_, false);
}
@@ -41,7 +45,7 @@
public void func_220069_a(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) {
if (p_220069_2_.func_175640_z(p_220069_3_)) {
@ -9,7 +25,7 @@
p_220069_2_.func_217377_a(p_220069_3_, false);
}
@@ -49,7 +49,7 @@
@@ -49,7 +53,7 @@
public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, PlayerEntity p_176208_4_) {
if (!p_176208_1_.func_201670_d() && !p_176208_4_.func_184812_l_() && p_176208_3_.func_177229_b(field_212569_a)) {
@ -18,7 +34,7 @@
}
super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
@@ -63,10 +63,12 @@
@@ -63,10 +67,12 @@
}
}
@ -31,7 +47,7 @@
private static void func_196535_a(World p_196535_0_, BlockPos p_196535_1_, @Nullable LivingEntity p_196535_2_) {
if (!p_196535_0_.field_72995_K) {
TNTEntity tntentity = new TNTEntity(p_196535_0_, (double)p_196535_1_.func_177958_n() + 0.5D, (double)p_196535_1_.func_177956_o(), (double)p_196535_1_.func_177952_p() + 0.5D, p_196535_2_);
@@ -81,7 +83,7 @@
@@ -81,7 +87,7 @@
if (item != Items.field_151033_d && item != Items.field_151059_bz) {
return super.func_225533_a_(p_225533_1_, p_225533_2_, p_225533_3_, p_225533_4_, p_225533_5_, p_225533_6_);
} else {
@ -40,7 +56,7 @@
p_225533_2_.func_180501_a(p_225533_3_, Blocks.field_150350_a.func_176223_P(), 11);
if (!p_225533_4_.func_184812_l_()) {
if (item == Items.field_151033_d) {
@@ -102,7 +104,7 @@
@@ -102,7 +108,7 @@
Entity entity = p_220066_4_.func_234616_v_();
if (p_220066_4_.func_70027_ad()) {
BlockPos blockpos = p_220066_3_.func_216350_a();

View File

@ -289,10 +289,11 @@
worldloadprogressscreen.func_231023_e_();
this.func_195542_b(false);
@@ -1697,6 +1740,12 @@
@@ -1696,7 +1739,12 @@
networkmanager.func_150719_a(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_229998_0_) -> {
}));
networkmanager.func_179290_a(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN));
networkmanager.func_179290_a(new CLoginStartPacket(this.func_110432_I().func_148256_e()));
- networkmanager.func_179290_a(new CLoginStartPacket(this.func_110432_I().func_148256_e()));
+ com.mojang.authlib.GameProfile gameProfile = this.func_110432_I().func_148256_e();
+ if (!this.func_110432_I().hasCachedProperties()) {
+ gameProfile = field_152355_az.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974.
@ -302,7 +303,7 @@
this.field_71453_ak = networkmanager;
} else {
this.func_241559_a_(p_238195_6_, p_238195_1_, flag, () -> {
@@ -1770,6 +1819,7 @@
@@ -1770,6 +1818,7 @@
}
public void func_71403_a(ClientWorld p_71403_1_) {
@ -310,7 +311,7 @@
WorkingScreen workingscreen = new WorkingScreen();
workingscreen.func_200210_a(new TranslationTextComponent("connect.joining"));
this.func_213241_c(workingscreen);
@@ -1801,10 +1851,12 @@
@@ -1801,10 +1850,12 @@
IntegratedServer integratedserver = this.field_71437_Z;
this.field_71437_Z = null;
this.field_71460_t.func_190564_k();
@ -323,7 +324,7 @@
if (integratedserver != null) {
this.field_71424_I.func_76320_a("waitForServer");
@@ -1819,6 +1871,7 @@
@@ -1819,6 +1870,7 @@
this.field_71456_v.func_181029_i();
this.field_71422_O = null;
this.field_71455_al = false;
@ -331,7 +332,7 @@
this.field_213274_aO.func_216815_b();
}
@@ -1849,6 +1902,7 @@
@@ -1849,6 +1901,7 @@
this.field_71452_i.func_78870_a(p_213257_1_);
TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_213257_1_);
this.func_230150_b_();
@ -339,7 +340,7 @@
}
public boolean func_238216_r_() {
@@ -1894,112 +1948,9 @@
@@ -1894,112 +1947,9 @@
private void func_147112_ai() {
if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) {
@ -455,7 +456,7 @@
}
}
@@ -2081,6 +2032,7 @@
@@ -2081,6 +2031,7 @@
return field_71432_P;
}
@ -463,7 +464,7 @@
public CompletableFuture<Void> func_213245_w() {
return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> {
return p_229993_0_;
@@ -2388,7 +2340,7 @@
@@ -2388,7 +2339,7 @@
supplier = func_228022_c_(supplier);
}
@ -472,7 +473,7 @@
}
private static Supplier<IResourcePack> func_228021_b_(Supplier<IResourcePack> p_228021_0_) {
@@ -2407,6 +2359,14 @@
@@ -2407,6 +2358,14 @@
this.field_175617_aL.func_229355_a_(p_228020_1_);
}

View File

@ -0,0 +1,22 @@
--- a/net/minecraft/client/gui/screen/PackLoadingManager.java
+++ b/net/minecraft/client/gui/screen/PackLoadingManager.java
@@ -135,6 +135,11 @@
public void func_230468_k_() {
this.func_238879_a_(1);
}
+
+ @Override
+ public boolean notHidden() {
+ return !field_238878_b_.isHidden();
+ }
}
@OnlyIn(Dist.CLIENT)
@@ -230,5 +235,7 @@
boolean func_230469_o_();
boolean func_230470_p_();
+
+ default boolean notHidden() { return true; }
}
}

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screen/PackScreen.java
+++ b/net/minecraft/client/gui/screen/PackScreen.java
@@ -84,7 +84,7 @@
private void func_238899_a_(ResourcePackList p_238899_1_, Stream<PackLoadingManager.IPack> p_238899_2_) {
p_238899_1_.func_231039_at__().clear();
- p_238899_2_.forEach((p_238898_2_) -> {
+ p_238899_2_.filter(PackLoadingManager.IPack::notHidden).forEach((p_238898_2_) -> {
p_238899_1_.func_231039_at__().add(new ResourcePackList.ResourcePackEntry(this.field_230706_i_, p_238899_1_, this, p_238898_2_));
});
}

View File

@ -200,7 +200,7 @@
+ for (int idx = start; idx < end; idx++) {
+ ItemGroup itemgroup1 = ItemGroup.field_78032_a[idx];
+ if (itemgroup1 != null && itemgroup1.func_78021_a() != field_147058_w) {
+ this.field_230706_i_.func_110434_K().func_110577_a(itemgroup1.getBackgroundImage());
+ this.field_230706_i_.func_110434_K().func_110577_a(itemgroup1.getTabsImage());
this.func_238808_a_(p_230450_1_, itemgroup1);
}
}
@ -253,16 +253,7 @@
this.func_238474_b_(p_238808_1_, l, i1, j, k, 28, 32);
this.field_230707_j_.field_77023_b = 100.0F;
l = l + 6;
@@ -769,6 +852,8 @@
for(int i = 0; i < 5; ++i) {
for(int j = 0; j < 9; ++j) {
this.func_75146_a(new CreativeScreen.LockedSlot(CreativeScreen.field_195378_x, i * 9 + j, 9 + j * 18, 18 + i * 18));
+ RenderSystem.color3f(1F, 1F, 1F); //Forge: Reset color in case Items change it.
+ RenderSystem.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
}
}
@@ -884,6 +969,22 @@
@@ -884,6 +967,22 @@
public boolean func_82869_a(PlayerEntity p_82869_1_) {
return this.field_148332_b.func_82869_a(p_82869_1_);
}

View File

@ -8,8 +8,8 @@
+ public int getHeight() { return this.field_230671_e_; }
+ public int getTop() { return this.field_230672_i_; }
+ public int getBottom() { return this.field_230673_j_; }
+ public int getLeft() { return this.field_230674_k_; }
+ public int getRight() { return this.field_230675_l_; }
+ public int getLeft() { return this.field_230675_l_; }
+ public int getRight() { return this.field_230674_k_; }
+
@OnlyIn(Dist.CLIENT)
public abstract static class AbstractListEntry<E extends AbstractList.AbstractListEntry<E>> implements IGuiEventListener {

View File

@ -82,7 +82,7 @@
public float func_78757_d() {
- return this.field_78779_k.func_77145_d() ? 5.0F : 4.5F;
+ float attrib = (float)field_78776_a.field_71439_g.func_110148_a(PlayerEntity.REACH_DISTANCE).func_111126_e();
+ float attrib = (float)field_78776_a.field_71439_g.func_110148_a(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).func_111126_e();
+ return this.field_78779_k.func_77145_d() ? attrib : attrib - 0.5F;
}

View File

@ -16,7 +16,27 @@
this.field_147299_f.field_71474_y.func_82879_c();
this.field_147302_e.func_179290_a(new CCustomPayloadPacket(CCustomPayloadPacket.field_210344_a, (new PacketBuffer(Unpooled.buffer())).func_180714_a(ClientBrandRetriever.getClientModName())));
this.field_147299_f.func_213229_ar().func_216814_a();
@@ -1034,8 +1036,10 @@
@@ -745,7 +747,7 @@
BlockPos blockpos = new BlockPos(compoundnbt.func_74762_e("x"), compoundnbt.func_74762_e("y"), compoundnbt.func_74762_e("z"));
TileEntity tileentity = this.field_147300_g.func_175625_s(blockpos);
if (tileentity != null) {
- tileentity.func_230337_a_(this.field_147300_g.func_180495_p(blockpos), compoundnbt);
+ tileentity.handleUpdateTag(this.field_147300_g.func_180495_p(blockpos), compoundnbt);
}
}
@@ -844,7 +846,9 @@
public void func_147251_a(SChatPacket p_147251_1_) {
PacketThreadUtil.func_218797_a(p_147251_1_, this, this.field_147299_f);
- this.field_147299_f.field_71456_v.func_238450_a_(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c(), p_147251_1_.func_240810_e_());
+ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c());
+ if (message == null) return;
+ this.field_147299_f.field_71456_v.func_238450_a_(p_147251_1_.func_192590_c(), message, p_147251_1_.func_240810_e_());
}
public void func_147279_a(SAnimateHandPacket p_147279_1_) {
@@ -1034,8 +1038,10 @@
clientplayerentity1.func_233645_dx_().func_233784_a_(clientplayerentity.func_233645_dx_());
}
@ -27,7 +47,7 @@
this.field_147300_g.func_217408_a(i, clientplayerentity1);
clientplayerentity1.field_70177_z = -180.0F;
clientplayerentity1.field_71158_b = new MovementInputFromOptions(this.field_147299_f.field_71474_y);
@@ -1161,6 +1165,12 @@
@@ -1161,6 +1167,12 @@
if (flag && this.field_147299_f.field_71462_r instanceof CommandBlockScreen) {
((CommandBlockScreen)this.field_147299_f.field_71462_r).func_184075_a();
@ -40,7 +60,7 @@
}
}
@@ -1329,6 +1339,7 @@
@@ -1329,6 +1341,7 @@
clientrecipebook.func_199644_c();
clientrecipebook.func_199642_d().forEach(imutablesearchtree::func_217872_a);
imutablesearchtree.func_194040_a();
@ -48,7 +68,7 @@
}
public void func_200232_a(SPlayerLookPacket p_200232_1_) {
@@ -1409,7 +1420,7 @@
@@ -1409,7 +1422,7 @@
PacketThreadUtil.func_218797_a(p_147260_1_, this, this.field_147299_f);
Entity entity = this.field_147300_g.func_73045_a(p_147260_1_.func_149426_d());
if (entity instanceof LivingEntity) {
@ -57,7 +77,7 @@
if (effect != null) {
EffectInstance effectinstance = new EffectInstance(effect, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), p_147260_1_.func_186984_g(), p_147260_1_.func_179707_f(), p_147260_1_.func_205527_h());
effectinstance.func_100012_b(p_147260_1_.func_149429_c());
@@ -1426,6 +1437,7 @@
@@ -1426,6 +1439,7 @@
}
this.field_147299_f.func_213253_a(SearchTreeManager.field_215360_b).func_194040_a();
@ -65,7 +85,7 @@
}
public void func_175098_a(SCombatPacket p_175098_1_) {
@@ -1909,10 +1921,12 @@
@@ -1909,10 +1923,12 @@
int l5 = packetbuffer.readInt();
this.field_147299_f.field_184132_p.field_229018_q_.func_229022_a_(blockpos8, l3, s10, l5);
} else {

View File

@ -18,15 +18,16 @@
}
}
@@ -477,6 +479,7 @@
@@ -476,7 +478,7 @@
}
} else if (this.field_78531_r.field_71462_r != null) {
try {
this.field_78531_r.field_71462_r.func_230430_a_(matrixstack, i, j, this.field_78531_r.func_193989_ak());
- this.field_78531_r.field_71462_r.func_230430_a_(matrixstack, i, j, this.field_78531_r.func_193989_ak());
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.field_78531_r.field_71462_r, matrixstack, i, j, this.field_78531_r.func_193989_ak());
} catch (Throwable throwable) {
CrashReport crashreport1 = CrashReport.func_85055_a(throwable, "Rendering screen");
CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Screen render details");
@@ -589,9 +592,16 @@
@@ -589,9 +591,16 @@
Matrix4f matrix4f = matrixstack.func_227866_c_().func_227870_a_();
this.func_228379_a_(matrix4f);
activerenderinfo.func_216772_a(this.field_78531_r.field_71441_e, (Entity)(this.field_78531_r.func_175606_aa() == null ? this.field_78531_r.field_71439_g : this.field_78531_r.func_175606_aa()), this.field_78531_r.field_71474_y.field_74320_O > 0, this.field_78531_r.field_71474_y.field_74320_O == 2, p_228378_1_);
@ -43,7 +44,7 @@
this.field_78531_r.func_213239_aq().func_219895_b("hand");
if (this.field_175074_C) {
RenderSystem.clear(256, Minecraft.field_142025_a);
@@ -671,4 +681,9 @@
@@ -671,4 +680,9 @@
public OverlayTexture func_228385_m_() {
return this.field_228375_t_;
}

View File

@ -125,7 +125,7 @@
BufferBuilder bufferbuilder2 = p_228940_5_.func_228366_a_(rendertype1);
if (p_228940_4_.field_178501_c.add(rendertype1)) {
ChunkRender.this.func_228923_a_(bufferbuilder2);
@@ -500,7 +524,7 @@
@@ -500,14 +524,16 @@
matrixstack.func_227860_a_();
matrixstack.func_227861_a_((double)(blockpos2.func_177958_n() & 15), (double)(blockpos2.func_177956_o() & 15), (double)(blockpos2.func_177952_p() & 15));
@ -134,11 +134,11 @@
p_228940_4_.field_178498_d = false;
p_228940_4_.field_178500_b.add(rendertype1);
}
@@ -508,6 +532,8 @@
matrixstack.func_227865_b_();
}
+ }
}
+ }
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null);
if (p_228940_4_.field_178500_b.contains(RenderType.func_228645_f_())) {

View File

@ -1,11 +1,11 @@
--- a/net/minecraft/client/shader/ShaderGroup.java
+++ b/net/minecraft/client/shader/ShaderGroup.java
@@ -143,7 +143,8 @@
String s3 = JSONUtils.func_151200_h(jsonobject1, "id");
Framebuffer framebuffer2 = this.func_148017_a(s3);
if (framebuffer2 == null) {
- ResourceLocation resourcelocation = new ResourceLocation("textures/effect/" + s3 + ".png");
+ ResourceLocation rl = ResourceLocation.func_208304_a(s3);
@@ -157,7 +157,8 @@
throw new JSONException("Render target '" + s4 + "' can't be used as depth buffer");
}
- ResourceLocation resourcelocation = new ResourceLocation("textures/effect/" + s4 + ".png");
+ ResourceLocation rl = ResourceLocation.func_208304_a(s4);
+ ResourceLocation resourcelocation = new ResourceLocation(rl.func_110624_b(), "textures/effect/" + rl.func_110623_a() + ".png");
IResource iresource = null;

View File

@ -9,16 +9,15 @@
return false;
} else if (p_212832_2_.func_213700_eh().func_221130_b() != VillagerProfession.field_221156_f) {
return false;
@@ -117,7 +117,12 @@
@@ -117,6 +117,11 @@
} else if (itemstack.func_77973_b() == Items.field_185163_cU) {
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) {
+ 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;
+ } 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) {
+ 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;
+ }
}
+ }
}
if (flag) {

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java
+++ b/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java
@@ -36,7 +36,7 @@
}
protected boolean func_188498_f() {
- return this.field_188499_a.func_233631_a_(Items.field_151031_f);
+ return this.field_188499_a.func_233634_a_(item -> item instanceof BowItem);
}
public boolean func_75253_b() {

View File

@ -5,9 +5,9 @@
BlockState blockstate = this.field_70170_p.func_180495_p(blockpos);
Block block = blockstate.func_177230_c();
- if (!blockstate.func_196958_f() && blockstate.func_185904_a() != Material.field_151581_o) {
- if (this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b) && !BlockTags.field_219754_W.func_199685_a_(block)) {
- if (this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223599_b) && !BlockTags.field_219754_W.func_230235_a_(block)) {
+ if (!blockstate.isAir(this.field_70170_p, blockpos) && blockstate.func_185904_a() != Material.field_151581_o) {
+ if (net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.field_70170_p, blockpos, this) && !BlockTags.field_219754_W.func_199685_a_(block)) {
+ if (net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.field_70170_p, blockpos, this) && !BlockTags.field_219754_W.func_230235_a_(block)) {
flag1 = this.field_70170_p.func_217377_a(blockpos, false) || flag1;
} else {
flag = true;

View File

@ -18,3 +18,19 @@
if (this.func_180431_b(p_70097_1_)) {
return false;
} else {
@@ -151,13 +153,14 @@
public void func_70100_b_(PlayerEntity p_70100_1_) {
if (!this.field_70170_p.field_72995_K) {
if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) {
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerXpEvent.PickupXp(p_70100_1_, this))) return;
p_70100_1_.field_71090_bL = 2;
p_70100_1_.func_71001_a(this, 1);
Entry<EquipmentSlotType, ItemStack> entry = EnchantmentHelper.func_234844_a_(Enchantments.field_185296_A, p_70100_1_, ItemStack::func_77951_h);
if (entry != null) {
ItemStack itemstack = entry.getValue();
if (!itemstack.func_190926_b() && itemstack.func_77951_h()) {
- int i = Math.min(this.func_184514_c(this.field_70530_e), itemstack.func_77952_i());
+ int i = Math.min((int)(this.field_70530_e * itemstack.getXpRepairRatio()), itemstack.func_77952_i());
this.field_70530_e -= this.func_184515_b(i);
itemstack.func_196085_b(itemstack.func_77952_i() - i);
}

View File

@ -57,7 +57,7 @@
return false;
} else if (p_226532_1_.func_77942_o() ^ p_226532_0_.func_77942_o()) {
return false;
+ }else if (!p_226532_0_.areCapsCompatible(p_226532_1_)) {
+ } else if (!p_226532_0_.areCapsCompatible(p_226532_1_)) {
+ return false;
} else {
return !p_226532_1_.func_77942_o() || p_226532_1_.func_77978_p().equals(p_226532_0_.func_77978_p());
@ -86,7 +86,7 @@
if (!this.func_92059_d().func_190926_b()) {
p_213281_1_.func_218657_a("Item", this.func_92059_d().func_77955_b(new CompoundNBT()));
@@ -291,12 +310,21 @@
@@ -291,10 +310,18 @@
public void func_70100_b_(PlayerEntity p_70100_1_) {
if (!this.field_70170_p.field_72995_K) {
@ -105,11 +105,8 @@
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerItemPickupEvent(p_70100_1_, this, copy);
p_70100_1_.func_71001_a(this, i);
if (itemstack.func_190926_b()) {
+ p_70100_1_.func_71001_a(this, i);
this.func_70106_y();
itemstack.func_190920_e(i);
}
@@ -392,7 +420,7 @@
@@ -392,7 +419,7 @@
public void func_174870_v() {
this.func_174871_r();

View File

@ -31,15 +31,19 @@
}
public double func_70042_X() {
@@ -291,6 +293,7 @@
}
@@ -304,9 +306,9 @@
} else {
+ //net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition()));
if (!this.func_189652_ae()) {
this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, -0.04D, 0.0D));
}
@@ -331,8 +334,11 @@
BlockPos blockpos = new BlockPos(i, j, k);
BlockState blockstate = this.field_70170_p.func_180495_p(blockpos);
- if (AbstractRailBlock.func_208487_j(blockstate)) {
+ if (canUseRail() && AbstractRailBlock.func_208487_j(blockstate)) {
this.func_180460_a(blockpos, blockstate);
- if (blockstate.func_203425_a(Blocks.field_150408_cc)) {
+ if (blockstate.func_177230_c() instanceof PoweredRailBlock && ((PoweredRailBlock) blockstate.func_177230_c()).isActivatorRail()) {
this.func_96095_a(i, j, k, blockstate.func_177229_b(PoweredRailBlock.field_176569_M));
}
} else {
@@ -331,8 +333,11 @@
}
this.func_70101_b(this.field_70177_z, this.field_70125_A);
@ -53,7 +57,7 @@
if (!list.isEmpty()) {
for(int l = 0; l < list.size(); ++l) {
Entity entity1 = list.get(l);
@@ -344,7 +350,7 @@
@@ -344,7 +349,7 @@
}
}
} else {
@ -62,7 +66,77 @@
if (!this.func_184196_w(entity) && entity.func_70104_M() && entity instanceof AbstractMinecartEntity) {
entity.func_70108_f(this);
}
@@ -440,7 +446,7 @@
@@ -352,6 +357,7 @@
}
this.func_233566_aG_();
+ //net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition()));
}
}
@@ -363,16 +369,23 @@
}
protected void func_180459_n() {
- double d0 = this.func_174898_m();
+ double d0 = field_70122_E ? this.func_174898_m() : getMaxSpeedAirLateral();
Vector3d vector3d = this.func_213322_ci();
this.func_213293_j(MathHelper.func_151237_a(vector3d.field_72450_a, -d0, d0), vector3d.field_72448_b, MathHelper.func_151237_a(vector3d.field_72449_c, -d0, d0));
if (this.field_70122_E) {
this.func_213317_d(this.func_213322_ci().func_186678_a(0.5D));
}
+ if (getMaxSpeedAirVertical() > 0 && func_213322_ci().field_72448_b > getMaxSpeedAirVertical()) {
+ if(Math.abs(func_213322_ci().field_72450_a) < 0.3f && Math.abs(func_213322_ci().field_72449_c) < 0.3f)
+ func_213317_d(new Vector3d(func_213322_ci().field_72450_a, 0.15f, func_213322_ci().field_72449_c));
+ else
+ func_213317_d(new Vector3d(func_213322_ci().field_72450_a, getMaxSpeedAirVertical(), func_213322_ci().field_72449_c));
+ }
+
this.func_213315_a(MoverType.SELF, this.func_213322_ci());
if (!this.field_70122_E) {
- this.func_213317_d(this.func_213322_ci().func_186678_a(0.95D));
+ this.func_213317_d(this.func_213322_ci().func_186678_a(getDragAir()));
}
}
@@ -387,29 +400,29 @@
boolean flag = false;
boolean flag1 = false;
AbstractRailBlock abstractrailblock = (AbstractRailBlock)p_180460_2_.func_177230_c();
- if (abstractrailblock == Blocks.field_196552_aC) {
+ if (abstractrailblock instanceof PoweredRailBlock && !((PoweredRailBlock) abstractrailblock).isActivatorRail()) {
flag = p_180460_2_.func_177229_b(PoweredRailBlock.field_176569_M);
flag1 = !flag;
}
double d3 = 0.0078125D;
Vector3d vector3d1 = this.func_213322_ci();
- RailShape railshape = p_180460_2_.func_177229_b(abstractrailblock.func_176560_l());
+ RailShape railshape = ((AbstractRailBlock)p_180460_2_.func_177230_c()).getRailDirection(p_180460_2_, this.field_70170_p, p_180460_1_, this);
switch(railshape) {
case ASCENDING_EAST:
- this.func_213317_d(vector3d1.func_72441_c(-0.0078125D, 0.0D, 0.0D));
+ this.func_213317_d(vector3d1.func_72441_c(-1 * getSlopeAdjustment(), 0.0D, 0.0D));
++d1;
break;
case ASCENDING_WEST:
- this.func_213317_d(vector3d1.func_72441_c(0.0078125D, 0.0D, 0.0D));
+ this.func_213317_d(vector3d1.func_72441_c(getSlopeAdjustment(), 0.0D, 0.0D));
++d1;
break;
case ASCENDING_NORTH:
- this.func_213317_d(vector3d1.func_72441_c(0.0D, 0.0D, 0.0078125D));
+ this.func_213317_d(vector3d1.func_72441_c(0.0D, 0.0D, getSlopeAdjustment()));
++d1;
break;
case ASCENDING_SOUTH:
- this.func_213317_d(vector3d1.func_72441_c(0.0D, 0.0D, -0.0078125D));
+ this.func_213317_d(vector3d1.func_72441_c(0.0D, 0.0D, -1 * getSlopeAdjustment()));
++d1;
}
@@ -440,7 +453,7 @@
}
}
@ -71,7 +145,19 @@
double d22 = Math.sqrt(func_213296_b(this.func_213322_ci()));
if (d22 < 0.03D) {
this.func_213317_d(Vector3d.field_186680_a);
@@ -500,7 +506,10 @@
@@ -469,10 +482,7 @@
d0 = d23 + d4 * d14;
d2 = d10 + d5 * d14;
this.func_70107_b(d0, d1, d2);
- double d24 = this.func_184207_aI() ? 0.75D : 1.0D;
- double d25 = this.func_174898_m();
- vector3d1 = this.func_213322_ci();
- this.func_213315_a(MoverType.SELF, new Vector3d(MathHelper.func_151237_a(d24 * vector3d1.field_72450_a, -d25, d25), 0.0D, MathHelper.func_151237_a(d24 * vector3d1.field_72449_c, -d25, d25)));
+ this.moveMinecartOnRail(p_180460_1_);
if (vector3i.func_177956_o() != 0 && MathHelper.func_76128_c(this.func_226277_ct_()) - p_180460_1_.func_177958_n() == vector3i.func_177958_n() && MathHelper.func_76128_c(this.func_226281_cx_()) - p_180460_1_.func_177952_p() == vector3i.func_177952_p()) {
this.func_70107_b(this.func_226277_ct_(), this.func_226278_cu_() + (double)vector3i.func_177956_o(), this.func_226281_cx_());
} else if (vector3i1.func_177956_o() != 0 && MathHelper.func_76128_c(this.func_226277_ct_()) - p_180460_1_.func_177958_n() == vector3i1.func_177958_n() && MathHelper.func_76128_c(this.func_226281_cx_()) - p_180460_1_.func_177952_p() == vector3i1.func_177952_p()) {
@@ -500,7 +510,10 @@
this.func_213293_j(d26 * (double)(j - p_180460_1_.func_177958_n()), vector3d5.field_72448_b, d26 * (double)(i - p_180460_1_.func_177952_p()));
}
@ -83,7 +169,7 @@
Vector3d vector3d6 = this.func_213322_ci();
double d27 = Math.sqrt(func_213296_b(vector3d6));
if (d27 > 0.01D) {
@@ -555,7 +564,7 @@
@@ -555,7 +568,7 @@
BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k));
if (AbstractRailBlock.func_208487_j(blockstate)) {
@ -92,7 +178,7 @@
p_70495_3_ = (double)j;
if (railshape.func_208092_c()) {
p_70495_3_ = (double)(j + 1);
@@ -594,7 +603,7 @@
@@ -594,7 +607,7 @@
BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k));
if (AbstractRailBlock.func_208487_j(blockstate)) {
@ -101,7 +187,7 @@
Pair<Vector3i, Vector3i> pair = func_226573_a_(railshape);
Vector3i vector3i = pair.getFirst();
Vector3i vector3i1 = pair.getSecond();
@@ -657,6 +666,11 @@
@@ -657,6 +670,11 @@
}
public void func_70108_f(Entity p_70108_1_) {
@ -113,7 +199,21 @@
if (!this.field_70170_p.field_72995_K) {
if (!p_70108_1_.field_70145_X && !this.field_70145_X) {
if (!this.func_184196_w(p_70108_1_)) {
@@ -802,6 +816,40 @@
@@ -692,11 +710,11 @@
Vector3d vector3d2 = this.func_213322_ci();
Vector3d vector3d3 = p_70108_1_.func_213322_ci();
- if (((AbstractMinecartEntity)p_70108_1_).func_184264_v() == AbstractMinecartEntity.Type.FURNACE && this.func_184264_v() != AbstractMinecartEntity.Type.FURNACE) {
+ if (((AbstractMinecartEntity)p_70108_1_).isPoweredCart() && !this.isPoweredCart()) {
this.func_213317_d(vector3d2.func_216372_d(0.2D, 1.0D, 0.2D));
this.func_70024_g(vector3d3.field_72450_a - d0, 0.0D, vector3d3.field_72449_c - d1);
p_70108_1_.func_213317_d(vector3d3.func_216372_d(0.95D, 1.0D, 0.95D));
- } else if (((AbstractMinecartEntity)p_70108_1_).func_184264_v() != AbstractMinecartEntity.Type.FURNACE && this.func_184264_v() == AbstractMinecartEntity.Type.FURNACE) {
+ } else if (!((AbstractMinecartEntity)p_70108_1_).isPoweredCart() && this.isPoweredCart()) {
p_70108_1_.func_213317_d(vector3d3.func_216372_d(0.2D, 1.0D, 0.2D));
p_70108_1_.func_70024_g(vector3d2.field_72450_a + d0, 0.0D, vector3d2.field_72449_c + d1);
this.func_213317_d(vector3d2.func_216372_d(0.95D, 1.0D, 0.95D));
@@ -802,6 +820,40 @@
return new SSpawnObjectPacket(this);
}

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/entity/item/minecart/CommandBlockMinecartEntity.java
+++ b/net/minecraft/entity/item/minecart/CommandBlockMinecartEntity.java
@@ -73,6 +73,8 @@
}
public ActionResultType func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) {
+ ActionResultType ret = super.func_184230_a(p_184230_1_, p_184230_2_);
+ if (ret.func_226246_a_()) return ret;
return this.field_145824_a.func_175574_a(p_184230_1_);
}

View File

@ -1,15 +1,32 @@
--- a/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java
+++ b/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java
@@ -151,6 +151,8 @@
public ActionResultType func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) {
p_184230_1_.func_213829_a(this);
+ ActionResultType ret = super.func_184230_a(p_184230_1_, p_184230_2_);
+ if (ret.func_226246_a_()) return ret;
return ActionResultType.func_233537_a_(this.field_70170_p.field_72995_K);
@@ -116,12 +116,14 @@
return super.func_241206_a_(p_241206_1_);
}
@@ -173,6 +175,8 @@
- public void func_70106_y() {
+ @Override
+ public void remove(boolean keepData) {
if (!this.field_70170_p.field_72995_K && this.field_94112_b) {
InventoryHelper.func_180176_a(this.field_70170_p, this, this);
}
- super.func_70106_y();
+ super.remove(keepData);
+ if (!keepData) itemHandler.invalidate();
}
protected void func_213281_b(CompoundNBT p_213281_1_) {
@@ -150,6 +152,8 @@
}
public ActionResultType func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) {
+ ActionResultType ret = super.func_184230_a(p_184230_1_, p_184230_2_);
+ if (ret.func_226246_a_()) return ret;
p_184230_1_.func_213829_a(this);
return ActionResultType.func_233537_a_(this.field_70170_p.field_72995_K);
}
@@ -173,6 +177,8 @@
this.field_184290_c = null;
LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, this.func_233580_cy_()).func_216016_a(this.field_184291_d);
@ -18,7 +35,7 @@
if (p_184288_1_ != null) {
lootcontext$builder.func_186469_a(p_184288_1_.func_184817_da()).func_216015_a(LootParameters.field_216281_a, p_184288_1_);
}
@@ -203,4 +207,17 @@
@@ -203,4 +209,17 @@
}
protected abstract Container func_213968_a(int p_213968_1_, PlayerInventory p_213968_2_);

View File

@ -1,5 +1,14 @@
--- a/net/minecraft/entity/merchant/villager/VillagerEntity.java
+++ b/net/minecraft/entity/merchant/villager/VillagerEntity.java
@@ -240,7 +240,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_196172_da && this.func_70089_S() && !this.func_213716_dX() && !this.func_70608_bn()) {
+ if (itemstack.func_77973_b() != Items.field_196172_da && this.func_70089_S() && !this.func_213716_dX() && !this.func_70608_bn() && !p_230254_1_.func_226563_dT_()) {
if (this.func_70631_g_()) {
this.func_213756_es();
return ActionResultType.func_233537_a_(this.field_70170_p.field_72995_K);
@@ -628,7 +628,8 @@
}

View File

@ -45,6 +45,15 @@
iworld.func_180501_a(blockpos, blockstate2, 3);
this.field_179475_a.func_195406_b((BlockState)null);
}
@@ -457,7 +459,7 @@
}
private boolean func_220836_a(IWorldReader p_220836_1_, BlockPos p_220836_2_, BlockState p_220836_3_, BlockState p_220836_4_, BlockState p_220836_5_, BlockPos p_220836_6_) {
- return p_220836_4_.func_196958_f() && !p_220836_5_.func_196958_f() && p_220836_5_.func_235785_r_(p_220836_1_, p_220836_6_) && p_220836_3_.func_196955_c(p_220836_1_, p_220836_2_);
+ return p_220836_4_.isAir(p_220836_1_, p_220836_2_) && !p_220836_5_.isAir(p_220836_1_, p_220836_6_) && p_220836_5_.func_235785_r_(p_220836_1_, p_220836_6_) && p_220836_3_.func_196955_c(p_220836_1_, p_220836_2_);
}
}
@@ -499,7 +501,7 @@
public boolean func_75250_a() {
if (this.field_179473_a.func_195405_dq() != null) {

View File

@ -9,7 +9,15 @@
if (blockstate.func_203425_a(Blocks.field_196603_bb)) {
Direction direction = blockstate.func_177229_b(PistonBlock.field_176387_N);
if (this.field_70170_p.func_175623_d(blockpos.func_177972_a(direction))) {
@@ -249,6 +249,7 @@
@@ -219,6 +219,7 @@
this.func_226286_f_((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p() + 0.5D);
double d2 = 0.5D - (double)MathHelper.func_76126_a((0.5F + this.field_184706_by) * (float)Math.PI) * 0.5D;
double d0 = 0.5D - (double)MathHelper.func_76126_a((0.5F + this.field_184705_bx) * (float)Math.PI) * 0.5D;
+ if (this.isAddedToWorld() && this.field_70170_p instanceof net.minecraft.world.server.ServerWorld) ((net.minecraft.world.server.ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving.
Direction direction2 = this.func_184696_cZ().func_176734_d();
this.func_174826_a((new AxisAlignedBB(this.func_226277_ct_() - 0.5D, this.func_226278_cu_(), this.func_226281_cx_() - 0.5D, this.func_226277_ct_() + 0.5D, this.func_226278_cu_() + 1.0D, this.func_226281_cx_() + 0.5D)).func_72321_a((double)direction2.func_82601_c() * d2, (double)direction2.func_96559_d() * d2, (double)direction2.func_82599_e() * d2));
double d1 = d2 - d0;
@@ -249,6 +250,7 @@
super.func_70107_b(p_70107_1_, p_70107_3_, p_70107_5_);
if (this.field_70180_af != null && this.field_70173_aa != 0) {
Optional<BlockPos> optional = this.field_70180_af.func_187225_a(field_184701_b);
@ -17,7 +25,7 @@
Optional<BlockPos> optional1 = Optional.of(new BlockPos(p_70107_1_, p_70107_3_, p_70107_5_));
if (!optional1.equals(optional)) {
this.field_70180_af.func_187227_b(field_184701_b, optional1);
@@ -282,7 +283,14 @@
@@ -282,7 +284,14 @@
BlockPos blockpos1 = blockpos.func_177982_a(8 - this.field_70146_Z.nextInt(17), 8 - this.field_70146_Z.nextInt(17), 8 - this.field_70146_Z.nextInt(17));
if (blockpos1.func_177956_o() > 0 && this.field_70170_p.func_175623_d(blockpos1) && this.field_70170_p.func_175723_af().func_177746_a(blockpos1) && this.field_70170_p.func_226665_a__(this, new AxisAlignedBB(blockpos1))) {
Direction direction = this.func_234299_g_(blockpos1);
@ -32,7 +40,7 @@
this.field_70180_af.func_187227_b(field_184700_a, direction);
this.func_184185_a(SoundEvents.field_187791_eX, 1.0F, 1.0F);
this.field_70180_af.func_187227_b(field_184701_b, Optional.of(blockpos1));
@@ -306,7 +314,6 @@
@@ -306,7 +315,6 @@
this.field_70760_ar = 0.0F;
this.field_70761_aq = 0.0F;
}

View File

@ -1,6 +1,25 @@
--- a/net/minecraft/entity/monster/ZombieEntity.java
+++ b/net/minecraft/entity/monster/ZombieEntity.java
@@ -277,6 +277,7 @@
@@ -260,12 +260,16 @@
livingentity = (LivingEntity)p_70097_1_.func_76346_g();
}
- if (livingentity != null && this.field_70170_p.func_175659_aa() == Difficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_233637_b_(Attributes.field_233829_l_) && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223601_d)) {
int i = MathHelper.func_76128_c(this.func_226277_ct_());
int j = MathHelper.func_76128_c(this.func_226278_cu_());
int k = MathHelper.func_76128_c(this.func_226281_cx_());
- ZombieEntity zombieentity = new ZombieEntity(this.field_70170_p);
+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, livingentity, this.func_110148_a(Attributes.field_233829_l_).func_111126_e());
+ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true;
+ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ||
+ livingentity != null && this.field_70170_p.func_175659_aa() == Difficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(Attributes.field_233829_l_).func_111126_e() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223601_d)) {
+ ZombieEntity zombieentity = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : EntityType.field_200725_aD.func_200721_a(this.field_70170_p);
+
for(int l = 0; l < 50; ++l) {
int i1 = i + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1);
int j1 = j + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1);
@@ -277,6 +281,7 @@
zombieentity.func_70107_b((double)i1, (double)j1, (double)k1);
if (!this.field_70170_p.func_217358_a((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_226668_i_(zombieentity) && this.field_70170_p.func_226669_j_(zombieentity) && !this.field_70170_p.func_72953_d(zombieentity.func_174813_aQ())) {
this.field_70170_p.func_217376_c(zombieentity);
@ -8,3 +27,21 @@
zombieentity.func_70624_b(livingentity);
zombieentity.func_213386_a(this.field_70170_p, this.field_70170_p.func_175649_E(zombieentity.func_233580_cy_()), SpawnReason.REINFORCEMENT, (ILivingEntityData)null, (CompoundNBT)null);
this.func_110148_a(Attributes.field_233829_l_).func_233769_c_(new AttributeModifier("Zombie reinforcement caller charge", (double)-0.05F, AttributeModifier.Operation.ADDITION));
@@ -463,7 +468,7 @@
}
public static boolean func_241399_a_(Random p_241399_0_) {
- return p_241399_0_.nextFloat() < 0.05F;
+ return p_241399_0_.nextFloat() < net.minecraftforge.common.ForgeConfig.SERVER.zombieBabyChance.get();
}
protected void func_207304_a(float p_207304_1_) {
@@ -483,7 +488,7 @@
}
protected void func_230291_eT_() {
- this.func_110148_a(Attributes.field_233829_l_).func_111128_a(this.field_70146_Z.nextDouble() * (double)0.1F);
+ this.func_110148_a(Attributes.field_233829_l_).func_111128_a(this.field_70146_Z.nextDouble() * net.minecraftforge.common.ForgeConfig.SERVER.zombieBaseSummonChance.get());
}
public double func_70033_W() {

View File

@ -7,17 +7,29 @@
+ this.itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this.field_110296_bG));
int i = Math.min(inventory.func_70302_i_(), this.field_110296_bG.func_70302_i_());
if (this.func_184207_aI() && this.field_190688_bE) {
@@ -672,6 +673,7 @@
this.func_213293_j(vec3d.field_72450_a, d1, vec3d.field_72449_c);
this.func_110255_k(true);
this.field_70160_al = true;
+ net.minecraftforge.common.ForgeHooks.onLivingJump(this);
if (f1 > 0.0F) {
float f2 = MathHelper.func_76126_a(this.field_70177_z * ((float)Math.PI / 180F));
float f3 = MathHelper.func_76134_b(this.field_70177_z * ((float)Math.PI / 180F));
@@ -947,4 +949,22 @@
for(int j = 0; j < i; ++j) {
@@ -275,6 +276,7 @@
this.field_110296_bG.func_110134_a(this);
this.func_230275_fc_();
+ this.itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this.field_110296_bG));
}
protected void func_230275_fc_() {
@@ -333,9 +335,9 @@
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 = p_180429_2_.func_215695_r();
+ SoundType soundtype = p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this);
if (blockstate.func_203425_a(Blocks.field_150433_aE)) {
- soundtype = blockstate.func_215695_r();
+ soundtype = blockstate.getSoundType(field_70170_p, p_180429_1_, this);
}
if (this.func_184207_aI() && this.field_190688_bE) {
@@ -1010,4 +1012,22 @@
this.func_230273_eI_();
return super.func_213386_a(p_213386_1_, p_213386_2_, p_213386_3_, p_213386_4_, p_213386_5_);
}
+

View File

@ -1,35 +1,32 @@
--- a/net/minecraft/entity/player/PlayerEntity.java
+++ b/net/minecraft/entity/player/PlayerEntity.java
@@ -110,6 +110,10 @@
@@ -110,6 +110,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class PlayerEntity extends LivingEntity {
+ public static final String PERSISTED_NBT_TAG = "PlayerPersisted";
+ protected java.util.HashMap<ResourceLocation, BlockPos> spawnPosMap = new java.util.HashMap<>();
+ protected java.util.HashMap<ResourceLocation, Boolean> spawnForcedMap = new java.util.HashMap<>();
+ public static final net.minecraft.entity.ai.attributes.Attribute REACH_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute( "generic.reachDistance", 5.0D, 0.0D, 1024.0D).func_233753_a_(true);
public static final EntitySize field_213835_bs = EntitySize.func_220314_b(0.6F, 1.8F);
private static final Map<Pose, EntitySize> field_213836_b = ImmutableMap.<Pose, EntitySize>builder().put(Pose.STANDING, field_213835_bs).put(Pose.SLEEPING, field_213377_as).put(Pose.FALL_FLYING, EntitySize.func_220314_b(0.6F, 0.6F)).put(Pose.SWIMMING, EntitySize.func_220314_b(0.6F, 0.6F)).put(Pose.SPIN_ATTACK, EntitySize.func_220314_b(0.6F, 0.6F)).put(Pose.CROUCHING, EntitySize.func_220314_b(0.6F, 1.5F)).put(Pose.DYING, EntitySize.func_220311_c(0.2F, 0.2F)).build();
private static final DataParameter<Float> field_184829_a = EntityDataManager.func_187226_a(PlayerEntity.class, DataSerializers.field_187193_c);
@@ -150,6 +154,8 @@
@@ -150,6 +151,8 @@
private final CooldownTracker field_184832_bU = this.func_184815_l();
@Nullable
public FishingBobberEntity field_71104_cf;
+ private final java.util.Collection<ITextComponent> prefixes = new java.util.LinkedList<ITextComponent>();
+ private final java.util.Collection<ITextComponent> suffixes = new java.util.LinkedList<ITextComponent>();
+ private final java.util.Collection<IFormattableTextComponent> prefixes = new java.util.LinkedList<>();
+ private final java.util.Collection<IFormattableTextComponent> suffixes = new java.util.LinkedList<>();
public PlayerEntity(World p_i231577_1_, BlockPos p_i231577_2_, GameProfile p_i231577_3_) {
super(EntityType.field_200729_aH, p_i231577_1_);
@@ -175,7 +181,7 @@
@@ -175,7 +178,7 @@
}
public static AttributeModifierMap.MutableAttribute func_234570_el_() {
- return LivingEntity.func_233639_cI_().func_233815_a_(Attributes.field_233823_f_, 1.0D).func_233815_a_(Attributes.field_233821_d_, (double)0.1F).func_233814_a_(Attributes.field_233825_h_).func_233814_a_(Attributes.field_233828_k_);
+ return LivingEntity.func_233639_cI_().func_233815_a_(Attributes.field_233823_f_, 1.0D).func_233815_a_(Attributes.field_233821_d_, (double)0.1F).func_233814_a_(Attributes.field_233825_h_).func_233814_a_(Attributes.field_233828_k_).func_233814_a_(REACH_DISTANCE);
+ return LivingEntity.func_233639_cI_().func_233815_a_(Attributes.field_233823_f_, 1.0D).func_233815_a_(Attributes.field_233821_d_, (double)0.1F).func_233814_a_(Attributes.field_233825_h_).func_233814_a_(Attributes.field_233828_k_).func_233814_a_(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get());
}
protected void func_70088_a() {
@@ -189,6 +195,7 @@
@@ -189,6 +192,7 @@
}
public void func_70071_h_() {
@ -37,7 +34,7 @@
this.field_70145_X = this.func_175149_v();
if (this.func_175149_v()) {
this.field_70122_E = false;
@@ -204,7 +211,7 @@
@@ -204,7 +208,7 @@
this.field_71076_b = 100;
}
@ -46,7 +43,7 @@
this.func_225652_a_(false, true);
}
} else if (this.field_71076_b > 0) {
@@ -258,6 +265,7 @@
@@ -258,6 +262,7 @@
this.func_203041_m();
this.field_184832_bU.func_185144_a();
this.func_213832_dB();
@ -54,7 +51,7 @@
}
public boolean func_226563_dT_() {
@@ -550,6 +558,7 @@
@@ -550,6 +555,7 @@
}
public void func_70645_a(DamageSource p_70645_1_) {
@ -62,7 +59,7 @@
super.func_70645_a(p_70645_1_);
this.func_226264_Z_();
if (!this.func_175149_v()) {
@@ -603,12 +612,14 @@
@@ -603,12 +609,14 @@
}
public boolean func_225609_n_(boolean p_225609_1_) {
@ -79,7 +76,7 @@
}
@Nullable
@@ -646,7 +657,12 @@
@@ -646,7 +654,12 @@
}
}
@ -92,42 +89,21 @@
float f = this.field_71071_by.func_184438_a(p_184813_1_);
if (f > 1.0F) {
int i = EnchantmentHelper.func_185293_e(this);
@@ -733,6 +749,13 @@
p_213281_1_.func_74768_a("DataVersion", SharedConstants.func_215069_a().getWorldVersion());
p_213281_1_.func_218657_a("Inventory", this.field_71071_by.func_70442_a(new ListNBT()));
p_213281_1_.func_74768_a("SelectedItemSlot", this.field_71071_by.field_70461_c);
+ p_213281_1_.func_150295_c("Spawns", 10).forEach(e -> {
+ CompoundNBT data = (CompoundNBT)e;
+ ResourceLocation dim = new ResourceLocation(data.func_74779_i("Dim"));
+ this.spawnPosMap.put(dim, new BlockPos(data.func_74762_e("SpawnX"), data.func_74762_e("SpawnY"), data.func_74762_e("SpawnZ")));
+ this.spawnForcedMap.put(dim, data.func_74767_n("SpawnForced"));
+ });
+
p_213281_1_.func_74777_a("SleepTimer", (short)this.field_71076_b);
p_213281_1_.func_74776_a("XpP", this.field_71106_cc);
p_213281_1_.func_74768_a("XpLevel", this.field_71068_ca);
@@ -750,6 +773,20 @@
p_213281_1_.func_218657_a("ShoulderEntityRight", this.func_192025_dl());
@@ -688,11 +701,12 @@
f /= 5.0F;
}
+ ListNBT spawnlist = new ListNBT();
+ spawnPosMap.forEach((dim, pos) -> {
+ if (pos != null) {
+ CompoundNBT data = new CompoundNBT();
+ data.func_74778_a("Dim", dim.toString());
+ data.func_74768_a("SpawnX", pos.func_177958_n());
+ data.func_74768_a("SpawnY", pos.func_177956_o());
+ data.func_74768_a("SpawnZ", pos.func_177952_p());
+ data.func_74757_a("SpawnForced", spawnForcedMap.getOrDefault(dim, false));
+ spawnlist.add(data);
+ }
+ });
+ p_213281_1_.func_218657_a("Spawns", spawnlist);
+
+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, p_184813_1_, f, pos);
return f;
}
public boolean func_180431_b(DamageSource p_180431_1_) {
@@ -767,6 +804,7 @@
public boolean func_234569_d_(BlockState p_234569_1_) {
- return !p_234569_1_.func_235783_q_() || this.field_71071_by.func_70448_g().func_150998_b(p_234569_1_);
+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_234569_1_, !p_234569_1_.func_235783_q_() || this.field_71071_by.func_70448_g().func_150998_b(p_234569_1_));
}
public void func_70037_a(CompoundNBT p_70037_1_) {
@@ -767,6 +781,7 @@
}
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
@ -135,7 +111,7 @@
if (this.func_180431_b(p_70097_1_)) {
return false;
} else if (this.field_71075_bZ.field_75102_a && !p_70097_1_.func_76357_e()) {
@@ -798,7 +836,7 @@
@@ -798,7 +813,7 @@
protected void func_190629_c(LivingEntity p_190629_1_) {
super.func_190629_c(p_190629_1_);
@ -144,7 +120,24 @@
this.func_190777_m(true);
}
@@ -847,10 +885,13 @@
@@ -819,7 +834,7 @@
}
protected void func_184590_k(float p_184590_1_) {
- if (this.field_184627_bm.func_77973_b() == Items.field_185159_cQ) {
+ if (this.field_184627_bm.isShield(this)) {
if (!this.field_70170_p.field_72995_K) {
this.func_71029_a(Stats.field_75929_E.func_199076_b(this.field_184627_bm.func_77973_b()));
}
@@ -829,6 +844,7 @@
Hand hand = this.func_184600_cs();
this.field_184627_bm.func_222118_a(i, this, (p_213833_1_) -> {
p_213833_1_.func_213334_d(hand);
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, this.field_184627_bm, hand);
});
if (this.field_184627_bm.func_190926_b()) {
if (hand == Hand.MAIN_HAND) {
@@ -847,10 +863,13 @@
protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) {
if (!this.func_180431_b(p_70665_1_)) {
@ -158,7 +151,7 @@
float f = p_70665_2_ - f2;
if (f > 0.0F && f < 3.4028235E37F) {
this.func_195067_a(Stats.field_212738_J, Math.round(f * 10.0F));
@@ -909,6 +950,8 @@
@@ -909,6 +928,8 @@
return ActionResultType.PASS;
} else {
@ -167,7 +160,7 @@
ItemStack itemstack = this.func_184586_b(p_190775_2_);
ItemStack itemstack1 = itemstack.func_77946_l();
ActionResultType actionresulttype = p_190775_1_.func_184230_a(this, p_190775_2_);
@@ -917,6 +960,9 @@
@@ -917,6 +938,9 @@
itemstack.func_190920_e(itemstack1.func_190916_E());
}
@ -177,7 +170,7 @@
return actionresulttype;
} else {
if (!itemstack.func_190926_b() && p_190775_1_ instanceof LivingEntity) {
@@ -927,6 +973,7 @@
@@ -927,6 +951,7 @@
ActionResultType actionresulttype1 = itemstack.func_111282_a_(this, (LivingEntity)p_190775_1_, p_190775_2_);
if (actionresulttype1.func_226246_a_()) {
if (itemstack.func_190926_b() && !this.field_71075_bZ.field_75098_d) {
@ -185,7 +178,7 @@
this.func_184611_a(p_190775_2_, ItemStack.field_190927_a);
}
@@ -1007,6 +1054,7 @@
@@ -1007,6 +1032,7 @@
}
public void func_71059_n(Entity p_71059_1_) {
@ -193,7 +186,7 @@
if (p_71059_1_.func_70075_an()) {
if (!p_71059_1_.func_85031_j(this)) {
float f = (float)this.func_233637_b_(Attributes.field_233823_f_);
@@ -1034,8 +1082,10 @@
@@ -1034,8 +1060,10 @@
boolean flag2 = flag && this.field_70143_R > 0.0F && !this.field_70122_E && !this.func_70617_f_() && !this.func_70090_H() && !this.func_70644_a(Effects.field_76440_q) && !this.func_184218_aH() && p_71059_1_ instanceof LivingEntity;
flag2 = flag2 && !this.func_70051_ag();
@ -205,7 +198,7 @@
}
f = f + f1;
@@ -1123,8 +1173,10 @@
@@ -1123,8 +1151,10 @@
}
if (!this.field_70170_p.field_72995_K && !itemstack1.func_190926_b() && entity instanceof LivingEntity) {
@ -216,7 +209,7 @@
this.func_184611_a(Hand.MAIN_HAND, ItemStack.field_190927_a);
}
}
@@ -1166,7 +1218,7 @@
@@ -1166,7 +1196,7 @@
}
if (this.field_70146_Z.nextFloat() < f) {
@ -225,7 +218,7 @@
this.func_184602_cy();
this.field_70170_p.func_72960_a(this, (byte)30);
}
@@ -1192,8 +1244,9 @@
@@ -1192,8 +1222,9 @@
public void func_71004_bE() {
}
@ -237,7 +230,7 @@
this.field_71069_bz.func_75134_a(this);
if (this.field_71070_bA != null) {
this.field_71070_bA.func_75134_a(this);
@@ -1216,6 +1269,7 @@
@@ -1216,6 +1247,7 @@
}
public void func_225652_a_(boolean p_225652_1_, boolean p_225652_2_) {
@ -245,7 +238,18 @@
super.func_213366_dy();
if (this.field_70170_p instanceof ServerWorld && p_225652_2_) {
((ServerWorld)this.field_70170_p).func_72854_c();
@@ -1421,6 +1475,7 @@
@@ -1238,8 +1270,8 @@
}
return optional;
- } else if (block instanceof BedBlock && BedBlock.func_235330_a_(p_234567_0_)) {
- return BedBlock.func_220172_a(EntityType.field_200729_aH, p_234567_0_, p_234567_1_, 0);
+ } else if (blockstate.isBed(p_234567_0_, p_234567_1_, null) && BedBlock.func_235330_a_(p_234567_0_)) {
+ return blockstate.getBedSpawnPosition(EntityType.field_200729_aH, p_234567_0_, p_234567_1_, null);
} else if (!p_234567_2_) {
return Optional.empty();
} else {
@@ -1421,6 +1453,7 @@
public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) {
if (this.field_71075_bZ.field_75101_c) {
@ -253,7 +257,7 @@
return false;
} else {
if (p_225503_1_ >= 2.0F) {
@@ -1475,6 +1530,10 @@
@@ -1475,6 +1508,10 @@
}
public void func_195068_e(int p_195068_1_) {
@ -264,7 +268,7 @@
this.func_85039_t(p_195068_1_);
this.field_71106_cc += (float)p_195068_1_ / (float)this.func_71050_bK();
this.field_71067_cb = MathHelper.func_76125_a(this.field_71067_cb + p_195068_1_, 0, Integer.MAX_VALUE);
@@ -1503,7 +1562,7 @@
@@ -1503,7 +1540,7 @@
}
public void func_192024_a(ItemStack p_192024_1_, int p_192024_2_) {
@ -273,7 +277,7 @@
if (this.field_71068_ca < 0) {
this.field_71068_ca = 0;
this.field_71106_cc = 0.0F;
@@ -1514,6 +1573,10 @@
@@ -1514,6 +1551,10 @@
}
public void func_82242_a(int p_82242_1_) {
@ -284,17 +288,29 @@
this.field_71068_ca += p_82242_1_;
if (this.field_71068_ca < 0) {
this.field_71068_ca = 0;
@@ -1956,4 +2019,37 @@
@@ -1704,7 +1745,10 @@
}
public ITextComponent func_145748_c_() {
- IFormattableTextComponent iformattabletextcomponent = ScorePlayerTeam.func_237500_a_(this.func_96124_cp(), this.func_200200_C_());
+ IFormattableTextComponent iformattabletextcomponent = new StringTextComponent("");
+ iformattabletextcomponent = prefixes.stream().reduce(iformattabletextcomponent, IFormattableTextComponent::func_230529_a_);
+ iformattabletextcomponent = iformattabletextcomponent.func_230529_a_(ScorePlayerTeam.func_237500_a_(this.func_96124_cp(), this.func_200200_C_()));
+ iformattabletextcomponent = suffixes.stream().reduce(iformattabletextcomponent, IFormattableTextComponent::func_230529_a_);
return this.func_208016_c(iformattabletextcomponent);
}
@@ -1956,4 +2000,37 @@
return this.field_221260_g;
}
}
+
+ // =========== FORGE START ==============//
+ public Collection<ITextComponent> getPrefixes() {
+ public Collection<IFormattableTextComponent> getPrefixes() {
+ return this.prefixes;
+ }
+
+ public Collection<ITextComponent> getSuffixes() {
+ public Collection<IFormattableTextComponent> getSuffixes() {
+ return this.suffixes;
+ }
+

View File

@ -23,7 +23,41 @@
boolean flag = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223609_l);
if (flag) {
ITextComponent itextcomponent = this.func_110142_aN().func_151521_b();
@@ -731,6 +728,9 @@
@@ -597,12 +594,13 @@
@Nullable
public Entity func_241206_a_(ServerWorld p_241206_1_) {
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_241206_1_.func_234923_W_())) return null;
this.field_184851_cj = true;
ServerWorld serverworld = this.func_71121_q();
RegistryKey<World> registrykey = serverworld.func_234923_W_();
if (registrykey == World.field_234920_i_ && p_241206_1_.func_234923_W_() == World.field_234918_g_) {
this.func_213319_R();
- this.func_71121_q().func_217434_e(this);
+ this.func_71121_q().removePlayer(this, true); //Forge: The player entity is cloned so keep the data until after cloning calls copyFrom
if (!this.field_71136_j) {
this.field_71136_j = true;
this.field_71135_a.func_147359_a(new SChangeGameStatePacket(SChangeGameStatePacket.field_241768_e_, this.field_192040_cp ? 0.0F : 1.0F));
@@ -616,8 +614,8 @@
this.field_71135_a.func_147359_a(new SServerDifficultyPacket(iworldinfo.func_176130_y(), iworldinfo.func_176123_z()));
PlayerList playerlist = this.field_71133_b.func_184103_al();
playerlist.func_187243_f(this);
- serverworld.func_217434_e(this);
- this.field_70128_L = false;
+ serverworld.removeEntity(this, true); //Forge: the player entity is moved to the new world, NOT cloned. So keep the data alive with no matching invalidate call.
+ this.revive();
double d0 = this.func_226277_ct_();
double d1 = this.func_226278_cu_();
double d2 = this.func_226281_cx_();
@@ -689,6 +687,7 @@
this.field_71144_ck = -1;
this.field_71149_ch = -1.0F;
this.field_71146_ci = -1;
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(this, registrykey, p_241206_1_.func_234923_W_());
return this;
}
}
@@ -731,6 +730,9 @@
}
public Either<PlayerEntity.SleepResult, Unit> func_213819_a(BlockPos p_213819_1_) {
@ -33,7 +67,7 @@
Direction direction = this.field_70170_p.func_180495_p(p_213819_1_).func_177229_b(HorizontalBlock.field_185512_D);
if (!this.func_70608_bn() && this.func_70089_S()) {
if (!this.field_70170_p.func_230315_m_().func_236043_f_()) {
@@ -775,6 +775,7 @@
@@ -775,6 +777,7 @@
}
private boolean func_241147_a_(BlockPos p_241147_1_, Direction p_241147_2_) {
@ -41,7 +75,7 @@
return this.func_241158_g_(p_241147_1_) || this.func_241158_g_(p_241147_1_.func_177972_a(p_241147_2_.func_176734_d()));
}
@@ -874,6 +875,7 @@
@@ -874,6 +877,7 @@
this.field_71135_a.func_147359_a(new SOpenWindowPacket(container.field_75152_c, container.func_216957_a(), p_213829_1_.func_145748_c_()));
container.func_75132_a(this);
this.field_71070_bA = container;
@ -49,7 +83,7 @@
return OptionalInt.of(this.field_71139_cq);
}
}
@@ -892,6 +894,7 @@
@@ -892,6 +896,7 @@
this.field_71135_a.func_147359_a(new SOpenHorseWindowPacket(this.field_71139_cq, p_184826_2_.func_70302_i_(), p_184826_1_.func_145782_y()));
this.field_71070_bA = new HorseInventoryContainer(this.field_71139_cq, this.field_71071_by, p_184826_2_, p_184826_1_);
this.field_71070_bA.func_75132_a(this);
@ -57,7 +91,7 @@
}
public void func_184814_a(ItemStack p_184814_1_, Hand p_184814_2_) {
@@ -949,6 +952,7 @@
@@ -949,6 +954,7 @@
public void func_71128_l() {
this.field_71070_bA.func_75134_a(this);
@ -65,14 +99,11 @@
this.field_71070_bA = this.field_71069_bz;
}
@@ -1075,6 +1079,16 @@
@@ -1075,6 +1081,13 @@
this.field_193110_cw = p_193104_1_.field_193110_cw;
this.func_192029_h(p_193104_1_.func_192023_dk());
this.func_192031_i(p_193104_1_.func_192025_dl());
+
+ this.spawnPosMap = p_193104_1_.spawnPosMap;
+ this.spawnForcedMap = p_193104_1_.spawnForcedMap;
+
+ //Copy over a section of the Entity Data from the old player.
+ //Allows mods to specify data that persists after players respawn.
+ CompoundNBT old = p_193104_1_.getPersistentData();
@ -82,6 +113,32 @@
}
protected void func_70670_a(EffectInstance p_70670_1_) {
@@ -1291,14 +1304,14 @@
this.func_184210_p();
if (p_200619_1_ == this.field_70170_p) {
this.field_71135_a.func_147364_a(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_);
- } else {
+ } else if (net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_200619_1_.func_234923_W_())) {
ServerWorld serverworld = this.func_71121_q();
IWorldInfo iworldinfo = p_200619_1_.func_72912_H();
this.field_71135_a.func_147359_a(new SRespawnPacket(p_200619_1_.func_234922_V_(), p_200619_1_.func_234923_W_(), BiomeManager.func_235200_a_(p_200619_1_.func_72905_C()), this.field_71134_c.func_73081_b(), this.field_71134_c.func_241815_c_(), p_200619_1_.func_234925_Z_(), p_200619_1_.func_241109_A_(), true));
this.field_71135_a.func_147359_a(new SServerDifficultyPacket(iworldinfo.func_176130_y(), iworldinfo.func_176123_z()));
this.field_71133_b.func_184103_al().func_187243_f(this);
- serverworld.func_217434_e(this);
- this.field_70128_L = false;
+ serverworld.removePlayer(this, true); //Forge: The player entity itself is moved, and not cloned. So we need to keep the data alive with no matching invalidate call later.
+ this.revive();
this.func_70012_b(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_);
this.func_70029_a(p_200619_1_);
p_200619_1_.func_217446_a(this);
@@ -1307,6 +1320,7 @@
this.field_71134_c.func_73080_a(p_200619_1_);
this.field_71133_b.func_184103_al().func_72354_b(this, p_200619_1_);
this.field_71133_b.func_184103_al().func_72385_f(this);
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(this, serverworld.func_234923_W_(), p_200619_1_.func_234923_W_());
}
}
@@ -1375,6 +1389,8 @@
if (itementity == null) {
return null;

View File

@ -0,0 +1,16 @@
--- a/net/minecraft/entity/projectile/FireworkRocketEntity.java
+++ b/net/minecraft/entity/projectile/FireworkRocketEntity.java
@@ -155,6 +155,13 @@
}
+ @Override
+ protected void func_70227_a(RayTraceResult result) {
+ if (result.func_216346_c() == RayTraceResult.Type.MISS || !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, result)) {
+ super.func_70227_a(result);
+ }
+ }
+
private void func_213893_k() {
this.field_70170_p.func_72960_a(this, (byte)17);
this.func_191510_k();

View File

@ -63,7 +63,7 @@
float f7 = f2 * f4;
- double d0 = 5.0D;
- Vector3d vector3d1 = vector3d.func_72441_c((double)f6 * 5.0D, (double)f5 * 5.0D, (double)f7 * 5.0D);
+ double d0 = p_219968_1_.func_110148_a(PlayerEntity.REACH_DISTANCE).func_111126_e();;
+ double d0 = p_219968_1_.func_110148_a(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).func_111126_e();;
+ Vector3d vector3d1 = vector3d.func_72441_c((double)f6 * d0, (double)f5 * d0, (double)f7 * d0);
return p_219968_0_.func_217299_a(new RayTraceContext(vector3d, vector3d1, RayTraceContext.BlockMode.OUTLINE, p_219968_2_, p_219968_1_));
}

View File

@ -26,7 +26,7 @@
this.field_147369_b.func_143004_u();
if (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;
+ double dist = field_147369_b.func_110148_a(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).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);

View File

@ -8,6 +8,15 @@
try {
OptionSet optionset = optionparser.parse(p_main_0_);
@@ -86,7 +87,7 @@
Util.func_240994_l_();
Path path = Paths.get("server.properties");
ServerPropertiesProvider serverpropertiesprovider = new ServerPropertiesProvider(path);
- serverpropertiesprovider.func_219035_b();
+ if (optionset.has(optionspec1) || !java.nio.file.Files.exists(path)) serverpropertiesprovider.func_219035_b();
Path path1 = Paths.get("eula.txt");
ServerEula servereula = new ServerEula(path1);
if (optionset.has(optionspec1)) {
@@ -105,6 +106,10 @@
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(file1, MinecraftServer.field_152367_a.getName()));
@ -19,3 +28,11 @@
SaveFormat saveformat = SaveFormat.func_237269_a_(file1.toPath());
SaveFormat.LevelSave saveformat$levelsave = saveformat.func_237274_c_(s);
MinecraftServer.func_240777_a_(saveformat$levelsave);
@@ -170,6 +175,7 @@
Thread thread = new Thread("Server Shutdown Thread") {
public void run() {
dedicatedserver.func_71263_m(true);
+ LogManager.shutdown(); // we're manually managing the logging shutdown on the server. Make sure we do it here at the end.
}
};
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(field_240759_a_));

View File

@ -1,15 +1,15 @@
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -336,6 +336,8 @@
ServerWorld serverworld = new ServerWorld(this, this.field_213217_au, this.field_71310_m, iserverworldinfo, World.field_234918_g_, registrykey, dimensiontype, p_240787_1_, chunkgenerator, flag, j, list, true);
this.field_71305_c.put(World.field_234918_g_, serverworld);
DimensionSavedDataManager dimensionsaveddatamanager = serverworld.func_217481_x();
+ // Move factory creation earlier to prevent startupquery deadlock
+ IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11);
this.func_213204_a(dimensionsaveddatamanager);
this.field_229733_al_ = new CommandStorage(dimensionsaveddatamanager);
WorldBorder worldborder = serverworld.func_175723_af();
@@ -380,6 +382,7 @@
@@ -226,7 +226,7 @@
public static <S extends MinecraftServer> S func_240784_a_(Function<Thread, S> p_240784_0_) {
AtomicReference<S> atomicreference = new AtomicReference<>();
- Thread thread = new Thread(() -> {
+ Thread thread = new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, () -> {
atomicreference.get().func_240802_v_();
}, "Server thread");
thread.setUncaughtExceptionHandler((p_240779_0_, p_240779_1_) -> {
@@ -380,6 +380,7 @@
worldborder.func_177737_a(new IBorderListener.Impl(serverworld1.func_175723_af()));
this.field_71305_c.put(registrykey2, serverworld1);
}
@ -17,7 +17,7 @@
}
}
@@ -391,6 +394,7 @@
@@ -391,6 +392,7 @@
} else if (p_240786_3_) {
p_240786_1_.func_176143_a(BlockPos.field_177992_a.func_177984_a());
} else {
@ -25,7 +25,7 @@
BiomeProvider biomeprovider = chunkgenerator.func_202090_b();
List<Biome> list = biomeprovider.func_76932_a();
Random random = new Random(p_240786_0_.func_72905_C());
@@ -569,6 +573,7 @@
@@ -569,6 +571,7 @@
for(ServerWorld serverworld1 : this.func_212370_w()) {
if (serverworld1 != null) {
try {
@ -33,7 +33,7 @@
serverworld1.close();
} catch (IOException ioexception1) {
field_147145_h.error("Exception closing the level", (Throwable)ioexception1);
@@ -617,6 +622,7 @@
@@ -617,6 +620,7 @@
protected void func_240802_v_() {
try {
if (this.func_71197_b()) {
@ -41,7 +41,7 @@
this.field_211151_aa = Util.func_211177_b();
this.field_147147_p.func_151315_a(new StringTextComponent(this.field_71286_C));
this.field_147147_p.func_151321_a(new ServerStatusResponse.Version(SharedConstants.func_215069_a().getName(), SharedConstants.func_215069_a().getProtocolVersion()));
@@ -646,9 +652,15 @@
@@ -646,9 +650,15 @@
this.func_240795_b_(longtickdetector);
this.field_71296_Q = true;
}
@ -57,7 +57,7 @@
} catch (Throwable throwable1) {
field_147145_h.error("Encountered an unexpected exception", throwable1);
CrashReport crashreport;
@@ -665,6 +677,7 @@
@@ -665,6 +675,7 @@
field_147145_h.error("We were unable to save this crash report to disk.");
}
@ -65,7 +65,7 @@
this.func_71228_a(crashreport);
} finally {
try {
@@ -673,6 +686,7 @@
@@ -673,6 +684,7 @@
} catch (Throwable throwable) {
field_147145_h.error("Exception stopping the server", throwable);
} finally {
@ -73,7 +73,7 @@
this.func_71240_o();
}
@@ -774,6 +788,7 @@
@@ -774,6 +786,7 @@
protected void func_71217_p(BooleanSupplier p_71217_1_) {
long i = Util.func_211178_c();
@ -81,7 +81,7 @@
++this.field_71315_w;
this.func_71190_q(p_71217_1_);
if (i - this.field_147142_T >= 5000000000L) {
@@ -788,6 +803,7 @@
@@ -788,6 +801,7 @@
Collections.shuffle(Arrays.asList(agameprofile));
this.field_147147_p.func_151318_b().func_151330_a(agameprofile);
@ -89,7 +89,7 @@
}
if (this.field_71315_w % 6000 == 0) {
@@ -815,6 +831,7 @@
@@ -815,6 +829,7 @@
long i1 = Util.func_211178_c();
this.field_213215_ap.func_181747_a(i1 - i);
this.field_71304_b.func_76319_b();
@ -97,7 +97,7 @@
}
protected void func_71190_q(BooleanSupplier p_71190_1_) {
@@ -822,7 +839,8 @@
@@ -822,7 +837,8 @@
this.func_193030_aL().func_73660_a();
this.field_71304_b.func_219895_b("levels");
@ -107,7 +107,7 @@
this.field_71304_b.func_194340_a(() -> {
return serverworld + " " + serverworld.func_234923_W_().func_240901_a_();
});
@@ -833,6 +851,7 @@
@@ -833,6 +849,7 @@
}
this.field_71304_b.func_76320_a("tick");
@ -115,6 +115,27 @@
try {
serverworld.func_72835_b(p_71190_1_);
@@ -841,9 +858,11 @@
serverworld.func_72914_a(crashreport);
throw new ReportedException(crashreport);
}
+ net.minecraftforge.fml.hooks.BasicEventHooks.onPostWorldTick(serverworld);
this.field_71304_b.func_76319_b();
this.field_71304_b.func_76319_b();
+ perWorldTickTimes.computeIfAbsent(serverworld.func_234923_W_(), k -> new long[100])[this.field_71315_w % 100] = Util.func_211178_c() - tickStart;
}
this.field_71304_b.func_219895_b("connection");
@@ -918,7 +937,7 @@
}
public String getServerModName() {
- return "vanilla";
+ return net.minecraftforge.fml.BrandingControl.getServerBranding();
}
public CrashReport func_71230_b(CrashReport p_71230_1_) {
@@ -931,6 +950,7 @@
p_71230_1_.func_85056_g().func_189529_a("Data Packs", () -> {
StringBuilder stringbuilder = new StringBuilder();

View File

@ -1,6 +1,17 @@
--- a/net/minecraft/server/integrated/IntegratedServer.java
+++ b/net/minecraft/server/integrated/IntegratedServer.java
@@ -171,6 +171,7 @@
@@ -60,8 +60,9 @@
field_147148_h.info("Generating keypair");
this.func_71253_a(CryptManager.func_75891_b());
this.func_240800_l__();
+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false;
this.func_71205_p(this.func_71214_G() + " - " + this.func_240793_aU_().func_76065_j());
- return true;
+ return net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(this);
}
public void func_71217_p(BooleanSupplier p_71217_1_) {
@@ -171,6 +172,7 @@
}
public void func_71263_m(boolean p_71263_1_) {

View File

@ -23,7 +23,7 @@
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;
+ double dist = field_73090_b.func_110148_a(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).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"));

View File

@ -1,31 +1,27 @@
--- a/net/minecraft/util/ScreenShotHelper.java
+++ b/net/minecraft/util/ScreenShotHelper.java
@@ -51,12 +51,25 @@
@@ -50,13 +50,21 @@
file2 = new File(file1, p_228051_1_);
}
+
+ net.minecraftforge.client.event.ScreenshotEvent event = net.minecraftforge.client.ForgeHooksClient.onScreenshot(nativeimage, file2);
+ if (event.isCanceled()) {
+ p_228051_5_.accept(event.getCancelMessage());
+ return;
+ }
+
+ final File target = event.getScreenshotFile();
+
SimpleResource.field_199031_a.execute(() -> {
Util.func_240992_g_().execute(() -> {
try {
- nativeimage.func_209271_a(file2);
- ITextComponent itextcomponent = (new StringTextComponent(file2.getName())).func_211708_a(TextFormatting.UNDERLINE).func_211710_a((p_228050_1_) -> {
- p_228050_1_.func_150241_a(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath()));
+ nativeimage.func_209271_a(target);
+ ITextComponent itextcomponent = (new StringTextComponent(target.getName())).func_211708_a(TextFormatting.UNDERLINE).func_211710_a((p_228050_1_) -> {
+ p_228050_1_.func_150241_a(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath()));
ITextComponent itextcomponent = (new StringTextComponent(file2.getName())).func_240699_a_(TextFormatting.UNDERLINE).func_240700_a_((p_238335_1_) -> {
- return p_238335_1_.func_240715_a_(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath()));
+ return p_238335_1_.func_240715_a_(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath()));
});
+
- p_228051_5_.accept(new TranslationTextComponent("screenshot.success", itextcomponent));
+ if (event.getResultMessage() != null)
+ p_228051_5_.accept(event.getResultMessage());
+ else
p_228051_5_.accept(new TranslationTextComponent("screenshot.success", itextcomponent));
} catch (Exception exception) {
field_148261_a.warn("Couldn't save screenshot", (Throwable)exception);
p_228051_5_.accept(new TranslationTextComponent("screenshot.failure", exception.getMessage()));

View File

@ -9,15 +9,24 @@
public static final Logger field_150586_aC = LogManager.getLogger();
public static final Codec<Biome> field_235051_b_ = RecordCodecBuilder.create((p_235064_0_) -> {
return p_235064_0_.group(Biome.RainType.field_235121_d_.fieldOf("precipitation").forGetter((p_235088_0_) -> {
@@ -283,7 +283,7 @@
if (this.func_225486_c(p_201854_2_) >= 0.15F) {
return false;
} else {
- if (p_201854_2_.func_177956_o() >= 0 && p_201854_2_.func_177956_o() < 256 && p_201854_1_.func_226658_a_(LightType.BLOCK, p_201854_2_) < 10) {
+ if (p_201854_2_.func_177956_o() >= 0 && p_201854_2_.func_177956_o() < 256/*TODO worldIn.getDimension().getHeight()*/ && p_201854_1_.func_226658_a_(LightType.BLOCK, p_201854_2_) < 10) {
BlockState blockstate = p_201854_1_.func_180495_p(p_201854_2_);
FluidState fluidstate = p_201854_1_.func_204610_c(p_201854_2_);
if (fluidstate.func_206886_c() == Fluids.field_204546_a && blockstate.func_177230_c() instanceof FlowingFluidBlock) {
@@ -221,7 +221,7 @@
}
protected void func_201866_a(EntityClassification p_201866_1_, Biome.SpawnListEntry p_201866_2_) {
- this.field_201880_ax.get(p_201866_1_).add(p_201866_2_);
+ this.field_201880_ax.computeIfAbsent(p_201866_1_, k -> Lists.newArrayList()).add(p_201866_2_);
}
protected void func_235059_a_(EntityType<?> p_235059_1_, double p_235059_2_, double p_235059_4_) {
@@ -229,7 +229,7 @@
}
public List<Biome.SpawnListEntry> func_76747_a(EntityClassification p_76747_1_) {
- return this.field_201880_ax.get(p_76747_1_);
+ return this.field_201880_ax.computeIfAbsent(p_76747_1_, k -> Lists.newArrayList());
}
@Nullable
@@ -308,7 +308,7 @@
} else {
if (p_201850_2_.func_177956_o() >= 0 && p_201850_2_.func_177956_o() < 256 && p_201850_1_.func_226658_a_(LightType.BLOCK, p_201850_2_) < 10) {
@ -45,22 +54,3 @@
public static class Builder {
@Nullable
private ConfiguredSurfaceBuilder<?> field_205422_a;
@@ -787,6 +798,18 @@
}
}
+ public static class FlowerEntry extends WeightedRandom.Item {
+ private final BlockState state;
+ public FlowerEntry(BlockState state, int weight) {
+ super(weight);
+ this.state = state;
+ }
+
+ public BlockState getState() {
+ return state;
+ }
+ }
+
public static enum TempCategory {
OCEAN("ocean"),
COLD("cold"),

View File

@ -1,102 +0,0 @@
--- a/net/minecraft/world/chunk/storage/RegionFile.java
+++ b/net/minecraft/world/chunk/storage/RegionFile.java
@@ -33,6 +33,7 @@
private final IntBuffer field_76716_d;
private final IntBuffer field_227127_h_;
private final RegionBitmap field_227128_i_ = new RegionBitmap();
+ private final Path filePath;
public RegionFile(File p_i231893_1_, File p_i231893_2_, boolean p_i231893_3_) throws IOException {
this(p_i231893_1_.toPath(), p_i231893_2_.toPath(), RegionFileVersion.field_227159_b_, p_i231893_3_);
@@ -40,6 +41,7 @@
public RegionFile(Path p_i231894_1_, Path p_i231894_2_, RegionFileVersion p_i231894_3_, boolean p_i231894_4_) throws IOException {
this.field_227125_e_ = p_i231894_3_;
+ this.filePath = p_i231894_2_;
if (!Files.isDirectory(p_i231894_2_)) {
throw new IllegalArgumentException("Expected directory, got " + p_i231894_2_.toAbsolutePath());
} else {
@@ -67,6 +69,8 @@
if (k != 0) {
int l = func_227142_b_(k);
int i1 = func_227131_a_(k);
+ if (i1 == 255)
+ i1 = forgeGetRealLength(j, l);
this.field_227128_i_.func_227120_a_(l, i1);
}
}
@@ -75,6 +79,66 @@
}
}
+ private int forgeGetRealLength(int index, int offset) throws IOException {
+ int chunkX = index & 31;
+ int chunkZ = (index >> 5) & 31;
+
+ ByteBuffer header = ByteBuffer.allocate(5);
+ this.field_76719_c.read(header, offset * 4096);
+ ((Buffer)header).flip();
+
+ if (header.remaining() < 5) {
+ field_227122_a_.error("Chunk {},{} in {} header is truncated: expected 5 but read {}", chunkX, chunkZ, this.filePath.getFileName(), header.remaining());
+ return 255;
+ }
+
+ return (header.getInt() + 4) / 4096 + 1;
+ }
+
+ /**
+ * In 1.14, Forge added support for large chunks by allowing it to overflow the 255 section limit.
+ * Deferring the section size to the 'length' header in front of the chunk data.
+ * In 1.15, Mojang solved this issue by adding an external '.mcc' file for large chunks.
+ * Here, we attempt to detect and extract these large chunks from Forge's format to Vanilla's
+ */
+ public RegionFile extractLargeChunks(ChunkPos pos) throws IOException {
+ ChunkPos regionBase = new ChunkPos(pos.func_222241_h() * 32, pos.func_222242_i() * 32);
+ for (int index = 0; index < 1024; index++) {
+ int offset = this.field_76716_d.get(index);
+ if (func_227131_a_(offset) != 255) //If it's not 255, then it's not possible to be a oversized chunk. Move on.
+ continue;
+ offset = func_227142_b_(offset);
+
+ ChunkPos chunk = new ChunkPos(regionBase.field_77276_a + (index & 31), regionBase.field_77275_b + ((index >> 5) & 31));
+
+ ByteBuffer header = ByteBuffer.allocate(5);
+ this.field_76719_c.read(header, offset * 4096);
+ ((Buffer)header).flip();
+
+ if (header.remaining() < 5) {
+ field_227122_a_.error("Chunk {} in {} header is truncated: expected 5 but read {}", chunk, this.filePath.getFileName(), header.remaining());
+ continue;
+ }
+
+ int length = header.getInt();
+ byte version = header.get();
+ int sectors = (length + 4) / 4096 + 1;
+ if (sectors <= 255 || func_227130_a_(version))
+ continue; //Not over sized, or already external
+
+ ByteBuffer data = ByteBuffer.allocate(length + 4);
+ this.field_76719_c.read(data, offset * 4096);
+ ((Buffer)data).flip();
+
+ if (data.remaining() < length + 4) {
+ field_227122_a_.error("Chunk {} in {} is truncated: expected {} but read {}", chunk, this.filePath.getFileName(), length + 4, data.remaining());
+ continue;
+ }
+ func_227135_a_(chunk, data); //Save the chunk data, it'll be spit out to an external file.
+ }
+ return this;
+ }
+
private Path func_227145_e_(ChunkPos p_227145_1_) {
String s = "c." + p_227145_1_.field_77276_a + "." + p_227145_1_.field_77275_b + ".mcc";
return this.field_227124_d_.resolve(s);
@@ -234,6 +298,7 @@
int j = this.field_76716_d.get(i);
int k = func_227142_b_(j);
int l = func_227131_a_(j);
+ if (l == 255) l = forgeGetRealLength(i, k); //Forge: Old Forge fix, get real length, so we can free if needed
int i1 = p_227135_2_.remaining();
int j1 = func_227144_c_(i1);
int k1;

View File

@ -1,12 +1,8 @@
--- a/net/minecraft/world/gen/IWorldGenerationBaseReader.java
+++ b/net/minecraft/world/gen/IWorldGenerationBaseReader.java
@@ -8,4 +8,9 @@
@@ -8,4 +8,5 @@
boolean func_217375_a(BlockPos p_217375_1_, Predicate<BlockState> p_217375_2_);
BlockPos func_205770_a(Heightmap.Type p_205770_1_, BlockPos p_205770_2_);
+
+ //TODO, Dimensions..
+// default int getMaxHeight() {
+// return this instanceof net.minecraft.world.IWorld ? ((net.minecraft.world.IWorld)this).getWorld().getDimension().getHeight() : 256;
+// }
}

View File

@ -9,12 +9,12 @@
this.func_230367_a_(p_227210_1_, p_227210_6_, p_227210_4_.field_227273_b_.func_225574_a_(p_227210_2_, p_227210_3_));
}
}
@@ -38,7 +38,7 @@
protected boolean func_227209_a_(IWorld p_227209_1_, BlockPos p_227209_2_, int p_227209_3_, BlockPos.Mutable p_227209_4_, BigMushroomFeatureConfig p_227209_5_) {
int i = p_227209_2_.func_177956_o();
- if (i >= 1 && i + p_227209_3_ + 1 < 256) {
+ if (i >= 1 && i + p_227209_3_ + 1 < 256/*TODO p_227209_1_.getMaxHeight()*/) {
Block block = p_227209_1_.func_180495_p(p_227209_2_.func_177977_b()).func_177230_c();
if (!func_227250_b_(block)) {
return false;
@@ -49,7 +49,7 @@
for(int l = -k; l <= k; ++l) {
for(int i1 = -k; i1 <= k; ++i1) {
BlockState blockstate = p_227209_1_.func_180495_p(p_227209_4_.func_239621_a_(p_227209_2_, l, j, i1));
- if (!blockstate.func_196958_f() && !blockstate.func_235714_a_(BlockTags.field_206952_E)) {
+ if (!blockstate.isAir(p_227209_1_, p_227209_4_.func_239621_a_(p_227209_2_, l, j, i1)) && !blockstate.func_235714_a_(BlockTags.field_206952_E)) {
return false;
}
}

View File

@ -1,26 +1,10 @@
--- a/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java
+++ b/net/minecraft/world/gen/feature/BaseTreeFeatureConfig.java
@@ -42,6 +42,7 @@
public final int field_236680_i_;
public final boolean field_236681_j_;
public final Heightmap.Type field_236682_l_;
+ protected net.minecraftforge.common.IPlantable sapling = (net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196674_t;
protected BaseTreeFeatureConfig(BlockStateProvider p_i232020_1_, BlockStateProvider p_i232020_2_, FoliagePlacer p_i232020_3_, AbstractTrunkPlacer p_i232020_4_, AbstractFeatureSizeType p_i232020_5_, List<TreeDecorator> p_i232020_6_, int p_i232020_7_, boolean p_i232020_8_, Heightmap.Type p_i232020_9_) {
this.field_227368_m_ = p_i232020_1_;
@@ -55,6 +56,15 @@
this.field_236682_l_ = p_i232020_9_;
}
+ protected BaseTreeFeatureConfig setSapling(net.minecraftforge.common.IPlantable value) {
+ this.sapling = value;
+ return this;
+ }
+
+ public net.minecraftforge.common.IPlantable getSapling() {
+ return this.sapling;
+ }
+
public void func_227373_a_() {
this.field_227372_q_ = true;
}
@@ -32,6 +32,7 @@
return p_236684_0_.field_236682_l_;
})).apply(p_236683_0_, BaseTreeFeatureConfig::new);
});
+ //TODO: Review this, see if we can hook in the sapling into the Codec
public final BlockStateProvider field_227368_m_;
public final BlockStateProvider field_227369_n_;
public final List<TreeDecorator> field_227370_o_;

View File

@ -1,10 +1,10 @@
--- a/net/minecraft/world/gen/feature/DungeonsFeature.java
+++ b/net/minecraft/world/gen/feature/DungeonsFeature.java
@@ -123,6 +123,6 @@
@@ -124,6 +124,6 @@
}
private EntityType<?> func_201043_a(Random p_201043_1_) {
- return field_175916_b[p_201043_1_.nextInt(field_175916_b.length)];
- return Util.func_240989_a_(field_175916_b, p_201043_1_);
+ return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(p_201043_1_);
}
}

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java
+++ b/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java
@@ -27,7 +27,7 @@
for(int i = 0; i < 1500; ++i) {
BlockPos blockpos = p_230362_5_.func_177982_a(p_230362_4_.nextInt(8) - p_230362_4_.nextInt(8), -p_230362_4_.nextInt(12), p_230362_4_.nextInt(8) - p_230362_4_.nextInt(8));
- if (p_230362_1_.func_180495_p(blockpos).func_196958_f()) {
+ if (p_230362_1_.func_180495_p(blockpos).isAir(p_230362_1_, blockpos)) {
int j = 0;
for(Direction direction : Direction.values()) {

View File

@ -1,5 +1,22 @@
--- a/net/minecraft/world/gen/feature/IceSpikeFeature.java
+++ b/net/minecraft/world/gen/feature/IceSpikeFeature.java
@@ -43,14 +43,14 @@
if ((i1 == 0 && j1 == 0 || !(f1 * f1 + f2 * f2 > f * f)) && (i1 != -l && i1 != l && j1 != -l && j1 != l || !(p_230362_4_.nextFloat() > 0.75F))) {
BlockState blockstate = p_230362_1_.func_180495_p(p_230362_5_.func_177982_a(i1, k, j1));
Block block = blockstate.func_177230_c();
- if (blockstate.func_196958_f() || func_227250_b_(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) {
+ if (blockstate.isAir(p_230362_1_, p_230362_5_.func_177982_a(i1, k, j1)) || func_227250_b_(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) {
this.func_230367_a_(p_230362_1_, p_230362_5_.func_177982_a(i1, k, j1), Blocks.field_150403_cj.func_176223_P());
}
if (k != 0 && l > 1) {
blockstate = p_230362_1_.func_180495_p(p_230362_5_.func_177982_a(i1, -k, j1));
block = blockstate.func_177230_c();
- if (blockstate.func_196958_f() || func_227250_b_(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) {
+ if (blockstate.isAir(p_230362_1_, p_230362_5_.func_177982_a(i1, -k, j1)) || func_227250_b_(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) {
this.func_230367_a_(p_230362_1_, p_230362_5_.func_177982_a(i1, -k, j1), Blocks.field_150403_cj.func_176223_P());
}
}
@@ -77,7 +77,7 @@
while(blockpos.func_177956_o() > 50) {
BlockState blockstate1 = p_230362_1_.func_180495_p(blockpos);

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/world/gen/feature/SpringFeature.java
+++ b/net/minecraft/world/gen/feature/SpringFeature.java
@@ -20,7 +20,7 @@
return false;
} else {
BlockState blockstate = p_230362_1_.func_180495_p(p_230362_5_);
- if (!blockstate.func_196958_f() && !p_230362_6_.field_227366_f_.contains(blockstate.func_177230_c())) {
+ if (!blockstate.isAir(p_230362_1_, p_230362_5_) && !p_230362_6_.field_227366_f_.contains(blockstate.func_177230_c())) {
return false;
} else {
int i = 0;

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java
+++ b/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java
@@ -113,7 +113,7 @@
if (!template.func_237146_a_(p_230378_2_, p_230378_5_, p_230378_6_, placementsettings, p_230378_9_, 18)) {
return false;
} else {
- for(Template.BlockInfo template$blockinfo : Template.func_237145_a_(p_230378_2_, p_230378_5_, p_230378_6_, placementsettings, this.func_214857_a(p_230378_1_, p_230378_5_, p_230378_7_, false))) {
+ for(Template.BlockInfo template$blockinfo : Template.processBlockInfos(p_230378_2_, p_230378_5_, p_230378_6_, placementsettings, this.func_214857_a(p_230378_1_, p_230378_5_, p_230378_7_, false), template)) {
this.func_214846_a(p_230378_2_, template$blockinfo, p_230378_5_, p_230378_7_, p_230378_9_, p_230378_8_);
}

View File

@ -0,0 +1,41 @@
--- a/net/minecraft/world/gen/feature/template/StructureProcessor.java
+++ b/net/minecraft/world/gen/feature/template/StructureProcessor.java
@@ -6,7 +6,37 @@
public abstract class StructureProcessor {
@Nullable
- public abstract Template.BlockInfo func_230386_a_(IWorldReader p_230386_1_, BlockPos p_230386_2_, BlockPos p_230386_3_, Template.BlockInfo p_230386_4_, Template.BlockInfo p_230386_5_, PlacementSettings p_230386_6_);
+ @Deprecated //Forge: Use process below, with the Template context
+ public Template.BlockInfo func_230386_a_(IWorldReader p_230386_1_, BlockPos p_230386_2_, BlockPos p_230386_3_, Template.BlockInfo p_230386_4_, Template.BlockInfo p_230386_5_, PlacementSettings p_230386_6_) {
+ return p_230386_5_;
+ }
protected abstract IStructureProcessorType<?> func_215192_a();
+
+ @Nullable
+ public Template.BlockInfo process(IWorldReader p_230386_1_, BlockPos p_230386_2_, BlockPos p_230386_3_, Template.BlockInfo p_230386_4_, Template.BlockInfo p_230386_5_, PlacementSettings p_230386_6_, @Nullable Template template) {
+ return func_230386_a_(p_230386_1_, p_230386_2_, p_230386_3_, p_230386_4_, p_230386_5_, p_230386_6_);
+ }
+
+ /**
+ * FORGE: Add entity processing.
+ * <p>
+ * Use this method to process entities from a structure in much the same way as
+ * blocks, parameters are analogous.
+ *
+ * @param world
+ * @param seedPos
+ * @param rawEntityInfo
+ * @param entityInfo
+ * @param placementSettings
+ * @param template
+ *
+ * @see #process(IWorldReader, BlockPos,
+ * net.minecraft.world.gen.feature.template.Template.BlockInfo,
+ * net.minecraft.world.gen.feature.template.Template.BlockInfo,
+ * PlacementSettings)
+ */
+ public Template.EntityInfo processEntity(IWorldReader world, BlockPos seedPos, Template.EntityInfo rawEntityInfo, Template.EntityInfo entityInfo, PlacementSettings placementSettings, Template template) {
+ return entityInfo;
+ }
}

View File

@ -1,14 +1,103 @@
--- a/net/minecraft/world/gen/feature/template/Template.java
+++ b/net/minecraft/world/gen/feature/template/Template.java
@@ -422,6 +422,11 @@
}
@@ -189,6 +189,10 @@
return func_207669_a(p_186266_1_, p_186266_0_.func_186212_b(), p_186266_0_.func_186215_c(), p_186266_0_.func_207664_d());
}
+ // FORGE: Add overload accepting Vec3d
+ public static Vector3d transformedVec3d(PlacementSettings placementIn, Vector3d pos) {
+ return func_207667_a(pos, placementIn.func_186212_b(), placementIn.func_186215_c(), placementIn.func_207664_d());
+ }
+ public static Vector3d transformedVec3d(PlacementSettings placementIn, Vector3d pos) {
+ return func_207667_a(pos, placementIn.func_186212_b(), placementIn.func_186215_c(), placementIn.func_207664_d());
+ }
+
public static BlockPos func_207669_a(BlockPos p_207669_0_, Mirror p_207669_1_, Rotation p_207669_2_, BlockPos p_207669_3_) {
int i = p_207669_0_.func_177958_n();
int j = p_207669_0_.func_177956_o();
public void func_237144_a_(IWorld p_237144_1_, BlockPos p_237144_2_, PlacementSettings p_237144_3_, Random p_237144_4_) {
p_237144_3_.func_186224_i();
this.func_237152_b_(p_237144_1_, p_237144_2_, p_237144_3_, p_237144_4_);
@@ -214,7 +218,7 @@
int i1 = Integer.MIN_VALUE;
int j1 = Integer.MIN_VALUE;
- for(Template.BlockInfo template$blockinfo : func_237145_a_(p_237146_1_, p_237146_2_, p_237146_3_, p_237146_4_, list)) {
+ for(Template.BlockInfo template$blockinfo : processBlockInfos(p_237146_1_, p_237146_2_, p_237146_3_, p_237146_4_, list, this)) {
BlockPos blockpos = template$blockinfo.field_186242_a;
if (mutableboundingbox == null || mutableboundingbox.func_175898_b(blockpos)) {
FluidState fluidstate = p_237146_4_.func_204763_l() ? p_237146_1_.func_204610_c(blockpos) : null;
@@ -329,7 +333,7 @@
}
if (!p_237146_4_.func_186221_e()) {
- this.func_237143_a_(p_237146_1_, p_237146_2_, p_237146_4_.func_186212_b(), p_237146_4_.func_186215_c(), p_237146_4_.func_207664_d(), mutableboundingbox, p_237146_4_.func_237134_m_());
+ this.addEntitiesToWorld(p_237146_1_, p_237146_2_, p_237146_4_);
}
return true;
@@ -358,14 +362,19 @@
});
}
+ @Deprecated //Use Forge version
public static List<Template.BlockInfo> func_237145_a_(IWorld p_237145_0_, BlockPos p_237145_1_, BlockPos p_237145_2_, PlacementSettings p_237145_3_, List<Template.BlockInfo> p_237145_4_) {
+ return processBlockInfos(p_237145_0_, p_237145_1_, p_237145_2_, p_237145_3_, p_237145_4_, null);
+ }
+
+ public static List<Template.BlockInfo> processBlockInfos(IWorld p_237145_0_, BlockPos p_237145_1_, BlockPos p_237145_2_, PlacementSettings p_237145_3_, List<Template.BlockInfo> p_237145_4_, @Nullable Template template) {
List<Template.BlockInfo> list = Lists.newArrayList();
for(Template.BlockInfo template$blockinfo : p_237145_4_) {
BlockPos blockpos = func_186266_a(p_237145_3_, template$blockinfo.field_186242_a).func_177971_a(p_237145_1_);
Template.BlockInfo template$blockinfo1 = new Template.BlockInfo(blockpos, template$blockinfo.field_186243_b, template$blockinfo.field_186244_c != null ? template$blockinfo.field_186244_c.func_74737_b() : null);
- for(Iterator<StructureProcessor> iterator = p_237145_3_.func_215221_j().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().func_230386_a_(p_237145_0_, p_237145_1_, p_237145_2_, template$blockinfo, template$blockinfo1, p_237145_3_)) {
+ for(Iterator<StructureProcessor> iterator = p_237145_3_.func_215221_j().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().process(p_237145_0_, p_237145_1_, p_237145_2_, template$blockinfo, template$blockinfo1, p_237145_3_, template)) {
}
if (template$blockinfo1 != null) {
@@ -376,13 +385,30 @@
return list;
}
- private void func_237143_a_(IWorld p_237143_1_, BlockPos p_237143_2_, Mirror p_237143_3_, Rotation p_237143_4_, BlockPos p_237143_5_, @Nullable MutableBoundingBox p_237143_6_, boolean p_237143_7_) {
- for(Template.EntityInfo template$entityinfo : this.field_186271_b) {
- BlockPos blockpos = func_207669_a(template$entityinfo.field_186248_b, p_237143_3_, p_237143_4_, p_237143_5_).func_177971_a(p_237143_2_);
- if (p_237143_6_ == null || p_237143_6_.func_175898_b(blockpos)) {
+ public static List<Template.EntityInfo> processEntityInfos(@Nullable Template template, IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List<Template.EntityInfo> p_215387_3_) {
+ List<Template.EntityInfo> list = Lists.newArrayList();
+ for(Template.EntityInfo entityInfo : p_215387_3_) {
+ Vector3d pos = transformedVec3d(p_215387_2_, entityInfo.field_186247_a).func_178787_e(Vector3d.func_237491_b_(p_215387_1_));
+ BlockPos blockpos = func_186266_a(p_215387_2_, entityInfo.field_186248_b).func_177971_a(p_215387_1_);
+ Template.EntityInfo info = new Template.EntityInfo(pos, blockpos, entityInfo.field_186249_c);
+ for (StructureProcessor proc : p_215387_2_.func_215221_j()) {
+ info = proc.processEntity(p_215387_0_, p_215387_1_, entityInfo, info, p_215387_2_, template);
+ if (info == null)
+ break;
+ }
+ if (info != null)
+ list.add(info);
+ }
+ return list;
+ }
+
+ private void addEntitiesToWorld(IWorld p_237143_1_, BlockPos p_237143_2_, PlacementSettings placementIn) {
+ for(Template.EntityInfo template$entityinfo : processEntityInfos(this, p_237143_1_, p_237143_2_, placementIn, this.field_186271_b)) {
+ BlockPos blockpos = func_207669_a(template$entityinfo.field_186248_b, placementIn.func_186212_b(), placementIn.func_186215_c(), placementIn.func_207664_d()).func_177971_a(p_237143_2_);
+ blockpos = template$entityinfo.field_186248_b; // FORGE: Position will have already been transformed by processEntityInfos
+ if (placementIn.func_186213_g() == null || placementIn.func_186213_g().func_175898_b(blockpos)) {
CompoundNBT compoundnbt = template$entityinfo.field_186249_c.func_74737_b();
- Vector3d vector3d = func_207667_a(template$entityinfo.field_186247_a, p_237143_3_, p_237143_4_, p_237143_5_);
- Vector3d vector3d1 = vector3d.func_72441_c((double)p_237143_2_.func_177958_n(), (double)p_237143_2_.func_177956_o(), (double)p_237143_2_.func_177952_p());
+ Vector3d vector3d1 = template$entityinfo.field_186247_a; // FORGE: Position will have already been transformed by processEntityInfos
ListNBT listnbt = new ListNBT();
listnbt.add(DoubleNBT.func_229684_a_(vector3d1.field_72450_a));
listnbt.add(DoubleNBT.func_229684_a_(vector3d1.field_72448_b));
@@ -390,10 +416,10 @@
compoundnbt.func_218657_a("Pos", listnbt);
compoundnbt.func_82580_o("UUID");
func_215382_a(p_237143_1_, compoundnbt).ifPresent((p_237147_6_) -> {
- float f = p_237147_6_.func_184217_a(p_237143_3_);
- f = f + (p_237147_6_.field_70177_z - p_237147_6_.func_184229_a(p_237143_4_));
+ float f = p_237147_6_.func_184217_a(placementIn.func_186212_b());
+ f = f + (p_237147_6_.field_70177_z - p_237147_6_.func_184229_a(placementIn.func_186215_c()));
p_237147_6_.func_70012_b(vector3d1.field_72450_a, vector3d1.field_72448_b, vector3d1.field_72449_c, f, p_237147_6_.field_70125_A);
- if (p_237143_7_ && p_237147_6_ instanceof MobEntity) {
+ if (placementIn.func_237134_m_() && p_237147_6_ instanceof MobEntity) {
((MobEntity)p_237147_6_).func_213386_a(p_237143_1_, p_237143_1_.func_175649_E(new BlockPos(vector3d1)), SpawnReason.STRUCTURE, (ILivingEntityData)null, compoundnbt);
}

View File

@ -1,12 +1,10 @@
--- a/net/minecraft/world/lighting/BlockLightEngine.java
+++ b/net/minecraft/world/lighting/BlockLightEngine.java
@@ -117,4 +117,11 @@
@@ -117,4 +117,9 @@
this.field_215627_c.func_215532_c();
this.func_215469_a(Long.MAX_VALUE, p_215623_1_.func_218275_a(), 15 - p_215623_2_, true);
}
+
+ // FORGE START
+
+ @Override
+ public int queuedUpdateSize() {
+ return field_215627_c.queuedUpdateSize();

View File

@ -1,12 +1,10 @@
--- a/net/minecraft/world/lighting/LevelBasedGraph.java
+++ b/net/minecraft/world/lighting/LevelBasedGraph.java
@@ -228,4 +228,10 @@
@@ -228,4 +228,8 @@
protected abstract void func_215476_a(long p_215476_1_, int p_215476_3_);
protected abstract int func_215480_b(long p_215480_1_, long p_215480_3_, int p_215480_5_);
+
+ // FORGE START
+
+ protected int queuedUpdateSize() {
+ return field_215488_c.size();
+ }

View File

@ -1,11 +1,9 @@
--- a/net/minecraft/world/lighting/LightEngine.java
+++ b/net/minecraft/world/lighting/LightEngine.java
@@ -215,4 +215,8 @@
@@ -215,4 +215,6 @@
long i = SectionPos.func_218169_f(SectionPos.func_218166_b(p_223129_1_.field_77276_a, 0, p_223129_1_.field_77275_b));
this.field_215627_c.func_223113_c(i, p_223129_2_);
}
+
+ // FORGE START
+
+ public abstract int queuedUpdateSize();
}

View File

@ -1,12 +1,10 @@
--- a/net/minecraft/world/lighting/SkyLightEngine.java
+++ b/net/minecraft/world/lighting/SkyLightEngine.java
@@ -228,4 +228,11 @@
@@ -228,4 +228,9 @@
public String func_215614_b(long p_215614_1_) {
return super.func_215614_b(p_215614_1_) + (this.field_215627_c.func_215549_m(p_215614_1_) ? "*" : "");
}
+
+ // FORGE START
+
+ @Override
+ public int queuedUpdateSize() {
+ return 0;

View File

@ -1,10 +0,0 @@
--- a/net/minecraft/advancements/AdvancementList.java
+++ b/net/minecraft/advancements/AdvancementList.java
@@ -96,6 +96,7 @@
}
}
+ net.minecraftforge.common.AdvancementLoadFix.buildSortedTrees(this.field_192093_c);
field_192091_a.info("Loaded {} advancements", (int)this.field_192092_b.size());
}

View File

@ -1,15 +0,0 @@
--- a/net/minecraft/advancements/AdvancementManager.java
+++ b/net/minecraft/advancements/AdvancementManager.java
@@ -36,7 +36,11 @@
Map<ResourceLocation, Advancement.Builder> map = Maps.newHashMap();
p_212853_1_.forEach((p_223387_1_, p_223387_2_) -> {
try {
- Advancement.Builder advancement$builder = field_192783_b.fromJson(p_223387_2_, Advancement.Builder.class);
+ Advancement.Builder advancement$builder = net.minecraftforge.common.crafting.ConditionalAdvancement.read(field_192783_b, p_223387_1_, p_223387_2_);
+ if (advancement$builder == null) {
+ field_192782_a.info("Skipping loading advancement {} as it's conditions were not met", p_223387_1_);
+ return;
+ }
map.put(p_223387_1_, advancement$builder);
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
field_192782_a.error("Parsing error loading custom advancement {}: {}", p_223387_1_, jsonparseexception.getMessage());

View File

@ -1,27 +0,0 @@
--- a/net/minecraft/advancements/PlayerAdvancements.java
+++ b/net/minecraft/advancements/PlayerAdvancements.java
@@ -154,6 +154,7 @@
}
this.func_192748_e();
+ if (net.minecraftforge.common.ForgeConfig.SERVER.fixAdvancementLoading.get()) net.minecraftforge.common.AdvancementLoadFix.loadVisibility(this, this.field_192759_g, this.field_192760_h, this.field_192758_f, this.field_192761_i, this::func_192738_c); else
this.func_192752_d();
this.func_192751_c();
}
@@ -187,6 +188,8 @@
}
public boolean func_192750_a(Advancement p_192750_1_, String p_192750_2_) {
+ // Forge: don't grant advancements for fake players
+ if (this.field_192762_j instanceof net.minecraftforge.common.util.FakePlayer) return false;
boolean flag = false;
AdvancementProgress advancementprogress = this.func_192747_a(p_192750_1_);
boolean flag1 = advancementprogress.func_192105_a();
@@ -199,6 +202,7 @@
if (p_192750_1_.func_192068_c() != null && p_192750_1_.func_192068_c().func_193220_i() && this.field_192762_j.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223620_w)) {
this.field_192756_d.func_184103_al().func_148539_a(new TranslationTextComponent("chat.type.advancement." + p_192750_1_.func_192068_c().func_192291_d().func_192307_a(), this.field_192762_j.func_145748_c_(), p_192750_1_.func_193123_j()));
}
+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.field_192762_j, p_192750_1_);
}
}

View File

@ -1,38 +0,0 @@
--- a/net/minecraft/advancements/criterion/ItemPredicate.java
+++ b/net/minecraft/advancements/criterion/ItemPredicate.java
@@ -26,6 +26,8 @@
import net.minecraft.util.registry.Registry;
public class ItemPredicate {
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> custom_predicates = new java.util.HashMap<>();
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> unmod_predicates = java.util.Collections.unmodifiableMap(custom_predicates);
public static final ItemPredicate field_192495_a = new ItemPredicate();
@Nullable
private final Tag<Item> field_200018_b;
@@ -105,6 +107,11 @@
public static ItemPredicate func_192492_a(@Nullable JsonElement p_192492_0_) {
if (p_192492_0_ != null && !p_192492_0_.isJsonNull()) {
JsonObject jsonobject = JSONUtils.func_151210_l(p_192492_0_, "item");
+ if (jsonobject.has("type")) {
+ final ResourceLocation rl = new ResourceLocation(JSONUtils.func_151200_h(jsonobject, "type"));
+ if (custom_predicates.containsKey(rl)) return custom_predicates.get(rl).apply(jsonobject);
+ else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl);
+ }
MinMaxBounds.IntBound minmaxbounds$intbound = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("count"));
MinMaxBounds.IntBound minmaxbounds$intbound1 = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("durability"));
if (jsonobject.has("data")) {
@@ -204,6 +211,14 @@
}
}
+ public static void register(ResourceLocation name, java.util.function.Function<JsonObject, ItemPredicate> deserializer) {
+ custom_predicates.put(name, deserializer);
+ }
+
+ public static Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> getPredicates() {
+ return unmod_predicates;
+ }
+
public static class Builder {
private final List<EnchantmentPredicate> field_200312_a = Lists.newArrayList();
private final List<EnchantmentPredicate> field_226657_b_ = Lists.newArrayList();

View File

@ -1,13 +0,0 @@
--- a/net/minecraft/block/BedBlock.java
+++ b/net/minecraft/block/BedBlock.java
@@ -88,7 +88,9 @@
}
}
- if (p_225533_2_.field_73011_w.func_76567_e() && p_225533_2_.func_226691_t_(p_225533_3_) != Biomes.field_76778_j) {
+ net.minecraftforge.common.extensions.IForgeDimension.SleepResult sleepResult = p_225533_2_.field_73011_w.canSleepAt(p_225533_4_, p_225533_3_);
+ if (sleepResult != net.minecraftforge.common.extensions.IForgeDimension.SleepResult.BED_EXPLODES) {
+ if (sleepResult == net.minecraftforge.common.extensions.IForgeDimension.SleepResult.DENY) return ActionResultType.SUCCESS;
if (p_225533_1_.func_177229_b(field_176471_b)) {
if (!this.func_226861_a_(p_225533_2_, p_225533_3_)) {
p_225533_4_.func_146105_b(new TranslationTextComponent("block.minecraft.bed.occupied"), true);

View File

@ -1,26 +0,0 @@
--- a/net/minecraft/block/BlockState.java
+++ b/net/minecraft/block/BlockState.java
@@ -51,7 +51,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class BlockState extends StateHolder<Block, BlockState> implements IStateHolder<BlockState> {
+public class BlockState extends StateHolder<Block, BlockState> implements IStateHolder<BlockState>, net.minecraftforge.common.extensions.IForgeBlockState {
@Nullable
private BlockState.Cache field_215707_c;
private final int field_215708_d;
@@ -106,10 +106,14 @@
return this.field_215708_d;
}
+ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos) */
+ @Deprecated
public boolean func_196958_f() {
return this.func_177230_c().func_196261_e(this);
}
+ /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation) */
+ @Deprecated
public MaterialColor func_185909_g(IBlockReader p_185909_1_, BlockPos p_185909_2_) {
return this.func_177230_c().func_180659_g(this, p_185909_1_, p_185909_2_);
}

View File

@ -1,36 +0,0 @@
--- a/net/minecraft/block/Blocks.java
+++ b/net/minecraft/block/Blocks.java
@@ -14,6 +14,7 @@
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.registry.Registry;
+@net.minecraftforge.registries.ObjectHolder("minecraft")
public class Blocks {
public static final Block field_150350_a = func_222382_a("air", new AirBlock(Block.Properties.func_200945_a(Material.field_151579_a).func_200942_a().func_222380_e()));
public static final Block field_150348_b = func_222382_a("stone", new Block(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151665_m).func_200948_a(1.5F, 6.0F)));
@@ -105,7 +106,7 @@
public static final Block field_196601_az = func_222382_a("green_bed", new BedBlock(DyeColor.GREEN, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F).func_226896_b_()));
public static final Block field_196550_aA = func_222382_a("red_bed", new BedBlock(DyeColor.RED, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F).func_226896_b_()));
public static final Block field_196551_aB = func_222382_a("black_bed", new BedBlock(DyeColor.BLACK, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F).func_226896_b_()));
- public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e)));
+ public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e), true));
public static final Block field_150319_E = func_222382_a("detector_rail", new DetectorRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e)));
public static final Block field_150320_F = func_222382_a("sticky_piston", new PistonBlock(true, Block.Properties.func_200945_a(Material.field_76233_E).func_200943_b(0.5F)));
public static final Block field_196553_aF = func_222382_a("cobweb", new WebBlock(Block.Properties.func_200945_a(Material.field_151569_G).func_200942_a().func_200943_b(4.0F)));
@@ -701,16 +702,4 @@
private static Block func_222382_a(String p_222382_0_, Block p_222382_1_) {
return Registry.func_218325_a(Registry.field_212618_g, p_222382_0_, p_222382_1_);
}
-
- static {
- for(Block block : Registry.field_212618_g) {
- for(BlockState blockstate : block.func_176194_O().func_177619_a()) {
- blockstate.func_215692_c();
- Block.field_176229_d.func_195867_b(blockstate);
- }
-
- block.func_220068_i();
- }
-
- }
}

View File

@ -1,32 +0,0 @@
--- a/net/minecraft/block/BushBlock.java
+++ b/net/minecraft/block/BushBlock.java
@@ -7,7 +7,7 @@
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
-public class BushBlock extends Block {
+public class BushBlock extends Block implements net.minecraftforge.common.IPlantable {
protected BushBlock(Block.Properties p_i48437_1_) {
super(p_i48437_1_);
}
@@ -23,6 +23,8 @@
public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos blockpos = p_196260_3_.func_177977_b();
+ if (p_196260_1_.func_177230_c() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
+ return p_196260_2_.func_180495_p(blockpos).canSustainPlant(p_196260_2_, blockpos, Direction.UP, this);
return this.func_200014_a_(p_196260_2_.func_180495_p(blockpos), p_196260_2_, blockpos);
}
@@ -33,4 +35,11 @@
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return p_196266_4_ == PathType.AIR && !this.field_196274_w ? true : super.func_196266_a(p_196266_1_, p_196266_2_, p_196266_3_, p_196266_4_);
}
+
+ @Override
+ public BlockState getPlant(IBlockReader world, BlockPos pos) {
+ BlockState state = world.func_180495_p(pos);
+ if (state.func_177230_c() != this) return func_176223_P();
+ return state;
+ }
}

View File

@ -1,63 +0,0 @@
--- a/net/minecraft/block/CactusBlock.java
+++ b/net/minecraft/block/CactusBlock.java
@@ -19,7 +19,7 @@
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
-public class CactusBlock extends Block {
+public class CactusBlock extends Block implements net.minecraftforge.common.IPlantable {
public static final IntegerProperty field_176587_a = BlockStateProperties.field_208171_X;
protected static final VoxelShape field_196400_b = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 15.0D, 15.0D);
protected static final VoxelShape field_196401_c = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
@@ -30,6 +30,7 @@
}
public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
+ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update
if (!p_225534_1_.func_196955_c(p_225534_2_, p_225534_3_)) {
p_225534_2_.func_175655_b(p_225534_3_, true);
} else {
@@ -42,6 +43,7 @@
if (i < 3) {
int j = p_225534_1_.func_177229_b(field_176587_a);
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, blockpos, p_225534_1_, true)) {
if (j == 15) {
p_225534_2_.func_175656_a(blockpos, this.func_176223_P());
BlockState blockstate = p_225534_1_.func_206870_a(field_176587_a, Integer.valueOf(0));
@@ -50,7 +52,8 @@
} else {
p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_.func_206870_a(field_176587_a, Integer.valueOf(j + 1)), 4);
}
-
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_);
+ }
}
}
}
@@ -81,8 +84,8 @@
}
}
- Block block = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_177230_c();
- return (block == Blocks.field_150434_aF || block == Blocks.field_150354_m || block == Blocks.field_196611_F) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
+ BlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
+ return soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), Direction.UP, this) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
}
public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
@@ -96,4 +99,14 @@
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return false;
}
+
+ @Override
+ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) {
+ return net.minecraftforge.common.PlantType.Desert;
+ }
+
+ @Override
+ public BlockState getPlant(IBlockReader world, BlockPos pos) {
+ return func_176223_P();
+ }
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/block/CampfireBlock.java
+++ b/net/minecraft/block/CampfireBlock.java
@@ -187,7 +187,7 @@
boolean flag = p_220066_4_ instanceof AbstractFireballEntity || p_220066_4_ instanceof AbstractArrowEntity && p_220066_4_.func_70027_ad();
if (flag) {
Entity entity = this.func_226913_a_(p_220066_4_);
- boolean flag1 = entity == null || entity instanceof PlayerEntity || p_220066_1_.func_82736_K().func_223586_b(GameRules.field_223599_b);
+ boolean flag1 = entity == null || entity instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_220066_1_, entity);
if (flag1 && !p_220066_2_.func_177229_b(field_220101_b) && !p_220066_2_.func_177229_b(field_220103_d)) {
BlockPos blockpos = p_220066_3_.func_216350_a();
p_220066_1_.func_180501_a(blockpos, p_220066_2_.func_206870_a(BlockStateProperties.field_208190_q, Boolean.valueOf(true)), 11);

View File

@ -1,50 +0,0 @@
--- a/net/minecraft/block/ChorusFlowerBlock.java
+++ b/net/minecraft/block/ChorusFlowerBlock.java
@@ -29,9 +29,9 @@
p_225534_2_.func_175655_b(p_225534_3_, true);
} else {
BlockPos blockpos = p_225534_3_.func_177984_a();
- if (p_225534_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) {
+ if (p_225534_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < p_225534_2_.func_201675_m().getHeight()) {
int i = p_225534_1_.func_177229_b(field_185607_a);
- if (i < 5) {
+ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, blockpos, p_225534_1_, true)) {
boolean flag = false;
boolean flag1 = false;
BlockState blockstate = p_225534_2_.func_180495_p(p_225534_3_.func_177977_b());
@@ -56,7 +56,7 @@
if (j < 2 || j <= p_225534_4_.nextInt(flag1 ? 5 : 4)) {
flag = true;
}
- } else if (blockstate.func_196958_f()) {
+ } else if (blockstate.isAir(p_225534_2_, p_225534_3_.func_177977_b())) {
flag = true;
}
@@ -88,7 +88,7 @@
} else {
this.func_185605_c(p_225534_2_, p_225534_3_);
}
-
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_);
}
}
}
@@ -126,7 +126,7 @@
BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
Block block = blockstate.func_177230_c();
if (block != this.field_196405_b && block != Blocks.field_150377_bs) {
- if (!blockstate.func_196958_f()) {
+ if (!blockstate.isAir(p_196260_2_, p_196260_3_.func_177977_b())) {
return false;
} else {
boolean flag = false;
@@ -139,7 +139,7 @@
}
flag = true;
- } else if (!blockstate1.func_196958_f()) {
+ } else if (!blockstate1.isAir(p_196260_2_, p_196260_3_.func_177972_a(direction))) {
return false;
}
}

View File

@ -1,16 +0,0 @@
--- a/net/minecraft/block/CocoaBlock.java
+++ b/net/minecraft/block/CocoaBlock.java
@@ -30,10 +30,11 @@
}
public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
- if (p_225534_2_.field_73012_v.nextInt(5) == 0) {
+ if (true) {
int i = p_225534_1_.func_177229_b(field_176501_a);
- if (i < 2) {
+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, p_225534_3_, p_225534_1_, p_225534_2_.field_73012_v.nextInt(5) == 0)) {
p_225534_2_.func_180501_a(p_225534_3_, p_225534_1_.func_206870_a(field_176501_a, Integer.valueOf(i + 1)), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_);
}
}

View File

@ -1,28 +0,0 @@
--- a/net/minecraft/block/ComparatorBlock.java
+++ b/net/minecraft/block/ComparatorBlock.java
@@ -71,7 +71,7 @@
blockstate = p_176397_1_.func_180495_p(blockpos);
if (blockstate.func_185912_n()) {
i = blockstate.func_185888_a(p_176397_1_, blockpos);
- } else if (blockstate.func_196958_f()) {
+ } else if (blockstate.isAir(p_176397_1_, blockpos)) {
ItemFrameEntity itemframeentity = this.func_176461_a(p_176397_1_, direction, blockpos);
if (itemframeentity != null) {
i = itemframeentity.func_174866_q();
@@ -157,4 +157,16 @@
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.func_206894_a(field_185512_D, field_176463_b, field_196348_c);
}
+
+ @Override
+ public boolean getWeakChanges(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return true;
+ }
+
+ @Override
+ public void onNeighborChange(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, BlockPos neighbor) {
+ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World && !((World)world).func_201670_d()) {
+ state.func_215697_a((World)world, pos, world.func_180495_p(neighbor).func_177230_c(), neighbor, false);
+ }
+ }
}

View File

@ -1,39 +0,0 @@
--- a/net/minecraft/block/CropsBlock.java
+++ b/net/minecraft/block/CropsBlock.java
@@ -58,12 +58,14 @@
public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
super.func_225534_a_(p_225534_1_, p_225534_2_, p_225534_3_, p_225534_4_);
+ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
if (p_225534_2_.func_226659_b_(p_225534_3_, 0) >= 9) {
int i = this.func_185527_x(p_225534_1_);
if (i < this.func_185526_g()) {
float f = func_180672_a(this, p_225534_2_, p_225534_3_);
- if (p_225534_4_.nextInt((int)(25.0F / f) + 1) == 0) {
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, p_225534_3_, p_225534_1_, p_225534_4_.nextInt((int)(25.0F / f) + 1) == 0)) {
p_225534_2_.func_180501_a(p_225534_3_, this.func_185528_e(i + 1), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, p_225534_3_, p_225534_1_);
}
}
}
@@ -92,9 +94,9 @@
for(int j = -1; j <= 1; ++j) {
float f1 = 0.0F;
BlockState blockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j));
- if (blockstate.func_177230_c() == Blocks.field_150458_ak) {
+ if (blockstate.canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.Direction.UP, (net.minecraftforge.common.IPlantable)p_180672_0_)) {
f1 = 1.0F;
- if (blockstate.func_177229_b(FarmlandBlock.field_176531_a) > 0) {
+ if (blockstate.isFertile(p_180672_1_, blockpos.func_177982_a(i, 0, j))) {
f1 = 3.0F;
}
}
@@ -130,7 +132,7 @@
}
public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
- if (p_196262_4_ instanceof RavagerEntity && p_196262_2_.func_82736_K().func_223586_b(GameRules.field_223599_b)) {
+ if (p_196262_4_ instanceof RavagerEntity && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_196262_2_, p_196262_4_)) {
p_196262_2_.func_225521_a_(p_196262_3_, true, p_196262_4_);
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/block/DeadBushBlock.java
+++ b/net/minecraft/block/DeadBushBlock.java
@@ -5,7 +5,7 @@
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
-public class DeadBushBlock extends BushBlock {
+public class DeadBushBlock extends BushBlock implements net.minecraftforge.common.IShearable {
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(Block.Properties p_i48418_1_) {

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/block/DetectorRailBlock.java
+++ b/net/minecraft/block/DetectorRailBlock.java
@@ -129,6 +129,8 @@
public int func_180641_l(BlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) {
if (p_180641_1_.func_177229_b(field_176574_M)) {
+ List<AbstractMinecartEntity> carts = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, null);
+ if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel();
List<MinecartCommandBlockEntity> list = this.func_200878_a(p_180641_2_, p_180641_3_, MinecartCommandBlockEntity.class, (Predicate<Entity>)null);
if (!list.isEmpty()) {
return list.get(0).func_145822_e().func_145760_g();

View File

@ -1,19 +0,0 @@
--- a/net/minecraft/block/DoublePlantBlock.java
+++ b/net/minecraft/block/DoublePlantBlock.java
@@ -39,7 +39,7 @@
@Nullable
public BlockState func_196258_a(BlockItemUseContext p_196258_1_) {
BlockPos blockpos = p_196258_1_.func_195995_a();
- return blockpos.func_177956_o() < 255 && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null;
+ return blockpos.func_177956_o() < p_196258_1_.func_195991_k().func_201675_m().getHeight() - 1 && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null;
}
public void func_180633_a(World p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
@@ -51,6 +51,7 @@
return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_);
} else {
BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
+ if (p_196260_1_.func_177230_c() != this) return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
return blockstate.func_177230_c() == this && blockstate.func_177229_b(field_176492_b) == DoubleBlockHalf.LOWER;
}
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/block/DropperBlock.java
+++ b/net/minecraft/block/DropperBlock.java
@@ -37,7 +37,7 @@
p_176439_1_.func_217379_c(1001, p_176439_2_, 0);
} else {
ItemStack itemstack = dispensertileentity.func_70301_a(i);
- if (!itemstack.func_190926_b()) {
+ if (!itemstack.func_190926_b() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_176439_1_, p_176439_2_, dispensertileentity, i, itemstack)) {
Direction direction = p_176439_1_.func_180495_p(p_176439_2_).func_177229_b(field_176441_a);
IInventory iinventory = HopperTileEntity.func_195484_a(p_176439_1_, p_176439_2_.func_177972_a(direction));
ItemStack itemstack1;

View File

@ -1,20 +0,0 @@
--- a/net/minecraft/block/FallingBlock.java
+++ b/net/minecraft/block/FallingBlock.java
@@ -29,7 +29,7 @@
}
public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
- if (func_185759_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b())) && p_225534_3_.func_177956_o() >= 0) {
+ if (p_225534_2_.func_175623_d(p_225534_3_.func_177977_b()) || func_185759_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b())) && p_225534_3_.func_177956_o() >= 0) {
FallingBlockEntity fallingblockentity = new FallingBlockEntity(p_225534_2_, (double)p_225534_3_.func_177958_n() + 0.5D, (double)p_225534_3_.func_177956_o(), (double)p_225534_3_.func_177952_p() + 0.5D, p_225534_2_.func_180495_p(p_225534_3_));
this.func_149829_a(fallingblockentity);
p_225534_2_.func_217376_c(fallingblockentity);
@@ -59,7 +59,7 @@
public void func_180655_c(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, Random p_180655_4_) {
if (p_180655_4_.nextInt(16) == 0) {
BlockPos blockpos = p_180655_3_.func_177977_b();
- if (func_185759_i(p_180655_2_.func_180495_p(blockpos))) {
+ if (p_180655_2_.func_175623_d(blockpos) || func_185759_i(p_180655_2_.func_180495_p(blockpos))) {
double d0 = (double)p_180655_3_.func_177958_n() + (double)p_180655_4_.nextFloat();
double d1 = (double)p_180655_3_.func_177956_o() - 0.05D;
double d2 = (double)p_180655_3_.func_177952_p() + (double)p_180655_4_.nextFloat();

View File

@ -1,33 +0,0 @@
--- a/net/minecraft/block/FarmlandBlock.java
+++ b/net/minecraft/block/FarmlandBlock.java
@@ -76,7 +76,7 @@
}
public void func_180658_a(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) {
- if (!p_180658_1_.field_72995_K && p_180658_1_.field_73012_v.nextFloat() < p_180658_4_ - 0.5F && p_180658_3_ instanceof LivingEntity && (p_180658_3_ instanceof PlayerEntity || p_180658_1_.func_82736_K().func_223586_b(GameRules.field_223599_b)) && p_180658_3_.func_213311_cf() * p_180658_3_.func_213311_cf() * p_180658_3_.func_213302_cg() > 0.512F) {
+ if (!p_180658_1_.field_72995_K && net.minecraftforge.common.ForgeHooks.onFarmlandTrample(p_180658_1_, p_180658_2_, Blocks.field_150346_d.func_176223_P(), p_180658_4_, p_180658_3_)) { // Forge: Move logic to Entity#canTrample
func_199610_d(p_180658_1_.func_180495_p(p_180658_2_), p_180658_1_, p_180658_2_);
}
@@ -87,9 +87,9 @@
p_199610_1_.func_175656_a(p_199610_2_, func_199601_a(p_199610_0_, Blocks.field_150346_d.func_176223_P(), p_199610_1_, p_199610_2_));
}
- private static boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) {
- Block block = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a()).func_177230_c();
- return block instanceof CropsBlock || block instanceof StemBlock || block instanceof AttachedStemBlock;
+ private boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) {
+ BlockState state = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a());
+ return state.func_177230_c() instanceof net.minecraftforge.common.IPlantable && canSustainPlant(state, p_176529_0_, p_176529_1_, Direction.UP, (net.minecraftforge.common.IPlantable)state.func_177230_c());
}
private static boolean func_176530_e(IWorldReader p_176530_0_, BlockPos p_176530_1_) {
@@ -99,7 +99,7 @@
}
}
- return false;
+ return net.minecraftforge.common.FarmlandWaterManager.hasBlockWaterTicket(p_176530_0_, p_176530_1_);
}
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {

View File

@ -1,85 +0,0 @@
--- a/net/minecraft/block/FlowingFluidBlock.java
+++ b/net/minecraft/block/FlowingFluidBlock.java
@@ -31,9 +31,11 @@
public class FlowingFluidBlock extends Block implements IBucketPickupHandler {
public static final IntegerProperty field_176367_b = BlockStateProperties.field_208132_ag;
- protected final FlowingFluid field_204517_c;
+ private final FlowingFluid field_204517_c;
private final List<IFluidState> field_212565_c;
+ // Forge: Use the constructor that takes a supplier
+ @Deprecated
protected FlowingFluidBlock(FlowingFluid p_i49014_1_, Block.Properties p_i49014_2_) {
super(p_i49014_2_);
this.field_204517_c = p_i49014_1_;
@@ -46,8 +48,21 @@
this.field_212565_c.add(p_i49014_1_.func_207207_a(8, true));
this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176367_b, Integer.valueOf(0)));
+ fluidStateCacheInitialized = true;
+ supplier = p_i49014_1_.delegate;
}
+ /**
+ * @param supplier A fluid supplier such as {@link net.minecraftforge.fml.RegistryObject<Fluid>}
+ */
+ public FlowingFluidBlock(java.util.function.Supplier<? extends FlowingFluid> supplier, Block.Properties p_i48368_1_) {
+ super(p_i48368_1_);
+ this.field_204517_c = null;
+ this.field_212565_c = Lists.newArrayList();
+ this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176367_b, Integer.valueOf(0)));
+ this.supplier = supplier;
+ }
+
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
p_225542_2_.func_204610_c(p_225542_3_).func_206891_b(p_225542_2_, p_225542_3_, p_225542_4_);
}
@@ -62,6 +77,7 @@
public IFluidState func_204507_t(BlockState p_204507_1_) {
int i = p_204507_1_.func_177229_b(field_176367_b);
+ if (!fluidStateCacheInitialized) initFluidStateCache();
return this.field_212565_c.get(Math.min(i, 8));
}
@@ -122,13 +138,13 @@
if (flag) {
IFluidState ifluidstate = p_204515_1_.func_204610_c(p_204515_2_);
if (ifluidstate.func_206889_d()) {
- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_150343_Z.func_176223_P());
+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_150343_Z.func_176223_P()));
this.func_180688_d(p_204515_1_, p_204515_2_);
return false;
}
if (ifluidstate.func_215679_a(p_204515_1_, p_204515_2_) >= 0.44444445F) {
- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_150347_e.func_176223_P());
+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_150347_e.func_176223_P()));
this.func_180688_d(p_204515_1_, p_204515_2_);
return false;
}
@@ -161,4 +177,23 @@
}
}
+
+ // Forge start
+ private final java.util.function.Supplier<? extends Fluid> supplier;
+ public FlowingFluid getFluid() {
+ return (FlowingFluid)supplier.get();
+ }
+
+ private boolean fluidStateCacheInitialized = false;
+ protected synchronized void initFluidStateCache() {
+ if (fluidStateCacheInitialized == false) {
+ this.field_212565_c.add(getFluid().func_207204_a(false));
+
+ for (int i = 1; i < 8; ++i)
+ this.field_212565_c.add(getFluid().func_207207_a(8 - i, false));
+
+ this.field_212565_c.add(getFluid().func_207207_a(8, true));
+ fluidStateCacheInitialized = true;
+ }
+ }
}

View File

@ -1,10 +0,0 @@
--- a/net/minecraft/block/ITileEntityProvider.java
+++ b/net/minecraft/block/ITileEntityProvider.java
@@ -4,6 +4,7 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
+@Deprecated //Forge: Do not use, use BlockState.hasTileEntity/Block.createTileEntity
public interface ITileEntityProvider {
@Nullable
TileEntity func_196283_a_(IBlockReader p_196283_1_);

View File

@ -1,13 +0,0 @@
--- a/net/minecraft/block/KelpTopBlock.java
+++ b/net/minecraft/block/KelpTopBlock.java
@@ -52,8 +52,9 @@
} else {
BlockPos blockpos = p_225534_3_.func_177984_a();
BlockState blockstate = p_225534_2_.func_180495_p(blockpos);
- if (blockstate.func_177230_c() == Blocks.field_150355_j && p_225534_1_.func_177229_b(field_203163_a) < 25 && p_225534_4_.nextDouble() < 0.14D) {
+ if (blockstate.func_177230_c() == Blocks.field_150355_j && p_225534_1_.func_177229_b(field_203163_a) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225534_2_, blockpos, p_225534_1_, p_225534_4_.nextDouble() < 0.14D)) {
p_225534_2_.func_175656_a(blockpos, p_225534_1_.func_177231_a(field_203163_a));
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225534_2_, blockpos, p_225534_1_);
}
}

View File

@ -1,14 +0,0 @@
--- a/net/minecraft/block/LadderBlock.java
+++ b/net/minecraft/block/LadderBlock.java
@@ -93,6 +93,11 @@
return null;
}
+ @Override
+ public boolean isLadder(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) {
+ return true;
+ }
+
public BlockState func_185499_a(BlockState p_185499_1_, Rotation p_185499_2_) {
return p_185499_1_.func_206870_a(field_176382_a, p_185499_2_.func_185831_a(p_185499_1_.func_177229_b(field_176382_a)));
}

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/block/LeavesBlock.java
+++ b/net/minecraft/block/LeavesBlock.java
@@ -18,7 +18,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class LeavesBlock extends Block {
+public class LeavesBlock extends Block implements net.minecraftforge.common.IShearable {
public static final IntegerProperty field_208494_a = BlockStateProperties.field_208514_aa;
public static final BooleanProperty field_208495_b = BlockStateProperties.field_208515_s;

View File

@ -1,11 +0,0 @@
--- a/net/minecraft/block/MushroomBlock.java
+++ b/net/minecraft/block/MushroomBlock.java
@@ -64,7 +64,7 @@
BlockState blockstate = p_196260_2_.func_180495_p(blockpos);
Block block = blockstate.func_177230_c();
if (block != Blocks.field_150391_bh && block != Blocks.field_196661_l) {
- return p_196260_2_.func_226659_b_(p_196260_3_, 0) < 13 && this.func_200014_a_(blockstate, p_196260_2_, blockpos);
+ return p_196260_2_.func_226659_b_(p_196260_3_, 0) < 13 && blockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.Direction.UP, this);
} else {
return true;
}

View File

@ -1,56 +0,0 @@
--- a/net/minecraft/block/NetherPortalBlock.java
+++ b/net/minecraft/block/NetherPortalBlock.java
@@ -69,7 +69,7 @@
public boolean func_176548_d(IWorld p_176548_1_, BlockPos p_176548_2_) {
NetherPortalBlock.Size netherportalblock$size = this.func_201816_b(p_176548_1_, p_176548_2_);
- if (netherportalblock$size != null) {
+ if (netherportalblock$size != null && !net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_176548_1_, p_176548_2_, netherportalblock$size)) {
netherportalblock$size.func_150859_c();
return true;
} else {
@@ -241,13 +241,13 @@
int i;
for(i = 0; i < 22; ++i) {
BlockPos blockpos = p_180120_1_.func_177967_a(p_180120_2_, i);
- if (!this.func_196900_a(this.field_150867_a.func_180495_p(blockpos)) || this.field_150867_a.func_180495_p(blockpos.func_177977_b()).func_177230_c() != Blocks.field_150343_Z) {
+ if (!this.func_196900_a(this.field_150867_a.func_180495_p(blockpos)) || !this.field_150867_a.func_180495_p(blockpos.func_177977_b()).isPortalFrame(this.field_150867_a, blockpos.func_177977_b())) {
break;
}
}
- Block block = this.field_150867_a.func_180495_p(p_180120_1_.func_177967_a(p_180120_2_, i)).func_177230_c();
- return block == Blocks.field_150343_Z ? i : 0;
+ BlockPos framePos = p_180120_1_.func_177967_a(p_180120_2_, i);
+ return this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos) ? i : 0;
}
public int func_181100_a() {
@@ -274,13 +274,13 @@
}
if (i == 0) {
- block = this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150863_d)).func_177230_c();
- if (block != Blocks.field_150343_Z) {
+ BlockPos framePos = blockpos.func_177972_a(this.field_150863_d);
+ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) {
break label56;
}
} else if (i == this.field_150868_h - 1) {
- block = this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150866_c)).func_177230_c();
- if (block != Blocks.field_150343_Z) {
+ BlockPos framePos = blockpos.func_177972_a(this.field_150866_c);
+ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) {
break label56;
}
}
@@ -288,7 +288,8 @@
}
for(int j = 0; j < this.field_150868_h; ++j) {
- if (this.field_150867_a.func_180495_p(this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g)).func_177230_c() != Blocks.field_150343_Z) {
+ BlockPos framePos = this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g);
+ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) {
this.field_150862_g = 0;
break;
}

View File

@ -1,32 +0,0 @@
--- a/net/minecraft/block/NoteBlock.java
+++ b/net/minecraft/block/NoteBlock.java
@@ -50,7 +50,7 @@
}
private void func_196482_a(World p_196482_1_, BlockPos p_196482_2_) {
- if (p_196482_1_.func_180495_p(p_196482_2_.func_177984_a()).func_196958_f()) {
+ if (p_196482_1_.func_175623_d(p_196482_2_.func_177984_a())) {
p_196482_1_.func_175641_c(p_196482_2_, this, 0, 0);
}
@@ -60,7 +60,9 @@
if (p_225533_2_.field_72995_K) {
return ActionResultType.SUCCESS;
} else {
- p_225533_1_ = p_225533_1_.func_177231_a(field_196485_c);
+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_225533_2_, p_225533_3_, p_225533_1_, p_225533_1_.func_177229_b(field_196485_c), p_225533_1_.func_177231_a(field_196485_c).func_177229_b(field_196485_c));
+ if (_new == -1) return ActionResultType.FAIL;
+ p_225533_1_ = (BlockState)p_225533_1_.func_206870_a(field_196485_c, _new);
p_225533_2_.func_180501_a(p_225533_3_, p_225533_1_, 3);
this.func_196482_a(p_225533_2_, p_225533_3_);
p_225533_4_.func_195066_a(Stats.field_188087_U);
@@ -76,6 +78,9 @@
}
public boolean func_189539_a(BlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) {
+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_189539_2_, p_189539_3_, p_189539_1_, p_189539_1_.func_177229_b(field_196485_c), p_189539_1_.func_177229_b(field_196483_a));
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false;
+ p_189539_1_ = p_189539_1_.func_206870_a(field_196485_c, e.getVanillaNoteId()).func_206870_a(field_196483_a, e.getInstrument());
int i = p_189539_1_.func_177229_b(field_196485_c);
float f = (float)Math.pow(2.0D, (double)(i - 12) / 12.0D);
p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, p_189539_1_.func_177229_b(field_196483_a).func_208088_a(), SoundCategory.RECORDS, 3.0F, f);

View File

@ -1,19 +0,0 @@
--- a/net/minecraft/block/OreBlock.java
+++ b/net/minecraft/block/OreBlock.java
@@ -29,12 +29,10 @@
public void func_220062_a(BlockState p_220062_1_, World p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) {
super.func_220062_a(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_);
- if (EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_220062_4_) == 0) {
- int i = this.func_220281_a(p_220062_2_.field_73012_v);
- if (i > 0) {
- this.func_180637_b(p_220062_2_, p_220062_3_, i);
- }
- }
+ }
+ @Override
+ public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader reader, BlockPos pos, int fortune, int silktouch) {
+ return silktouch == 0 ? this.func_220281_a(RANDOM) : 0;
}
}

View File

@ -1,81 +0,0 @@
--- a/net/minecraft/block/PistonBlockStructureHelper.java
+++ b/net/minecraft/block/PistonBlockStructureHelper.java
@@ -48,7 +48,7 @@
} else {
for(int i = 0; i < this.field_177258_e.size(); ++i) {
BlockPos blockpos = this.field_177258_e.get(i);
- if (func_227029_a_(this.field_177261_a.func_180495_p(blockpos).func_177230_c()) && !this.func_177250_b(blockpos)) {
+ if (this.field_177261_a.func_180495_p(blockpos).isStickyBlock() && !this.func_177250_b(blockpos)) {
return false;
}
}
@@ -57,24 +57,9 @@
}
}
- private static boolean func_227029_a_(Block p_227029_0_) {
- return p_227029_0_ == Blocks.field_180399_cE || p_227029_0_ == Blocks.field_226907_mc_;
- }
-
- private static boolean func_227030_a_(Block p_227030_0_, Block p_227030_1_) {
- if (p_227030_0_ == Blocks.field_226907_mc_ && p_227030_1_ == Blocks.field_180399_cE) {
- return false;
- } else if (p_227030_0_ == Blocks.field_180399_cE && p_227030_1_ == Blocks.field_226907_mc_) {
- return false;
- } else {
- return func_227029_a_(p_227030_0_) || func_227029_a_(p_227030_1_);
- }
- }
-
private boolean func_177251_a(BlockPos p_177251_1_, Direction p_177251_2_) {
BlockState blockstate = this.field_177261_a.func_180495_p(p_177251_1_);
- Block block = blockstate.func_177230_c();
- if (blockstate.func_196958_f()) {
+ if (field_177261_a.func_175623_d(p_177251_1_)) {
return true;
} else if (!PistonBlock.func_185646_a(blockstate, this.field_177261_a, p_177251_1_, this.field_177257_d, false, p_177251_2_)) {
return true;
@@ -87,12 +72,12 @@
if (i + this.field_177258_e.size() > 12) {
return false;
} else {
- while(func_227029_a_(block)) {
+ BlockState oldState;
+ while(blockstate.isStickyBlock()) {
BlockPos blockpos = p_177251_1_.func_177967_a(this.field_177257_d.func_176734_d(), i);
- Block block1 = block;
+ oldState = blockstate;
blockstate = this.field_177261_a.func_180495_p(blockpos);
- block = blockstate.func_177230_c();
- if (blockstate.func_196958_f() || !func_227030_a_(block1, block) || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) {
+ if (blockstate.isAir(this.field_177261_a, blockpos) || !oldState.canStickTo(blockstate) || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) {
break;
}
@@ -119,7 +104,7 @@
for(int k = 0; k <= j + l; ++k) {
BlockPos blockpos2 = this.field_177258_e.get(k);
- if (func_227029_a_(this.field_177261_a.func_180495_p(blockpos2).func_177230_c()) && !this.func_177250_b(blockpos2)) {
+ if (this.field_177261_a.func_180495_p(blockpos2).isStickyBlock() && !this.func_177250_b(blockpos2)) {
return false;
}
}
@@ -128,7 +113,7 @@
}
blockstate = this.field_177261_a.func_180495_p(blockpos1);
- if (blockstate.func_196958_f()) {
+ if (blockstate.isAir(field_177261_a, blockpos1)) {
return true;
}
@@ -173,7 +158,7 @@
if (direction.func_176740_k() != this.field_177257_d.func_176740_k()) {
BlockPos blockpos = p_177250_1_.func_177972_a(direction);
BlockState blockstate1 = this.field_177261_a.func_180495_p(blockpos);
- if (func_227030_a_(blockstate1.func_177230_c(), blockstate.func_177230_c()) && !this.func_177251_a(blockpos, direction)) {
+ if (blockstate1.canStickTo(blockstate) && !this.func_177251_a(blockpos, direction)) {
return false;
}
}

View File

@ -1,57 +0,0 @@
--- a/net/minecraft/block/RailState.java
+++ b/net/minecraft/block/RailState.java
@@ -15,14 +15,16 @@
private BlockState field_196923_d;
private final boolean field_208513_e;
private final List<BlockPos> field_196924_e = Lists.newArrayList();
+ private final boolean canMakeSlopes;
public RailState(World p_i47755_1_, BlockPos p_i47755_2_, BlockState p_i47755_3_) {
this.field_196920_a = p_i47755_1_;
this.field_196921_b = p_i47755_2_;
this.field_196923_d = p_i47755_3_;
this.field_196922_c = (AbstractRailBlock)p_i47755_3_.func_177230_c();
- RailShape railshape = p_i47755_3_.func_177229_b(this.field_196922_c.func_176560_l());
- this.field_208513_e = this.field_196922_c.func_208490_b();
+ RailShape railshape = this.field_196922_c.getRailDirection(field_196923_d, p_i47755_1_, p_i47755_2_, null);
+ this.field_208513_e = !this.field_196922_c.isFlexibleRail(field_196923_d, p_i47755_1_, p_i47755_2_);
+ this.canMakeSlopes = this.field_196922_c.canMakeSlopes(field_196923_d, p_i47755_1_, p_i47755_2_);
this.func_208509_a(railshape);
}
@@ -178,7 +180,7 @@
}
}
- if (railshape == RailShape.NORTH_SOUTH) {
+ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) {
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
railshape = RailShape.ASCENDING_NORTH;
}
@@ -188,7 +190,7 @@
}
}
- if (railshape == RailShape.EAST_WEST) {
+ if (railshape == RailShape.EAST_WEST && canMakeSlopes) {
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
railshape = RailShape.ASCENDING_EAST;
}
@@ -304,7 +306,7 @@
}
}
- if (railshape == RailShape.NORTH_SOUTH) {
+ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) {
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
railshape = RailShape.ASCENDING_NORTH;
}
@@ -314,7 +316,7 @@
}
}
- if (railshape == RailShape.EAST_WEST) {
+ if (railshape == RailShape.EAST_WEST && canMakeSlopes) {
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
railshape = RailShape.ASCENDING_EAST;
}

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