Patching and updates

This commit is contained in:
tterrag 2020-06-23 20:56:24 -04:00 committed by cpw
parent 6d15febdb3
commit 631230b298
No known key found for this signature in database
GPG key ID: 8EB3DF749553B1B7
113 changed files with 1011 additions and 3194 deletions

View file

@ -65,8 +65,8 @@ ext {
}
MAPPING_CHANNEL = 'snapshot'
MAPPING_VERSION = '20200514-1.16'
MC_VERSION = '1.16-rc1'
MCP_VERSION = '20200622.150620'
MC_VERSION = '1.16'
MCP_VERSION = '20200623.201412'
}
project(':mcp') {

View file

@ -32,7 +32,7 @@
@Deprecated
public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
- if (this.func_235695_q_() && !p_196243_1_.func_203425_a(p_196243_4_.func_177230_c())) {
+ if (this.func_235695_q_() && (p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c() || !p_196243_4_.hasTileEntity())) {
+ if (p_196243_1_.hasTileEntity() && (p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c() || !p_196243_4_.hasTileEntity())) {
p_196243_2_.func_175713_t(p_196243_3_);
}
@ -54,7 +54,14 @@
return p_180647_2_.func_184813_a(p_180647_1_) / f / (float)i;
}
}
@@ -326,8 +330,7 @@
@@ -320,14 +324,14 @@
return 0;
}
+ @Deprecated //Forge: Use state.hasTileEntity()
public final boolean func_235695_q_() {
return this instanceof ITileEntityProvider;
}
public final ResourceLocation func_220068_i() {
if (this.field_220085_g == null) {
@ -64,7 +71,7 @@
}
return this.field_220085_g;
@@ -345,6 +348,10 @@
@@ -345,6 +349,10 @@
return this.field_235684_aB_.field_235800_b_.apply(this.func_230328_p_().func_176223_P());
}
@ -75,7 +82,7 @@
public abstract static class AbstractBlockState extends StateHolder<Block, BlockState> {
private final int field_215708_d;
private final boolean field_215709_e;
@@ -786,6 +793,7 @@
@@ -786,6 +794,7 @@
private ResourceLocation field_222381_j;
private boolean field_226895_m_ = true;
private boolean field_235813_o_;

View file

@ -33,7 +33,7 @@
}
+ @Deprecated
+ @Deprecated //Forge: Use more sensitive version
public float func_149638_a() {
return this.field_235689_au_;
}

View file

@ -17,21 +17,21 @@
if (!p_225534_1_.func_196955_c(p_225534_2_, p_225534_3_)) {
p_225534_2_.func_175655_b(p_225534_3_, true);
}
@@ -42,6 +43,7 @@
int i;
for(i = 1; p_225542_2_.func_180495_p(p_225542_3_.func_177979_c(i)).func_203425_a(this); ++i) {
}
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, blockpos, p_225542_1_, true)) {
@@ -45,6 +46,7 @@
if (i < 3) {
int j = p_225542_1_.func_177229_b(field_176587_a);
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, blockpos, p_225542_1_, true)) {
if (j == 15) {
p_225542_2_.func_175656_a(blockpos, this.func_176223_P());
BlockState blockstate = p_225542_1_.func_206870_a(field_176587_a, Integer.valueOf(0));
@@ -53,7 +55,8 @@
} else {
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176587_a, Integer.valueOf(j + 1)), 4);
}
-
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
+ }
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
+ }
}
}
}

View file

@ -1,11 +1,20 @@
--- a/net/minecraft/block/ChorusFlowerBlock.java
+++ b/net/minecraft/block/ChorusFlowerBlock.java
@@ -40,7 +40,7 @@
BlockPos blockpos = p_225542_3_.func_177984_a();
if (p_225542_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) {
int i = p_225542_1_.func_177229_b(field_185607_a);
- if (i < 5) {
+ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, blockpos, p_225542_1_, true)) {
boolean flag = false;
boolean flag1 = false;
BlockState blockstate = p_225542_2_.func_180495_p(p_225542_3_.func_177977_b());
@@ -65,7 +65,7 @@
if (j < 2 || j <= p_225542_4_.nextInt(flag1 ? 5 : 4)) {
flag = true;
}
- } else if (blockstate.func_196958_f()) {
+ } else if (blockstate.isAir(p_225542_2_, p_225542_3_.func_177977_b())) {
+ } else if (blockstate.isAir(p_225542_2_, p_225542_3_.func_177977_b())) {
flag = true;
}
@ -14,7 +23,7 @@
this.func_185605_c(p_225542_2_, p_225542_3_);
}
-
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/block/FlowerPotBlock.java
+++ b/net/minecraft/block/FlowerPotBlock.java
@@ -24,12 +24,33 @@
@@ -24,12 +24,35 @@
protected static final VoxelShape field_196450_a = Block.func_208617_a(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D);
private final Block field_196452_c;
@ -14,8 +14,8 @@
+ ((FlowerPotBlock)Blocks.field_150457_bL).addPlant(p_i48395_1_.getRegistryName(), () -> this);
+ }
}
-
+ /**
+ /**
+ * For mod use, eliminates the need to extend this class, and prevents modded
+ * flower pots from altering vanilla behavior.
+ *
@ -23,22 +23,23 @@
+ * @param p_i48395_1_ The flower block.
+ * @param properties
+ */
+ public FlowerPotBlock(@javax.annotation.Nullable java.util.function.Supplier<FlowerPotBlock> emptyPot, java.util.function.Supplier<? extends Block> p_i48395_1_, AbstractBlock.Properties p_i48395_2_) {
+ super(p_i48395_2_);
+ this.field_196452_c = null; // Unused, redirected by coremod
+ this.flowerDelegate = p_i48395_1_;
+ if (emptyPot == null) {
+ this.fullPots = Maps.newHashMap();
+ this.emptyPot = null;
+ } else {
+ this.fullPots = java.util.Collections.emptyMap();
+ this.emptyPot = emptyPot;
+ }
+ }
+ public FlowerPotBlock(@javax.annotation.Nullable java.util.function.Supplier<FlowerPotBlock> emptyPot, java.util.function.Supplier<? extends Block> p_i48395_1_, AbstractBlock.Properties properties) {
+ super(properties);
+ this.field_196452_c = null; // Unused, redirected by coremod
+ this.flowerDelegate = p_i48395_1_;
+ if (emptyPot == null) {
+ this.fullPots = Maps.newHashMap();
+ this.emptyPot = null;
+ } else {
+ this.fullPots = java.util.Collections.emptyMap();
+ this.emptyPot = emptyPot;
+ }
+ }
+
public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
return field_196450_a;
}
@@ -41,7 +62,7 @@
@@ -41,7 +64,7 @@
public ActionResultType func_225533_a_(BlockState p_225533_1_, World p_225533_2_, BlockPos p_225533_3_, PlayerEntity p_225533_4_, Hand p_225533_5_, BlockRayTraceResult p_225533_6_) {
ItemStack itemstack = p_225533_4_.func_184586_b(p_225533_5_);
Item item = itemstack.func_77973_b();
@ -47,7 +48,7 @@
boolean flag = block == Blocks.field_150350_a;
boolean flag1 = this.field_196452_c == Blocks.field_150350_a;
if (flag != flag1) {
@@ -59,7 +80,7 @@
@@ -59,7 +82,7 @@
p_225533_4_.func_71019_a(itemstack1, false);
}
@ -56,7 +57,7 @@
}
return ActionResultType.func_233537_a_(p_225533_2_.field_72995_K);
@@ -77,10 +98,28 @@
@@ -77,10 +100,27 @@
}
public Block func_220276_d() {
@ -73,7 +74,6 @@
+ private final java.util.function.Supplier<FlowerPotBlock> emptyPot;
+ private final java.util.function.Supplier<? extends Block> flowerDelegate;
+
+
+ public FlowerPotBlock getEmptyPot() {
+ return emptyPot == null ? this : emptyPot.get();
+ }

View file

@ -24,6 +24,24 @@
return true;
}
@@ -230,7 +233,7 @@
return false;
}
- return !p_185646_0_.func_177230_c().func_235695_q_();
+ return !p_185646_0_.hasTileEntity();
} else {
return false;
}
@@ -271,7 +274,7 @@
for(int k = list2.size() - 1; k >= 0; --k) {
BlockPos blockpos2 = list2.get(k);
BlockState blockstate1 = p_176319_1_.func_180495_p(blockpos2);
- TileEntity tileentity = blockstate1.func_177230_c().func_235695_q_() ? p_176319_1_.func_175625_s(blockpos2) : null;
+ TileEntity tileentity = blockstate1.hasTileEntity() ? p_176319_1_.func_175625_s(blockpos2) : null;
func_220059_a(blockstate1, p_176319_1_, blockpos2, tileentity);
p_176319_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 18);
ablockstate[j++] = blockstate1;
@@ -335,6 +338,10 @@
return p_185499_1_.func_206870_a(field_176387_N, p_185499_2_.func_185831_a(p_185499_1_.func_177229_b(field_176387_N)));
}

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/block/SpongeBlock.java
+++ b/net/minecraft/block/SpongeBlock.java
@@ -64,7 +64,7 @@
queue.add(new Tuple<>(blockpos1, j + 1));
}
} else if (material == Material.field_203243_f || material == Material.field_204868_h) {
- TileEntity tileentity = blockstate.func_177230_c().func_235695_q_() ? p_176312_1_.func_175625_s(blockpos1) : null;
+ TileEntity tileentity = blockstate.hasTileEntity() ? p_176312_1_.func_175625_s(blockpos1) : null;
func_220059_a(blockstate, p_176312_1_, blockpos1, tileentity);
p_176312_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 3);
++i;

View file

@ -16,7 +16,40 @@
this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a;
this.field_238175_ae_ = !p_i45547_1_.field_178741_d.field_239099_d_;
this.field_238176_af_ = !p_i45547_1_.field_178741_d.field_239100_e_;
@@ -482,12 +482,11 @@
@@ -416,13 +416,13 @@
this.field_195558_d.func_216526_a(this.field_71474_y.field_74350_i);
this.field_71417_B = new MouseHelper(this);
- this.field_71417_B.func_198029_a(this.field_195558_d.func_198092_i());
this.field_195559_v = new KeyboardListener(this);
this.field_195559_v.func_197968_a(this.field_195558_d.func_198092_i());
RenderSystem.initRenderer(this.field_71474_y.field_209231_W, false);
this.field_147124_at = new Framebuffer(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), true, field_142025_a);
this.field_147124_at.func_147604_a(0.0F, 0.0F, 0.0F, 0.0F);
this.field_110451_am = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES);
+ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.field_110448_aq, this.field_110451_am, this.field_195554_ax);
this.field_110448_aq.func_198983_a();
this.field_71474_y.func_198017_a(this.field_110448_aq);
this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab);
@@ -463,6 +463,7 @@
this.func_193986_ar();
this.field_110451_am.func_219534_a(this.field_193995_ae);
this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o);
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.ParticleFactoryRegisterEvent());
this.field_110451_am.func_219534_a(this.field_71452_i);
this.field_213272_aL = new PaintingSpriteUploader(this.field_71446_o);
this.field_110451_am.func_219534_a(this.field_213272_aL);
@@ -470,7 +471,8 @@
this.field_110451_am.func_219534_a(this.field_213273_aM);
this.field_241557_ar_ = new GPUWarning();
this.field_110451_am.func_219534_a(this.field_241557_ar_);
- this.field_71456_v = new IngameGui(this);
+ this.field_71456_v = new net.minecraftforge.client.gui.ForgeIngameGui(this);
+ this.field_71417_B.func_198029_a(this.field_195558_d.func_198092_i()); //Forge: Moved below ingameGUI setting to prevent NPEs in handeler.
this.field_184132_p = new DebugRenderer(this);
RenderSystem.setErrorCallback(this::func_195545_a);
if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) {
@@ -482,11 +484,6 @@
this.field_195558_d.func_224798_d(this.field_71474_y.field_225307_E);
this.field_195558_d.func_227801_c_();
this.func_213226_a();
@ -26,29 +59,25 @@
- this.func_147108_a(new MainMenuScreen(true));
- }
+ //Final needed so we can move into lambda below.
+ final String autoServerName = s;
+ final int autoServerPort = i;
+
ResourceLoadProgressGui.func_212970_a(this);
List<IResourcePack> list = this.field_110448_aq.func_232623_f_();
this.func_213268_a(new ResourceLoadProgressGui(this, this.field_110451_am.func_219537_a(Util.func_215072_e(), this, field_223714_G, list), (p_238197_1_) -> {
@@ -496,6 +495,14 @@
@@ -495,7 +492,14 @@
if (SharedConstants.field_206244_b) {
this.func_213256_aB();
}
+ if (net.minecraftforge.fml.client.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen
+ // FORGE: Move opening initial screen to after startup and events are enabled.
+ // Also Fixes MC-145102
+ if (autoServerName != null) {
+ this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, autoServerName, autoServerPort));
+ } else {
+ this.func_147108_a(new MainMenuScreen(true));
+ }
-
+ if (net.minecraftforge.fml.client.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen
+ // FORGE: Move opening initial screen to after startup and events are enabled.
+ // Also Fixes MC-145102
+ if (s != null) {
+ this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, s, i));
+ } else {
+ this.func_147108_a(new MainMenuScreen(true));
+ }
});
}, false));
}
@@ -534,7 +541,7 @@
@@ -534,7 +538,7 @@
}
private void func_229988_a_(Throwable p_229988_1_) {
@ -57,7 +86,7 @@
ITextComponent itextcomponent;
if (p_229988_1_ instanceof SimpleReloadableResourceManager.FailedPackException) {
itextcomponent = new StringTextComponent(((SimpleReloadableResourceManager.FailedPackException)p_229988_1_).func_241203_a().func_195762_a());
@@ -618,7 +625,7 @@
@@ -618,7 +622,7 @@
return Stream.of(Registry.field_212630_s.func_177774_c(p_213251_0_.func_77973_b()));
});
SearchTreeReloadable<ItemStack> searchtreereloadable = new SearchTreeReloadable<>((p_213235_0_) -> {
@ -66,7 +95,7 @@
});
NonNullList<ItemStack> nonnulllist = NonNullList.func_191196_a();
@@ -688,13 +695,13 @@
@@ -688,13 +692,13 @@
Bootstrap.func_179870_a(p_71377_0_.func_71502_e());
if (p_71377_0_.func_71497_f() != null) {
Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_0_.func_71497_f());
@ -83,7 +112,7 @@
}
}
@@ -703,6 +710,7 @@
@@ -703,6 +707,7 @@
return this.field_71474_y.field_211842_aO;
}
@ -91,7 +120,7 @@
public CompletableFuture<Void> func_213237_g() {
if (this.field_213276_aV != null) {
return this.field_213276_aV;
@@ -791,10 +799,6 @@
@@ -791,10 +796,6 @@
}
public void func_147108_a(@Nullable Screen p_147108_1_) {
@ -102,7 +131,7 @@
if (p_147108_1_ == null && this.field_71441_e == null) {
p_147108_1_ = new MainMenuScreen();
} else if (p_147108_1_ == null && this.field_71439_g.func_233643_dh_()) {
@@ -805,6 +809,14 @@
@@ -805,6 +806,14 @@
}
}
@ -117,7 +146,7 @@
if (p_147108_1_ instanceof MainMenuScreen || p_147108_1_ instanceof MultiplayerScreen) {
this.field_71474_y.field_74330_P = false;
this.field_71456_v.func_146158_b().func_146231_a(true);
@@ -936,11 +948,13 @@
@@ -936,11 +945,13 @@
RenderSystem.enableCull();
this.field_71424_I.func_76319_b();
if (!this.field_71454_w) {
@ -131,7 +160,7 @@
}
if (this.field_238174_aV_ != null) {
@@ -1039,7 +1053,7 @@
@@ -1039,7 +1050,7 @@
Framebuffer framebuffer = this.func_147110_a();
framebuffer.func_216491_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), field_142025_a);
@ -140,7 +169,7 @@
this.field_71417_B.func_198021_g();
}
@@ -1227,11 +1241,21 @@
@@ -1227,11 +1238,21 @@
if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.func_216346_c() == RayTraceResult.Type.BLOCK) {
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
BlockPos blockpos = blockraytraceresult.func_216350_a();
@ -164,7 +193,7 @@
}
}
@@ -1250,6 +1274,8 @@
@@ -1250,6 +1271,8 @@
}
} else if (!this.field_71439_g.func_184838_M()) {
@ -173,7 +202,7 @@
switch(this.field_71476_x.func_216346_c()) {
case ENTITY:
this.field_71442_b.func_78764_a(this.field_71439_g, ((EntityRayTraceResult)this.field_71476_x).func_216348_a());
@@ -1257,7 +1283,7 @@
@@ -1257,7 +1280,7 @@
case BLOCK:
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
BlockPos blockpos = blockraytraceresult.func_216350_a();
@ -182,7 +211,7 @@
this.field_71442_b.func_180511_b(blockpos, blockraytraceresult.func_216354_b());
break;
}
@@ -1267,8 +1293,10 @@
@@ -1267,8 +1290,10 @@
}
this.field_71439_g.func_184821_cY();
@ -193,7 +222,7 @@
this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
}
}
@@ -1283,6 +1311,11 @@
@@ -1283,6 +1308,11 @@
}
for(Hand hand : Hand.values()) {
@ -205,7 +234,7 @@
ItemStack itemstack = this.field_71439_g.func_184586_b(hand);
if (this.field_71476_x != null) {
switch(this.field_71476_x.func_216346_c()) {
@@ -1296,6 +1329,7 @@
@@ -1296,6 +1326,7 @@
if (actionresulttype.func_226246_a_()) {
if (actionresulttype.func_226247_b_()) {
@ -213,7 +242,7 @@
this.field_71439_g.func_184609_a(hand);
}
@@ -1308,6 +1342,7 @@
@@ -1308,6 +1339,7 @@
ActionResultType actionresulttype1 = this.field_71442_b.func_217292_a(this.field_71439_g, this.field_71441_e, hand, blockraytraceresult);
if (actionresulttype1.func_226246_a_()) {
if (actionresulttype1.func_226247_b_()) {
@ -221,17 +250,17 @@
this.field_71439_g.func_184609_a(hand);
if (!itemstack.func_190926_b() && (itemstack.func_190916_E() != i || this.field_71442_b.func_78758_h())) {
this.field_71460_t.field_78516_c.func_187460_a(hand);
@@ -1323,6 +1358,9 @@
@@ -1323,6 +1355,9 @@
}
}
+ if (itemstack.func_190926_b() && (this.field_71476_x == null || this.field_71476_x.func_216346_c() == RayTraceResult.Type.MISS))
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.field_71439_g, hand);
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.field_71439_g, hand);
+
if (!itemstack.func_190926_b()) {
ActionResultType actionresulttype2 = this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, hand);
if (actionresulttype2.func_226246_a_()) {
@@ -1349,6 +1387,8 @@
@@ -1349,6 +1384,8 @@
--this.field_71467_ac;
}
@ -240,7 +269,7 @@
this.field_71424_I.func_76320_a("gui");
if (!this.field_71445_n) {
this.field_71456_v.func_73831_a();
@@ -1465,6 +1505,8 @@
@@ -1465,6 +1502,8 @@
this.field_71424_I.func_219895_b("keyboard");
this.field_195559_v.func_204870_b();
this.field_71424_I.func_76319_b();
@ -249,20 +278,31 @@
}
private void func_184117_aA() {
@@ -1697,6 +1739,12 @@
@@ -1676,6 +1715,10 @@
this.field_71424_I.func_76320_a("waitForServer");
while(!this.field_71437_Z.func_71200_ad()) {
+ if (!net.minecraftforge.fml.StartupQuery.check() || this.field_71437_Z.func_71241_aa()) {
+ this.func_147108_a(null);
+ return;
+ } else if (this.field_71462_r == null) // if we're showing nothing, put the working screen back again
worldloadprogressscreen.func_231023_e_();
this.func_195542_b(false);
@@ -1697,6 +1740,12 @@
}));
networkmanager.func_179290_a(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN));
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.
+ this.func_110432_I().setProperties(gameProfile.getProperties());
+ gameProfile = field_152355_az.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974.
+ this.func_110432_I().setProperties(gameProfile.getProperties());
+ }
+ networkmanager.func_179290_a(new CLoginStartPacket(gameProfile));
this.field_71453_ak = networkmanager;
} else {
this.func_241559_a_(p_238195_6_, p_238195_1_, flag, () -> {
@@ -1770,6 +1818,7 @@
@@ -1770,6 +1819,7 @@
}
public void func_71403_a(ClientWorld p_71403_1_) {
@ -270,7 +310,7 @@
WorkingScreen workingscreen = new WorkingScreen();
workingscreen.func_200210_a(new TranslationTextComponent("connect.joining"));
this.func_213241_c(workingscreen);
@@ -1801,10 +1850,12 @@
@@ -1801,10 +1851,12 @@
IntegratedServer integratedserver = this.field_71437_Z;
this.field_71437_Z = null;
this.field_71460_t.func_190564_k();
@ -283,7 +323,7 @@
if (integratedserver != null) {
this.field_71424_I.func_76320_a("waitForServer");
@@ -1819,6 +1870,7 @@
@@ -1819,6 +1871,7 @@
this.field_71456_v.func_181029_i();
this.field_71422_O = null;
this.field_71455_al = false;
@ -291,7 +331,7 @@
this.field_213274_aO.func_216815_b();
}
@@ -1849,6 +1901,7 @@
@@ -1849,6 +1902,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_();
@ -299,7 +339,123 @@
}
public boolean func_238216_r_() {
@@ -2081,6 +2134,7 @@
@@ -1894,112 +1948,9 @@
private void func_147112_ai() {
if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) {
- boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d;
- TileEntity tileentity = null;
- RayTraceResult.Type raytraceresult$type = this.field_71476_x.func_216346_c();
- ItemStack itemstack;
- if (raytraceresult$type == RayTraceResult.Type.BLOCK) {
- BlockPos blockpos = ((BlockRayTraceResult)this.field_71476_x).func_216350_a();
- BlockState blockstate = this.field_71441_e.func_180495_p(blockpos);
- Block block = blockstate.func_177230_c();
- if (blockstate.func_196958_f()) {
- return;
- }
-
- itemstack = block.func_185473_a(this.field_71441_e, blockpos, blockstate);
- if (itemstack.func_190926_b()) {
- return;
- }
-
- if (flag && Screen.func_231172_r_() && block.func_235695_q_()) {
- tileentity = this.field_71441_e.func_175625_s(blockpos);
- }
- } else {
- if (raytraceresult$type != RayTraceResult.Type.ENTITY || !flag) {
- return;
- }
-
- Entity entity = ((EntityRayTraceResult)this.field_71476_x).func_216348_a();
- if (entity instanceof PaintingEntity) {
- itemstack = new ItemStack(Items.field_151159_an);
- } else if (entity instanceof LeashKnotEntity) {
- itemstack = new ItemStack(Items.field_151058_ca);
- } else if (entity instanceof ItemFrameEntity) {
- ItemFrameEntity itemframeentity = (ItemFrameEntity)entity;
- ItemStack itemstack1 = itemframeentity.func_82335_i();
- if (itemstack1.func_190926_b()) {
- itemstack = new ItemStack(Items.field_151160_bD);
- } else {
- itemstack = itemstack1.func_77946_l();
- }
- } else if (entity instanceof AbstractMinecartEntity) {
- AbstractMinecartEntity abstractminecartentity = (AbstractMinecartEntity)entity;
- Item item;
- switch(abstractminecartentity.func_184264_v()) {
- case FURNACE:
- item = Items.field_151109_aJ;
- break;
- case CHEST:
- item = Items.field_151108_aI;
- break;
- case TNT:
- item = Items.field_151142_bV;
- break;
- case HOPPER:
- item = Items.field_151140_bW;
- break;
- case COMMAND_BLOCK:
- item = Items.field_151095_cc;
- break;
- default:
- item = Items.field_151143_au;
- }
-
- itemstack = new ItemStack(item);
- } else if (entity instanceof BoatEntity) {
- itemstack = new ItemStack(((BoatEntity)entity).func_184455_j());
- } else if (entity instanceof ArmorStandEntity) {
- itemstack = new ItemStack(Items.field_179565_cj);
- } else if (entity instanceof EnderCrystalEntity) {
- itemstack = new ItemStack(Items.field_185158_cP);
- } else {
- SpawnEggItem spawneggitem = SpawnEggItem.func_200889_b(entity.func_200600_R());
- if (spawneggitem == null) {
- return;
- }
-
- itemstack = new ItemStack(spawneggitem);
- }
- }
-
- if (itemstack.func_190926_b()) {
- String s = "";
- if (raytraceresult$type == RayTraceResult.Type.BLOCK) {
- s = Registry.field_212618_g.func_177774_c(this.field_71441_e.func_180495_p(((BlockRayTraceResult)this.field_71476_x).func_216350_a()).func_177230_c()).toString();
- } else if (raytraceresult$type == RayTraceResult.Type.ENTITY) {
- s = Registry.field_212629_r.func_177774_c(((EntityRayTraceResult)this.field_71476_x).func_216348_a().func_200600_R()).toString();
- }
-
- field_147123_G.warn("Picking on: [{}] {} gave null item", raytraceresult$type, s);
- } else {
- PlayerInventory playerinventory = this.field_71439_g.field_71071_by;
- if (tileentity != null) {
- this.func_184119_a(itemstack, tileentity);
- }
-
- int i = playerinventory.func_184429_b(itemstack);
- if (flag) {
- playerinventory.func_184434_a(itemstack);
- this.field_71442_b.func_78761_a(this.field_71439_g.func_184586_b(Hand.MAIN_HAND), 36 + playerinventory.field_70461_c);
- } else if (i != -1) {
- if (PlayerInventory.func_184435_e(i)) {
- playerinventory.field_70461_c = i;
- } else {
- this.field_71442_b.func_187100_a(i);
- }
- }
-
- }
+ if (!net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.field_71474_y.field_74322_I, Hand.MAIN_HAND).isCanceled())
+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e);
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
}
}
@@ -2081,6 +2032,7 @@
return field_71432_P;
}
@ -307,7 +463,16 @@
public CompletableFuture<Void> func_213245_w() {
return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> {
return p_229993_0_;
@@ -2407,6 +2461,14 @@
@@ -2388,7 +2340,7 @@
supplier = func_228022_c_(supplier);
}
- return new ClientResourcePackInfo(p_228011_0_, p_228011_1_, supplier, p_228011_3_, p_228011_4_, p_228011_5_, p_228011_6_);
+ return new ClientResourcePackInfo(p_228011_0_, p_228011_1_, supplier, p_228011_3_, p_228011_4_, p_228011_5_, p_228011_6_, p_228011_3_.isHidden());
}
private static Supplier<IResourcePack> func_228021_b_(Supplier<IResourcePack> p_228021_0_) {
@@ -2407,6 +2359,14 @@
this.field_175617_aL.func_229355_a_(p_228020_1_);
}

View file

@ -35,10 +35,10 @@
- this.func_175179_f().func_238407_a_(p_238453_1_, iformattabletextcomponent, (float)j, (float)k, 16777215 + (l << 24));
+ FontRenderer font = field_92016_l.func_77973_b().getFontRenderer(field_92016_l);
+ if (font == null) {
+ this.func_175179_f().func_238407_a_(p_238453_1_, highlightTip, (float)j, (float)k, 16777215 + (l << 24));
+ this.func_175179_f().func_238407_a_(p_238453_1_, highlightTip, (float)j, (float)k, 16777215 + (l << 24));
+ } else {
+ j = (this.field_194811_H - font.func_238414_a_(highlightTip)) / 2;
+ font.func_238407_a_(p_238453_1_, highlightTip, (float)j, (float)k, 16777215 + (l << 24));
+ j = (this.field_194811_H - font.func_238414_a_(highlightTip)) / 2;
+ font.func_238407_a_(p_238453_1_, highlightTip, (float)j, (float)k, 16777215 + (l << 24));
+ }
RenderSystem.disableBlend();
RenderSystem.popMatrix();

View file

@ -20,8 +20,8 @@
- if (!flag) {
+ list.add((new TranslationTextComponent("container.enchant.clue", enchantment == null ? "" : enchantment.func_200305_d(l))).func_240699_a_(TextFormatting.WHITE));
+ if(enchantment == null) {
+ list.add(new StringTextComponent(""));
+ list.add(new TranslationTextComponent("forge.container.enchant.limitedEnchantability").func_240699_a_(TextFormatting.RED));
+ list.add(new StringTextComponent(""));
+ list.add(new TranslationTextComponent("forge.container.enchant.limitedEnchantability").func_240699_a_(TextFormatting.RED));
+ } else if (!flag) {
list.add(StringTextComponent.field_240750_d_);
if (this.field_230706_i_.field_71439_g.field_71068_ca < k) {

View file

@ -17,8 +17,8 @@
this.func_73972_b(j, 24);
} else {
this.func_73969_a(j, 24);
+ modButton = this.func_230480_a_(new Button(this.field_230708_k_ / 2 - 100, j + 24 * 2, 98, 20, new TranslationTextComponent("fml.menu.mods"), button -> {
+ this.field_230706_i_.func_147108_a(new net.minecraftforge.fml.client.gui.screen.ModListScreen(this));
+ modButton = this.func_230480_a_(new Button(this.field_230708_k_ / 2 - 100, j + 24 * 2, 98, 20, new TranslationTextComponent("fml.menu.mods"), button -> {
+ this.field_230706_i_.func_147108_a(new net.minecraftforge.fml.client.gui.screen.ModListScreen(this));
+ }));
}
+ modUpdateNotification = net.minecraftforge.client.gui.NotificationModUpdateScreen.init(this, modButton);
@ -48,11 +48,11 @@
- this.func_238476_c_(p_230430_1_, this.field_230712_o_, s, 2, this.field_230709_l_ - 10, 16777215 | l);
+ net.minecraftforge.fml.BrandingControl.forEachLine(true, true, (brdline, brd) ->
+ this.func_238476_c_(p_230430_1_, this.field_230712_o_, brd, 2, this.field_230709_l_ - ( 10 + brdline * (this.field_230712_o_.field_78288_b + 1)), 16777215 | l)
+ this.func_238476_c_(p_230430_1_, this.field_230712_o_, brd, 2, this.field_230709_l_ - ( 10 + brdline * (this.field_230712_o_.field_78288_b + 1)), 16777215 | l)
+ );
+
+ net.minecraftforge.fml.BrandingControl.forEachAboveCopyrightLine((brdline, brd) ->
+ this.func_238476_c_(p_230430_1_, this.field_230712_o_, brd, this.field_230708_k_ - field_230712_o_.func_78256_a(brd), this.field_230709_l_ - (10 + (brdline + 1) * ( this.field_230712_o_.field_78288_b + 1)), 16777215 | l)
+ this.func_238476_c_(p_230430_1_, this.field_230712_o_, brd, this.field_230708_k_ - field_230712_o_.func_78256_a(brd), this.field_230709_l_ - (10 + (brdline + 1) * ( this.field_230712_o_.field_78288_b + 1)), 16777215 | l)
+ );
this.func_238476_c_(p_230430_1_, this.field_230712_o_, "Copyright Mojang AB. Do not distribute!", this.field_193979_N, this.field_230709_l_ - 10, 16777215 | l);
if (p_230430_2_ > this.field_193979_N && p_230430_2_ < this.field_193979_N + this.field_193978_M && p_230430_3_ > this.field_230709_l_ - 10 && p_230430_3_ < this.field_230709_l_) {
@ -61,7 +61,7 @@
if (this.func_183501_a() && f1 >= 1.0F) {
this.field_183503_M.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_);
}
+ modUpdateNotification.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_);
+ modUpdateNotification.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_);
}
}

View file

@ -43,8 +43,8 @@
this.field_230708_k_ = p_231158_2_;
this.field_230709_l_ = p_231158_3_;
+ java.util.function.Consumer<Widget> remove = (b) -> {
+ field_230710_m_.remove(b);
+ field_230705_e_.remove(b);
+ field_230710_m_.remove(b);
+ field_230705_e_.remove(b);
+ };
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.field_230710_m_, this::func_230480_a_, remove))) {
this.field_230710_m_.clear();
@ -77,7 +77,7 @@
public void func_230476_a_(List<Path> p_230476_1_) {
}
+
+ public Minecraft getMinecraft() {
+ return this.field_230706_i_;
+ }
+ public Minecraft getMinecraft() {
+ return this.field_230706_i_;
+ }
}

View file

@ -117,7 +117,7 @@
+ } else if (p_231046_1_ != 256 && !this.field_230706_i_.field_71474_y.field_151445_Q.isActiveAndMatches(mouseKey)) {
+ boolean handled = false;// Forge MC-146650: Needs to return true when the key is handled.
+ if (this.func_195363_d(p_231046_1_, p_231046_2_))
+ handled = true;
+ handled = true;
if (this.field_147006_u != null && this.field_147006_u.func_75216_d()) {
- if (this.field_230706_i_.field_71474_y.field_74322_I.func_197976_a(p_231046_1_, p_231046_2_)) {
+ if (this.field_230706_i_.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) {
@ -129,7 +129,7 @@
+ handled = true;
}
+ } else if (this.field_230706_i_.field_71474_y.field_74316_C.isActiveAndMatches(mouseKey)) {
+ handled = true; // Forge MC-146650: Emulate MC bug, so we don't drop from hotbar when pressing drop without hovering over a item.
+ handled = true; // Forge MC-146650: Emulate MC bug, so we don't drop from hotbar when pressing drop without hovering over a item.
}
- return true;

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/main/Main.java
+++ b/net/minecraft/client/main/Main.java
@@ -120,7 +120,7 @@
String s7 = func_206236_a(optionset, optionspec);
Integer integer = func_206236_a(optionset, optionspec1);
CrashReport.func_230188_h_();
- Bootstrap.func_151354_b();
+ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(()->Bootstrap.func_151354_b(), net.minecraftforge.fml.loading.FMLLoader.progressWindowTick);
Bootstrap.func_218821_c();
Util.func_240994_l_();
Session session = new Session(optionspec10.value(optionset), s5, optionspec12.value(optionset), optionspec21.value(optionset));

View file

@ -1,11 +1,10 @@
--- a/net/minecraft/client/network/ServerPinger.java
+++ b/net/minecraft/client/network/ServerPinger.java
@@ -116,6 +116,8 @@
@@ -116,6 +116,7 @@
p_147224_2_.run();
}
+ net.minecraftforge.fml.client.ClientHooks.processForgeListPingData(serverstatusresponse, p_147224_1_);
+
this.field_175092_e = Util.func_211177_b();
networkmanager.func_179290_a(new CPingPacket(this.field_175092_e));
this.field_147403_d = true;

View file

@ -32,11 +32,11 @@
if (flag && this.field_147299_f.field_71462_r instanceof CommandBlockScreen) {
((CommandBlockScreen)this.field_147299_f.field_71462_r).func_184075_a();
+ } else {
+ if(tileentity == null) {
+ field_147301_d.error("Received invalid update packet for null tile entity at {} with data: {}", p_147273_1_.func_179823_a(), p_147273_1_.func_148857_g());
+ return;
+ }
+ tileentity.onDataPacket(field_147302_e, p_147273_1_);
+ if(tileentity == null) {
+ field_147301_d.error("Received invalid update packet for null tile entity at {} with data: {}", p_147273_1_.func_179823_a(), p_147273_1_.func_148857_g());
+ return;
+ }
+ tileentity.onDataPacket(field_147302_e, p_147273_1_);
}
}

View file

@ -17,9 +17,9 @@
}
}
+
+ private Particle updateSprite(BlockPos pos) { //FORGE: we cannot assume that the x y z of the particles match the block pos of the block.
+ if (pos != null) // There are cases where we are not able to obtain the correct source pos, and need to fallback to the non-model data version
+ this.func_217567_a(Minecraft.func_71410_x().func_175602_ab().func_175023_a().getTexture(field_174847_a, field_187122_b, pos));
+ return this;
+ }
+ private Particle updateSprite(BlockPos pos) { //FORGE: we cannot assume that the x y z of the particles match the block pos of the block.
+ if (pos != null) // There are cases where we are not able to obtain the correct source pos, and need to fallback to the non-model data version
+ this.func_217567_a(Minecraft.func_71410_x().func_175602_ab().func_175023_a().getTexture(field_174847_a, field_187122_b, pos));
+ return this;
+ }
}

View file

@ -21,6 +21,7 @@
}
}
+
+ // Forge start
+ public void putBulkData(ByteBuffer buffer) {
+ func_181670_b(buffer.limit() + this.field_179011_q.func_177338_f());
+ ((Buffer)this.field_179001_a).position(this.field_178997_d * this.field_179011_q.func_177338_f());
@ -29,6 +30,5 @@
+ this.field_227824_l_ += buffer.limit();
+ }
+
+ // Forge start
+ public VertexFormat getVertexFormat() { return this.field_179011_q; }
}

View file

@ -1,15 +1,6 @@
--- a/net/minecraft/client/renderer/FirstPersonRenderer.java
+++ b/net/minecraft/client/renderer/FirstPersonRenderer.java
@@ -25,6 +25,8 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
+import java.util.Objects;
+
@OnlyIn(Dist.CLIENT)
public class FirstPersonRenderer {
private static final RenderType field_230010_a_ = RenderType.func_228658_l_(new ResourceLocation("textures/map/map_background.png"));
@@ -208,7 +210,7 @@
@@ -208,7 +208,7 @@
boolean flag1 = true;
if (p_228396_4_.func_184587_cr()) {
ItemStack itemstack = p_228396_4_.func_184607_cu();
@ -18,7 +9,7 @@
flag = p_228396_4_.func_184600_cs() == Hand.MAIN_HAND;
flag1 = !flag;
}
@@ -216,18 +218,18 @@
@@ -216,18 +216,18 @@
Hand hand1 = p_228396_4_.func_184600_cs();
if (hand1 == Hand.MAIN_HAND) {
ItemStack itemstack1 = p_228396_4_.func_184592_cb();
@ -40,7 +31,7 @@
flag = !itemstack2.func_190926_b();
flag1 = !flag;
}
@@ -240,12 +242,14 @@
@@ -240,12 +240,14 @@
if (flag) {
float f5 = hand == Hand.MAIN_HAND ? f : 0.0F;
float f2 = 1.0F - MathHelper.func_219799_g(p_228396_1_, this.field_187470_g, this.field_187469_f);
@ -55,7 +46,7 @@
this.func_228405_a_(p_228396_4_, p_228396_1_, f1, Hand.OFF_HAND, f6, this.field_187468_e, f7, p_228396_2_, p_228396_3_, p_228396_5_);
}
@@ -260,13 +264,13 @@
@@ -260,13 +262,13 @@
if (flag && !p_228405_1_.func_82150_aj()) {
this.func_228401_a_(p_228405_8_, p_228405_9_, p_228405_10_, p_228405_7_, p_228405_5_, handside);
}
@ -71,26 +62,26 @@
boolean flag1 = CrossbowItem.func_220012_d(p_228405_6_);
boolean flag2 = handside == HandSide.RIGHT;
int i = flag2 ? 1 : -1;
@@ -410,8 +414,16 @@
@@ -410,8 +412,16 @@
this.field_187471_h = MathHelper.func_76131_a(this.field_187471_h - 0.4F, 0.0F, 1.0F);
} else {
float f = clientplayerentity.func_184825_o(1.0F);
- this.field_187469_f += MathHelper.func_76131_a((this.field_187467_d == itemstack ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F);
- this.field_187471_h += MathHelper.func_76131_a((float)(this.field_187468_e == itemstack1 ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F);
+ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, clientplayerentity.field_71071_by.field_70461_c);
+ boolean requipO = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1);
+ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, clientplayerentity.field_71071_by.field_70461_c);
+ boolean requipO = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1);
+
+ if (!requipM && this.field_187467_d != itemstack)
+ this.field_187467_d = itemstack;
+ if (!requipO && this.field_187468_e != itemstack1)
+ this.field_187468_e = itemstack1;
+ if (!requipM && this.field_187467_d != itemstack)
+ this.field_187467_d = itemstack;
+ if (!requipO && this.field_187468_e != itemstack1)
+ this.field_187468_e = itemstack1;
+
+ this.field_187469_f += MathHelper.func_76131_a((!requipM ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F);
+ this.field_187471_h += MathHelper.func_76131_a((float)(!requipO ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F);
+ this.field_187469_f += MathHelper.func_76131_a((!requipM ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F);
+ this.field_187471_h += MathHelper.func_76131_a((float)(!requipO ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F);
}
if (this.field_187469_f < 0.1F) {
@@ -430,6 +442,5 @@
@@ -430,6 +440,5 @@
} else {
this.field_187471_h = 0.0F;
}

View file

@ -36,7 +36,7 @@
- public static void func_228372_a_(ActiveRenderInfo p_228372_0_, FogRenderer.FogType p_228372_1_, float p_228372_2_, boolean p_228372_3_) {
+ @Deprecated // FORGE: Pass in partialTicks
+ public static void func_228372_a_(ActiveRenderInfo p_228372_0_, FogRenderer.FogType p_228372_1_, float p_228372_2_, boolean p_228372_3_) {
+ setupFog(p_228372_0_, p_228372_1_, p_228372_2_, p_228372_3_, 0);
+ setupFog(p_228372_0_, p_228372_1_, p_228372_2_, p_228372_3_, 0);
+ }
+
+ public static void setupFog(ActiveRenderInfo p_228372_0_, FogRenderer.FogType p_228372_1_, float p_228372_2_, boolean p_228372_3_, float partialTicks) {

View file

@ -23,7 +23,7 @@
this.func_229114_a_(p_229111_8_, p_229111_1_, p_229111_6_, p_229111_7_, p_229111_4_, ivertexbuilder);
} else {
- ItemStackTileEntityRenderer.field_147719_a.func_239207_a_(p_229111_1_, p_229111_2_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_);
+ p_229111_1_.func_77973_b().getItemStackTileEntityRenderer().func_239207_a_(p_229111_1_, p_229111_2_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_);
+ p_229111_1_.func_77973_b().getItemStackTileEntityRenderer().func_239207_a_(p_229111_1_, p_229111_2_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_);
}
p_229111_4_.func_227865_b_();

View file

@ -1,16 +1,6 @@
--- a/net/minecraft/client/renderer/LightTexture.java
+++ b/net/minecraft/client/renderer/LightTexture.java
@@ -123,6 +123,9 @@
}
}
+ //TODO
+ //clientworld.getDimension().getLightmapColors(partialTicks, f, f4, f5, vector3f1);
+
vector3f1.func_195901_a(0.0F, 1.0F);
if (f2 > 0.0F) {
float f10 = Math.max(vector3f1.func_195899_a(), Math.max(vector3f1.func_195900_b(), vector3f1.func_195902_c()));
@@ -169,7 +172,7 @@
@@ -169,7 +169,7 @@
}
public static int func_228450_a_(int p_228450_0_) {

View file

@ -5,7 +5,7 @@
public AlphaState(float p_i225974_1_) {
- super("alpha", () -> {
+ super("line_width", () -> { // FORGE: fix MC-167447
+ super("alpha", () -> { // FORGE: fix MC-167447
if (p_i225974_1_ > 0.0F) {
RenderSystem.enableAlphaTest();
RenderSystem.alphaFunc(516, p_i225974_1_);

View file

@ -20,71 +20,76 @@
});
private static boolean field_228388_c_;
+ @Deprecated
+ @Deprecated // FORGE: Use canRenderInLayer
public static RenderType func_228390_a_(BlockState p_228390_0_) {
Block block = p_228390_0_.func_177230_c();
if (block instanceof LeavesBlock) {
@@ -317,12 +320,62 @@
@@ -280,6 +283,7 @@
}
}
+ @Deprecated
+ @Deprecated // FORGE: Use canRenderInLayer
public static RenderType func_239221_b_(BlockState p_239221_0_) {
Block block = p_239221_0_.func_177230_c();
if (block instanceof LeavesBlock) {
@@ -317,11 +321,60 @@
}
}
+ @Deprecated // FORGE: Use canRenderInLayer
public static RenderType func_228391_a_(FluidState p_228391_0_) {
RenderType rendertype = field_228387_b_.get(p_228391_0_.func_206886_c());
return rendertype != null ? rendertype : RenderType.func_228639_c_();
}
- public static void func_228393_a_(boolean p_228393_0_) {
+ // FORGE START
+
+ // FORGE START
+ private static final Map<net.minecraftforge.registries.IRegistryDelegate<Block>, java.util.function.Predicate<RenderType>> blockRenderChecks = Maps.newHashMap();
+ private static final Map<net.minecraftforge.registries.IRegistryDelegate<Fluid>, java.util.function.Predicate<RenderType>> fluidRenderChecks = Maps.newHashMap();
+ static {
+ field_228386_a_.forEach(RenderTypeLookup::setRenderLayer);
+ field_228387_b_.forEach(RenderTypeLookup::setRenderLayer);
+ }
+
+ private static final Map<net.minecraftforge.registries.IRegistryDelegate<Block>, java.util.function.Predicate<RenderType>> blockRenderChecks = Maps.newHashMap();
+ private static final Map<net.minecraftforge.registries.IRegistryDelegate<Fluid>, java.util.function.Predicate<RenderType>> fluidRenderChecks = Maps.newHashMap();
+ static {
+ field_228386_a_.forEach(RenderTypeLookup::setRenderLayer);
+ field_228387_b_.forEach(RenderTypeLookup::setRenderLayer);
+ }
+ public static boolean canRenderInLayer(BlockState state, RenderType type) {
+ Block block = state.func_177230_c();
+ if (block instanceof LeavesBlock) {
+ return field_228388_c_ ? type == RenderType.func_228641_d_() : type == RenderType.func_228639_c_();
+ } else {
+ java.util.function.Predicate<RenderType> rendertype;
+ synchronized (RenderTypeLookup.class) {
+ rendertype = blockRenderChecks.get(block.delegate);
+ }
+ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_();
+ }
+ }
+
+ public static boolean canRenderInLayer(BlockState state, RenderType type) {
+ Block block = state.func_177230_c();
+ if (block instanceof LeavesBlock) {
+ return field_228388_c_ ? type == RenderType.func_228641_d_() : type == RenderType.func_228639_c_();
+ } else {
+ java.util.function.Predicate<RenderType> rendertype;
+ synchronized (RenderTypeLookup.class) {
+ rendertype = blockRenderChecks.get(block.delegate);
+ }
+ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_();
+ }
+ }
+ public static boolean canRenderInLayer(FluidState fluid, RenderType type) {
+ java.util.function.Predicate<RenderType> rendertype;
+ synchronized (RenderTypeLookup.class) {
+ rendertype = fluidRenderChecks.get(fluid.func_206886_c().delegate);
+ }
+ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_();
+ }
+
+ public static boolean canRenderInLayer(FluidState fluid, RenderType type) {
+ java.util.function.Predicate<RenderType> rendertype;
+ synchronized (RenderTypeLookup.class) {
+ rendertype = fluidRenderChecks.get(fluid.func_206886_c().delegate);
+ }
+ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_();
+ }
+ public static void setRenderLayer(Block block, RenderType type) {
+ java.util.Objects.requireNonNull(type);
+ setRenderLayer(block, type::equals);
+ }
+
+ public static void setRenderLayer(Block block, RenderType type) {
+ java.util.Objects.requireNonNull(type);
+ setRenderLayer(block, type::equals);
+ }
+ public static synchronized void setRenderLayer(Block block, java.util.function.Predicate<RenderType> predicate) {
+ blockRenderChecks.put(block.delegate, predicate);
+ }
+
+ public static synchronized void setRenderLayer(Block block, java.util.function.Predicate<RenderType> predicate) {
+ blockRenderChecks.put(block.delegate, predicate);
+ }
+ public static void setRenderLayer(Fluid fluid, RenderType type) {
+ java.util.Objects.requireNonNull(type);
+ setRenderLayer(fluid, type::equals);
+ }
+
+ public static void setRenderLayer(Fluid fluid, RenderType type) {
+ java.util.Objects.requireNonNull(type);
+ setRenderLayer(fluid, type::equals);
+ }
+ public static synchronized void setRenderLayer(Fluid fluid, java.util.function.Predicate<RenderType> predicate) {
+ fluidRenderChecks.put(fluid.delegate, predicate);
+ }
+
+ public static synchronized void setRenderLayer(Fluid fluid, java.util.function.Predicate<RenderType> predicate) {
+ fluidRenderChecks.put(fluid.delegate, predicate);
+ }
+
+ public static void func_228393_a_(boolean p_228393_0_) {
public static void func_228393_a_(boolean p_228393_0_) {
field_228388_c_ = p_228393_0_;
}
}

View file

@ -1,18 +1,6 @@
--- a/net/minecraft/client/renderer/WorldRenderer.java
+++ b/net/minecraft/client/renderer/WorldRenderer.java
@@ -221,6 +221,11 @@
}
private void func_228438_a_(LightTexture p_228438_1_, float p_228438_2_, double p_228438_3_, double p_228438_5_, double p_228438_7_) {
+ net.minecraftforge.client.IRenderHandler renderer = null;//this.mc.world.getDimension().getWeatherRenderer(); //TODO FIX THIS
+ if (renderer != null) {
+ renderer.render(this.field_72773_u, p_228438_2_, this.field_72777_q.field_71441_e, this.field_72777_q);
+ return;
+ }
float f = this.field_72777_q.field_71441_e.func_72867_j(p_228438_2_);
if (!(f <= 0.0F)) {
p_228438_1_.func_205109_c();
@@ -812,7 +817,7 @@
@@ -812,7 +812,7 @@
this.field_147595_R = true;
BlockPos blockpos2 = chunkrenderdispatcher$chunkrender4.func_178568_j().func_177982_a(8, 8, 8);
boolean flag1 = blockpos2.func_177951_i(blockpos) < 768.0D;
@ -21,7 +9,7 @@
this.field_175009_l.add(chunkrenderdispatcher$chunkrender4);
} else {
this.field_72777_q.func_213239_aq().func_76320_a("build near");
@@ -897,13 +902,13 @@
@@ -897,13 +897,13 @@
float f = p_228426_7_.func_205001_m();
boolean flag1 = this.field_72777_q.field_71441_e.func_239132_a_().func_230493_a_(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d1)) || this.field_72777_q.field_71456_v.func_184046_j().func_184056_f();
if (this.field_72777_q.field_71474_y.field_151451_c >= 4) {
@ -37,7 +25,7 @@
iprofiler.func_219895_b("terrain_setup");
this.func_228437_a_(p_228426_6_, clippinghelper, flag, this.field_228409_ai_++, this.field_72777_q.field_71439_g.func_175149_v());
iprofiler.func_219895_b("updatechunks");
@@ -924,7 +929,9 @@
@@ -924,7 +924,9 @@
this.func_174967_a(p_228426_3_ + l1);
iprofiler.func_219895_b("terrain");
this.func_228441_a_(RenderType.func_228639_c_(), p_228426_1_, d0, d1, d2);
@ -47,7 +35,7 @@
this.func_228441_a_(RenderType.func_228643_e_(), p_228426_1_, d0, d1, d2);
if (this.field_72769_h.func_239132_a_().func_239217_c_()) {
RenderHelper.func_237533_a_(p_228426_1_.func_227866_c_().func_227870_a_());
@@ -994,6 +1001,7 @@
@@ -994,6 +996,7 @@
List<TileEntity> list = worldrenderer$localrenderinformationcontainer.field_178036_a.func_178571_g().func_178485_b();
if (!list.isEmpty()) {
for(TileEntity tileentity1 : list) {
@ -55,7 +43,7 @@
BlockPos blockpos3 = tileentity1.func_174877_v();
IRenderTypeBuffer irendertypebuffer1 = irendertypebuffer$impl;
p_228426_1_.func_227860_a_();
@@ -1019,6 +1027,7 @@
@@ -1019,6 +1022,7 @@
synchronized(this.field_181024_n) {
for(TileEntity tileentity : this.field_181024_n) {
@ -63,7 +51,7 @@
BlockPos blockpos2 = tileentity.func_174877_v();
p_228426_1_.func_227860_a_();
p_228426_1_.func_227861_a_((double)blockpos2.func_177958_n() - d0, (double)blockpos2.func_177956_o() - d1, (double)blockpos2.func_177952_p() - d2);
@@ -1069,7 +1078,8 @@
@@ -1069,7 +1073,8 @@
iprofiler.func_219895_b("outline");
BlockPos blockpos = ((BlockRayTraceResult)raytraceresult).func_216350_a();
BlockState blockstate = this.field_72769_h.func_180495_p(blockpos);
@ -73,39 +61,7 @@
IVertexBuilder ivertexbuilder2 = irendertypebuffer$impl.getBuffer(RenderType.func_228659_m_());
this.func_228429_a_(p_228426_1_, ivertexbuilder2, p_228426_6_.func_216773_g(), d0, d1, d2, blockpos, blockstate);
}
@@ -1461,6 +1471,15 @@
}
public void func_228424_a_(MatrixStack p_228424_1_, float p_228424_2_) {
+ net.minecraftforge.client.IRenderHandler renderer = null;//this.world.getDimension().getSkyRenderer(); //TODO FIX THIS
+ if (renderer != null) {
+ if (renderer instanceof net.minecraftforge.client.SkyRenderHandler) {
+ ((net.minecraftforge.client.SkyRenderHandler) renderer).render(this.field_72773_u, p_228424_2_, p_228424_1_, this.field_72769_h, this.field_72777_q);
+ } else {
+ renderer.render(this.field_72773_u, p_228424_2_, this.field_72769_h, this.field_72777_q);
+ }
+ return;
+ }
if (this.field_72777_q.field_71441_e.func_239132_a_().func_241683_c_() == DimensionRenderInfo.FogType.END) {
this.func_228444_b_(p_228424_1_);
} else if (this.field_72777_q.field_71441_e.func_239132_a_().func_241683_c_() == DimensionRenderInfo.FogType.NORMAL) {
@@ -1589,6 +1608,15 @@
}
public void func_228425_a_(MatrixStack p_228425_1_, float p_228425_2_, double p_228425_3_, double p_228425_5_, double p_228425_7_) {
+ net.minecraftforge.client.IRenderHandler renderer = null;//this.world.getDimension().getCloudRenderer(); //TODO FIX THIS
+ if (renderer != null) {
+ if (renderer instanceof net.minecraftforge.client.CloudRenderHandler) {
+ ((net.minecraftforge.client.CloudRenderHandler) renderer).render(this.field_72773_u, p_228425_2_, p_228425_1_, this.field_72769_h, this.field_72777_q);
+ } else {
+ renderer.render(this.field_72773_u, p_228425_2_, this.field_72769_h, this.field_72777_q);
+ }
+ return;
+ }
float f = this.field_72769_h.func_239132_a_().func_239213_a_();
if (!Float.isNaN(f)) {
RenderSystem.disableCull();
@@ -2056,7 +2084,12 @@
@@ -2056,7 +2061,12 @@
this.field_175008_n.func_217628_a(p_215319_1_, p_215319_2_, p_215319_3_, p_215319_4_);
}
@ -118,7 +74,7 @@
ISound isound = this.field_147593_P.get(p_184377_2_);
if (isound != null) {
this.field_72777_q.func_147118_V().func_147683_b(isound);
@@ -2064,7 +2097,7 @@
@@ -2064,7 +2074,7 @@
}
if (p_184377_1_ != null) {
@ -127,7 +83,7 @@
if (musicdiscitem != null) {
this.field_72777_q.field_71456_v.func_238451_a_(musicdiscitem.func_234801_g_());
}
@@ -2212,7 +2245,7 @@
@@ -2212,7 +2222,7 @@
break;
case 1010:
if (Item.func_150899_d(p_180439_4_) instanceof MusicDiscItem) {
@ -136,7 +92,7 @@
} else {
this.func_184377_a((SoundEvent)null, p_180439_3_);
}
@@ -2362,8 +2395,8 @@
@@ -2362,8 +2372,8 @@
break;
case 2001:
BlockState blockstate = Block.func_196257_b(p_180439_4_);
@ -147,7 +103,7 @@
this.field_72769_h.func_184156_a(p_180439_3_, soundtype.func_185845_c(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F, false);
}
@@ -2511,7 +2544,7 @@
@@ -2511,7 +2521,7 @@
} else {
int i = p_228420_0_.func_226658_a_(LightType.SKY, p_228420_2_);
int j = p_228420_0_.func_226658_a_(LightType.BLOCK, p_228420_2_);
@ -156,7 +112,7 @@
if (j < k) {
j = k;
}
@@ -2550,6 +2583,11 @@
@@ -2550,6 +2560,11 @@
return this.field_239226_J_;
}

View file

@ -59,9 +59,9 @@
+ public ChunkRenderTask(@Nullable net.minecraft.util.math.ChunkPos pos, double p_i226023_2_) {
this.field_188229_e = p_i226023_2_;
+ if (pos == null) {
+ this.modelData = java.util.Collections.emptyMap();
+ this.modelData = java.util.Collections.emptyMap();
+ } else {
+ this.modelData = net.minecraftforge.client.model.ModelDataManager.getModelData(net.minecraft.client.Minecraft.func_71410_x().field_71441_e, pos);
+ this.modelData = net.minecraftforge.client.model.ModelDataManager.getModelData(net.minecraft.client.Minecraft.func_71410_x().field_71441_e, pos);
+ }
}
@ -107,9 +107,9 @@
FluidState fluidstate = chunkrendercache.func_204610_c(blockpos2);
- if (!fluidstate.func_206888_e()) {
- RenderType rendertype = RenderTypeLookup.func_228391_a_(fluidstate);
+ net.minecraftforge.client.model.data.IModelData modelData = getModelData(blockpos2);
+ net.minecraftforge.client.model.data.IModelData modelData = getModelData(blockpos2);
+ for (RenderType rendertype : RenderType.func_228661_n_()) {
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(rendertype);
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(rendertype);
+ if (!fluidstate.func_206888_e() && RenderTypeLookup.canRenderInLayer(fluidstate, rendertype)) {
BufferBuilder bufferbuilder = p_228940_5_.func_228366_a_(rendertype);
if (p_228940_4_.field_178501_c.add(rendertype)) {

View file

@ -6,10 +6,10 @@
BlockRendererDispatcher blockrendererdispatcher = Minecraft.func_71410_x().func_175602_ab();
- blockrendererdispatcher.func_175019_b().func_228802_a_(world, blockrendererdispatcher.func_184389_a(blockstate), blockstate, blockpos, p_225623_4_, p_225623_5_.getBuffer(RenderTypeLookup.func_239221_b_(blockstate)), false, new Random(), blockstate.func_209533_a(p_225623_1_.func_184531_j()), OverlayTexture.field_229196_a_);
+ for (net.minecraft.client.renderer.RenderType type : net.minecraft.client.renderer.RenderType.func_228661_n_()) {
+ if (RenderTypeLookup.canRenderInLayer(blockstate, type)) {
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(type);
+ blockrendererdispatcher.func_175019_b().func_228802_a_(world, blockrendererdispatcher.func_184389_a(blockstate), blockstate, blockpos, p_225623_4_, p_225623_5_.getBuffer(RenderTypeLookup.func_239221_b_(blockstate)), false, new Random(), blockstate.func_209533_a(p_225623_1_.func_184531_j()), OverlayTexture.field_229196_a_);
+ }
+ if (RenderTypeLookup.canRenderInLayer(blockstate, type)) {
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(type);
+ blockrendererdispatcher.func_175019_b().func_228802_a_(world, blockrendererdispatcher.func_184389_a(blockstate), blockstate, blockpos, p_225623_4_, p_225623_5_.getBuffer(type), false, new Random(), blockstate.func_209533_a(p_225623_1_.func_184531_j()), OverlayTexture.field_229196_a_);
+ }
+ }
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null);
p_225623_4_.func_227865_b_();

View file

@ -38,7 +38,7 @@
p_241738_6_.func_225598_a_(p_241738_1_, ivertexbuilder, p_241738_3_, OverlayTexture.field_229196_a_, p_241738_8_, p_241738_9_, p_241738_10_, 1.0F);
}
@@ -100,8 +104,52 @@
@@ -100,8 +104,50 @@
return p_188363_1_ == EquipmentSlotType.LEGS;
}
@ -71,8 +71,7 @@
+ String texture = item.func_200880_d().func_200897_d();
+ String domain = "minecraft";
+ int idx = texture.indexOf(':');
+ if (idx != -1)
+ {
+ if (idx != -1) {
+ domain = texture.substring(0, idx);
+ texture = texture.substring(idx + 1);
+ }
@ -81,10 +80,9 @@
+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type);
+ ResourceLocation resourcelocation = field_177191_j.get(s1);
+
+ if (resourcelocation == null)
+ {
+ if (resourcelocation == null) {
+ resourcelocation = new ResourceLocation(s1);
+ field_177191_j.put(s1, resourcelocation);
+ field_177191_j.put(s1, resourcelocation);
+ }
+
+ return resourcelocation;

View file

@ -59,7 +59,7 @@
}
public IBakedModel func_228813_a_(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function<RenderMaterial, TextureAtlasSprite> p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_, boolean p_228813_6_) {
+ return net.minecraftforge.client.model.ModelLoaderRegistry.bakeHelper(this, p_228813_1_, p_228813_2_, p_228813_3_, p_228813_4_, p_228813_5_, p_228813_6_);
+ return net.minecraftforge.client.model.ModelLoaderRegistry.bakeHelper(this, p_228813_1_, p_228813_2_, p_228813_3_, p_228813_4_, p_228813_5_, p_228813_6_);
+ }
+
+ @Deprecated //Forge: exposed for our callbacks only. Use the above function.

View file

@ -1,18 +1,14 @@
--- a/net/minecraft/client/renderer/model/ModelBakery.java
+++ b/net/minecraft/client/renderer/model/ModelBakery.java
@@ -145,9 +145,19 @@
p_229336_0_.defaultReturnValue(-1);
@@ -146,8 +146,16 @@
});
- public ModelBakery(IResourceManager p_i226056_1_, BlockColors p_i226056_2_, IProfiler p_i226056_3_, int p_i226056_4_) {
+ public ModelBakery(IResourceManager p_i226056_1_, BlockColors p_i226056_2_, IProfiler p_i226056_3_, int p_i226056_4_)
+ {
public ModelBakery(IResourceManager p_i226056_1_, BlockColors p_i226056_2_, IProfiler p_i226056_3_, int p_i226056_4_) {
+ this(p_i226056_1_, p_i226056_2_, true);
+ processLoading(p_i226056_3_, p_i226056_4_);
+ }
+
+ protected ModelBakery(IResourceManager p_i226056_1_, BlockColors p_i226056_2_, boolean vanillaBakery)
+ {
+ protected ModelBakery(IResourceManager p_i226056_1_, BlockColors p_i226056_2_, boolean vanillaBakery) {
this.field_177598_f = p_i226056_1_;
this.field_225365_D = p_i226056_2_;
+ }
@ -21,12 +17,12 @@
p_i226056_3_.func_76320_a("missing_model");
try {
@@ -180,12 +190,16 @@
@@ -180,12 +188,16 @@
p_i226056_3_.func_219895_b("special");
this.func_217843_a(new ModelResourceLocation("minecraft:trident_in_hand#inventory"));
+ for (ResourceLocation rl : getSpecialModels()) {
+ addModelToCache(rl);
+ addModelToCache(rl);
+ }
p_i226056_3_.func_219895_b("textures");
Set<Pair<String, String>> set = Sets.newLinkedHashSet();
@ -38,7 +34,7 @@
set.stream().filter((p_229346_0_) -> {
return !p_229346_0_.getSecond().equals(field_229321_r_);
}).forEach((p_229330_0_) -> {
@@ -224,6 +238,7 @@
@@ -224,6 +236,7 @@
try {
ibakedmodel = this.func_217845_a(p_229350_1_, ModelRotation.X0_Y0);
} catch (Exception exception) {
@ -46,7 +42,7 @@
field_177603_c.warn("Unable to bake model: '{}': {}", p_229350_1_, exception);
}
@@ -442,6 +457,13 @@
@@ -442,6 +455,13 @@
this.field_217848_D.addAll(p_209593_2_.func_187965_e());
}
@ -60,7 +56,7 @@
private void func_217843_a(ModelResourceLocation p_217843_1_) {
IUnbakedModel iunbakedmodel = this.func_209597_a(p_217843_1_);
this.field_217849_F.put(p_217843_1_, iunbakedmodel);
@@ -456,7 +478,13 @@
@@ -456,7 +476,13 @@
}
@Nullable
@ -74,7 +70,7 @@
Triple<ResourceLocation, TransformationMatrix, Boolean> triple = Triple.of(p_217845_1_, p_217845_2_.func_225615_b_(), p_217845_2_.func_188049_c());
if (this.field_217850_G.containsKey(triple)) {
return this.field_217850_G.get(triple);
@@ -467,11 +495,11 @@
@@ -467,11 +493,11 @@
if (iunbakedmodel instanceof BlockModel) {
BlockModel blockmodel = (BlockModel)iunbakedmodel;
if (blockmodel.func_178310_f() == field_177606_o) {
@ -88,7 +84,7 @@
this.field_217850_G.put(triple, ibakedmodel);
return ibakedmodel;
}
@@ -524,6 +552,10 @@
@@ -524,6 +550,10 @@
return this.field_225367_M;
}
@ -99,7 +95,7 @@
@OnlyIn(Dist.CLIENT)
static class BlockStateDefinitionException extends RuntimeException {
public BlockStateDefinitionException(String p_i49526_1_) {
@@ -531,6 +563,10 @@
@@ -531,6 +561,10 @@
}
}

View file

@ -1,12 +1,12 @@
--- a/net/minecraft/client/renderer/model/WeightedBakedModel.java
+++ b/net/minecraft/client/renderer/model/WeightedBakedModel.java
@@ -30,6 +30,9 @@
public boolean func_177555_b() {
@@ -31,6 +31,9 @@
return this.field_177566_c.func_177555_b();
}
+
+ @Override
+ public boolean isAmbientOcclusion(BlockState state) { return this.field_177566_c.isAmbientOcclusion(state); }
+
public boolean func_177556_c() {
return this.field_177566_c.func_177556_c();
}

View file

@ -24,6 +24,6 @@
+
+ // Forge Start
+ public int getPixelRGBA(int frameIndex, int x, int y) {
+ return this.field_195670_c[0].func_195709_a(x + this.field_195671_d[frameIndex] * func_94211_a(), y + this.field_195672_e[frameIndex] * func_94216_b());
+ return this.field_195670_c[0].func_195709_a(x + this.field_195671_d[frameIndex] * func_94211_a(), y + this.field_195672_e[frameIndex] * func_94216_b());
+ }
}

View file

@ -0,0 +1,12 @@
--- a/net/minecraft/client/resources/ClientLanguageMap.java
+++ b/net/minecraft/client/resources/ClientLanguageMap.java
@@ -116,4 +116,9 @@
return p_239500_1_;
}
}
+
+ @Override
+ public Map<String, String> getLanguageData() {
+ return field_239495_c_;
+ }
}

View file

@ -7,7 +7,7 @@
+ @Deprecated
public ClientResourcePackInfo(String p_i232485_1_, boolean p_i232485_2_, Supplier<IResourcePack> p_i232485_3_, IResourcePack p_i232485_4_, PackMetadataSection p_i232485_5_, ResourcePackInfo.Priority p_i232485_6_, IPackNameDecorator p_i232485_7_) {
- super(p_i232485_1_, p_i232485_2_, p_i232485_3_, p_i232485_4_, p_i232485_5_, p_i232485_6_, p_i232485_7_);
+ this(p_i232485_1_, p_i232485_2_, p_i232485_3_, p_i232485_4_, p_i232485_5_, p_i232485_6_, p_i232485_7_, false);
+ this(p_i232485_1_, p_i232485_2_, p_i232485_3_, p_i232485_4_, p_i232485_5_, p_i232485_6_, p_i232485_7_, false);
+ }
+
+ public ClientResourcePackInfo(String p_i232485_1_, boolean p_i232485_2_, Supplier<IResourcePack> p_i232485_3_, IResourcePack p_i232485_4_, PackMetadataSection p_i232485_5_, ResourcePackInfo.Priority p_i232485_6_, IPackNameDecorator p_i232485_7_, boolean hidden) {
@ -18,7 +18,7 @@
+ @Deprecated
public ClientResourcePackInfo(String p_i232486_1_, boolean p_i232486_2_, Supplier<IResourcePack> p_i232486_3_, ITextComponent p_i232486_4_, ITextComponent p_i232486_5_, PackCompatibility p_i232486_6_, ResourcePackInfo.Priority p_i232486_7_, boolean p_i232486_8_, IPackNameDecorator p_i232486_9_, @Nullable NativeImage p_i232486_10_) {
- super(p_i232486_1_, p_i232486_2_, p_i232486_3_, p_i232486_4_, p_i232486_5_, p_i232486_6_, p_i232486_7_, p_i232486_8_, p_i232486_9_);
+ this(p_i232486_1_, p_i232486_2_, p_i232486_3_, p_i232486_4_, p_i232486_5_, p_i232486_6_, p_i232486_7_, p_i232486_8_, p_i232486_9_, p_i232486_10_, false);
+ this(p_i232486_1_, p_i232486_2_, p_i232486_3_, p_i232486_4_, p_i232486_5_, p_i232486_6_, p_i232486_7_, p_i232486_8_, p_i232486_9_, p_i232486_10_, false);
+ }
+
+ public ClientResourcePackInfo(String p_i232486_1_, boolean p_i232486_2_, Supplier<IResourcePack> p_i232486_3_, ITextComponent p_i232486_4_, ITextComponent p_i232486_5_, PackCompatibility p_i232486_6_, ResourcePackInfo.Priority p_i232486_7_, boolean p_i232486_8_, IPackNameDecorator p_i232486_9_, @Nullable NativeImage p_i232486_10_, boolean hidden) {

View file

@ -4,7 +4,7 @@
static void func_239502_a_(LanguageMap p_239502_0_) {
field_239501_a_ = p_239502_0_;
+ //net.minecraftforge.fml.ForgeI18n.loadLanguageData(i18nLocale.properties); //TODO
+ net.minecraftforge.fml.ForgeI18n.loadLanguageData(p_239502_0_.getLanguageData());
}
public static String func_135052_a(String p_135052_0_, Object... p_135052_1_) {

View file

@ -6,6 +6,6 @@
}
+
+ protected ResourceLocation getPreparedPath(ResourceLocation rl) {
+ return new ResourceLocation(rl.func_110624_b(), this.field_223383_d + "/" + rl.func_110623_a() + ".json");
+ return new ResourceLocation(rl.func_110624_b(), this.field_223383_d + "/" + rl.func_110623_a() + ".json");
+ }
}

View file

@ -6,9 +6,9 @@
this.field_135036_d = p_i1303_4_;
+ String[] splitLangCode = field_135038_c.split("_", 2);
+ if (splitLangCode.length == 1) { // Vanilla has some languages without underscores
+ this.javaLocale = new java.util.Locale(field_135039_a);
+ this.javaLocale = new java.util.Locale(field_135039_a);
+ } else {
+ this.javaLocale = new java.util.Locale(splitLangCode[0], splitLangCode[1]);
+ this.javaLocale = new java.util.Locale(splitLangCode[0], splitLangCode[1]);
+ }
}

View file

@ -143,18 +143,18 @@
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
+ */
+ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputMappings.Input keyCode, String category) {
+ this.field_74515_c = description;
+ this.field_74512_d = keyCode;
+ this.field_151472_e = keyCode;
+ this.field_151471_f = category;
+ this.keyConflictContext = keyConflictContext;
+ this.keyModifier = keyModifier;
+ this.keyModifierDefault = keyModifier;
+ if (this.keyModifier.matches(keyCode))
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
+ field_74516_a.put(description, this);
+ field_74514_b.addKey(keyCode, this);
+ field_151473_c.add(category);
+ this.field_74515_c = description;
+ this.field_74512_d = keyCode;
+ this.field_151472_e = keyCode;
+ this.field_151471_f = category;
+ this.keyConflictContext = keyConflictContext;
+ this.keyModifier = keyModifier;
+ this.keyModifierDefault = keyModifier;
+ if (this.keyModifier.matches(keyCode))
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
+ field_74516_a.put(description, this);
+ field_74514_b.addKey(keyCode, this);
+ field_151473_c.add(category);
+ }
+
+ @Override

View file

@ -1,32 +1,29 @@
--- a/net/minecraft/client/shader/Framebuffer.java
+++ b/net/minecraft/client/shader/Framebuffer.java
@@ -280,4 +280,29 @@
@@ -280,4 +280,26 @@
GlStateManager.func_227658_a_(i, p_216493_1_);
this.func_147609_e();
}
+
+ /*================================ FORGE START ================================================*/
+ private boolean stencilEnabled = false;
+ /*================================ FORGE START ================================================*/
+ private boolean stencilEnabled = false;
+ /**
+ * Attempts to enable 8 bits of stencil buffer on this FrameBuffer.
+ * Modders must call this directly to set things up.
+ * This is to prevent the default cause where graphics cards do not support stencil bits.
+ * <b>Make sure to call this on the main render thread!</b>
+ */
+ public void enableStencil() {
+ if(stencilEnabled) return;
+ stencilEnabled = true;
+ this.func_216491_a(field_147621_c, field_147618_d, net.minecraft.client.Minecraft.field_142025_a);
+ }
+ /**
+ * Attempts to enable 8 bits of stencil buffer on this FrameBuffer.
+ * Modders must call this directly to set things up.
+ * This is to prevent the default cause where graphics cards do not support stencil bits.
+ * <b>Make sure to call this on the main render thread!</b>
+ */
+ public void enableStencil()
+ {
+ if(stencilEnabled) return;
+ stencilEnabled = true;
+ this.func_216491_a(field_147621_c, field_147618_d, net.minecraft.client.Minecraft.field_142025_a);
+ }
+
+ /**
+ * Returns wither or not this FBO has been successfully initialized with stencil bits.
+ * If not, and a modder wishes it to be, they must call enableStencil.
+ */
+ public boolean isStencilEnabled()
+ {
+ return this.stencilEnabled;
+ }
+ /*================================ FORGE END ================================================*/
+ * Returns wither or not this FBO has been successfully initialized with stencil bits.
+ * If not, and a modder wishes it to be, they must call enableStencil.
+ */
+ public boolean isStencilEnabled() {
+ return this.stencilEnabled;
+ }
+ /*================================ FORGE END ================================================*/
}

View file

@ -32,10 +32,11 @@
if (resourcelocation != LootTables.field_186419_a && this.field_218587_b.remove(resourcelocation) != null) {
break;
}
@@ -171,6 +175,14 @@
@@ -171,11 +175,19 @@
throw new IllegalStateException(String.format("Weird loottable '%s' for '%s', not a LivingEntity so should not have loot", resourcelocation, Registry.field_212629_r.func_177774_c(entitytype)));
}
- protected void func_218582_a(EntityType<?> p_218582_1_, LootTable.Builder p_218582_2_) {
+ protected Iterable<EntityType<?>> getKnownEntities() {
+ return Registry.field_212629_r;
+ }
@ -44,6 +45,12 @@
+ return !field_222944_b.contains(entitytype) && entitytype.func_220339_d() == EntityClassification.MISC;
+ }
+
private void func_218582_a(EntityType<?> p_218582_1_, LootTable.Builder p_218582_2_) {
+ private void func_218582_a(EntityType<?> p_218582_1_, LootTable.Builder p_218582_2_) {
this.func_218585_a(p_218582_1_.func_220348_g(), p_218582_2_);
}
- protected void func_218585_a(ResourceLocation p_218585_1_, LootTable.Builder p_218585_2_) {
+ private void func_218585_a(ResourceLocation p_218585_1_, LootTable.Builder p_218585_2_) {
this.field_218587_b.put(p_218585_1_, p_218585_2_);
}
}

View file

@ -10,26 +10,16 @@
protected static final DataParameter<Byte> field_184621_as = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187191_a);
private static final DataParameter<Float> field_184632_c = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187193_c);
private static final DataParameter<Integer> field_184633_f = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187192_b);
@@ -124,6 +126,9 @@
private static final DataParameter<Integer> field_184635_h = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187192_b);
private static final DataParameter<Integer> field_226291_bp_ = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187192_b);
private static final DataParameter<Optional<BlockPos>> field_213379_bs = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187201_k);
+ public static final net.minecraft.entity.ai.attributes.Attribute SWIM_SPEED = new net.minecraft.entity.ai.attributes.RangedAttribute("forge.swimSpeed", 1.0D, 0.0D, 1024.0D).func_233753_a_(true);
+ public static final net.minecraft.entity.ai.attributes.Attribute NAMETAG_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute("forge.nameTagDistance", 64.0D, 0.0D, Float.MAX_VALUE).func_233753_a_(true);
+ public static final net.minecraft.entity.ai.attributes.Attribute ENTITY_GRAVITY = new net.minecraft.entity.ai.attributes.RangedAttribute("forge.entity_gravity", 0.08D, -8.0D, 8.0D).func_233753_a_(true);
protected static final EntitySize field_213377_as = EntitySize.func_220311_c(0.2F, 0.2F);
private final AttributeModifierManager field_110155_d;
private final CombatTracker field_94063_bt = new CombatTracker(this);
@@ -244,7 +249,7 @@
@@ -244,7 +246,7 @@
}
public static AttributeModifierMap.MutableAttribute func_233639_cI_() {
- return AttributeModifierMap.func_233803_a_().func_233814_a_(Attributes.field_233818_a_).func_233814_a_(Attributes.field_233820_c_).func_233814_a_(Attributes.field_233821_d_).func_233814_a_(Attributes.field_233826_i_).func_233814_a_(Attributes.field_233827_j_);
+ return AttributeModifierMap.func_233803_a_().func_233814_a_(Attributes.field_233818_a_).func_233814_a_(Attributes.field_233820_c_).func_233814_a_(Attributes.field_233821_d_).func_233814_a_(Attributes.field_233826_i_).func_233814_a_(Attributes.field_233827_j_).func_233814_a_(SWIM_SPEED).func_233814_a_(NAMETAG_DISTANCE).func_233814_a_(ENTITY_GRAVITY);
+ return AttributeModifierMap.func_233803_a_().func_233814_a_(Attributes.field_233818_a_).func_233814_a_(Attributes.field_233820_c_).func_233814_a_(Attributes.field_233821_d_).func_233814_a_(Attributes.field_233826_i_).func_233814_a_(Attributes.field_233827_j_).func_233814_a_(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).func_233814_a_(net.minecraftforge.common.ForgeMod.NAMETAG_DISTANCE.get()).func_233814_a_(net.minecraftforge.common.ForgeMod.ENTITY_GRAVITY.get());
}
protected void func_184231_a(double p_184231_1_, boolean p_184231_3_, BlockState p_184231_4_, BlockPos p_184231_5_) {
@@ -259,9 +264,10 @@
@@ -259,9 +261,10 @@
if (!this.field_70170_p.field_72995_K && this.field_70143_R > 3.0F && p_184231_3_) {
float f = (float)MathHelper.func_76123_f(this.field_70143_R - 3.0F);
@ -41,7 +31,7 @@
((ServerWorld)this.field_70170_p).func_195598_a(new BlockParticleData(ParticleTypes.field_197611_d, p_184231_4_), this.func_226277_ct_(), this.func_226278_cu_(), this.func_226281_cx_(), i, 0.0D, 0.0D, 0.0D, (double)0.15F);
}
}
@@ -329,7 +335,7 @@
@@ -329,7 +332,7 @@
}
}
@ -50,7 +40,7 @@
this.func_184210_p();
}
} else if (this.func_70086_ai() < this.func_205010_bg()) {
@@ -474,7 +480,7 @@
@@ -474,7 +477,7 @@
protected void func_70609_aI() {
++this.field_70725_aQ;
if (this.field_70725_aQ == 20) {
@ -59,7 +49,7 @@
for(int i = 0; i < 20; ++i) {
double d0 = this.field_70146_Z.nextGaussian() * 0.02D;
@@ -667,7 +673,7 @@
@@ -667,7 +670,7 @@
if (!effectinstance.func_76455_a(this, () -> {
this.func_70695_b(effectinstance, true);
})) {
@ -68,7 +58,7 @@
iterator.remove();
this.func_70688_c(effectinstance);
}
@@ -716,8 +722,10 @@
@@ -716,8 +719,10 @@
this.func_82142_c(false);
} else {
Collection<EffectInstance> collection = this.field_70713_bf.values();
@ -81,7 +71,7 @@
this.func_82142_c(this.func_70644_a(Effects.field_76441_p));
}
@@ -781,7 +789,9 @@
@@ -781,7 +786,9 @@
boolean flag;
for(flag = false; iterator.hasNext(); flag = true) {
@ -92,7 +82,7 @@
iterator.remove();
}
@@ -811,6 +821,7 @@
@@ -811,6 +818,7 @@
return false;
} else {
EffectInstance effectinstance = this.field_70713_bf.get(p_195064_1_.func_188419_a());
@ -100,7 +90,7 @@
if (effectinstance == null) {
this.field_70713_bf.put(p_195064_1_.func_188419_a(), p_195064_1_);
this.func_70670_a(p_195064_1_);
@@ -825,6 +836,9 @@
@@ -825,6 +833,9 @@
}
public boolean func_70687_e(EffectInstance p_70687_1_) {
@ -110,7 +100,7 @@
if (this.func_70668_bt() == CreatureAttribute.field_223223_b_) {
Effect effect = p_70687_1_.func_188419_a();
if (effect == Effects.field_76428_l || effect == Effects.field_76436_u) {
@@ -858,6 +872,7 @@
@@ -858,6 +869,7 @@
}
public boolean func_195063_d(Effect p_195063_1_) {
@ -118,7 +108,7 @@
EffectInstance effectinstance = this.func_184596_c(p_195063_1_);
if (effectinstance != null) {
this.func_70688_c(effectinstance);
@@ -894,6 +909,8 @@
@@ -894,6 +906,8 @@
}
public void func_70691_i(float p_70691_1_) {
@ -127,7 +117,7 @@
float f = this.func_110143_aJ();
if (f > 0.0F) {
this.func_70606_j(f + p_70691_1_);
@@ -914,6 +931,7 @@
@@ -914,6 +928,7 @@
}
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
@ -135,7 +125,7 @@
if (this.func_180431_b(p_70097_1_)) {
return false;
} else if (this.field_70170_p.field_72995_K) {
@@ -980,8 +998,8 @@
@@ -980,8 +995,8 @@
if (entity1 instanceof PlayerEntity) {
this.field_70718_bc = 100;
this.field_70717_bb = (PlayerEntity)entity1;
@ -146,7 +136,7 @@
if (wolfentity.func_70909_n()) {
this.field_70718_bc = 100;
LivingEntity livingentity = wolfentity.func_70902_q();
@@ -1163,6 +1181,7 @@
@@ -1163,6 +1178,7 @@
}
public void func_70645_a(DamageSource p_70645_1_) {
@ -154,7 +144,7 @@
if (!this.field_70128_L && !this.field_70729_aU) {
Entity entity = p_70645_1_.func_76346_g();
LivingEntity livingentity = this.func_94060_bK();
@@ -1214,13 +1233,10 @@
@@ -1214,13 +1230,10 @@
protected void func_213345_d(DamageSource p_213345_1_) {
Entity entity = p_213345_1_.func_76346_g();
@ -171,7 +161,7 @@
boolean flag = this.field_70718_bc > 0;
if (this.func_230282_cS_() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e)) {
this.func_213354_a(p_213345_1_, flag);
@@ -1229,6 +1245,10 @@
@@ -1229,6 +1242,10 @@
this.func_213337_cE();
this.func_226294_cV_();
@ -182,7 +172,7 @@
}
protected void func_213337_cE() {
@@ -1238,6 +1258,7 @@
@@ -1238,6 +1255,7 @@
if (!this.field_70170_p.field_72995_K && (this.func_70684_aJ() || this.field_70718_bc > 0 && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e))) {
int i = this.func_70693_a(this.field_70717_bb);
@ -190,7 +180,7 @@
while(i > 0) {
int j = ExperienceOrbEntity.func_70527_a(i);
i -= j;
@@ -1245,6 +1266,7 @@
@@ -1245,6 +1263,7 @@
}
}
@ -198,7 +188,7 @@
}
protected void func_213333_a(DamageSource p_213333_1_, int p_213333_2_, boolean p_213333_3_) {
@@ -1258,7 +1280,8 @@
@@ -1258,7 +1277,8 @@
ResourceLocation resourcelocation = this.func_213346_cF();
LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(resourcelocation);
LootContext.Builder lootcontext$builder = this.func_213363_a(p_213354_2_, p_213354_1_);
@ -208,7 +198,7 @@
}
protected LootContext.Builder func_213363_a(boolean p_213363_1_, DamageSource p_213363_2_) {
@@ -1271,6 +1294,12 @@
@@ -1271,6 +1291,12 @@
}
public void func_233627_a_(float p_233627_1_, double p_233627_2_, double p_233627_4_) {
@ -221,7 +211,7 @@
p_233627_1_ = (float)((double)p_233627_1_ * (1.0D - this.func_233637_b_(Attributes.field_233820_c_)));
if (!(p_233627_1_ <= 0.0F)) {
this.field_70160_al = true;
@@ -1353,6 +1382,11 @@
@@ -1353,6 +1379,11 @@
}
public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) {
@ -233,7 +223,7 @@
boolean flag = super.func_225503_b_(p_225503_1_, p_225503_2_);
int i = this.func_225508_e_(p_225503_1_, p_225503_2_);
if (i > 0) {
@@ -1376,9 +1410,10 @@
@@ -1376,9 +1407,10 @@
int i = MathHelper.func_76128_c(this.func_226277_ct_());
int j = MathHelper.func_76128_c(this.func_226278_cu_() - (double)0.2F);
int k = MathHelper.func_76128_c(this.func_226281_cx_());
@ -247,7 +237,7 @@
this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F);
}
@@ -1446,6 +1481,8 @@
@@ -1446,6 +1478,8 @@
protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) {
if (!this.func_180431_b(p_70665_1_)) {
@ -256,7 +246,7 @@
p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_);
p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_);
float f2 = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F);
@@ -1455,10 +1492,11 @@
@@ -1455,10 +1489,11 @@
((ServerPlayerEntity)p_70665_1_.func_76346_g()).func_195067_a(Stats.field_212735_F, Math.round(f * 10.0F));
}
@ -269,7 +259,7 @@
this.func_110149_m(this.func_110139_bj() - f2);
}
}
@@ -1512,6 +1550,8 @@
@@ -1512,6 +1547,8 @@
}
public void func_226292_a_(Hand p_226292_1_, boolean p_226292_2_) {
@ -278,11 +268,11 @@
if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) {
this.field_110158_av = -1;
this.field_82175_bq = true;
@@ -1868,11 +1908,15 @@
@@ -1868,11 +1905,15 @@
public void func_213352_e(Vector3d p_213352_1_) {
if (this.func_70613_aW() || this.func_184186_bw()) {
double d0 = 0.08D;
+ ModifiableAttributeInstance gravity = this.func_110148_a(ENTITY_GRAVITY);
+ ModifiableAttributeInstance gravity = this.func_110148_a(net.minecraftforge.common.ForgeMod.ENTITY_GRAVITY.get());
boolean flag = this.func_213322_ci().field_72448_b <= 0.0D;
if (flag && this.func_70644_a(Effects.field_204839_B)) {
- d0 = 0.01D;
@ -295,15 +285,15 @@
FluidState fluidstate = this.field_70170_p.func_204610_c(this.func_233580_cy_());
if (this.func_70090_H() && this.func_241208_cS_() && !this.func_230285_a_(fluidstate.func_206886_c())) {
@@ -1897,6 +1941,7 @@
@@ -1897,6 +1938,7 @@
f5 = 0.96F;
}
+ f6 *= (float)this.func_110148_a(SWIM_SPEED).func_111126_e();
+ f6 *= (float)this.func_110148_a(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).func_111126_e();
this.func_213309_a(f6, p_213352_1_);
this.func_213315_a(MoverType.SELF, this.func_213322_ci());
Vector3d vector3d6 = this.func_213322_ci();
@@ -2075,6 +2120,7 @@
@@ -2075,6 +2117,7 @@
}
public void func_70071_h_() {
@ -311,7 +301,7 @@
super.func_70071_h_();
this.func_184608_ct();
this.func_205014_p();
@@ -2707,8 +2753,10 @@
@@ -2707,8 +2750,10 @@
public void func_184598_c(Hand p_184598_1_) {
ItemStack itemstack = this.func_184586_b(p_184598_1_);
if (!itemstack.func_190926_b() && !this.func_184587_cr()) {
@ -323,7 +313,7 @@
if (!this.field_70170_p.field_72995_K) {
this.func_204802_c(1, true);
this.func_204802_c(2, p_184598_1_ == Hand.OFF_HAND);
@@ -2768,6 +2816,9 @@
@@ -2768,6 +2813,9 @@
vector3d1 = vector3d1.func_178789_a(-this.field_70125_A * ((float)Math.PI / 180F));
vector3d1 = vector3d1.func_178785_b(-this.field_70177_z * ((float)Math.PI / 180F));
vector3d1 = vector3d1.func_72441_c(this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_());
@ -333,7 +323,7 @@
this.field_70170_p.func_195594_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vector3d1.field_72450_a, vector3d1.field_72448_b, vector3d1.field_72449_c, vector3d.field_72450_a, vector3d.field_72448_b + 0.05D, vector3d.field_72449_c);
}
@@ -2779,7 +2830,9 @@
@@ -2779,7 +2827,9 @@
} else {
if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) {
this.func_226293_b_(this.field_184627_bm, 16);
@ -344,7 +334,7 @@
this.func_184602_cy();
}
@@ -2800,7 +2853,11 @@
@@ -2800,7 +2850,11 @@
public void func_184597_cx() {
if (!this.field_184627_bm.func_190926_b()) {
@ -356,7 +346,7 @@
if (this.field_184627_bm.func_222122_m()) {
this.func_184608_ct();
}
@@ -2993,7 +3050,9 @@
@@ -2993,7 +3047,9 @@
@OnlyIn(Dist.CLIENT)
public Direction func_213376_dz() {
BlockPos blockpos = this.func_213374_dv().orElse((BlockPos)null);
@ -367,7 +357,7 @@
}
public boolean func_70094_T() {
@@ -3062,4 +3121,58 @@
@@ -3062,4 +3118,58 @@
public void func_213334_d(Hand p_213334_1_) {
this.func_213361_c(p_213334_1_ == Hand.MAIN_HAND ? EquipmentSlotType.MAINHAND : EquipmentSlotType.OFFHAND);
}

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/entity/ai/attributes/Attribute.java
+++ b/net/minecraft/entity/ai/attributes/Attribute.java
@@ -1,6 +1,6 @@
package net.minecraft.entity.ai.attributes;
-public class Attribute {
+public class Attribute extends net.minecraftforge.registries.ForgeRegistryEntry<Attribute> {
private final double field_233750_a_;
private boolean field_233751_b_;
private final String field_233752_c_;

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/fluid/WaterFluid.java
+++ b/net/minecraft/fluid/WaterFluid.java
@@ -60,7 +60,7 @@
}
protected void func_205580_a(IWorld p_205580_1_, BlockPos p_205580_2_, BlockState p_205580_3_) {
- TileEntity tileentity = p_205580_3_.func_177230_c().func_235695_q_() ? p_205580_1_.func_175625_s(p_205580_2_) : null;
+ TileEntity tileentity = p_205580_3_.hasTileEntity() ? p_205580_1_.func_175625_s(p_205580_2_) : null;
Block.func_220059_a(p_205580_3_, p_205580_1_.func_201672_e(), p_205580_2_, tileentity);
}

View file

@ -1,5 +1,5 @@
--- a/net/minecraft/world/storage/loot/LootContext.java
+++ b/net/minecraft/world/storage/loot/LootContext.java
--- a/net/minecraft/loot/LootContext.java
+++ b/net/minecraft/loot/LootContext.java
@@ -94,6 +94,10 @@
return this.field_186499_b;
}

View file

@ -1,5 +1,5 @@
--- a/net/minecraft/world/storage/loot/LootParameterSets.java
+++ b/net/minecraft/world/storage/loot/LootParameterSets.java
--- a/net/minecraft/loot/LootParameterSets.java
+++ b/net/minecraft/loot/LootParameterSets.java
@@ -12,6 +12,7 @@
});
public static final LootParameterSet field_216261_b = func_216253_a("chest", (p_216259_0_) -> {
@ -11,7 +11,7 @@
@@ -21,6 +22,7 @@
});
public static final LootParameterSet field_216262_c = func_216253_a("fishing", (p_216258_0_) -> {
p_216258_0_.func_216269_a(LootParameters.field_216286_f).func_216269_a(LootParameters.field_216289_i);
p_216258_0_.func_216269_a(LootParameters.field_216286_f).func_216269_a(LootParameters.field_216289_i).func_216271_b(LootParameters.field_216281_a);
+ p_216258_0_.func_216271_b(LootParameters.field_216284_d).func_216271_b(LootParameters.field_216281_a); //Forge: Allow fisher, and bobber
});
public static final LootParameterSet field_216263_d = func_216253_a("entity", (p_216251_0_) -> {

View file

@ -1,5 +1,5 @@
--- a/net/minecraft/world/storage/loot/LootPool.java
+++ b/net/minecraft/world/storage/loot/LootPool.java
--- a/net/minecraft/loot/LootPool.java
+++ b/net/minecraft/loot/LootPool.java
@@ -25,17 +25,19 @@
import org.apache.commons.lang3.mutable.MutableInt;
@ -25,7 +25,7 @@
this.field_216101_c = LootConditionManager.func_216305_a(p_i51268_2_);
this.field_216102_d = p_i51268_3_;
this.field_216103_e = LootFunctionManager.func_216241_a(p_i51268_3_);
@@ -92,16 +94,16 @@
@@ -92,19 +94,33 @@
}
public void func_227505_a_(ValidationTracker p_227505_1_) {
@ -46,7 +46,24 @@
}
}
@@ -116,6 +118,7 @@
+ //======================== FORGE START =============================================
+ private boolean isFrozen = false;
+ public void freeze() { this.isFrozen = true; }
+ public boolean isFrozen(){ return this.isFrozen; }
+ private void checkFrozen() {
+ if (this.isFrozen())
+ throw new RuntimeException("Attempted to modify LootPool after being frozen!");
+ }
+ public String getName(){ return this.name; }
+ public IRandomRange getRolls() { return this.field_186455_c; }
+ public IRandomRange getBonusRolls() { return this.field_186456_d; }
+ public void setRolls (RandomValueRange v){ checkFrozen(); this.field_186455_c = v; }
+ public void setBonusRolls(RandomValueRange v){ checkFrozen(); this.field_186456_d = v; }
+ //======================== FORGE END ===============================================
public static LootPool.Builder func_216096_a() {
return new LootPool.Builder();
@@ -116,6 +132,7 @@
private final List<ILootFunction> field_216049_c = Lists.newArrayList();
private IRandomRange field_216050_d = new RandomValueRange(1.0F);
private RandomValueRange field_216051_e = new RandomValueRange(0.0F, 0.0F);
@ -54,7 +71,7 @@
public LootPool.Builder func_216046_a(IRandomRange p_216046_1_) {
this.field_216050_d = p_216046_1_;
@@ -141,15 +144,61 @@
@@ -141,11 +158,21 @@
return this;
}
@ -77,47 +94,7 @@
}
}
}
+ //======================== FORGE START =============================================
+ private boolean isFrozen = false;
+ public void freeze() { this.isFrozen = true; }
+ public boolean isFrozen(){ return this.isFrozen; }
+ private void checkFrozen() {
+ if (this.isFrozen())
+ throw new RuntimeException("Attempted to modify LootPool after being frozen!");
+ }
+ public String getName(){ return this.name; }
+ public IRandomRange getRolls() { return this.field_186455_c; }
+ public IRandomRange getBonusRolls() { return this.field_186456_d; }
+ public void setRolls (RandomValueRange v){ checkFrozen(); this.field_186455_c = v; }
+ public void setBonusRolls(RandomValueRange v){ checkFrozen(); this.field_186456_d = v; }
+ /*
+ public LootEntry getEntry(String name) {
+ return lootEntries.stream().filter(e -> name.equals(e.getEntryName())).findFirst().orElse(null);
+ }
+ public LootEntry removeEntry(String name) {
+ checkFrozen();
+ for (LootEntry entry : this.lootEntries) {
+ if (name.equals(entry.getEntryName())) {
+ this.lootEntries.remove(entry);
+ return entry;
+ }
+ }
+ return null;
+ }
+ public void addEntry(LootEntry entry) {
+ checkFrozen();
+ if (lootEntries.stream().anyMatch(e -> e == entry || e.getEntryName().equals(entry.getEntryName())))
+ throw new RuntimeException("Attempted to add a duplicate entry to pool: " + entry.getEntryName());
+ this.lootEntries.add(entry);
+ }
+ */
+ //======================== FORGE END ===============================================
+
public static class Serializer implements JsonDeserializer<LootPool>, JsonSerializer<LootPool> {
public LootPool deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException {
JsonObject jsonobject = JSONUtils.func_151210_l(p_deserialize_1_, "loot pool");
@@ -158,18 +207,20 @@
@@ -158,18 +185,20 @@
ILootFunction[] ailootfunction = JSONUtils.func_188177_a(jsonobject, "functions", new ILootFunction[0], p_deserialize_3_, ILootFunction[].class);
IRandomRange irandomrange = RandomRanges.func_216130_a(jsonobject.get("rolls"), p_deserialize_3_);
RandomValueRange randomvaluerange = JSONUtils.func_188177_a(jsonobject, "bonus_rolls", new RandomValueRange(0.0F, 0.0F), p_deserialize_3_, RandomValueRange.class);

View file

@ -1,5 +1,5 @@
--- a/net/minecraft/world/storage/loot/LootTable.java
+++ b/net/minecraft/world/storage/loot/LootTable.java
--- a/net/minecraft/loot/LootTable.java
+++ b/net/minecraft/loot/LootTable.java
@@ -31,13 +31,13 @@
public static final LootTable field_186464_a = new LootTable(LootParameterSets.field_216260_a, new LootPool[0], new ILootFunction[0]);
public static final LootParameterSet field_216126_b = LootParameterSets.field_216266_g;
@ -43,8 +43,8 @@
}
for(int j = 0; j < this.field_216128_f.length; ++j) {
@@ -202,6 +204,41 @@
}
@@ -173,6 +175,41 @@
return new LootTable.Builder();
}
+ //======================== FORGE START =============================================
@ -82,9 +82,9 @@
+ }
+ //======================== FORGE END ===============================================
+
public static class Serializer implements JsonDeserializer<LootTable>, JsonSerializer<LootTable> {
public LootTable deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException {
JsonObject jsonobject = JSONUtils.func_151210_l(p_deserialize_1_, "loot table");
public static class Builder implements ILootFunctionConsumer<LootTable.Builder> {
private final List<LootPool> field_216041_a = Lists.newArrayList();
private final List<ILootFunction> field_216042_b = Lists.newArrayList();
@@ -227,7 +264,7 @@
}
}

View file

@ -0,0 +1,13 @@
--- a/net/minecraft/loot/LootTableManager.java
+++ b/net/minecraft/loot/LootTableManager.java
@@ -36,8 +36,8 @@
}
p_212853_1_.forEach((p_237403_1_, p_237403_2_) -> {
- try {
- LootTable loottable = field_186526_b.fromJson(p_237403_2_, LootTable.class);
+ try (net.minecraft.resources.IResource res = p_212853_2_.func_199002_a(getPreparedPath(p_237403_1_));){
+ LootTable loottable = net.minecraftforge.common.ForgeHooks.loadLootTable(field_186526_b, p_237403_1_, p_237403_2_, res == null || !res.func_199026_d().equals("Default"), this);
builder.put(p_237403_1_, loottable);
} catch (Exception exception) {
field_186525_a.error("Couldn't parse loot table {}", p_237403_1_, exception);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java
+++ b/net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java
@@ -28,12 +28,7 @@
--- a/net/minecraft/loot/conditions/RandomChanceWithLooting.java
+++ b/net/minecraft/loot/conditions/RandomChanceWithLooting.java
@@ -33,12 +33,7 @@
}
public boolean test(LootContext p_test_1_) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java
+++ b/net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java
@@ -39,7 +39,7 @@
--- a/net/minecraft/loot/functions/LootingEnchantBonus.java
+++ b/net/minecraft/loot/functions/LootingEnchantBonus.java
@@ -43,7 +43,7 @@
public ItemStack func_215859_a(ItemStack p_215859_1_, LootContext p_215859_2_) {
Entity entity = p_215859_2_.func_216031_c(LootParameters.field_216284_d);
if (entity instanceof LivingEntity) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/storage/loot/functions/Smelt.java
+++ b/net/minecraft/world/storage/loot/functions/Smelt.java
@@ -30,7 +30,7 @@
--- a/net/minecraft/loot/functions/Smelt.java
+++ b/net/minecraft/loot/functions/Smelt.java
@@ -34,7 +34,7 @@
ItemStack itemstack = optional.get().func_77571_b();
if (!itemstack.func_190926_b()) {
ItemStack itemstack1 = itemstack.func_77946_l();

View file

@ -1,11 +1,11 @@
--- a/net/minecraft/resources/IResourcePack.java
+++ b/net/minecraft/resources/IResourcePack.java
@@ -12,7 +12,7 @@
@@ -11,7 +11,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public interface IResourcePack extends Closeable {
+public interface IResourcePack extends Closeable, net.minecraftforge.client.extensions.IForgeResourcePack {
-public interface IResourcePack extends AutoCloseable {
+public interface IResourcePack extends AutoCloseable, net.minecraftforge.common.extensions.IForgeResourcePack {
@OnlyIn(Dist.CLIENT)
InputStream func_195763_b(String p_195763_1_) throws IOException;

View file

@ -1,5 +1,14 @@
--- a/net/minecraft/resources/ResourcePackList.java
+++ b/net/minecraft/resources/ResourcePackList.java
@@ -22,7 +22,7 @@
public ResourcePackList(ResourcePackInfo.IFactory<T> p_i231423_1_, IPackFinder... p_i231423_2_) {
this.field_198990_d = p_i231423_1_;
- this.field_198987_a = ImmutableSet.copyOf(p_i231423_2_);
+ this.field_198987_a = new java.util.HashSet<>(java.util.Arrays.asList(p_i231423_2_));
}
public void func_198983_a() {
@@ -85,6 +85,10 @@
return this.field_198988_b.get(p_198981_1_);
}

View file

@ -21,7 +21,7 @@
} else if (p_240786_3_) {
p_240786_1_.func_176143_a(BlockPos.field_177992_a.func_177984_a());
} else {
+ //if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(p_240786_0_, settings)) return; //TODO, Re-Evaluate what settings to pass into here.
+ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(p_240786_0_, p_240786_1_)) return;
BiomeProvider biomeprovider = chunkgenerator.func_202090_b();
List<Biome> list = biomeprovider.func_76932_a();
Random random = new Random(p_240786_0_.func_72905_C());
@ -123,7 +123,15 @@
for(ResourcePackInfo resourcepackinfo : this.field_195577_ad.func_198980_d()) {
if (stringbuilder.length() > 0) {
stringbuilder.append(", ");
@@ -1437,6 +1457,31 @@
@@ -1284,6 +1304,7 @@
}
public static DatapackCodec func_240772_a_(ResourcePackList<ResourcePackInfo> p_240772_0_, DatapackCodec p_240772_1_, boolean p_240772_2_) {
+ net.minecraftforge.fml.packs.ResourcePackLoader.loadResourcePacks(p_240772_0_, net.minecraftforge.fml.server.ServerLifecycleHooks::buildPackFinder);
p_240772_0_.func_198983_a();
if (p_240772_2_) {
p_240772_0_.func_198985_a(Collections.singleton("vanilla"));
@@ -1437,6 +1458,31 @@
public abstract boolean func_213199_b(GameProfile p_213199_1_);
@ -155,3 +163,12 @@
public void func_223711_a(Path p_223711_1_) throws IOException {
Path path = p_223711_1_.resolve("levels");
@@ -1564,4 +1610,8 @@
public IServerConfiguration func_240793_aU_() {
return this.field_240768_i_;
}
+
+ public DataPackRegistries getDataPackRegistries() {
+ return field_195576_ac;
+ }
}

View file

@ -1,10 +1,9 @@
--- a/net/minecraft/tags/NetworkTagManager.java
+++ b/net/minecraft/tags/NetworkTagManager.java
@@ -69,6 +69,7 @@
TagCollectionManager.func_232924_a_(this.field_199719_a, this.field_199720_b, this.field_205705_c, this.field_215299_d);
Multimap<String, ResourceLocation> multimap = HashMultimap.create();
multimap.putAll("blocks", BlockTags.func_232892_b_(this.field_199719_a));
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this));
multimap.putAll("items", ItemTags.func_232917_b_(this.field_199720_b));
multimap.putAll("fluids", FluidTags.func_232901_b_(this.field_205705_c));
multimap.putAll("entity_types", EntityTypeTags.func_232897_b_(this.field_215299_d));
@@ -86,5 +86,6 @@
FluidTags.func_206953_a(this.field_205705_c);
EntityTypeTags.func_219759_a(this.field_215299_d);
Blocks.func_235419_a_();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this));
}
}

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/tags/TagRegistry.java
+++ b/net/minecraft/tags/TagRegistry.java
@@ -22,6 +22,7 @@
public ITag.INamedTag<T> func_232937_a_(String p_232937_1_) {
TagRegistry.NamedTag<T> namedtag = new TagRegistry.NamedTag<>(new ResourceLocation(p_232937_1_));
+ namedtag.func_232943_a_(field_232930_b_::func_199910_a);
this.field_232931_c_.add(namedtag);
return namedtag;
}

View file

@ -13,11 +13,11 @@
return null;
}
+ public static BannerPattern create(String enumName, String p_i47246_3_, String p_i47246_4_, net.minecraft.item.ItemStack p_i47246_5_) {
+ public static BannerPattern create(String enumName, String fileNameIn, String hashNameIn) {
+ throw new IllegalStateException("Enum not extended");
+ }
+
+ public static BannerPattern create(String enumName, String p_i47247_3_, String p_i47247_4_, String p_i47247_5_, String p_i47247_6_, String p_i47247_7_) {
+ public static BannerPattern create(String enumName, String fileNameIn, String hashNameIn, boolean p_i231861_5_) {
+ throw new IllegalStateException("Enum not extended");
+ }
+

View file

@ -8,3 +8,11 @@
func_179868_d();
}
}
@@ -101,7 +102,6 @@
});
}
- GlobalEntityTypeAttributes.func_233834_a_();
}
}

View file

@ -129,7 +129,8 @@
+ @Deprecated public static final Registry<IRecipeSerializer<?>> field_218368_I = forge(field_239679_Q_, IRecipeSerializer.class, () -> {
return IRecipeSerializer.field_222158_b;
});
public static final Registry<Attribute> field_239692_aP_ = func_239746_a_(field_239680_R_, () -> {
- public static final Registry<Attribute> field_239692_aP_ = func_239746_a_(field_239680_R_, () -> {
+ @Deprecated public static final Registry<Attribute> field_239692_aP_ = forge(field_239680_R_, Attribute.class, () -> {
return Attributes.field_233828_k_;
});
- public static final Registry<StatType<?>> field_212634_w = func_239746_a_(field_239681_S_, () -> {

View file

@ -1,10 +1,32 @@
--- a/net/minecraft/util/text/LanguageMap.java
+++ b/net/minecraft/util/text/LanguageMap.java
@@ -36,6 +36,7 @@
@@ -36,7 +36,8 @@
field_201045_a.error("Couldn't read strings from /assets/minecraft/lang/en_us.json", (Throwable)ioexception);
}
+ //net.minecraftforge.fml.server.LanguageHook.captureLanguageMap(this.languageList); //TODO
final Map<String, String> map = builder.build();
- final Map<String, String> map = builder.build();
+ final Map<String, String> map = new java.util.HashMap<>(builder.build());
+ net.minecraftforge.fml.server.LanguageHook.captureLanguageMap(map);
return new LanguageMap() {
public String func_230503_a_(String p_230503_1_) {
return map.getOrDefault(p_230503_1_, p_230503_1_);
@@ -54,6 +55,11 @@
public String func_230504_a_(String p_230504_1_, boolean p_230504_2_) {
return p_230504_1_;
}
+
+ @Override
+ public Map<String, String> getLanguageData() {
+ return map;
+ }
};
}
@@ -84,4 +90,7 @@
public abstract boolean func_230505_b_();
public abstract String func_230504_a_(String p_230504_1_, boolean p_230504_2_);
+
+ // FORGE START
+ public Map<String, String> getLanguageData() { return ImmutableMap.of(); }
}

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/world/DefaultExplosionContext.java
+++ b/net/minecraft/world/DefaultExplosionContext.java
@@ -9,7 +9,7 @@
INSTANCE;
public Optional<Float> func_230312_a_(Explosion p_230312_1_, IBlockReader p_230312_2_, BlockPos p_230312_3_, BlockState p_230312_4_, FluidState p_230312_5_) {
- return p_230312_4_.func_196958_f() && p_230312_5_.func_206888_e() ? Optional.empty() : Optional.of(Math.max(p_230312_4_.func_177230_c().func_149638_a(), p_230312_5_.func_210200_l()));
+ return p_230312_4_.isAir(p_230312_2_, p_230312_3_) && p_230312_5_.func_206888_e() ? Optional.empty() : Optional.of(Math.max(p_230312_4_.getExplosionResistance(p_230312_2_, p_230312_3_, p_230312_1_), p_230312_5_.getExplosionResistance(p_230312_2_, p_230312_3_, p_230312_1_)));
}
public boolean func_230311_a_(Explosion p_230311_1_, IBlockReader p_230311_2_, BlockPos p_230311_3_, BlockState p_230311_4_, float p_230311_5_) {

View file

@ -1,21 +1,21 @@
--- a/net/minecraft/world/Explosion.java
+++ b/net/minecraft/world/Explosion.java
@@ -54,6 +54,7 @@
private final Entity field_77283_e;
private final float field_77280_f;
private final DamageSource field_199593_j;
+ private final Vector3d position;
@@ -57,6 +57,7 @@
private final IExplosionContext field_234893_k_;
private final List<BlockPos> field_77281_g = Lists.newArrayList();
private final Map<PlayerEntity, Vector3d> field_77288_k = Maps.newHashMap();
@@ -81,6 +82,7 @@
this.field_77284_b = p_i231610_5_;
this.field_77285_c = p_i231610_7_;
this.field_77282_d = p_i231610_9_;
+ this.position = new Vector3d(this.field_77284_b, this.field_77285_c, this.field_77282_d);
this.field_77286_a = p_i231610_12_;
+ private final Vector3d position;
@OnlyIn(Dist.CLIENT)
public Explosion(World p_i45752_1_, @Nullable Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List<BlockPos> p_i45752_10_) {
@@ -85,6 +86,7 @@
this.field_222260_b = p_i231610_13_;
this.field_199593_j = p_i231610_3_ == null ? DamageSource.func_94539_a(this) : p_i231610_3_;
this.field_234893_k_ = p_i231610_4_ == null ? this.func_234894_a_(p_i231610_2_) : p_i231610_4_;
+ this.position = new Vector3d(this.field_77284_b, this.field_77285_c, this.field_77282_d);
}
private IExplosionContext func_234894_a_(@Nullable Entity p_234894_1_) {
@@ -175,6 +177,7 @@
int j2 = MathHelper.func_76128_c(this.field_77282_d - (double)f2 - 1.0D);
int j1 = MathHelper.func_76128_c(this.field_77282_d + (double)f2 + 1.0D);
@ -24,6 +24,21 @@
Vector3d vector3d = new Vector3d(this.field_77284_b, this.field_77285_c, this.field_77282_d);
for(int k2 = 0; k2 < list.size(); ++k2) {
@@ -233,11 +236,11 @@
for(BlockPos blockpos : this.field_77281_g) {
BlockState blockstate = this.field_77287_j.func_180495_p(blockpos);
Block block = blockstate.func_177230_c();
- if (!blockstate.func_196958_f()) {
+ if (!blockstate.isAir(this.field_77287_j, blockpos)) {
BlockPos blockpos1 = blockpos.func_185334_h();
this.field_77287_j.func_217381_Z().func_76320_a("explosion_blocks");
- if (block.func_149659_a(this) && this.field_77287_j instanceof ServerWorld) {
- TileEntity tileentity = block.func_235695_q_() ? this.field_77287_j.func_175625_s(blockpos) : null;
+ if (blockstate.canDropFromExplosion(this.field_77287_j, blockpos, this) && this.field_77287_j instanceof ServerWorld) {
+ TileEntity tileentity = blockstate.hasTileEntity() ? this.field_77287_j.func_175625_s(blockpos) : null;
LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_77287_j)).func_216023_a(this.field_77287_j.field_73012_v).func_216015_a(LootParameters.field_216286_f, blockpos).func_216015_a(LootParameters.field_216289_i, ItemStack.field_190927_a).func_216021_b(LootParameters.field_216288_h, tileentity).func_216021_b(LootParameters.field_216281_a, this.field_77283_e);
if (this.field_222260_b == Explosion.Mode.DESTROY) {
lootcontext$builder.func_216015_a(LootParameters.field_216290_j, this.field_77280_f);
@@ -248,8 +251,7 @@
});
}
@ -34,13 +49,18 @@
this.field_77287_j.func_217381_Z().func_76319_b();
}
}
@@ -323,6 +325,10 @@
@@ -323,6 +325,15 @@
return this.field_77281_g;
}
+ public Vector3d getPosition() {
+ return this.position;
+ }
+
+ @Nullable
+ public Entity getExploder() {
+ return this.field_77283_e;
+ }
+
public static enum Mode {
NONE,

View file

@ -60,13 +60,13 @@
this.func_217381_Z().func_76319_b();
}
+ if (blockSnapshot == null) { // Don't notify clients or update physics while capturing blockstates
+ if (blockSnapshot == null) { // Don't notify clients or update physics while capturing blockstates
+ this.markAndNotifyBlock(p_241211_1_, chunk, blockstate, p_241211_2_, p_241211_3_, p_241211_4_);
+ }
+ return true;
+ }
+ }
+ }
+ }
+ return true;
+ }
+ }
+ }
+
+ // Split off from original setBlockState(BlockPos, BlockState, int, int) method in order to directly send client and physic updates
+ public void markAndNotifyBlock(BlockPos p_241211_1_, @Nullable Chunk chunk, BlockState blockstate, BlockState p_241211_2_, int p_241211_3_, int p_241211_4_)
@ -364,7 +364,7 @@
}
public boolean func_175640_z(BlockPos p_175640_1_) {
@@ -985,16 +1048,14 @@
@@ -985,16 +1048,15 @@
public abstract Scoreboard func_96441_U();
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) {
@ -376,6 +376,7 @@
- if (blockstate.func_203425_a(Blocks.field_196762_fd)) {
- blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false);
- } else if (blockstate.func_215686_e(this, blockpos)) {
+ blockstate.onNeighborChange(this, blockpos, p_175666_1_);
+ if (blockstate.func_215686_e(this, blockpos)) {
blockpos = blockpos.func_177972_a(direction);
blockstate = this.func_180495_p(blockpos);
@ -384,7 +385,7 @@
blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false);
}
}
@@ -1075,6 +1136,18 @@
@@ -1075,6 +1137,18 @@
return this.field_226689_w_;
}

View file

@ -61,6 +61,15 @@
}
public int func_201576_a(Heightmap.Type p_201576_1_, int p_201576_2_, int p_201576_3_) {
@@ -356,7 +360,7 @@
private TileEntity func_177422_i(BlockPos p_177422_1_) {
BlockState blockstate = this.func_180495_p(p_177422_1_);
Block block = blockstate.func_177230_c();
- return !block.func_235695_q_() ? null : ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e);
+ return !blockstate.hasTileEntity() ? null : blockstate.createTileEntity(this.field_76637_e);
}
@Nullable
@@ -367,6 +371,10 @@
@Nullable
public TileEntity func_177424_a(BlockPos p_177424_1_, Chunk.CreateEntityType p_177424_2_) {

View file

@ -1,49 +0,0 @@
--- a/net/minecraft/world/gen/layer/BiomeLayer.java
+++ b/net/minecraft/world/gen/layer/BiomeLayer.java
@@ -5,6 +5,8 @@
import net.minecraft.world.gen.INoiseRandom;
import net.minecraft.world.gen.layer.traits.IC0Transformer;
+import java.util.Collections;
+
public class BiomeLayer implements IC0Transformer {
private static final int field_202727_a = Registry.field_212624_m.func_148757_b(Biomes.field_150583_P);
private static final int field_202728_b = Registry.field_212624_m.func_148757_b(Biomes.field_76769_d);
@@ -46,21 +48,21 @@
return p_202726_1_.func_202696_a(3) == 0 ? field_202733_g : field_202734_h;
}
- return this.field_151623_c[p_202726_1_.func_202696_a(this.field_151623_c.length)];
+ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT, p_202726_1_).biome);
case 2:
if (i > 0) {
return field_202732_f;
}
- return field_202745_s[p_202726_1_.func_202696_a(field_202745_s.length)];
+ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM, p_202726_1_).biome);
case 3:
if (i > 0) {
return field_202737_k;
}
- return field_202746_t[p_202726_1_.func_202696_a(field_202746_t.length)];
+ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL, p_202726_1_).biome);
case 4:
- return field_202747_u[p_202726_1_.func_202696_a(field_202747_u.length)];
+ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY, p_202726_1_).biome);
default:
return field_202735_i;
}
@@ -68,4 +70,11 @@
return p_202726_2_;
}
}
+
+ protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType type, INoiseRandom context) {
+ java.util.List<net.minecraftforge.common.BiomeManager.BiomeEntry> biomeList = Collections.emptyList(); //biomes[type.ordinal()]; //TODO WorldType stuff,
+ int totalWeight = net.minecraft.util.WeightedRandom.func_76272_a(biomeList);
+ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type)?context.func_202696_a(totalWeight):context.func_202696_a(totalWeight / 10) * 10;
+ return (net.minecraftforge.common.BiomeManager.BiomeEntry)net.minecraft.util.WeightedRandom.func_180166_a(biomeList, weight);
+ }
}

View file

@ -3,10 +3,10 @@
@@ -135,7 +135,7 @@
Chunk chunk = this.func_219298_c();
if (chunk != null) {
this.field_219322_q |= 1 << (p_241812_2_ >> 4);
this.field_219322_q |= 1 << (p_241819_2_ >> 4);
- if (this.field_219321_p < 64) {
+ { //Forge; Cache everything, so always run
short short1 = (short)(p_241812_1_ << 12 | p_241812_3_ << 8 | p_241812_2_);
short short1 = (short)(p_241819_1_ << 12 | p_241819_3_ << 8 | p_241819_2_);
for(int i = 0; i < this.field_219321_p; ++i) {
@@ -144,6 +144,8 @@
@ -18,3 +18,34 @@
this.field_219320_o[this.field_219321_p++] = short1;
}
@@ -166,7 +168,7 @@
public void func_219274_a(Chunk p_219274_1_) {
if (this.field_219321_p != 0 || this.field_219325_t != 0 || this.field_219324_s != 0) {
World world = p_219274_1_.func_177412_p();
- if (this.field_219321_p < 64 && (this.field_219325_t != 0 || this.field_219324_s != 0)) {
+ if (this.field_219321_p < net.minecraftforge.common.ForgeConfig.SERVER.clumpingThreshold.get() && (this.field_219325_t != 0 || this.field_219324_s != 0)) {
this.func_219293_a(new SUpdateLightPacket(p_219274_1_.func_76632_l(), this.field_219326_u, this.field_219325_t, this.field_219324_s, false), true);
this.field_219325_t = 0;
this.field_219324_s = 0;
@@ -178,10 +180,10 @@
int k = (this.field_219320_o[0] >> 8 & 15) + this.field_219319_n.field_77275_b * 16;
BlockPos blockpos = new BlockPos(i, j, k);
this.func_219293_a(new SChangeBlockPacket(world, blockpos), false);
- if (world.func_180495_p(blockpos).func_177230_c().func_235695_q_()) {
+ if (world.func_180495_p(blockpos).hasTileEntity()) {
this.func_219305_a(world, blockpos);
}
- } else if (this.field_219321_p == 64) {
+ } else if (this.field_219321_p >= net.minecraftforge.common.ForgeConfig.SERVER.clumpingThreshold.get()) {
this.func_219293_a(new SChunkDataPacket(p_219274_1_, this.field_219322_q, false), false);
} else if (this.field_219321_p != 0) {
this.func_219293_a(new SMultiBlockChangePacket(this.field_219321_p, this.field_219320_o, p_219274_1_), false);
@@ -191,7 +193,7 @@
int j1 = this.field_219320_o[l] & 255;
int k1 = (this.field_219320_o[l] >> 8 & 15) + this.field_219319_n.field_77275_b * 16;
BlockPos blockpos1 = new BlockPos(i1, j1, k1);
- if (world.func_180495_p(blockpos1).func_177230_c().func_235695_q_()) {
+ if (world.func_180495_p(blockpos1).hasTileEntity()) {
this.func_219305_a(world, blockpos1);
}
}

View file

@ -66,25 +66,11 @@
this.func_217454_n(entity1);
objectiterator.remove();
- this.func_217484_g(entity1);
+ this.removeEntityComplete(entity1, entity1 instanceof ServerPlayerEntity); //Forge: Keep cap data until revive. Every other entity removes directly.
+ this.removeEntityComplete(entity1, entity1 instanceof ServerPlayerEntity); //Forge: Keep cap data until revive. Every other entity removes directly.
}
iprofiler.func_76319_b();
@@ -443,7 +448,7 @@
int j = chunkpos.func_180333_d();
IProfiler iprofiler = this.func_217381_Z();
iprofiler.func_76320_a("thunder");
- if (flag && this.func_72911_I() && this.field_73012_v.nextInt(100000) == 0) {
+ if (/*TODO this.dimension.canDoLightning(chunkIn) &&*/ flag && this.func_72911_I() && this.field_73012_v.nextInt(100000) == 0) {
BlockPos blockpos = this.func_175736_a(this.func_217383_a(i, 0, j, 15));
if (this.func_175727_C(blockpos)) {
DifficultyInstance difficultyinstance = this.func_175649_E(blockpos);
@@ -464,10 +469,11 @@
}
iprofiler.func_219895_b("iceandsnow");
- if (this.field_73012_v.nextInt(16) == 0) {
+ if (/*TODO this.dimension.canDoRainSnowIce(chunkIn) &&*/ this.field_73012_v.nextInt(16) == 0) {
@@ -468,6 +473,7 @@
BlockPos blockpos2 = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, this.func_217383_a(i, 0, j, 15));
BlockPos blockpos3 = blockpos2.func_177977_b();
Biome biome = this.func_226691_t_(blockpos2);
@ -92,17 +78,18 @@
if (biome.func_201848_a(this, blockpos3)) {
this.func_175656_a(blockpos3, Blocks.field_150432_aD.func_176223_P());
}
@@ -591,8 +597,9 @@
@@ -591,9 +597,10 @@
++p_217479_1_.field_70173_aa;
IProfiler iprofiler = this.func_217381_Z();
iprofiler.func_194340_a(() -> {
- return Registry.field_212629_r.func_177774_c(p_217479_1_.func_200600_R()).toString();
+ return p_217479_1_.func_200600_R().getRegistryName() == null ? p_217479_1_.func_200600_R().toString() : p_217479_1_.func_200600_R().getRegistryName().toString();
});
+ if (p_217479_1_.canUpdate())
iprofiler.func_230035_c_("tickNonPassenger");
+ if (p_217479_1_.canUpdate())
p_217479_1_.func_70071_h_();
iprofiler.func_76319_b();
}
@@ -680,6 +687,7 @@
p_217445_1_.func_200209_c(new TranslationTextComponent("menu.savingChunks"));
}
@ -226,14 +213,13 @@
explosion.func_77278_a();
explosion.func_77279_a(false);
if (p_230546_12_ == Explosion.Mode.NONE) {
@@ -1331,4 +1366,15 @@
@@ -1331,4 +1366,14 @@
p_241121_0_.func_175656_a(p_241122_1_, Blocks.field_150343_Z.func_176223_P());
});
}
+
+ protected void initCapabilities() {
+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = null;//TODO dimension.initCapabilities();
+ this.gatherCapabilities(parent);
+ this.gatherCapabilities();
+ capabilityData = this.func_217481_x().func_215752_a(() -> new net.minecraftforge.common.util.WorldCapabilityData(getCapabilities()), net.minecraftforge.common.util.WorldCapabilityData.ID);
+ capabilityData.setCapabilities(getCapabilities());
+ }

View file

@ -9,7 +9,33 @@
if (entityclassification != EntityClassification.MISC) {
BlockPos blockpos = entity.func_233580_cy_();
long i = ChunkPos.func_77272_a(blockpos.func_177958_n() >> 4, blockpos.func_177952_p() >> 4);
@@ -294,6 +294,13 @@
@@ -171,13 +171,15 @@
}
mobentity.func_70012_b(d0, (double)i, d1, p_234966_1_.field_73012_v.nextFloat() * 360.0F, 0.0F);
- if (func_234974_a_(p_234966_1_, mobentity, d2)) {
+ int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_234966_1_, d0, i, d1, null, SpawnReason.NATURAL);
+ if (canSpawn != -1 && (canSpawn == 1 || func_234974_a_(p_234966_1_, mobentity, d2))) {
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mobentity, p_234966_1_, (float)d0, (float)i, (float)d1, null, SpawnReason.NATURAL))
ilivingentitydata = mobentity.func_213386_a(p_234966_1_, p_234966_1_.func_175649_E(mobentity.func_233580_cy_()), SpawnReason.NATURAL, ilivingentitydata, (CompoundNBT)null);
++j;
++l1;
p_234966_1_.func_217376_c(mobentity);
p_234966_5_.run(mobentity, p_234966_2_);
- if (j >= mobentity.func_70641_bl()) {
+ if (j >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(mobentity)) {
return;
}
@@ -255,6 +257,7 @@
return null;
} else {
List<Biome.SpawnListEntry> list = func_241463_a_(p_234977_0_, p_234977_1_, p_234977_2_, p_234977_3_, p_234977_5_, biome);
+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(p_234977_0_, p_234977_3_, p_234977_5_, list);
return list.isEmpty() ? null : WeightedRandom.func_76271_a(p_234977_4_, list);
}
}
@@ -294,6 +297,13 @@
if (p_209382_0_ == EntitySpawnPlacementRegistry.PlacementType.NO_RESTRICTIONS) {
return true;
} else if (p_209382_3_ != null && p_209382_1_.func_175723_af().func_177746_a(p_209382_2_)) {
@ -23,7 +49,7 @@
BlockState blockstate = p_209382_1_.func_180495_p(p_209382_2_);
FluidState fluidstate = p_209382_1_.func_204610_c(p_209382_2_);
BlockPos blockpos = p_209382_2_.func_177984_a();
@@ -312,8 +319,6 @@
@@ -312,8 +322,6 @@
return func_234968_a_(p_209382_1_, p_209382_2_, blockstate, fluidstate, p_209382_3_) && func_234968_a_(p_209382_1_, blockpos, p_209382_1_.func_180495_p(blockpos), p_209382_1_.func_204610_c(blockpos), p_209382_3_);
}
}
@ -32,7 +58,7 @@
}
}
@@ -356,6 +361,7 @@
@@ -356,6 +364,7 @@
entity.func_70012_b(d0, (double)blockpos.func_177956_o(), d1, p_77191_4_.nextFloat() * 360.0F, 0.0F);
if (entity instanceof MobEntity) {
MobEntity mobentity = (MobEntity)entity;

View file

@ -6,7 +6,7 @@
WorldSavedData worldsaveddata = this.field_212778_c.get(p_215753_2_);
+ if (worldsaveddata == net.minecraftforge.common.util.DummyWorldSaveData.DUMMY) return null;
if (worldsaveddata == null && !this.field_212778_c.containsKey(p_215753_2_)) {
worldsaveddata = this.<T>func_223409_c(p_215753_1_, p_215753_2_);
worldsaveddata = this.func_223409_c(p_215753_1_, p_215753_2_);
this.field_212778_c.put(p_215753_2_, worldsaveddata);
+ } else if (worldsaveddata == null) {
+ this.field_212778_c.put(p_215753_2_, net.minecraftforge.common.util.DummyWorldSaveData.DUMMY);

View file

@ -1,6 +1,22 @@
--- a/net/minecraft/world/storage/PlayerData.java
+++ b/net/minecraft/world/storage/PlayerData.java
@@ -74,4 +74,8 @@
@@ -33,6 +33,7 @@
File file2 = new File(this.field_237333_c_, p_237335_1_.func_189512_bd() + ".dat");
File file3 = new File(this.field_237333_c_, p_237335_1_.func_189512_bd() + ".dat_old");
Util.func_240977_a_(file2, file1, file3);
+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_237335_1_, field_237333_c_, p_237335_1_.func_189512_bd());
} catch (Exception exception) {
field_237332_b_.warn("Failed to save player data for {}", (Object)p_237335_1_.func_200200_C_().getString());
}
@@ -56,6 +57,7 @@
int i = compoundnbt.func_150297_b("DataVersion", 3) ? compoundnbt.func_74762_e("DataVersion") : -1;
p_237336_1_.func_70020_e(NBTUtil.func_210822_a(this.field_237331_a_, DefaultTypeReferences.PLAYER, compoundnbt, i));
}
+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_237336_1_, field_237333_c_, p_237336_1_.func_189512_bd());
return compoundnbt;
}
@@ -74,4 +76,8 @@
return astring;
}

View file

@ -1,507 +0,0 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -322,6 +322,7 @@
public Minecraft(GameConfiguration p_i45547_1_) {
super("Client");
field_71432_P = this;
+ net.minecraftforge.client.ForgeHooksClient.invalidateLog4jThreadCache();
this.field_71412_D = p_i45547_1_.field_178744_c.field_178760_a;
File file1 = p_i45547_1_.field_178744_c.field_178759_c;
this.field_130070_K = p_i45547_1_.field_178744_c.field_178758_b;
@@ -336,7 +337,6 @@
this.field_152355_az = (new YggdrasilAuthenticationService(this.field_110453_aa, UUID.randomUUID().toString())).createMinecraftSessionService();
this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a;
field_147123_G.info("Setting user: {}", (Object)this.field_71449_j.func_111285_a());
- field_147123_G.debug("(Session ID is {})", (Object)this.field_71449_j.func_111286_b());
this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a;
this.field_147129_ai = func_147122_X();
this.field_71437_Z = null;
@@ -350,7 +350,7 @@
i = 0;
}
- Bootstrap.func_151354_b();
+ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(()->Bootstrap.func_151354_b(), net.minecraftforge.fml.loading.FMLLoader.progressWindowTick);
Bootstrap.func_218821_c();
KeybindTextComponent.field_193637_b = KeyBinding::func_193626_b;
this.field_184131_U = DataFixesManager.func_210901_a();
@@ -383,13 +383,13 @@
this.field_195558_d.func_216526_a(this.field_71474_y.field_74350_i);
this.field_71417_B = new MouseHelper(this);
- this.field_71417_B.func_198029_a(this.field_195558_d.func_198092_i());
this.field_195559_v = new KeyboardListener(this);
this.field_195559_v.func_197968_a(this.field_195558_d.func_198092_i());
RenderSystem.initRenderer(this.field_71474_y.field_209231_W, false);
this.field_147124_at = new Framebuffer(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), true, field_142025_a);
this.field_147124_at.func_147604_a(0.0F, 0.0F, 0.0F, 0.0F);
this.field_110451_am = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES, this.field_152352_aC);
+ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.field_110448_aq, this.field_110451_am, this.field_195554_ax);
this.field_71474_y.func_198017_a(this.field_110448_aq);
this.field_110448_aq.func_198983_a();
this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab);
@@ -434,12 +434,14 @@
this.func_193986_ar();
this.field_110451_am.func_219534_a(this.field_193995_ae);
this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o);
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.ParticleFactoryRegisterEvent());
this.field_110451_am.func_219534_a(this.field_71452_i);
this.field_213272_aL = new PaintingSpriteUploader(this.field_71446_o);
this.field_110451_am.func_219534_a(this.field_213272_aL);
this.field_213273_aM = new PotionSpriteUploader(this.field_71446_o);
this.field_110451_am.func_219534_a(this.field_213273_aM);
- this.field_71456_v = new IngameGui(this);
+ this.field_71456_v = new net.minecraftforge.client.gui.ForgeIngameGui(this);
+ this.field_71417_B.func_198029_a(this.field_195558_d.func_198092_i()); //Forge: Moved below ingameGUI setting to prevent NPEs in handeler.
this.field_184132_p = new DebugRenderer(this);
RenderSystem.setErrorCallback(this::func_195545_a);
if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) {
@@ -451,12 +453,11 @@
this.field_195558_d.func_224798_d(this.field_71474_y.field_225307_E);
this.field_195558_d.func_227801_c_();
this.func_213226_a();
- if (s != null) {
- this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, s, i));
- } else {
- this.func_147108_a(new MainMenuScreen(true));
- }
+ //Final needed so we can move into lambda below.
+ final String autoServerName = s;
+ final int autoServerPort = i;
+
ResourceLoadProgressGui.func_212970_a(this);
List<IResourcePack> list = this.field_110448_aq.func_198980_d().stream().map(ResourcePackInfo::func_195796_e).collect(Collectors.toList());
this.func_213268_a(new ResourceLoadProgressGui(this, this.field_110451_am.func_219537_a(Util.func_215072_e(), this, field_223714_G, list), (p_229990_2_) -> {
@@ -466,6 +467,14 @@
this.func_213256_aB();
}
+ if (net.minecraftforge.fml.client.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen
+ // FORGE: Move opening initial screen to after startup and events are enabled.
+ // Also Fixes MC-145102
+ if (autoServerName != null) {
+ this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, autoServerName, autoServerPort));
+ } else {
+ this.func_147108_a(new MainMenuScreen(true));
+ }
});
}, false));
}
@@ -505,7 +514,7 @@
}
private void func_229988_a_(Throwable p_229988_1_) {
- if (this.field_110448_aq.func_198980_d().size() > 1) {
+ if (this.field_110448_aq.func_198980_d().stream().anyMatch(e -> !e.func_195797_g())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any.
ITextComponent itextcomponent;
if (p_229988_1_ instanceof SimpleReloadableResourceManager.FailedPackException) {
itextcomponent = new StringTextComponent(((SimpleReloadableResourceManager.FailedPackException)p_229988_1_).func_230028_a().func_195762_a());
@@ -579,7 +588,7 @@
return Stream.of(Registry.field_212630_s.func_177774_c(p_213251_0_.func_77973_b()));
});
SearchTreeReloadable<ItemStack> searchtreereloadable = new SearchTreeReloadable<>((p_213235_0_) -> {
- return ItemTags.func_199903_a().func_199913_a(p_213235_0_.func_77973_b()).stream();
+ return p_213235_0_.func_77973_b().getTags().stream();
});
NonNullList<ItemStack> nonnulllist = NonNullList.func_191196_a();
@@ -667,13 +676,13 @@
Bootstrap.func_179870_a(p_71377_0_.func_71502_e());
if (p_71377_0_.func_71497_f() != null) {
Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_0_.func_71497_f());
- System.exit(-1);
+ net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-1);
} else if (p_71377_0_.func_147149_a(file2)) {
Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
- System.exit(-1);
+ net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-1);
} else {
Bootstrap.func_179870_a("#@?@# Game crashed! Crash report could not be saved. #@?@#");
- System.exit(-2);
+ net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-2);
}
}
@@ -682,6 +691,7 @@
return this.field_71474_y.field_211842_aO;
}
+ @Deprecated // Forge: Use selective refreshResources method in FMLClientHandler
public CompletableFuture<Void> func_213237_g() {
if (this.field_213276_aV != null) {
return this.field_213276_aV;
@@ -760,10 +770,6 @@
}
public void func_147108_a(@Nullable Screen p_147108_1_) {
- if (this.field_71462_r != null) {
- this.field_71462_r.removed();
- }
-
if (p_147108_1_ == null && this.field_71441_e == null) {
p_147108_1_ = new MainMenuScreen();
} else if (p_147108_1_ == null && this.field_71439_g.func_110143_aJ() <= 0.0F) {
@@ -774,6 +780,14 @@
}
}
+ Screen old = this.field_71462_r;
+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(p_147108_1_);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
+
+ p_147108_1_ = event.getGui();
+ if (old != null && p_147108_1_ != old)
+ old.removed();
+
if (p_147108_1_ instanceof MainMenuScreen || p_147108_1_ instanceof MultiplayerScreen) {
this.field_71474_y.field_74330_P = false;
this.field_71456_v.func_146158_b().func_146231_a(true);
@@ -905,11 +919,13 @@
RenderSystem.enableTexture();
this.field_71424_I.func_76319_b();
if (!this.field_71454_w) {
+ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickStart(this.field_71428_T.field_194147_b);
this.field_71424_I.func_219895_b("gameRenderer");
this.field_71460_t.func_195458_a(this.field_71445_n ? this.field_193996_ah : this.field_71428_T.field_194147_b, i, p_195542_1_);
this.field_71424_I.func_219895_b("toasts");
this.field_193034_aS.func_195625_a();
this.field_71424_I.func_76319_b();
+ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickEnd(this.field_71428_T.field_194147_b);
}
this.field_71424_I.func_219897_b();
@@ -976,7 +992,7 @@
Framebuffer framebuffer = this.func_147110_a();
framebuffer.func_216491_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l(), field_142025_a);
- this.field_71460_t.func_147704_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l());
+ if (this.field_71460_t!=null) this.field_71460_t.func_147704_a(this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l());
this.field_71417_B.func_198021_g();
}
@@ -1164,11 +1180,21 @@
if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.func_216346_c() == RayTraceResult.Type.BLOCK) {
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
BlockPos blockpos = blockraytraceresult.func_216350_a();
- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) {
+ if (!this.field_71441_e.func_175623_d(blockpos)) {
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.field_71474_y.field_74312_F, Hand.MAIN_HAND);
+ if (inputEvent.isCanceled()) {
+ if (inputEvent.shouldSwingHand()) {
+ this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult);
+ this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
+ }
+ return;
+ }
Direction direction = blockraytraceresult.func_216354_b();
if (this.field_71442_b.func_180512_c(blockpos, direction)) {
- this.field_71452_i.func_180532_a(blockpos, direction);
+ if (inputEvent.shouldSwingHand()) {
+ this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult);
this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
+ }
}
}
@@ -1187,6 +1213,8 @@
}
} else if (!this.field_71439_g.func_184838_M()) {
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.field_71474_y.field_74312_F, Hand.MAIN_HAND);
+ if (!inputEvent.isCanceled())
switch(this.field_71476_x.func_216346_c()) {
case ENTITY:
this.field_71442_b.func_78764_a(this.field_71439_g, ((EntityRayTraceResult)this.field_71476_x).func_216348_a());
@@ -1194,7 +1222,7 @@
case BLOCK:
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
BlockPos blockpos = blockraytraceresult.func_216350_a();
- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) {
+ if (!this.field_71441_e.func_175623_d(blockpos)) {
this.field_71442_b.func_180511_b(blockpos, blockraytraceresult.func_216354_b());
break;
}
@@ -1204,8 +1232,10 @@
}
this.field_71439_g.func_184821_cY();
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.field_71439_g);
}
+ if (inputEvent.shouldSwingHand())
this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
}
}
@@ -1220,6 +1250,11 @@
}
for(Hand hand : Hand.values()) {
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.field_71474_y.field_74313_G, hand);
+ if (inputEvent.isCanceled()) {
+ if (inputEvent.shouldSwingHand()) this.field_71439_g.func_184609_a(hand);
+ return;
+ }
ItemStack itemstack = this.field_71439_g.func_184586_b(hand);
if (this.field_71476_x != null) {
switch(this.field_71476_x.func_216346_c()) {
@@ -1233,6 +1268,7 @@
if (actionresulttype.func_226246_a_()) {
if (actionresulttype.func_226247_b_()) {
+ if (inputEvent.shouldSwingHand())
this.field_71439_g.func_184609_a(hand);
}
@@ -1245,6 +1281,7 @@
ActionResultType actionresulttype1 = this.field_71442_b.func_217292_a(this.field_71439_g, this.field_71441_e, hand, blockraytraceresult);
if (actionresulttype1.func_226246_a_()) {
if (actionresulttype1.func_226247_b_()) {
+ if (inputEvent.shouldSwingHand())
this.field_71439_g.func_184609_a(hand);
if (!itemstack.func_190926_b() && (itemstack.func_190916_E() != i || this.field_71442_b.func_78758_h())) {
this.field_71460_t.field_78516_c.func_187460_a(hand);
@@ -1260,6 +1297,9 @@
}
}
+ if (itemstack.func_190926_b() && (this.field_71476_x == null || this.field_71476_x.func_216346_c() == RayTraceResult.Type.MISS))
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.field_71439_g, hand);
+
if (!itemstack.func_190926_b()) {
ActionResultType actionresulttype2 = this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, hand);
if (actionresulttype2.func_226246_a_()) {
@@ -1286,6 +1326,8 @@
--this.field_71467_ac;
}
+ net.minecraftforge.fml.hooks.BasicEventHooks.onPreClientTick();
+
this.field_71424_I.func_76320_a("gui");
if (!this.field_71445_n) {
this.field_71456_v.func_73831_a();
@@ -1403,6 +1445,8 @@
this.field_71424_I.func_219895_b("keyboard");
this.field_195559_v.func_204870_b();
this.field_71424_I.func_76319_b();
+
+ net.minecraftforge.fml.hooks.BasicEventHooks.onPostClientTick();
}
private void func_184117_aA() {
@@ -1557,6 +1601,12 @@
this.func_147108_a(worldloadprogressscreen);
while(!this.field_71437_Z.func_71200_ad()) {
+ if (!net.minecraftforge.fml.StartupQuery.check() || this.field_71437_Z.func_71241_aa()) {
+ this.func_147108_a(null);
+ return;
+ } else if (this.field_71462_r == null) // if we're showing nothing, put the working screen back again
+ this.func_147108_a(worldloadprogressscreen);
+
worldloadprogressscreen.tick();
this.func_195542_b(false);
@@ -1577,11 +1627,17 @@
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()));
+ 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.
+ this.func_110432_I().setProperties(gameProfile.getProperties());
+ }
+ networkmanager.func_179290_a(new CLoginStartPacket(gameProfile));
this.field_71453_ak = networkmanager;
}
public void func_71403_a(ClientWorld p_71403_1_) {
+ if (field_71441_e != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e));
WorkingScreen workingscreen = new WorkingScreen();
workingscreen.func_200210_a(new TranslationTextComponent("connect.joining"));
this.func_213241_c(workingscreen);
@@ -1613,10 +1669,12 @@
IntegratedServer integratedserver = this.field_71437_Z;
this.field_71437_Z = null;
this.field_71460_t.func_190564_k();
+ net.minecraftforge.fml.client.ClientHooks.firePlayerLogout(this.field_71442_b, this.field_71439_g);
this.field_71442_b = null;
NarratorChatListener.field_193643_a.func_193642_b();
this.func_213241_c(p_213231_1_);
if (this.field_71441_e != null) {
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e));
if (integratedserver != null) {
while(!integratedserver.func_213201_w()) {
this.func_195542_b(false);
@@ -1627,6 +1685,7 @@
this.field_71456_v.func_181029_i();
this.field_71422_O = null;
this.field_71455_al = false;
+ net.minecraftforge.fml.client.ClientHooks.handleClientWorldClosing(field_71441_e);
this.field_213274_aO.func_216815_b();
}
@@ -1649,6 +1708,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_();
+ net.minecraftforge.client.MinecraftForgeClient.clearRenderCache();
}
public final boolean func_71355_q() {
@@ -1674,112 +1734,9 @@
private void func_147112_ai() {
if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) {
- boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d;
- TileEntity tileentity = null;
- RayTraceResult.Type raytraceresult$type = this.field_71476_x.func_216346_c();
- ItemStack itemstack;
- if (raytraceresult$type == RayTraceResult.Type.BLOCK) {
- BlockPos blockpos = ((BlockRayTraceResult)this.field_71476_x).func_216350_a();
- BlockState blockstate = this.field_71441_e.func_180495_p(blockpos);
- Block block = blockstate.func_177230_c();
- if (blockstate.func_196958_f()) {
- return;
- }
-
- itemstack = block.func_185473_a(this.field_71441_e, blockpos, blockstate);
- if (itemstack.func_190926_b()) {
- return;
- }
-
- if (flag && Screen.hasControlDown() && block.func_149716_u()) {
- tileentity = this.field_71441_e.func_175625_s(blockpos);
- }
- } else {
- if (raytraceresult$type != RayTraceResult.Type.ENTITY || !flag) {
- return;
- }
-
- Entity entity = ((EntityRayTraceResult)this.field_71476_x).func_216348_a();
- if (entity instanceof PaintingEntity) {
- itemstack = new ItemStack(Items.field_151159_an);
- } else if (entity instanceof LeashKnotEntity) {
- itemstack = new ItemStack(Items.field_151058_ca);
- } else if (entity instanceof ItemFrameEntity) {
- ItemFrameEntity itemframeentity = (ItemFrameEntity)entity;
- ItemStack itemstack1 = itemframeentity.func_82335_i();
- if (itemstack1.func_190926_b()) {
- itemstack = new ItemStack(Items.field_151160_bD);
- } else {
- itemstack = itemstack1.func_77946_l();
- }
- } else if (entity instanceof AbstractMinecartEntity) {
- AbstractMinecartEntity abstractminecartentity = (AbstractMinecartEntity)entity;
- Item item;
- switch(abstractminecartentity.func_184264_v()) {
- case FURNACE:
- item = Items.field_151109_aJ;
- break;
- case CHEST:
- item = Items.field_151108_aI;
- break;
- case TNT:
- item = Items.field_151142_bV;
- break;
- case HOPPER:
- item = Items.field_151140_bW;
- break;
- case COMMAND_BLOCK:
- item = Items.field_151095_cc;
- break;
- default:
- item = Items.field_151143_au;
- }
-
- itemstack = new ItemStack(item);
- } else if (entity instanceof BoatEntity) {
- itemstack = new ItemStack(((BoatEntity)entity).func_184455_j());
- } else if (entity instanceof ArmorStandEntity) {
- itemstack = new ItemStack(Items.field_179565_cj);
- } else if (entity instanceof EnderCrystalEntity) {
- itemstack = new ItemStack(Items.field_185158_cP);
- } else {
- SpawnEggItem spawneggitem = SpawnEggItem.func_200889_b(entity.func_200600_R());
- if (spawneggitem == null) {
- return;
- }
-
- itemstack = new ItemStack(spawneggitem);
- }
- }
-
- if (itemstack.func_190926_b()) {
- String s = "";
- if (raytraceresult$type == RayTraceResult.Type.BLOCK) {
- s = Registry.field_212618_g.func_177774_c(this.field_71441_e.func_180495_p(((BlockRayTraceResult)this.field_71476_x).func_216350_a()).func_177230_c()).toString();
- } else if (raytraceresult$type == RayTraceResult.Type.ENTITY) {
- s = Registry.field_212629_r.func_177774_c(((EntityRayTraceResult)this.field_71476_x).func_216348_a().func_200600_R()).toString();
- }
-
- field_147123_G.warn("Picking on: [{}] {} gave null item", raytraceresult$type, s);
- } else {
- PlayerInventory playerinventory = this.field_71439_g.field_71071_by;
- if (tileentity != null) {
- this.func_184119_a(itemstack, tileentity);
- }
-
- int i = playerinventory.func_184429_b(itemstack);
- if (flag) {
- playerinventory.func_184434_a(itemstack);
- this.field_71442_b.func_78761_a(this.field_71439_g.func_184586_b(Hand.MAIN_HAND), 36 + playerinventory.field_70461_c);
- } else if (i != -1) {
- if (PlayerInventory.func_184435_e(i)) {
- playerinventory.field_70461_c = i;
- } else {
- this.field_71442_b.func_187100_a(i);
- }
- }
-
- }
+ if (!net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.field_71474_y.field_74322_I, Hand.MAIN_HAND).isCanceled())
+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e);
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
}
}
@@ -1861,6 +1818,7 @@
return field_71432_P;
}
+ @Deprecated // Forge: Use selective scheduleResourceRefresh method in FMLClientHandler
public CompletableFuture<Void> func_213245_w() {
return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> {
return p_229993_0_;
@@ -1988,6 +1946,8 @@
}
public MusicTicker.MusicType func_147109_W() {
+ MusicTicker.MusicType type = this.field_71441_e == null || this.field_71441_e.field_73011_w == null ? null : this.field_71441_e.field_73011_w.getMusicType();
+ if (type != null) return type;
if (this.field_71462_r instanceof WinGameScreen) {
return MusicTicker.MusicType.CREDITS;
} else if (this.field_71439_g == null) {
@@ -2164,7 +2124,7 @@
supplier = func_228022_c_(supplier);
}
- return new ClientResourcePackInfo(p_228011_0_, p_228011_1_, supplier, p_228011_3_, p_228011_4_, p_228011_5_);
+ return new ClientResourcePackInfo(p_228011_0_, p_228011_1_, supplier, p_228011_3_, p_228011_4_, p_228011_5_, p_228011_3_.isHidden());
}
private static Supplier<IResourcePack> func_228021_b_(Supplier<IResourcePack> p_228021_0_) {
@@ -2182,4 +2142,12 @@
public void func_228020_b_(int p_228020_1_) {
this.field_175617_aL.func_229355_a_(p_228020_1_);
}
+
+ public ItemColors getItemColors() {
+ return this.field_184128_aI;
+ }
+
+ public SearchTreeManager getSearchTreeManager() {
+ return this.field_193995_ae;
+ }
}

View file

@ -1,12 +0,0 @@
--- a/net/minecraft/client/renderer/RenderTypeLookup.java
+++ b/net/minecraft/client/renderer/RenderTypeLookup.java
@@ -256,8 +259,7 @@
}
public static RenderType func_228394_b_(BlockState p_228394_0_) {
- RenderType rendertype = func_228390_a_(p_228394_0_);
- return rendertype == RenderType.func_228645_f_() ? Atlases.func_228784_i_() : Atlases.func_228783_h_();
+ return canRenderInLayer(p_228394_0_, RenderType.func_228645_f_()) ? Atlases.func_228784_i_() : Atlases.func_228783_h_();
}
public static RenderType func_228389_a_(ItemStack p_228389_0_) {

View file

@ -1,73 +0,0 @@
--- a/net/minecraft/world/Explosion.java
+++ b/net/minecraft/world/Explosion.java
@@ -54,6 +54,7 @@
private DamageSource field_199593_j;
private final List<BlockPos> field_77281_g = Lists.newArrayList();
private final Map<PlayerEntity, Vec3d> field_77288_k = Maps.newHashMap();
+ private final Vec3d position;
@OnlyIn(Dist.CLIENT)
public Explosion(World p_i45752_1_, @Nullable Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List<BlockPos> p_i45752_10_) {
@@ -76,6 +77,7 @@
this.field_77286_a = p_i50007_10_;
this.field_222260_b = p_i50007_11_;
this.field_199593_j = DamageSource.func_94539_a(this);
+ this.position = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d);
}
public static float func_222259_a(Vec3d p_222259_0_, Entity p_222259_1_) {
@@ -135,8 +137,8 @@
BlockPos blockpos = new BlockPos(d4, d6, d8);
BlockState blockstate = this.field_77287_j.func_180495_p(blockpos);
IFluidState ifluidstate = this.field_77287_j.func_204610_c(blockpos);
- if (!blockstate.func_196958_f() || !ifluidstate.func_206888_e()) {
- float f2 = Math.max(blockstate.func_177230_c().func_149638_a(), ifluidstate.func_210200_l());
+ if (!blockstate.isAir(this.field_77287_j, blockpos) || !ifluidstate.func_206888_e()) {
+ float f2 = Math.max(blockstate.getExplosionResistance(this.field_77287_j, blockpos, field_77283_e, this), ifluidstate.getExplosionResistance(this.field_77287_j, blockpos, field_77283_e, this));
if (this.field_77283_e != null) {
f2 = this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, blockstate, ifluidstate, f2);
}
@@ -166,6 +168,7 @@
int j2 = MathHelper.func_76128_c(this.field_77282_d - (double)f3 - 1.0D);
int j1 = MathHelper.func_76128_c(this.field_77282_d + (double)f3 + 1.0D);
List<Entity> list = this.field_77287_j.func_72839_b(this.field_77283_e, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1));
+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.field_77287_j, this, list, f3);
Vec3d vec3d = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d);
for(int k2 = 0; k2 < list.size(); ++k2) {
@@ -224,11 +227,11 @@
for(BlockPos blockpos : this.field_77281_g) {
BlockState blockstate = this.field_77287_j.func_180495_p(blockpos);
Block block = blockstate.func_177230_c();
- if (!blockstate.func_196958_f()) {
+ if (!blockstate.isAir(this.field_77287_j, blockpos)) {
BlockPos blockpos1 = blockpos.func_185334_h();
this.field_77287_j.func_217381_Z().func_76320_a("explosion_blocks");
- if (block.func_149659_a(this) && this.field_77287_j instanceof ServerWorld) {
- TileEntity tileentity = block.func_149716_u() ? this.field_77287_j.func_175625_s(blockpos) : null;
+ if (blockstate.canDropFromExplosion(this.field_77287_j, blockpos, this) && this.field_77287_j instanceof ServerWorld) {
+ TileEntity tileentity = blockstate.hasTileEntity() ? this.field_77287_j.func_175625_s(blockpos) : null;
LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_77287_j)).func_216023_a(this.field_77287_j.field_73012_v).func_216015_a(LootParameters.field_216286_f, blockpos).func_216015_a(LootParameters.field_216289_i, ItemStack.field_190927_a).func_216021_b(LootParameters.field_216288_h, tileentity).func_216021_b(LootParameters.field_216281_a, this.field_77283_e);
if (this.field_222260_b == Explosion.Mode.DESTROY) {
lootcontext$builder.func_216015_a(LootParameters.field_216290_j, this.field_77280_f);
@@ -239,8 +242,7 @@
});
}
- this.field_77287_j.func_180501_a(blockpos, Blocks.field_150350_a.func_176223_P(), 3);
- block.func_180652_a(this.field_77287_j, blockpos, this);
+ blockstate.onBlockExploded(this.field_77287_j, blockpos, this);
this.field_77287_j.func_217381_Z().func_76319_b();
}
}
@@ -311,6 +313,10 @@
return this.field_77281_g;
}
+ public Vec3d getPosition() {
+ return this.position;
+ }
+
public static enum Mode {
NONE,
BREAK,

View file

@ -1,11 +0,0 @@
--- a/net/minecraft/world/IBlockReader.java
+++ b/net/minecraft/world/IBlockReader.java
@@ -23,7 +23,7 @@
IFluidState func_204610_c(BlockPos p_204610_1_);
default int func_217298_h(BlockPos p_217298_1_) {
- return this.func_180495_p(p_217298_1_).func_185906_d();
+ return this.func_180495_p(p_217298_1_).getLightValue(this, p_217298_1_);
}
default int func_201572_C() {

View file

@ -1,22 +0,0 @@
--- a/net/minecraft/world/IWorld.java
+++ b/net/minecraft/world/IWorld.java
@@ -26,16 +26,16 @@
long func_72905_C();
default float func_130001_d() {
- return Dimension.field_111203_a[this.func_201675_m().func_76559_b(this.func_72912_H().func_76073_f())];
+ return this.func_201675_m().getCurrentMoonPhaseFactor(this.func_201672_e().func_72820_D());
}
default float func_72826_c(float p_72826_1_) {
- return this.func_201675_m().func_76563_a(this.func_72912_H().func_76073_f(), p_72826_1_);
+ return this.func_201675_m().func_76563_a(this.func_201672_e().func_72820_D(), p_72826_1_);
}
@OnlyIn(Dist.CLIENT)
default int func_72853_d() {
- return this.func_201675_m().func_76559_b(this.func_72912_H().func_76073_f());
+ return this.func_201675_m().func_76559_b(this.func_201672_e().func_72820_D());
}
ITickList<Block> func_205220_G_();

View file

@ -1,22 +0,0 @@
--- a/net/minecraft/world/IWorldReader.java
+++ b/net/minecraft/world/IWorldReader.java
@@ -57,7 +57,7 @@
}
default boolean func_175623_d(BlockPos p_175623_1_) {
- return this.func_180495_p(p_175623_1_).func_196958_f();
+ return this.func_180495_p(p_175623_1_).isAir(this, p_175623_1_);
}
default boolean func_175710_j(BlockPos p_175710_1_) {
@@ -148,6 +148,10 @@
return this.func_217354_b(p_175667_1_.func_177958_n() >> 4, p_175667_1_.func_177952_p() >> 4);
}
+ default boolean isAreaLoaded(BlockPos center, int range) {
+ return this.func_175707_a(center.func_177982_a(-range, -range, -range), center.func_177982_a(range, range, range));
+ }
+
@Deprecated
default boolean func_175707_a(BlockPos p_175707_1_, BlockPos p_175707_2_) {
return this.func_217344_a(p_175707_1_.func_177958_n(), p_175707_1_.func_177956_o(), p_175707_1_.func_177952_p(), p_175707_2_.func_177958_n(), p_175707_2_.func_177956_o(), p_175707_2_.func_177952_p());

View file

@ -1,11 +0,0 @@
--- a/net/minecraft/world/Teleporter.java
+++ b/net/minecraft/world/Teleporter.java
@@ -23,7 +23,7 @@
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.server.TicketType;
-public class Teleporter {
+public class Teleporter implements net.minecraftforge.common.util.ITeleporter {
protected final ServerWorld field_85192_a;
protected final Random field_77187_a;

View file

@ -1,29 +0,0 @@
--- a/net/minecraft/world/TrackedEntity.java
+++ b/net/minecraft/world/TrackedEntity.java
@@ -80,9 +80,8 @@
if (this.field_219461_c instanceof ItemFrameEntity && this.field_219472_n % 10 == 0) {
ItemFrameEntity itemframeentity = (ItemFrameEntity)this.field_219461_c;
ItemStack itemstack = itemframeentity.func_82335_i();
- if (itemstack.func_77973_b() instanceof FilledMapItem) {
- MapData mapdata = FilledMapItem.func_195950_a(itemstack, this.field_219460_b);
-
+ MapData mapdata = FilledMapItem.func_195950_a(itemstack, this.field_219460_b);
+ if (mapdata != null) {
for(ServerPlayerEntity serverplayerentity : this.field_219460_b.func_217369_A()) {
mapdata.func_76191_a(serverplayerentity, itemstack);
IPacket<?> ipacket = ((FilledMapItem)itemstack.func_77973_b()).func_150911_c(itemstack, this.field_219460_b, serverplayerentity);
@@ -186,12 +185,14 @@
public void func_219454_a(ServerPlayerEntity p_219454_1_) {
this.field_219461_c.func_184203_c(p_219454_1_);
p_219454_1_.func_152339_d(this.field_219461_c);
+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(this.field_219461_c, p_219454_1_);
}
public void func_219455_b(ServerPlayerEntity p_219455_1_) {
this.func_219452_a(p_219455_1_.field_71135_a::func_147359_a);
this.field_219461_c.func_184178_b(p_219455_1_);
p_219455_1_.func_184848_d(this.field_219461_c);
+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(this.field_219461_c, p_219455_1_);
}
public void func_219452_a(Consumer<IPacket<?>> p_219452_1_) {

View file

@ -1,517 +0,0 @@
--- a/net/minecraft/world/World.java
+++ b/net/minecraft/world/World.java
@@ -62,13 +62,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public abstract class World implements IWorld, AutoCloseable {
+public abstract class World extends net.minecraftforge.common.capabilities.CapabilityProvider<World> implements IWorld, AutoCloseable, net.minecraftforge.common.extensions.IForgeWorld {
protected static final Logger field_195596_d = LogManager.getLogger();
private static final Direction[] field_200007_a = Direction.values();
public final List<TileEntity> field_147482_g = Lists.newArrayList();
public final List<TileEntity> field_175730_i = Lists.newArrayList();
protected final List<TileEntity> field_147484_a = Lists.newArrayList();
- protected final List<TileEntity> field_147483_b = Lists.newArrayList();
+ protected final java.util.Set<TileEntity> field_147483_b = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>()); // Forge: faster "contains" makes removal much more efficient
private final Thread field_217407_c;
private int field_73008_k;
protected int field_73005_l = (new Random()).nextInt();
@@ -86,8 +86,12 @@
protected boolean field_147481_N;
private final WorldBorder field_175728_M;
private final BiomeManager field_226689_w_;
+ public boolean restoringBlockSnapshots = false;
+ public boolean captureBlockSnapshots = false;
+ public java.util.ArrayList<net.minecraftforge.common.util.BlockSnapshot> capturedBlockSnapshots = new java.util.ArrayList<net.minecraftforge.common.util.BlockSnapshot>();
protected World(WorldInfo p_i50005_1_, DimensionType p_i50005_2_, BiFunction<World, Dimension, AbstractChunkProvider> p_i50005_3_, IProfiler p_i50005_4_, boolean p_i50005_5_) {
+ super(World.class);
this.field_72984_F = p_i50005_4_;
this.field_72986_A = p_i50005_1_;
this.field_73011_w = p_i50005_2_.func_218270_a(this);
@@ -158,23 +162,51 @@
} else {
Chunk chunk = this.func_175726_f(p_180501_1_);
Block block = p_180501_2_.func_177230_c();
+
+ p_180501_1_ = p_180501_1_.func_185334_h(); // Forge - prevent mutable BlockPos leaks
+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null;
+ if (this.captureBlockSnapshots && !this.field_72995_K) {
+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, p_180501_1_, p_180501_3_);
+ this.capturedBlockSnapshots.add(blockSnapshot);
+ }
+
+ BlockState old = func_180495_p(p_180501_1_);
+ int oldLight = old.getLightValue(this, p_180501_1_);
+ int oldOpacity = old.func_200016_a(this, p_180501_1_);
+
BlockState blockstate = chunk.func_177436_a(p_180501_1_, p_180501_2_, (p_180501_3_ & 64) != 0);
if (blockstate == null) {
+ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot);
return false;
} else {
BlockState blockstate1 = this.func_180495_p(p_180501_1_);
- if (blockstate1 != blockstate && (blockstate1.func_200016_a(this, p_180501_1_) != blockstate.func_200016_a(this, p_180501_1_) || blockstate1.func_185906_d() != blockstate.func_185906_d() || blockstate1.func_215691_g() || blockstate.func_215691_g())) {
+ if (blockstate1 != blockstate && (blockstate1.func_200016_a(this, p_180501_1_) != oldOpacity || blockstate1.getLightValue(this, p_180501_1_) != oldLight || blockstate1.func_215691_g() || blockstate.func_215691_g())) {
this.field_72984_F.func_76320_a("queueCheckLight");
this.func_72863_F().func_212863_j_().func_215568_a(p_180501_1_);
this.field_72984_F.func_76319_b();
}
+ if (blockSnapshot == null) { // Don't notify clients or update physics while capturing blockstates
+ this.markAndNotifyBlock(p_180501_1_, chunk, blockstate, p_180501_2_, p_180501_3_);
+ }
+ return true;
+ }
+ }
+ }
+
+ // Split off from original setBlockState(BlockPos, BlockState, int) method in order to directly send client and physic updates
+ public void markAndNotifyBlock(BlockPos p_180501_1_, @Nullable Chunk chunk, BlockState blockstate, BlockState p_180501_2_, int p_180501_3_)
+ {
+ Block block = p_180501_2_.func_177230_c();
+ BlockState blockstate1 = func_180495_p(p_180501_1_);
+ {
+ {
if (blockstate1 == p_180501_2_) {
if (blockstate != blockstate1) {
this.func_225319_b(p_180501_1_, blockstate, blockstate1);
}
- if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && (this.field_72995_K || chunk.func_217321_u() != null && chunk.func_217321_u().func_219065_a(ChunkHolder.LocationType.TICKING))) {
+ if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && (this.field_72995_K || chunk == null || chunk.func_217321_u() != null && chunk.func_217321_u().func_219065_a(ChunkHolder.LocationType.TICKING))) {
this.func_184138_a(p_180501_1_, blockstate, p_180501_2_, p_180501_3_);
}
@@ -194,8 +226,6 @@
this.func_217393_a(p_180501_1_, blockstate, blockstate1);
}
-
- return true;
}
}
}
@@ -210,13 +240,13 @@
public boolean func_225521_a_(BlockPos p_225521_1_, boolean p_225521_2_, @Nullable Entity p_225521_3_) {
BlockState blockstate = this.func_180495_p(p_225521_1_);
- if (blockstate.func_196958_f()) {
+ if (blockstate.isAir(this, p_225521_1_)) {
return false;
} else {
IFluidState ifluidstate = this.func_204610_c(p_225521_1_);
this.func_217379_c(2001, p_225521_1_, Block.func_196246_j(blockstate));
if (p_225521_2_) {
- TileEntity tileentity = blockstate.func_177230_c().func_149716_u() ? this.func_175625_s(p_225521_1_) : null;
+ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_225521_1_) : null;
Block.func_220054_a(blockstate, this, p_225521_1_, tileentity, p_225521_3_, ItemStack.field_190927_a);
}
@@ -241,6 +271,8 @@
}
public void func_195593_d(BlockPos p_195593_1_, Block p_195593_2_) {
+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_195593_1_, this.func_180495_p(p_195593_1_), java.util.EnumSet.allOf(Direction.class), false).isCanceled())
+ return;
this.func_190524_a(p_195593_1_.func_177976_e(), p_195593_2_, p_195593_1_);
this.func_190524_a(p_195593_1_.func_177974_f(), p_195593_2_, p_195593_1_);
this.func_190524_a(p_195593_1_.func_177977_b(), p_195593_2_, p_195593_1_);
@@ -250,6 +282,11 @@
}
public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, Direction p_175695_3_) {
+ java.util.EnumSet<Direction> directions = java.util.EnumSet.allOf(Direction.class);
+ directions.remove(p_175695_3_);
+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_175695_1_, this.func_180495_p(p_175695_1_), directions, false).isCanceled())
+ return;
+
if (p_175695_3_ != Direction.WEST) {
this.func_190524_a(p_175695_1_.func_177976_e(), p_175695_2_, p_175695_1_);
}
@@ -287,9 +324,9 @@
CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block being updated");
crashreportcategory.func_189529_a("Source block type", () -> {
try {
- return String.format("ID #%s (%s // %s)", Registry.field_212618_g.func_177774_c(p_190524_2_), p_190524_2_.func_149739_a(), p_190524_2_.getClass().getCanonicalName());
+ return String.format("ID #%s (%s // %s)", p_190524_2_.getRegistryName(), p_190524_2_.func_149739_a(), p_190524_2_.getClass().getCanonicalName());
} catch (Throwable var2) {
- return "ID #" + Registry.field_212618_g.func_177774_c(p_190524_2_);
+ return "ID #" + p_190524_2_.getRegistryName();
}
});
CrashReportCategory.func_175750_a(crashreportcategory, p_190524_1_, blockstate);
@@ -336,7 +373,7 @@
}
public boolean func_72935_r() {
- return this.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ && this.field_73008_k < 4;
+ return this.field_73011_w.isDaytime();
}
public boolean func_226690_K_() {
@@ -373,10 +410,12 @@
}
public boolean func_175700_a(TileEntity p_175700_1_) {
+ if (p_175700_1_.func_145831_w() != this) p_175700_1_.func_226984_a_(this, p_175700_1_.func_174877_v()); // Forge - set the world early as vanilla doesn't set it until next tick
if (this.field_147481_N) {
field_195596_d.error("Adding block entity while ticking: {} @ {}", () -> {
return Registry.field_212626_o.func_177774_c(p_175700_1_.func_200662_C());
}, p_175700_1_::func_174877_v);
+ return field_147484_a.add(p_175700_1_); // Forge: wait to add new TE if we're currently processing existing ones
}
boolean flag = this.field_147482_g.add(p_175700_1_);
@@ -384,6 +423,8 @@
this.field_175730_i.add(p_175700_1_);
}
+ p_175700_1_.onLoad();
+
if (this.field_72995_K) {
BlockPos blockpos = p_175700_1_.func_174877_v();
BlockState blockstate = this.func_180495_p(blockpos);
@@ -395,6 +436,7 @@
public void func_147448_a(Collection<TileEntity> p_147448_1_) {
if (this.field_147481_N) {
+ p_147448_1_.stream().filter(te -> te.func_145831_w() != this).forEach(te -> te.func_226984_a_(this, te.func_174877_v())); // Forge - set the world early as vanilla doesn't set it until next tick
this.field_147484_a.addAll(p_147448_1_);
} else {
for(TileEntity tileentity : p_147448_1_) {
@@ -407,13 +449,14 @@
public void func_217391_K() {
IProfiler iprofiler = this.func_217381_Z();
iprofiler.func_76320_a("blockEntities");
+ this.field_147481_N = true;// Forge: Move above remove to prevent CMEs
if (!this.field_147483_b.isEmpty()) {
+ this.field_147483_b.forEach(e -> e.onChunkUnloaded());
this.field_175730_i.removeAll(this.field_147483_b);
this.field_147482_g.removeAll(this.field_147483_b);
this.field_147483_b.clear();
}
- this.field_147481_N = true;
Iterator<TileEntity> iterator = this.field_175730_i.iterator();
while(iterator.hasNext()) {
@@ -422,8 +465,9 @@
BlockPos blockpos = tileentity.func_174877_v();
if (this.field_73020_y.func_222866_a(blockpos) && this.func_175723_af().func_177746_a(blockpos)) {
try {
+ net.minecraftforge.server.timings.TimeTracker.TILE_ENTITY_UPDATE.trackStart(tileentity);
iprofiler.func_194340_a(() -> {
- return String.valueOf((Object)TileEntityType.func_200969_a(tileentity.func_200662_C()));
+ return String.valueOf(tileentity.func_200662_C().getRegistryName());
});
if (tileentity.func_200662_C().func_223045_a(this.func_180495_p(blockpos).func_177230_c())) {
((ITickableTileEntity)tileentity).func_73660_a();
@@ -436,8 +480,16 @@
CrashReport crashreport = CrashReport.func_85055_a(throwable, "Ticking block entity");
CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block entity being ticked");
tileentity.func_145828_a(crashreportcategory);
+ if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringTileEntities.get()) {
+ LogManager.getLogger().fatal("{}", crashreport.func_71502_e());
+ tileentity.func_145843_s();
+ this.func_175713_t(tileentity.func_174877_v());
+ } else
throw new ReportedException(crashreport);
}
+ finally {
+ net.minecraftforge.server.timings.TimeTracker.TILE_ENTITY_UPDATE.trackEnd(tileentity);
+ }
}
}
@@ -445,7 +497,10 @@
iterator.remove();
this.field_147482_g.remove(tileentity);
if (this.func_175667_e(tileentity.func_174877_v())) {
- this.func_175726_f(tileentity.func_174877_v()).func_177425_e(tileentity.func_174877_v());
+ //Forge: Bugfix: If we set the tile entity it immediately sets it in the chunk, so we could be desyned
+ Chunk chunk = this.func_175726_f(tileentity.func_174877_v());
+ if (chunk.func_177424_a(tileentity.func_174877_v(), Chunk.CreateEntityType.CHECK) == tileentity)
+ chunk.func_177425_e(tileentity.func_174877_v());
}
}
}
@@ -477,12 +532,15 @@
public void func_217390_a(Consumer<Entity> p_217390_1_, Entity p_217390_2_) {
try {
+ net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackStart(p_217390_2_);
p_217390_1_.accept(p_217390_2_);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.func_85055_a(throwable, "Ticking entity");
CrashReportCategory crashreportcategory = crashreport.func_85058_a("Entity being ticked");
p_217390_2_.func_85029_a(crashreportcategory);
throw new ReportedException(crashreport);
+ } finally {
+ net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackEnd(p_217390_2_);
}
}
@@ -499,7 +557,7 @@
for(int l1 = k; l1 < l; ++l1) {
for(int i2 = i1; i2 < j1; ++i2) {
BlockState blockstate = this.func_180495_p(blockpos$pooledmutable.func_181079_c(k1, l1, i2));
- if (!blockstate.func_196958_f()) {
+ if (!blockstate.isAir(this, blockpos$pooledmutable)) {
boolean flag = true;
return flag;
}
@@ -523,8 +581,8 @@
for(int k1 = i; k1 < j; ++k1) {
for(int l1 = k; l1 < l; ++l1) {
for(int i2 = i1; i2 < j1; ++i2) {
- Block block = this.func_180495_p(blockpos$pooledmutable.func_181079_c(k1, l1, i2)).func_177230_c();
- if (block == Blocks.field_150480_ab || block == Blocks.field_150353_l) {
+ BlockState state = this.func_180495_p(blockpos$pooledmutable.func_181079_c(k1, l1, i2));
+ if (state.isBurning(this, blockpos$pooledmutable)) {
boolean flag = true;
return flag;
}
@@ -594,6 +652,7 @@
if (p_217401_2_ != null) {
explosion.func_199592_a(p_217401_2_);
}
+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion;
explosion.func_77278_a();
explosion.func_77279_a(true);
@@ -654,6 +713,7 @@
public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_) {
if (!func_189509_E(p_175690_1_)) {
+ p_175690_1_ = p_175690_1_.func_185334_h(); // Forge - prevent mutable BlockPos leaks
if (p_175690_2_ != null && !p_175690_2_.func_145837_r()) {
if (this.field_147481_N) {
p_175690_2_.func_226984_a_(this, p_175690_1_);
@@ -669,7 +729,8 @@
this.field_147484_a.add(p_175690_2_);
} else {
- this.func_175726_f(p_175690_1_).func_177426_a(p_175690_1_, p_175690_2_);
+ Chunk chunk = this.func_175726_f(p_175690_1_);
+ if (chunk != null) chunk.func_177426_a(p_175690_1_, p_175690_2_);
this.func_175700_a(p_175690_2_);
}
}
@@ -682,6 +743,8 @@
if (tileentity != null && this.field_147481_N) {
tileentity.func_145843_s();
this.field_147484_a.remove(tileentity);
+ if (!(tileentity instanceof ITickableTileEntity)) //Forge: If they are not tickable they wont be removed in the update loop.
+ this.field_147482_g.remove(tileentity);
} else {
if (tileentity != null) {
this.field_147484_a.remove(tileentity);
@@ -691,7 +754,7 @@
this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_);
}
-
+ this.func_175666_e(p_175713_1_, func_180495_p(p_175713_1_).func_177230_c()); //Notify neighbors of changes
}
public boolean func_195588_v(BlockPos p_195588_1_) {
@@ -716,9 +779,14 @@
public void func_72891_a(boolean p_72891_1_, boolean p_72891_2_) {
this.func_72863_F().func_217203_a(p_72891_1_, p_72891_2_);
+ this.func_201675_m().setAllowedSpawnTypes(p_72891_1_, p_72891_2_);
}
protected void func_72947_a() {
+ this.field_73011_w.calculateInitialWeather();
+ }
+
+ public void calculateInitialWeatherBody() {
if (this.field_72986_A.func_76059_o()) {
this.field_73004_o = 1.0F;
if (this.field_72986_A.func_76061_m()) {
@@ -740,10 +808,10 @@
public List<Entity> func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate<? super Entity> p_175674_3_) {
this.func_217381_Z().func_230035_c_("getEntities");
List<Entity> list = Lists.newArrayList();
- int i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - 2.0D) / 16.0D);
- int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + 2.0D) / 16.0D);
- int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - 2.0D) / 16.0D);
- int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + 2.0D) / 16.0D);
+ int i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - getMaxEntityRadius()) / 16.0D);
+ int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + getMaxEntityRadius()) / 16.0D);
+ int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - getMaxEntityRadius()) / 16.0D);
+ int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + getMaxEntityRadius()) / 16.0D);
for(int i1 = i; i1 <= j; ++i1) {
for(int j1 = k; j1 <= l; ++j1) {
@@ -759,10 +827,10 @@
public <T extends Entity> List<T> func_217394_a(@Nullable EntityType<T> p_217394_1_, AxisAlignedBB p_217394_2_, Predicate<? super T> p_217394_3_) {
this.func_217381_Z().func_230035_c_("getEntities");
- int i = MathHelper.func_76128_c((p_217394_2_.field_72340_a - 2.0D) / 16.0D);
- int j = MathHelper.func_76143_f((p_217394_2_.field_72336_d + 2.0D) / 16.0D);
- int k = MathHelper.func_76128_c((p_217394_2_.field_72339_c - 2.0D) / 16.0D);
- int l = MathHelper.func_76143_f((p_217394_2_.field_72334_f + 2.0D) / 16.0D);
+ int i = MathHelper.func_76128_c((p_217394_2_.field_72340_a - getMaxEntityRadius()) / 16.0D);
+ int j = MathHelper.func_76143_f((p_217394_2_.field_72336_d + getMaxEntityRadius()) / 16.0D);
+ int k = MathHelper.func_76128_c((p_217394_2_.field_72339_c - getMaxEntityRadius()) / 16.0D);
+ int l = MathHelper.func_76143_f((p_217394_2_.field_72334_f + getMaxEntityRadius()) / 16.0D);
List<T> list = Lists.newArrayList();
for(int i1 = i; i1 < j; ++i1) {
@@ -779,10 +847,10 @@
public <T extends Entity> List<T> func_175647_a(Class<? extends T> p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate<? super T> p_175647_3_) {
this.func_217381_Z().func_230035_c_("getEntities");
- int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - 2.0D) / 16.0D);
- int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + 2.0D) / 16.0D);
- int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - 2.0D) / 16.0D);
- int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + 2.0D) / 16.0D);
+ int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - getMaxEntityRadius()) / 16.0D);
+ int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + getMaxEntityRadius()) / 16.0D);
+ int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - getMaxEntityRadius()) / 16.0D);
+ int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + getMaxEntityRadius()) / 16.0D);
List<T> list = Lists.newArrayList();
AbstractChunkProvider abstractchunkprovider = this.func_72863_F();
@@ -800,10 +868,10 @@
public <T extends Entity> List<T> func_225316_b(Class<? extends T> p_225316_1_, AxisAlignedBB p_225316_2_, @Nullable Predicate<? super T> p_225316_3_) {
this.func_217381_Z().func_230035_c_("getLoadedEntities");
- int i = MathHelper.func_76128_c((p_225316_2_.field_72340_a - 2.0D) / 16.0D);
- int j = MathHelper.func_76143_f((p_225316_2_.field_72336_d + 2.0D) / 16.0D);
- int k = MathHelper.func_76128_c((p_225316_2_.field_72339_c - 2.0D) / 16.0D);
- int l = MathHelper.func_76143_f((p_225316_2_.field_72334_f + 2.0D) / 16.0D);
+ int i = MathHelper.func_76128_c((p_225316_2_.field_72340_a - getMaxEntityRadius()) / 16.0D);
+ int j = MathHelper.func_76143_f((p_225316_2_.field_72336_d + getMaxEntityRadius()) / 16.0D);
+ int k = MathHelper.func_76128_c((p_225316_2_.field_72339_c - getMaxEntityRadius()) / 16.0D);
+ int l = MathHelper.func_76143_f((p_225316_2_.field_72334_f + getMaxEntityRadius()) / 16.0D);
List<T> list = Lists.newArrayList();
AbstractChunkProvider abstractchunkprovider = this.func_72863_F();
@@ -830,7 +898,8 @@
}
public int func_181545_F() {
- return 63;
+ // FORGE: Allow modded dimensions to customize this value via Dimension
+ return this.func_201675_m().getSeaLevel();
}
public World func_201672_e() {
@@ -878,7 +947,7 @@
public int func_175651_c(BlockPos p_175651_1_, Direction p_175651_2_) {
BlockState blockstate = this.func_180495_p(p_175651_1_);
- return blockstate.func_215686_e(this, p_175651_1_) ? this.func_175676_y(p_175651_1_) : blockstate.func_185911_a(this, p_175651_1_, p_175651_2_);
+ return blockstate.shouldCheckWeakPower(this, p_175651_1_, p_175651_2_) ? this.func_175676_y(p_175651_1_) : blockstate.func_185911_a(this, p_175651_1_, p_175651_2_);
}
public boolean func_175640_z(BlockPos p_175640_1_) {
@@ -923,7 +992,7 @@
}
public long func_72905_C() {
- return this.field_72986_A.func_76063_b();
+ return this.field_73011_w.getSeed();
}
public long func_82737_E() {
@@ -931,11 +1000,11 @@
}
public long func_72820_D() {
- return this.field_72986_A.func_76073_f();
+ return this.field_73011_w.getWorldTime();
}
public void func_72877_b(long p_72877_1_) {
- this.field_72986_A.func_76068_b(p_72877_1_);
+ this.field_73011_w.setWorldTime(p_72877_1_);
}
protected void func_217389_a() {
@@ -947,7 +1016,7 @@
}
public BlockPos func_175694_M() {
- BlockPos blockpos = new BlockPos(this.field_72986_A.func_76079_c(), this.field_72986_A.func_76075_d(), this.field_72986_A.func_76074_e());
+ BlockPos blockpos = this.field_73011_w.getSpawnPoint();
if (!this.func_175723_af().func_177746_a(blockpos)) {
blockpos = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, new BlockPos(this.func_175723_af().func_177731_f(), 0.0D, this.func_175723_af().func_177721_g()));
}
@@ -956,10 +1025,14 @@
}
public void func_175652_B(BlockPos p_175652_1_) {
- this.field_72986_A.func_176143_a(p_175652_1_);
+ this.field_73011_w.setSpawnPoint(p_175652_1_);
}
public boolean func_175660_a(PlayerEntity p_175660_1_, BlockPos p_175660_2_) {
+ return field_73011_w.canMineBlock(p_175660_1_, p_175660_2_);
+ }
+
+ public boolean canMineBlockBody(PlayerEntity player, BlockPos pos) {
return true;
}
@@ -1027,8 +1100,7 @@
}
public boolean func_180502_D(BlockPos p_180502_1_) {
- Biome biome = this.func_226691_t_(p_180502_1_);
- return biome.func_76736_e();
+ return this.field_73011_w.isHighHumidity(p_180502_1_);
}
@Nullable
@@ -1042,7 +1114,7 @@
}
public int func_72940_L() {
- return this.field_73011_w.func_177495_o() ? 128 : 256;
+ return this.field_73011_w.getActualHeight();
}
public CrashReportCategory func_72914_a(CrashReport p_72914_1_) {
@@ -1073,16 +1145,15 @@
public abstract Scoreboard func_96441_U();
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) {
- for(Direction direction : Direction.Plane.HORIZONTAL) {
+ for(Direction direction : Direction.values()) { //Forge: TODO: change to VALUES once ATed
BlockPos blockpos = p_175666_1_.func_177972_a(direction);
if (this.func_175667_e(blockpos)) {
BlockState blockstate = this.func_180495_p(blockpos);
- if (blockstate.func_177230_c() == Blocks.field_196762_fd) {
- blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false);
- } else if (blockstate.func_215686_e(this, blockpos)) {
+ blockstate.onNeighborChange(this, blockpos, p_175666_1_);
+ if (blockstate.func_215686_e(this, blockpos)) {
blockpos = blockpos.func_177972_a(direction);
blockstate = this.func_180495_p(blockpos);
- if (blockstate.func_177230_c() == Blocks.field_196762_fd) {
+ if (blockstate.getWeakChanges(this, blockpos)) {
blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false);
}
}
@@ -1150,4 +1221,16 @@
public BiomeManager func_225523_d_() {
return this.field_226689_w_;
}
+
+ private double maxEntityRadius = 2.0D;
+ @Override
+ public double getMaxEntityRadius() {
+ return maxEntityRadius;
+ }
+ @Override
+ public double increaseMaxEntityRadius(double value) {
+ if (value > maxEntityRadius)
+ maxEntityRadius = value;
+ return maxEntityRadius;
+ }
}

View file

@ -1,47 +0,0 @@
--- a/net/minecraft/world/WorldType.java
+++ b/net/minecraft/world/WorldType.java
@@ -4,7 +4,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class WorldType {
+public class WorldType implements net.minecraftforge.common.extensions.IForgeWorldType {
public static WorldType[] field_77139_a = new WorldType[16];
public static final WorldType field_77137_b = (new WorldType(0, "default", 1)).func_77129_f();
public static final WorldType field_77138_c = (new WorldType(1, "flat")).func_205392_a(true);
@@ -23,6 +23,10 @@
private boolean field_151361_l;
private boolean field_205395_p;
+ public WorldType(String name) {
+ this(getNextID(), name);
+ }
+
private WorldType(int p_i1959_1_, String p_i1959_2_) {
this(p_i1959_1_, p_i1959_2_, p_i1959_2_, 0);
}
@@ -32,6 +36,7 @@
}
private WorldType(int p_i49778_1_, String p_i49778_2_, String p_i49778_3_, int p_i49778_4_) {
+ if (p_i49778_2_.length() > 16 && field_180272_g != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + p_i49778_2_);
this.field_77133_f = p_i49778_2_;
this.field_211890_l = p_i49778_3_;
this.field_77134_g = p_i49778_4_;
@@ -40,6 +45,16 @@
field_77139_a[p_i49778_1_] = this;
}
+ private static int getNextID() {
+ for (int x = 0; x < field_77139_a.length; x++) {
+ if (field_77139_a[x] == null)
+ return x;
+ }
+ int old = field_77139_a.length;
+ field_77139_a = java.util.Arrays.copyOf(field_77139_a, old + 16);
+ return old;
+ }
+
public String func_211888_a() {
return this.field_77133_f;
}

View file

@ -1,81 +0,0 @@
--- a/net/minecraft/world/gen/layer/BiomeLayer.java
+++ b/net/minecraft/world/gen/layer/BiomeLayer.java
@@ -23,17 +23,33 @@
private static final int field_202740_n = Registry.field_212624_m.func_148757_b(Biomes.field_76780_h);
private static final int field_202741_o = Registry.field_212624_m.func_148757_b(Biomes.field_76768_g);
private static final int field_202742_p = Registry.field_212624_m.func_148757_b(Biomes.field_150584_S);
- private static final int[] field_202743_q = new int[]{field_202728_b, field_202730_d, field_202729_c, field_202740_n, field_202736_j, field_202741_o};
- private static final int[] field_202744_r = new int[]{field_202728_b, field_202728_b, field_202728_b, field_202739_m, field_202739_m, field_202736_j};
- private static final int[] field_202745_s = new int[]{field_202730_d, field_202738_l, field_202729_c, field_202736_j, field_202727_a, field_202740_n};
- private static final int[] field_202746_t = new int[]{field_202730_d, field_202729_c, field_202741_o, field_202736_j};
- private static final int[] field_202747_u = new int[]{field_202731_e, field_202731_e, field_202731_e, field_202742_p};
private final int field_227472_v_;
- private int[] field_151623_c = field_202744_r;
+ @SuppressWarnings("unchecked")
+ private java.util.List<net.minecraftforge.common.BiomeManager.BiomeEntry>[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length];
public BiomeLayer(WorldType p_i225882_1_, int p_i225882_2_) {
+ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) {
+ com.google.common.collect.ImmutableList<net.minecraftforge.common.BiomeManager.BiomeEntry> biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type);
+ int idx = type.ordinal();
+
+ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList<net.minecraftforge.common.BiomeManager.BiomeEntry>();
+ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd);
+ }
+
+ int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.DESERT.ordinal();
+
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76769_d, 30));
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_150588_X, 20));
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76772_c, 10));
+
if (p_i225882_1_ == WorldType.field_77136_e) {
- this.field_151623_c = field_202743_q;
+ biomes[desertIdx].clear();
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76769_d, 10));
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76767_f, 10));
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76770_e, 10));
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76780_h, 10));
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76772_c, 10));
+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.field_76768_g, 10));
this.field_227472_v_ = -1;
} else {
this.field_227472_v_ = p_i225882_2_;
@@ -54,21 +70,21 @@
return p_202726_1_.func_202696_a(3) == 0 ? field_202733_g : field_202734_h;
}
- return this.field_151623_c[p_202726_1_.func_202696_a(this.field_151623_c.length)];
+ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT, p_202726_1_).biome);
case 2:
if (i > 0) {
return field_202732_f;
}
- return field_202745_s[p_202726_1_.func_202696_a(field_202745_s.length)];
+ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM, p_202726_1_).biome);
case 3:
if (i > 0) {
return field_202737_k;
}
- return field_202746_t[p_202726_1_.func_202696_a(field_202746_t.length)];
+ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL, p_202726_1_).biome);
case 4:
- return field_202747_u[p_202726_1_.func_202696_a(field_202747_u.length)];
+ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY, p_202726_1_).biome);
default:
return field_202735_i;
}
@@ -77,4 +93,11 @@
}
}
}
+
+ protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType type, INoiseRandom context) {
+ java.util.List<net.minecraftforge.common.BiomeManager.BiomeEntry> biomeList = biomes[type.ordinal()];
+ int totalWeight = net.minecraft.util.WeightedRandom.func_76272_a(biomeList);
+ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type)?context.func_202696_a(totalWeight):context.func_202696_a(totalWeight / 10) * 10;
+ return (net.minecraftforge.common.BiomeManager.BiomeEntry)net.minecraft.util.WeightedRandom.func_180166_a(biomeList, weight);
+ }
}

View file

@ -1,53 +0,0 @@
--- a/net/minecraft/world/server/ChunkHolder.java
+++ b/net/minecraft/world/server/ChunkHolder.java
@@ -136,7 +136,7 @@
Chunk chunk = this.func_219298_c();
if (chunk != null) {
this.field_219322_q |= 1 << (p_219279_2_ >> 4);
- if (this.field_219321_p < 64) {
+ { //Forge; Cache everything, so always run
short short1 = (short)(p_219279_1_ << 12 | p_219279_3_ << 8 | p_219279_2_);
for(int i = 0; i < this.field_219321_p; ++i) {
@@ -145,6 +145,8 @@
}
}
+ if (this.field_219321_p == this.field_219320_o.length)
+ this.field_219320_o = java.util.Arrays.copyOf(this.field_219320_o, this.field_219320_o.length << 1);
this.field_219320_o[this.field_219321_p++] = short1;
}
@@ -167,7 +169,7 @@
public void func_219274_a(Chunk p_219274_1_) {
if (this.field_219321_p != 0 || this.field_219325_t != 0 || this.field_219324_s != 0) {
World world = p_219274_1_.func_177412_p();
- if (this.field_219321_p == 64) {
+ if (this.field_219321_p >= net.minecraftforge.common.ForgeConfig.SERVER.clumpingThreshold.get()) {
this.field_219323_r = -1;
}
@@ -190,20 +192,19 @@
int k = (this.field_219320_o[0] >> 8 & 15) + this.field_219319_n.field_77275_b * 16;
BlockPos blockpos = new BlockPos(l, j1, k);
this.func_219293_a(new SChangeBlockPacket(world, blockpos), false);
- if (world.func_180495_p(blockpos).func_177230_c().func_149716_u()) {
+ if (world.func_180495_p(blockpos).hasTileEntity()) {
this.func_219305_a(world, blockpos);
}
- } else if (this.field_219321_p == 64) {
+ } else if (this.field_219321_p >= net.minecraftforge.common.ForgeConfig.SERVER.clumpingThreshold.get()) {
this.func_219293_a(new SChunkDataPacket(p_219274_1_, this.field_219322_q), false);
} else if (this.field_219321_p != 0) {
this.func_219293_a(new SMultiBlockChangePacket(this.field_219321_p, this.field_219320_o, p_219274_1_), false);
-
for(int i1 = 0; i1 < this.field_219321_p; ++i1) {
int k1 = (this.field_219320_o[i1] >> 12 & 15) + this.field_219319_n.field_77276_a * 16;
int l1 = this.field_219320_o[i1] & 255;
int i2 = (this.field_219320_o[i1] >> 8 & 15) + this.field_219319_n.field_77275_b * 16;
BlockPos blockpos1 = new BlockPos(k1, l1, i2);
- if (world.func_180495_p(blockpos1).func_177230_c().func_149716_u()) {
+ if (world.func_180495_p(blockpos1).hasTileEntity()) {
this.func_219305_a(world, blockpos1);
}
}

View file

@ -1,24 +0,0 @@
--- a/net/minecraft/world/server/ServerMultiWorld.java
+++ b/net/minecraft/world/server/ServerMultiWorld.java
@@ -10,11 +10,19 @@
import net.minecraft.world.storage.SaveHandler;
public class ServerMultiWorld extends ServerWorld {
+ private final ServerWorld delegate;
+ private final IBorderListener borderListener;
+
public ServerMultiWorld(ServerWorld p_i50708_1_, MinecraftServer p_i50708_2_, Executor p_i50708_3_, SaveHandler p_i50708_4_, DimensionType p_i50708_5_, IProfiler p_i50708_6_, IChunkStatusListener p_i50708_7_) {
super(p_i50708_2_, p_i50708_3_, p_i50708_4_, new DerivedWorldInfo(p_i50708_1_.func_72912_H()), p_i50708_5_, p_i50708_6_, p_i50708_7_);
- p_i50708_1_.func_175723_af().func_177737_a(new IBorderListener.Impl(this.func_175723_af()));
+ this.delegate = p_i50708_1_;
+ this.borderListener = new IBorderListener.Impl(this.func_175723_af());
+ p_i50708_1_.func_175723_af().func_177737_a(this.borderListener);
}
- protected void func_217389_a() {
+ @Override
+ public void close() throws java.io.IOException {
+ super.close();
+ this.delegate.func_175723_af().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak.
}
}

View file

@ -1,324 +0,0 @@
--- a/net/minecraft/world/server/ServerWorld.java
+++ b/net/minecraft/world/server/ServerWorld.java
@@ -137,7 +137,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public class ServerWorld extends World {
+public class ServerWorld extends World implements net.minecraftforge.common.extensions.IForgeWorldServer {
private static final Logger field_147491_a = LogManager.getLogger();
private final List<Entity> field_217497_w = Lists.newArrayList();
private final Int2ObjectMap<Entity> field_217498_x = new Int2ObjectLinkedOpenHashMap<>();
@@ -163,10 +163,13 @@
private boolean field_211159_Q;
@Nullable
private final WanderingTraderSpawner field_217496_L;
+ /** Stores the recently processed (lighting) chunks */
+ protected java.util.Set<ChunkPos> doneChunks = Sets.newHashSet();
+ private net.minecraftforge.common.util.WorldCapabilityData capabilityData;
public ServerWorld(MinecraftServer p_i50703_1_, Executor p_i50703_2_, SaveHandler p_i50703_3_, WorldInfo p_i50703_4_, DimensionType p_i50703_5_, IProfiler p_i50703_6_, IChunkStatusListener p_i50703_7_) {
super(p_i50703_4_, p_i50703_5_, (p_217442_4_, p_217442_5_) -> {
- return new ServerChunkProvider((ServerWorld)p_217442_4_, p_i50703_3_.func_75765_b(), p_i50703_3_.func_197718_i(), p_i50703_3_.func_186340_h(), p_i50703_2_, p_217442_5_.func_186060_c(), p_i50703_1_.func_184103_al().func_72395_o(), p_i50703_7_, () -> {
+ return new ServerChunkProvider((ServerWorld)p_217442_4_, p_i50703_3_.func_75765_b(), p_i50703_3_.func_197718_i(), p_i50703_3_.func_186340_h(), p_i50703_2_, p_217442_4_.func_175624_G().createChunkGenerator(p_217442_4_), p_i50703_1_.func_184103_al().func_72395_o(), p_i50703_7_, () -> {
return p_i50703_1_.func_71218_a(DimensionType.field_223227_a_).func_217481_x();
});
}, p_i50703_6_, false);
@@ -184,6 +187,7 @@
}
this.field_217496_L = this.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ ? new WanderingTraderSpawner(this) : null;
+ this.initCapabilities();
}
public Biome func_225604_a_(int p_225604_1_, int p_225604_2_, int p_225604_3_) {
@@ -197,6 +201,7 @@
this.func_175723_af().func_212673_r();
iprofiler.func_219895_b("weather");
boolean flag = this.func_72896_J();
+ this.field_73011_w.updateWeather(() -> {
if (this.field_73011_w.func_191066_m()) {
if (this.func_82736_K().func_223586_b(GameRules.field_223617_t)) {
int i = this.field_72986_A.func_176133_A();
@@ -258,6 +263,7 @@
this.field_73004_o = MathHelper.func_76131_a(this.field_73004_o, 0.0F, 1.0F);
}
+ }); //Forge: End weatherTick delegate
if (this.field_73003_n != this.field_73004_o) {
this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(7, this.field_73004_o), this.field_73011_w.func_186058_p());
@@ -267,15 +273,19 @@
this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(8, this.field_73017_q), this.field_73011_w.func_186058_p());
}
+ /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension,
+ * rather than to all players on the server. This is what causes the client-side rain, as the
+ * client believes that it has started raining locally, rather than in another dimension.
+ */
if (flag != this.func_72896_J()) {
if (flag) {
- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(2, 0.0F));
+ this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(2, 0.0F), this.field_73011_w.func_186058_p());
} else {
- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(1, 0.0F));
+ this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(1, 0.0F), this.field_73011_w.func_186058_p());
}
- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(7, this.field_73004_o));
- this.field_73061_a.func_184103_al().func_148540_a(new SChangeGameStatePacket(8, this.field_73017_q));
+ this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(7, this.field_73004_o), this.field_73011_w.func_186058_p());
+ this.field_73061_a.func_184103_al().func_148537_a(new SChangeGameStatePacket(8, this.field_73017_q), this.field_73011_w.func_186058_p());
}
if (this.func_72912_H().func_76093_s() && this.func_175659_aa() != Difficulty.HARD) {
@@ -287,8 +297,8 @@
})) {
this.field_73068_P = false;
if (this.func_82736_K().func_223586_b(GameRules.field_223607_j)) {
- long l = this.field_72986_A.func_76073_f() + 24000L;
- this.func_72877_b(l - l % 24000L);
+ long l = this.func_72820_D() + 24000L;
+ this.func_72877_b(net.minecraftforge.event.ForgeEventFactory.onSleepFinished(this, l - l % 24000L, this.func_72820_D()));
}
this.func_229856_ab_();
@@ -330,6 +340,7 @@
Entity entity = this.field_217497_w.get(i1);
this.func_217390_a((p_229858_0_) -> {
++p_229858_0_.field_70173_aa;
+ if (p_229858_0_.canUpdate())
p_229858_0_.func_70071_h_();
}, entity);
if (entity.field_70128_L) {
@@ -395,7 +406,7 @@
if (entity2.field_70128_L) {
this.func_217454_n(entity2);
objectiterator.remove();
- this.func_217484_g(entity2);
+ this.removeEntityComplete(entity2, entity2 instanceof ServerPlayerEntity); //Forge: Keep cap data until revive. Every other entity removes directly.
}
iprofiler.func_76319_b();
@@ -418,7 +429,7 @@
int j = chunkpos.func_180333_d();
IProfiler iprofiler = this.func_217381_Z();
iprofiler.func_76320_a("thunder");
- if (flag && this.func_72911_I() && this.field_73012_v.nextInt(100000) == 0) {
+ if (this.field_73011_w.canDoLightning(p_217441_1_) && flag && this.func_72911_I() && this.field_73012_v.nextInt(100000) == 0) {
BlockPos blockpos = this.func_175736_a(this.func_217383_a(i, 0, j, 15));
if (this.func_175727_C(blockpos)) {
DifficultyInstance difficultyinstance = this.func_175649_E(blockpos);
@@ -436,10 +447,11 @@
}
iprofiler.func_219895_b("iceandsnow");
- if (this.field_73012_v.nextInt(16) == 0) {
+ if (this.field_73011_w.canDoRainSnowIce(p_217441_1_) && this.field_73012_v.nextInt(16) == 0) {
BlockPos blockpos2 = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, this.func_217383_a(i, 0, j, 15));
BlockPos blockpos3 = blockpos2.func_177977_b();
Biome biome = this.func_226691_t_(blockpos2);
+ if (this.isAreaLoaded(blockpos2, 1)) // Forge: check area to avoid loading neighbors in unloaded chunks
if (biome.func_201848_a(this, blockpos3)) {
this.func_175656_a(blockpos3, Blocks.field_150432_aD.func_176223_P());
}
@@ -526,10 +538,7 @@
}
private void func_73051_P() {
- this.field_72986_A.func_76080_g(0);
- this.field_72986_A.func_76084_b(false);
- this.field_72986_A.func_76090_f(0);
- this.field_72986_A.func_76069_a(false);
+ this.field_73011_w.resetRainAndThunder();
}
@OnlyIn(Dist.CLIENT)
@@ -542,7 +551,7 @@
int j = this.field_72986_A.func_76074_e();
int k = 0;
- while(this.func_184141_c(new BlockPos(i, 0, j)).func_196958_f()) {
+ while(this.func_184141_c(new BlockPos(i, 0, j)).isAir(this, new BlockPos(i, 0, j))) {
i += this.field_73012_v.nextInt(8) - this.field_73012_v.nextInt(8);
j += this.field_73012_v.nextInt(8) - this.field_73012_v.nextInt(8);
++k;
@@ -584,8 +593,9 @@
++p_217479_1_.field_70173_aa;
IProfiler iprofiler = this.func_217381_Z();
iprofiler.func_194340_a(() -> {
- return Registry.field_212629_r.func_177774_c(p_217479_1_.func_200600_R()).toString();
+ return p_217479_1_.func_200600_R().getRegistryName() == null ? p_217479_1_.func_200600_R().toString() : p_217479_1_.func_200600_R().getRegistryName().toString();
});
+ if (p_217479_1_.canUpdate())
iprofiler.func_230035_c_("tickNonPassenger");
p_217479_1_.func_70071_h_();
iprofiler.func_76319_b();
@@ -652,6 +662,11 @@
}
public boolean func_175660_a(PlayerEntity p_175660_1_, BlockPos p_175660_2_) {
+ return super.func_175660_a(p_175660_1_, p_175660_2_);
+ }
+
+ @Override
+ public boolean canMineBlockBody(PlayerEntity p_175660_1_, BlockPos p_175660_2_) {
return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_);
}
@@ -661,6 +676,7 @@
} else if (this.field_72986_A.func_76067_t() == WorldType.field_180272_g) {
this.field_72986_A.func_176143_a(BlockPos.field_177992_a.func_177984_a());
} else {
+ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return;
BiomeProvider biomeprovider = this.func_72863_F().func_201711_g().func_202090_b();
List<Biome> list = biomeprovider.func_76932_a();
Random random = new Random(this.func_72905_C());
@@ -734,6 +750,7 @@
p_217445_1_.func_200209_c(new TranslationTextComponent("menu.savingChunks"));
}
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this));
serverchunkprovider.func_217210_a(p_217445_2_);
}
}
@@ -809,7 +826,7 @@
}
}
- EntityClassification entityclassification = entity.func_200600_R().func_220339_d();
+ EntityClassification entityclassification = entity.getClassification(true);
if (entityclassification != EntityClassification.MISC && this.func_72863_F().func_223435_b(entity)) {
object2intmap.mergeInt(entityclassification, 1, Integer::sum);
}
@@ -851,6 +868,7 @@
}
private void func_217448_f(ServerPlayerEntity p_217448_1_) {
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_217448_1_, this))) return;
Entity entity = this.field_175741_N.get(p_217448_1_.func_110124_au());
if (entity != null) {
field_147491_a.warn("Force-added player with duplicate UUID {}", (Object)p_217448_1_.func_110124_au().toString());
@@ -875,6 +893,7 @@
} else if (this.func_217478_l(p_72838_1_)) {
return false;
} else {
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72838_1_, this))) return false;
IChunk ichunk = this.func_217353_a(MathHelper.func_76128_c(p_72838_1_.func_226277_ct_() / 16.0D), MathHelper.func_76128_c(p_72838_1_.func_226281_cx_() / 16.0D), ChunkStatus.field_222617_m, p_72838_1_.field_98038_p);
if (!(ichunk instanceof Chunk)) {
return false;
@@ -890,6 +909,7 @@
if (this.func_217478_l(p_217440_1_)) {
return false;
} else {
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_217440_1_, this))) return false;
this.func_217465_m(p_217440_1_);
return true;
}
@@ -925,12 +945,17 @@
}
+ @Deprecated //Forge: Use removeEntityComplete(entity,boolean)
public void func_217484_g(Entity p_217484_1_) {
+ removeEntityComplete(p_217484_1_, false);
+ }
+ public void removeEntityComplete(Entity p_217484_1_, boolean keepData) {
if (p_217484_1_ instanceof EnderDragonEntity) {
for(EnderDragonPartEntity enderdragonpartentity : ((EnderDragonEntity)p_217484_1_).func_213404_dT()) {
- enderdragonpartentity.func_70106_y();
+ enderdragonpartentity.remove(keepData);
}
}
+ p_217484_1_.remove(keepData);
this.field_175741_N.remove(p_217484_1_.func_110124_au());
this.func_72863_F().func_217226_b(p_217484_1_);
@@ -944,6 +969,7 @@
this.field_217495_I.remove(((MobEntity)p_217484_1_).func_70661_as());
}
+ p_217484_1_.onRemovedFromWorld();
}
private void func_217465_m(Entity p_217465_1_) {
@@ -964,15 +990,19 @@
}
}
+ p_217465_1_.onAddedToWorld();
}
public void func_217467_h(Entity p_217467_1_) {
+ removeEntity(p_217467_1_, false);
+ }
+ public void removeEntity(Entity p_217467_1_, boolean keepData) {
if (this.field_217492_a) {
throw (IllegalStateException)Util.func_229757_c_(new IllegalStateException("Removing entity while ticking!"));
} else {
this.func_217454_n(p_217467_1_);
this.field_217498_x.remove(p_217467_1_.func_145782_y());
- this.func_217484_g(p_217467_1_);
+ this.removeEntityComplete(p_217467_1_, keepData);
}
}
@@ -985,8 +1015,11 @@
}
public void func_217434_e(ServerPlayerEntity p_217434_1_) {
- p_217434_1_.func_70106_y();
- this.func_217467_h(p_217434_1_);
+ removePlayer(p_217434_1_, false);
+ }
+ public void removePlayer(ServerPlayerEntity p_217434_1_, boolean keepData) {
+ p_217434_1_.remove(keepData);
+ this.removeEntity(p_217434_1_, keepData);
this.func_72854_c();
}
@@ -1010,10 +1043,20 @@
}
public void func_184148_a(@Nullable PlayerEntity p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) {
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_184148_8_ = event.getSound();
+ p_184148_9_ = event.getCategory();
+ p_184148_10_ = event.getVolume();
this.field_73061_a.func_184103_al().func_148543_a(p_184148_1_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_ > 1.0F ? (double)(16.0F * p_184148_10_) : 16.0D, this.field_73011_w.func_186058_p(), new SPlaySoundEffectPacket(p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_));
}
public void func_217384_a(@Nullable PlayerEntity p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, SoundCategory p_217384_4_, float p_217384_5_, float p_217384_6_) {
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_217384_1_, p_217384_3_, p_217384_4_, p_217384_5_, p_217384_6_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_217384_3_ = event.getSound();
+ p_217384_4_ = event.getCategory();
+ p_217384_5_ = event.getVolume();
this.field_73061_a.func_184103_al().func_148543_a(p_217384_1_, p_217384_2_.func_226277_ct_(), p_217384_2_.func_226278_cu_(), p_217384_2_.func_226281_cx_(), p_217384_5_ > 1.0F ? (double)(16.0F * p_217384_5_) : 16.0D, this.field_73011_w.func_186058_p(), new SSpawnMovingSoundEffectPacket(p_217384_3_, p_217384_4_, p_217384_2_, p_217384_5_, p_217384_6_));
}
@@ -1049,6 +1092,7 @@
public Explosion func_217401_a(@Nullable Entity p_217401_1_, @Nullable DamageSource p_217401_2_, double p_217401_3_, double p_217401_5_, double p_217401_7_, float p_217401_9_, boolean p_217401_10_, Explosion.Mode p_217401_11_) {
Explosion explosion = new Explosion(this, p_217401_1_, p_217401_3_, p_217401_5_, p_217401_7_, p_217401_9_, p_217401_10_, p_217401_11_);
+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion;
if (p_217401_2_ != null) {
explosion.func_199592_a(p_217401_2_);
}
@@ -1377,4 +1421,15 @@
return p_229854_1_.func_175898_b(p_229855_1_.func_180328_a());
});
}
+
+ protected void initCapabilities() {
+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = field_73011_w.initCapabilities();
+ this.gatherCapabilities(parent);
+ capabilityData = this.func_217481_x().func_215752_a(() -> new net.minecraftforge.common.util.WorldCapabilityData(getCapabilities()), net.minecraftforge.common.util.WorldCapabilityData.ID);
+ capabilityData.setCapabilities(field_73011_w, getCapabilities());
+ }
+
+ public java.util.stream.Stream<Entity> getEntities() {
+ return field_217498_x.values().stream();
+ }
}

View file

@ -1,26 +0,0 @@
--- a/net/minecraft/world/spawner/AbstractSpawner.java
+++ b/net/minecraft/world/spawner/AbstractSpawner.java
@@ -128,11 +128,12 @@
entity.func_70012_b(entity.func_226277_ct_(), entity.func_226278_cu_(), entity.func_226281_cx_(), world.field_73012_v.nextFloat() * 360.0F, 0.0F);
if (entity instanceof MobEntity) {
MobEntity mobentity = (MobEntity)entity;
- if (!mobentity.func_213380_a(world, SpawnReason.SPAWNER) || !mobentity.func_205019_a(world)) {
+ if (!net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(mobentity, world, (float)entity.func_226277_ct_(), (float)entity.func_226278_cu_(), (float)entity.func_226281_cx_(), this)) {
continue;
}
if (this.field_98282_f.func_185277_b().func_186856_d() == 1 && this.field_98282_f.func_185277_b().func_150297_b("id", 8)) {
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mobentity, world, (float)entity.func_226277_ct_(), (float)entity.func_226278_cu_(), (float)entity.func_226281_cx_(), this, SpawnReason.SPAWNER))
((MobEntity)entity).func_213386_a(world, world.func_175649_E(new BlockPos(entity)), SpawnReason.SPAWNER, (ILivingEntityData)null, (CompoundNBT)null);
}
}
@@ -285,4 +286,9 @@
public double func_177223_e() {
return this.field_98284_d;
}
+
+ @Nullable
+ public Entity getSpawnerEntity() {
+ return null;
+ }
}

View file

@ -1,96 +0,0 @@
--- a/net/minecraft/world/spawner/WorldEntitySpawner.java
+++ b/net/minecraft/world/spawner/WorldEntitySpawner.java
@@ -87,7 +87,7 @@
}
if (biome$spawnlistentry == null) {
- biome$spawnlistentry = func_222264_a(chunkgenerator, p_226701_0_, p_226701_1_.field_73012_v, blockpos$mutable);
+ biome$spawnlistentry = getSpawnList(chunkgenerator, p_226701_0_, p_226701_1_.field_73012_v, blockpos$mutable, p_226701_1_);
if (biome$spawnlistentry == null) {
break label123;
}
@@ -100,7 +100,7 @@
}
EntityType<?> entitytype = biome$spawnlistentry.field_200702_b;
- if (!entitytype.func_200720_b() || !func_222261_a(chunkgenerator, p_226701_0_, biome$spawnlistentry, blockpos$mutable)) {
+ if (!entitytype.func_200720_b() || !getSpawnList(chunkgenerator, p_226701_0_, biome$spawnlistentry, blockpos$mutable, p_226701_1_)) {
break label115;
}
@@ -123,15 +123,17 @@
}
mobentity.func_70012_b((double)f, (double)k, (double)f1, p_226701_1_.field_73012_v.nextFloat() * 360.0F, 0.0F);
- if (d0 > 16384.0D && mobentity.func_213397_c(d0) || !mobentity.func_213380_a(p_226701_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_226701_1_)) {
+ int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_226701_1_, f, k, f1, null, SpawnReason.NATURAL);
+ if (canSpawn == -1 || (canSpawn == 0 && (d0 > 16384.0D && mobentity.func_213397_c(d0) || !mobentity.func_213380_a(p_226701_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_226701_1_)))) {
break label115;
}
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mobentity, p_226701_1_, f, k, f1, null, SpawnReason.NATURAL))
ilivingentitydata = mobentity.func_213386_a(p_226701_1_, p_226701_1_.func_175649_E(new BlockPos(mobentity)), SpawnReason.NATURAL, ilivingentitydata, (CompoundNBT)null);
++i;
++j2;
p_226701_1_.func_217376_c(mobentity);
- if (i >= mobentity.func_70641_bl()) {
+ if (i >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(mobentity)) {
return;
}
@@ -154,13 +156,15 @@
}
@Nullable
- private static Biome.SpawnListEntry func_222264_a(ChunkGenerator<?> p_222264_0_, EntityClassification p_222264_1_, Random p_222264_2_, BlockPos p_222264_3_) {
+ private static Biome.SpawnListEntry getSpawnList(ChunkGenerator<?> p_222264_0_, EntityClassification p_222264_1_, Random p_222264_2_, BlockPos p_222264_3_, World world) {
List<Biome.SpawnListEntry> list = p_222264_0_.func_177458_a(p_222264_1_, p_222264_3_);
+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(world, p_222264_1_, p_222264_3_, list);
return list.isEmpty() ? null : WeightedRandom.func_76271_a(p_222264_2_, list);
}
- private static boolean func_222261_a(ChunkGenerator<?> p_222261_0_, EntityClassification p_222261_1_, Biome.SpawnListEntry p_222261_2_, BlockPos p_222261_3_) {
+ private static boolean getSpawnList(ChunkGenerator<?> p_222261_0_, EntityClassification p_222261_1_, Biome.SpawnListEntry p_222261_2_, BlockPos p_222261_3_, World world) {
List<Biome.SpawnListEntry> list = p_222261_0_.func_177458_a(p_222261_1_, p_222261_3_);
+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(world, p_222261_1_, p_222261_3_, list);
return list.isEmpty() ? false : list.contains(p_222261_2_);
}
@@ -189,6 +193,13 @@
if (p_209382_0_ == EntitySpawnPlacementRegistry.PlacementType.NO_RESTRICTIONS) {
return true;
} else if (p_209382_3_ != null && p_209382_1_.func_175723_af().func_177746_a(p_209382_2_)) {
+ return p_209382_0_.canSpawnAt(p_209382_1_, p_209382_2_, p_209382_3_);
+ }
+ return false;
+ }
+
+ public static boolean canSpawnAtBody(EntitySpawnPlacementRegistry.PlacementType p_209382_0_, IWorldReader p_209382_1_, BlockPos p_209382_2_, @Nullable EntityType<?> p_209382_3_) {
+ {
BlockState blockstate = p_209382_1_.func_180495_p(p_209382_2_);
IFluidState ifluidstate = p_209382_1_.func_204610_c(p_209382_2_);
BlockPos blockpos = p_209382_2_.func_177984_a();
@@ -199,14 +210,12 @@
case ON_GROUND:
default:
BlockState blockstate1 = p_209382_1_.func_180495_p(blockpos1);
- if (!blockstate1.func_215688_a(p_209382_1_, blockpos1, p_209382_3_)) {
+ if (!blockstate1.canCreatureSpawn(p_209382_1_, blockpos1, p_209382_0_, p_209382_3_)) {
return false;
} else {
return func_222266_a(p_209382_1_, p_209382_2_, blockstate, ifluidstate) && func_222266_a(p_209382_1_, blockpos, p_209382_1_.func_180495_p(blockpos), p_209382_1_.func_204610_c(blockpos));
}
}
- } else {
- return false;
}
}
@@ -249,6 +258,7 @@
entity.func_70012_b(d0, (double)blockpos.func_177956_o(), d1, p_77191_4_.nextFloat() * 360.0F, 0.0F);
if (entity instanceof MobEntity) {
MobEntity mobentity = (MobEntity)entity;
+ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_77191_0_, d0, blockpos.func_177956_o(), d1, null, SpawnReason.CHUNK_GENERATION) == -1) continue;
if (mobentity.func_213380_a(p_77191_0_, SpawnReason.CHUNK_GENERATION) && mobentity.func_205019_a(p_77191_0_)) {
ilivingentitydata = mobentity.func_213386_a(p_77191_0_, p_77191_0_.func_175649_E(new BlockPos(mobentity)), SpawnReason.CHUNK_GENERATION, ilivingentitydata, (CompoundNBT)null);
p_77191_0_.func_217376_c(mobentity);

View file

@ -1,13 +0,0 @@
--- a/net/minecraft/world/storage/MapData.java
+++ b/net/minecraft/world/storage/MapData.java
@@ -216,8 +216,8 @@
if (f >= -63.0F && f1 >= -63.0F && f <= 63.0F && f1 <= 63.0F) {
p_191095_8_ = p_191095_8_ + (p_191095_8_ < 0.0D ? -8.0D : 8.0D);
b2 = (byte)((int)(p_191095_8_ * 16.0D / 360.0D));
- if (this.field_76200_c == DimensionType.field_223228_b_ && p_191095_2_ != null) {
- int l = (int)(p_191095_2_.func_72912_H().func_76073_f() / 10L);
+ if (p_191095_2_ != null && p_191095_2_.func_201672_e().field_73011_w.shouldMapSpin(p_191095_3_, p_191095_4_, p_191095_6_, p_191095_8_)) {
+ int l = (int)(p_191095_2_.func_201672_e().func_72820_D() / 10L);
b2 = (byte)(l * l * 34187121 + l * 121 >> 15 & 15);
}
} else {

View file

@ -1,19 +0,0 @@
--- a/net/minecraft/world/storage/MapDecoration.java
+++ b/net/minecraft/world/storage/MapDecoration.java
@@ -83,6 +83,16 @@
return i;
}
+ /**
+ * Renders this decoration, useful for custom sprite sheets.
+ * @param index The index of this icon in the MapData's list. Used by vanilla to offset the Z-coordinate to prevent Z-fighting
+ * @return false to run vanilla logic for this decoration, true to skip it
+ */
+ @OnlyIn(Dist.CLIENT)
+ public boolean render(int index) {
+ return false;
+ }
+
public static enum Type {
PLAYER(false),
FRAME(true),

View file

@ -1,27 +0,0 @@
--- a/net/minecraft/world/storage/SaveFormat.java
+++ b/net/minecraft/world/storage/SaveFormat.java
@@ -138,13 +138,23 @@
@Nullable
public static WorldInfo func_215780_a(File p_215780_0_, DataFixer p_215780_1_) {
+ return getWorldData(p_215780_0_, p_215780_1_, null);
+ }
+
+ @Nullable
+ public static WorldInfo getWorldData(File p_215780_0_, DataFixer p_215780_1_, @Nullable SaveHandler saveHandler) {
try {
CompoundNBT compoundnbt = CompressedStreamTools.func_74796_a(new FileInputStream(p_215780_0_));
CompoundNBT compoundnbt1 = compoundnbt.func_74775_l("Data");
CompoundNBT compoundnbt2 = compoundnbt1.func_150297_b("Player", 10) ? compoundnbt1.func_74775_l("Player") : null;
compoundnbt1.func_82580_o("Player");
int i = compoundnbt1.func_150297_b("DataVersion", 99) ? compoundnbt1.func_74762_e("DataVersion") : -1;
- return new WorldInfo(NBTUtil.func_210822_a(p_215780_1_, DefaultTypeReferences.LEVEL, compoundnbt1, i), p_215780_1_, i, compoundnbt2);
+ WorldInfo ret = new WorldInfo(NBTUtil.func_210822_a(p_215780_1_, DefaultTypeReferences.LEVEL, compoundnbt1, i), p_215780_1_, i, compoundnbt2);
+ if (saveHandler != null)
+ net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataLoad(saveHandler, ret, compoundnbt);
+ return ret;
+ } catch (net.minecraftforge.fml.StartupQuery.AbortedException e) {
+ throw e;
} catch (Exception exception) {
field_215785_a.error("Exception reading {}", p_215780_0_, exception);
return null;

View file

@ -1,69 +0,0 @@
--- a/net/minecraft/world/storage/SaveHandler.java
+++ b/net/minecraft/world/storage/SaveHandler.java
@@ -50,6 +50,8 @@
CompoundNBT compoundnbt1 = new CompoundNBT();
compoundnbt1.func_218657_a("Data", compoundnbt);
+ net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataSave(this, p_75755_1_, compoundnbt1);
+
try {
File file1 = new File(this.field_215774_c, "level.dat_new");
File file2 = new File(this.field_215774_c, "level.dat_old");
@@ -117,14 +119,14 @@
public WorldInfo func_75757_d() {
File file1 = new File(this.field_215774_c, "level.dat");
if (file1.exists()) {
- WorldInfo worldinfo = SaveFormat.func_215780_a(file1, this.field_215772_a);
+ WorldInfo worldinfo = SaveFormat.getWorldData(file1, this.field_215772_a, this);
if (worldinfo != null) {
return worldinfo;
}
}
file1 = new File(this.field_215774_c, "level.dat_old");
- return file1.exists() ? SaveFormat.func_215780_a(file1, this.field_215772_a) : null;
+ return file1.exists() ? SaveFormat.getWorldData(file1, this.field_215772_a, this) : null;
}
public void func_75761_a(WorldInfo p_75761_1_) {
@@ -142,6 +144,7 @@
}
file1.renameTo(file2);
+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, field_215775_d, p_75753_1_.func_110124_au().toString());
} catch (Exception var5) {
field_215773_b.warn("Failed to save player data for {}", (Object)p_75753_1_.func_200200_C_().getString());
}
@@ -165,6 +168,7 @@
int i = compoundnbt.func_150297_b("DataVersion", 3) ? compoundnbt.func_74762_e("DataVersion") : -1;
p_75752_1_.func_70020_e(NBTUtil.func_210822_a(this.field_215772_a, DefaultTypeReferences.PLAYER, compoundnbt, i));
}
+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, field_215775_d, p_75752_1_.func_110124_au().toString());
return compoundnbt;
}
@@ -191,4 +195,24 @@
public DataFixer func_197718_i() {
return this.field_215772_a;
}
+
+ public CompoundNBT getPlayerNBT(net.minecraft.entity.player.ServerPlayerEntity player) {
+ try {
+ File file1 = new File(this.field_215775_d, player.func_189512_bd() + ".dat");
+ if (file1.exists() && file1.isFile()) {
+ CompoundNBT nbt = CompressedStreamTools.func_74796_a(new FileInputStream(file1));
+ if (nbt != null) {
+ nbt = NBTUtil.func_210822_a(this.field_215772_a, DefaultTypeReferences.PLAYER, nbt, nbt.func_150297_b("DataVersion", 3) ? nbt.func_74762_e("DataVersion") : -1);
+ }
+ return nbt;
+ }
+ } catch (Exception exception) {
+ field_215773_b.warn("Failed to load player data for " + player.func_200200_C_());
+ }
+ return null;
+ }
+
+ public File getPlayerFolder() {
+ return field_215775_d;
+ }
}

View file

@ -1,10 +0,0 @@
--- a/net/minecraft/world/storage/WorldInfo.java
+++ b/net/minecraft/world/storage/WorldInfo.java
@@ -362,6 +362,7 @@
CompoundNBT compoundnbt1 = new CompoundNBT();
for(Entry<DimensionType, CompoundNBT> entry : this.field_186348_N.entrySet()) {
+ if (entry.getValue() == null || entry.getValue().isEmpty()) continue;
compoundnbt1.func_218657_a(String.valueOf(entry.getKey().func_186068_a()), entry.getValue());
}

View file

@ -1,26 +0,0 @@
--- a/net/minecraft/world/storage/WorldSavedData.java
+++ b/net/minecraft/world/storage/WorldSavedData.java
@@ -9,7 +9,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public abstract class WorldSavedData {
+public abstract class WorldSavedData implements net.minecraftforge.common.util.INBTSerializable<CompoundNBT> {
private static final Logger field_215159_a = LogManager.getLogger();
private final String field_76190_i;
private boolean field_76189_a;
@@ -53,4 +53,14 @@
this.func_76186_a(false);
}
}
+
+ @Override
+ public void deserializeNBT(CompoundNBT nbt) {
+ func_76184_a(nbt);
+ }
+
+ @Override
+ public CompoundNBT serializeNBT() {
+ return func_189551_b(new CompoundNBT());
+ }
}

View file

@ -1,13 +0,0 @@
--- a/net/minecraft/world/storage/loot/LootTableManager.java
+++ b/net/minecraft/world/storage/loot/LootTableManager.java
@@ -42,8 +42,8 @@
}
p_212853_1_.forEach((p_223385_1_, p_223385_2_) -> {
- try {
- LootTable loottable = field_186526_b.fromJson(p_223385_2_, LootTable.class);
+ try (net.minecraft.resources.IResource res = p_212853_2_.func_199002_a(getPreparedPath(p_223385_1_));){
+ LootTable loottable = net.minecraftforge.common.ForgeHooks.loadLootTable(field_186526_b, p_223385_1_, p_223385_2_, res == null || !res.func_199026_d().equals("Default"), this);
builder.put(p_223385_1_, loottable);
} catch (Exception exception) {
field_186525_a.error("Couldn't parse loot table {}", p_223385_1_, exception);

View file

@ -369,80 +369,79 @@ public class BiomeDictionary
private static void registerVanillaBiomes()
{
addTypes(Biomes.OCEAN, OCEAN, OVERWORLD );
addTypes(Biomes.PLAINS, PLAINS, OVERWORLD );
addTypes(Biomes.DESERT, HOT, DRY, SANDY, OVERWORLD );
addTypes(Biomes.MOUNTAINS, MOUNTAIN, HILLS, OVERWORLD );
addTypes(Biomes.FOREST, FOREST, OVERWORLD );
addTypes(Biomes.TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD );
addTypes(Biomes.SWAMP, WET, SWAMP, OVERWORLD );
addTypes(Biomes.RIVER, RIVER, OVERWORLD );
addTypes(Biomes.field_235254_j_, HOT, DRY, NETHER );
addTypes(Biomes.THE_END, COLD, DRY, END );
addTypes(Biomes.FROZEN_OCEAN, COLD, OCEAN, SNOWY, OVERWORLD );
addTypes(Biomes.FROZEN_RIVER, COLD, RIVER, SNOWY, OVERWORLD );
addTypes(Biomes.SNOWY_TUNDRA, COLD, SNOWY, WASTELAND, OVERWORLD );
addTypes(Biomes.SNOWY_MOUNTAINS, COLD, SNOWY, MOUNTAIN, OVERWORLD );
addTypes(Biomes.MUSHROOM_FIELDS, MUSHROOM, RARE, OVERWORLD );
addTypes(Biomes.MUSHROOM_FIELD_SHORE, MUSHROOM, BEACH, RARE, OVERWORLD );
addTypes(Biomes.BEACH, BEACH, OVERWORLD );
addTypes(Biomes.DESERT_HILLS, HOT, DRY, SANDY, HILLS, OVERWORLD );
addTypes(Biomes.WOODED_HILLS, FOREST, HILLS, OVERWORLD );
addTypes(Biomes.TAIGA_HILLS, COLD, CONIFEROUS, FOREST, HILLS, OVERWORLD );
addTypes(Biomes.MOUNTAIN_EDGE, MOUNTAIN, OVERWORLD );
addTypes(Biomes.JUNGLE, HOT, WET, DENSE, JUNGLE, OVERWORLD );
addTypes(Biomes.JUNGLE_HILLS, HOT, WET, DENSE, JUNGLE, HILLS, OVERWORLD );
addTypes(Biomes.JUNGLE_EDGE, HOT, WET, JUNGLE, FOREST, RARE, OVERWORLD );
addTypes(Biomes.DEEP_OCEAN, OCEAN, OVERWORLD );
addTypes(Biomes.STONE_SHORE, BEACH, OVERWORLD );
addTypes(Biomes.SNOWY_BEACH, COLD, BEACH, SNOWY, OVERWORLD );
addTypes(Biomes.BIRCH_FOREST, FOREST, OVERWORLD );
addTypes(Biomes.BIRCH_FOREST_HILLS, FOREST, HILLS, OVERWORLD );
addTypes(Biomes.DARK_FOREST, SPOOKY, DENSE, FOREST, OVERWORLD );
addTypes(Biomes.SNOWY_TAIGA, COLD, CONIFEROUS, FOREST, SNOWY, OVERWORLD );
addTypes(Biomes.SNOWY_TAIGA_HILLS, COLD, CONIFEROUS, FOREST, SNOWY, HILLS, OVERWORLD );
addTypes(Biomes.GIANT_TREE_TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD );
addTypes(Biomes.GIANT_TREE_TAIGA_HILLS, COLD, CONIFEROUS, FOREST, HILLS, OVERWORLD );
addTypes(Biomes.WOODED_MOUNTAINS, MOUNTAIN, FOREST, SPARSE, OVERWORLD );
addTypes(Biomes.SAVANNA, HOT, SAVANNA, PLAINS, SPARSE, OVERWORLD );
addTypes(Biomes.SAVANNA_PLATEAU, HOT, SAVANNA, PLAINS, SPARSE, RARE, OVERWORLD, PLATEAU );
addTypes(Biomes.BADLANDS, MESA, SANDY, DRY, OVERWORLD );
addTypes(Biomes.WOODED_BADLANDS_PLATEAU, MESA, SANDY, DRY, SPARSE, OVERWORLD, PLATEAU );
addTypes(Biomes.BADLANDS_PLATEAU, MESA, SANDY, DRY, OVERWORLD, PLATEAU );
addTypes(Biomes.SMALL_END_ISLANDS, END );
addTypes(Biomes.END_MIDLANDS, END );
addTypes(Biomes.END_HIGHLANDS, END );
addTypes(Biomes.END_BARRENS, END );
addTypes(Biomes.WARM_OCEAN, OCEAN, HOT, OVERWORLD );
addTypes(Biomes.LUKEWARM_OCEAN, OCEAN, OVERWORLD );
addTypes(Biomes.COLD_OCEAN, OCEAN, COLD, OVERWORLD );
addTypes(Biomes.DEEP_WARM_OCEAN, OCEAN, HOT, OVERWORLD );
addTypes(Biomes.DEEP_LUKEWARM_OCEAN, OCEAN, OVERWORLD );
addTypes(Biomes.DEEP_COLD_OCEAN, OCEAN, COLD, OVERWORLD );
addTypes(Biomes.DEEP_FROZEN_OCEAN, OCEAN, COLD, OVERWORLD );
addTypes(Biomes.THE_VOID, VOID );
addTypes(Biomes.SUNFLOWER_PLAINS, PLAINS, RARE, OVERWORLD );
addTypes(Biomes.DESERT_LAKES, HOT, DRY, SANDY, RARE, OVERWORLD );
addTypes(Biomes.GRAVELLY_MOUNTAINS, MOUNTAIN, SPARSE, RARE, OVERWORLD );
addTypes(Biomes.FLOWER_FOREST, FOREST, HILLS, RARE, OVERWORLD );
addTypes(Biomes.TAIGA_MOUNTAINS, COLD, CONIFEROUS, FOREST, MOUNTAIN, RARE, OVERWORLD );
addTypes(Biomes.SWAMP_HILLS, WET, SWAMP, HILLS, RARE, OVERWORLD );
addTypes(Biomes.ICE_SPIKES, COLD, SNOWY, HILLS, RARE, OVERWORLD );
addTypes(Biomes.MODIFIED_JUNGLE, HOT, WET, DENSE, JUNGLE, MOUNTAIN, RARE, OVERWORLD, MODIFIED);
addTypes(Biomes.MODIFIED_JUNGLE_EDGE, HOT, SPARSE, JUNGLE, HILLS, RARE, OVERWORLD, MODIFIED );
addTypes(Biomes.TALL_BIRCH_FOREST, FOREST, DENSE, HILLS, RARE, OVERWORLD );
addTypes(Biomes.TALL_BIRCH_HILLS, FOREST, DENSE, MOUNTAIN, RARE, OVERWORLD );
addTypes(Biomes.DARK_FOREST_HILLS, SPOOKY, DENSE, FOREST, MOUNTAIN, RARE, OVERWORLD );
addTypes(Biomes.SNOWY_TAIGA_MOUNTAINS, COLD, CONIFEROUS, FOREST, SNOWY, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.GIANT_SPRUCE_TAIGA, DENSE, FOREST, RARE, OVERWORLD );
addTypes(Biomes.GIANT_SPRUCE_TAIGA_HILLS, DENSE, FOREST, HILLS, RARE, OVERWORLD );
addTypes(Biomes.MODIFIED_GRAVELLY_MOUNTAINS, MOUNTAIN, SPARSE, RARE, OVERWORLD, MODIFIED );
addTypes(Biomes.SHATTERED_SAVANNA, HOT, DRY, SPARSE, SAVANNA, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.SHATTERED_SAVANNA_PLATEAU, HOT, DRY, SPARSE, SAVANNA, HILLS, RARE, OVERWORLD, PLATEAU);
addTypes(Biomes.ERODED_BADLANDS, HOT, DRY, SPARSE, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.MODIFIED_WOODED_BADLANDS_PLATEAU, HOT, DRY, SPARSE, HILLS, RARE, OVERWORLD, PLATEAU, MODIFIED );
addTypes(Biomes.MODIFIED_BADLANDS_PLATEAU, HOT, DRY, SPARSE, MOUNTAIN, RARE, OVERWORLD, PLATEAU, MODIFIED);
addTypes(Biomes.OCEAN, OCEAN, OVERWORLD);
addTypes(Biomes.PLAINS, PLAINS, OVERWORLD);
addTypes(Biomes.DESERT, HOT, DRY, SANDY, OVERWORLD);
addTypes(Biomes.MOUNTAINS, MOUNTAIN, HILLS, OVERWORLD);
addTypes(Biomes.FOREST, FOREST, OVERWORLD);
addTypes(Biomes.TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD);
addTypes(Biomes.SWAMP, WET, SWAMP, OVERWORLD);
addTypes(Biomes.RIVER, RIVER, OVERWORLD);
addTypes(Biomes.field_235254_j_, HOT, DRY, NETHER);
addTypes(Biomes.THE_END, COLD, DRY, END);
addTypes(Biomes.FROZEN_OCEAN, COLD, OCEAN, SNOWY, OVERWORLD);
addTypes(Biomes.FROZEN_RIVER, COLD, RIVER, SNOWY, OVERWORLD);
addTypes(Biomes.SNOWY_TUNDRA, COLD, SNOWY, WASTELAND, OVERWORLD);
addTypes(Biomes.SNOWY_MOUNTAINS, COLD, SNOWY, MOUNTAIN, OVERWORLD);
addTypes(Biomes.MUSHROOM_FIELDS, MUSHROOM, RARE, OVERWORLD);
addTypes(Biomes.MUSHROOM_FIELD_SHORE, MUSHROOM, BEACH, RARE, OVERWORLD);
addTypes(Biomes.BEACH, BEACH, OVERWORLD);
addTypes(Biomes.DESERT_HILLS, HOT, DRY, SANDY, HILLS, OVERWORLD);
addTypes(Biomes.WOODED_HILLS, FOREST, HILLS, OVERWORLD);
addTypes(Biomes.TAIGA_HILLS, COLD, CONIFEROUS, FOREST, HILLS, OVERWORLD);
addTypes(Biomes.MOUNTAIN_EDGE, MOUNTAIN, OVERWORLD);
addTypes(Biomes.JUNGLE, HOT, WET, DENSE, JUNGLE, OVERWORLD);
addTypes(Biomes.JUNGLE_HILLS, HOT, WET, DENSE, JUNGLE, HILLS, OVERWORLD);
addTypes(Biomes.JUNGLE_EDGE, HOT, WET, JUNGLE, FOREST, RARE, OVERWORLD);
addTypes(Biomes.DEEP_OCEAN, OCEAN, OVERWORLD);
addTypes(Biomes.STONE_SHORE, BEACH, OVERWORLD);
addTypes(Biomes.SNOWY_BEACH, COLD, BEACH, SNOWY, OVERWORLD);
addTypes(Biomes.BIRCH_FOREST, FOREST, OVERWORLD);
addTypes(Biomes.BIRCH_FOREST_HILLS, FOREST, HILLS, OVERWORLD);
addTypes(Biomes.DARK_FOREST, SPOOKY, DENSE, FOREST, OVERWORLD);
addTypes(Biomes.SNOWY_TAIGA, COLD, CONIFEROUS, FOREST, SNOWY, OVERWORLD);
addTypes(Biomes.SNOWY_TAIGA_HILLS, COLD, CONIFEROUS, FOREST, SNOWY, HILLS, OVERWORLD);
addTypes(Biomes.GIANT_TREE_TAIGA, COLD, CONIFEROUS, FOREST, OVERWORLD);
addTypes(Biomes.GIANT_TREE_TAIGA_HILLS, COLD, CONIFEROUS, FOREST, HILLS, OVERWORLD);
addTypes(Biomes.WOODED_MOUNTAINS, MOUNTAIN, FOREST, SPARSE, OVERWORLD);
addTypes(Biomes.SAVANNA, HOT, SAVANNA, PLAINS, SPARSE, OVERWORLD);
addTypes(Biomes.SAVANNA_PLATEAU, HOT, SAVANNA, PLAINS, SPARSE, RARE, OVERWORLD, PLATEAU);
addTypes(Biomes.BADLANDS, MESA, SANDY, DRY, OVERWORLD);
addTypes(Biomes.WOODED_BADLANDS_PLATEAU, MESA, SANDY, DRY, SPARSE, OVERWORLD, PLATEAU);
addTypes(Biomes.BADLANDS_PLATEAU, MESA, SANDY, DRY, OVERWORLD, PLATEAU);
addTypes(Biomes.SMALL_END_ISLANDS, END);
addTypes(Biomes.END_MIDLANDS, END);
addTypes(Biomes.END_HIGHLANDS, END);
addTypes(Biomes.END_BARRENS, END);
addTypes(Biomes.WARM_OCEAN, OCEAN, HOT, OVERWORLD);
addTypes(Biomes.LUKEWARM_OCEAN, OCEAN, OVERWORLD);
addTypes(Biomes.COLD_OCEAN, OCEAN, COLD, OVERWORLD);
addTypes(Biomes.DEEP_WARM_OCEAN, OCEAN, HOT, OVERWORLD);
addTypes(Biomes.DEEP_LUKEWARM_OCEAN, OCEAN, OVERWORLD);
addTypes(Biomes.DEEP_COLD_OCEAN, OCEAN, COLD, OVERWORLD);
addTypes(Biomes.DEEP_FROZEN_OCEAN, OCEAN, COLD, OVERWORLD);
addTypes(Biomes.THE_VOID, VOID);
addTypes(Biomes.SUNFLOWER_PLAINS, PLAINS, RARE, OVERWORLD);
addTypes(Biomes.DESERT_LAKES, HOT, DRY, SANDY, RARE, OVERWORLD);
addTypes(Biomes.GRAVELLY_MOUNTAINS, MOUNTAIN, SPARSE, RARE, OVERWORLD);
addTypes(Biomes.FLOWER_FOREST, FOREST, HILLS, RARE, OVERWORLD);
addTypes(Biomes.TAIGA_MOUNTAINS, COLD, CONIFEROUS, FOREST, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.SWAMP_HILLS, WET, SWAMP, HILLS, RARE, OVERWORLD);
addTypes(Biomes.ICE_SPIKES, COLD, SNOWY, HILLS, RARE, OVERWORLD);
addTypes(Biomes.MODIFIED_JUNGLE, HOT, WET, DENSE, JUNGLE, MOUNTAIN, RARE, OVERWORLD, MODIFIED);
addTypes(Biomes.MODIFIED_JUNGLE_EDGE, HOT, SPARSE, JUNGLE, HILLS, RARE, OVERWORLD, MODIFIED);
addTypes(Biomes.TALL_BIRCH_FOREST, FOREST, DENSE, HILLS, RARE, OVERWORLD);
addTypes(Biomes.TALL_BIRCH_HILLS, FOREST, DENSE, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.DARK_FOREST_HILLS, SPOOKY, DENSE, FOREST, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.SNOWY_TAIGA_MOUNTAINS, COLD, CONIFEROUS, FOREST, SNOWY, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.GIANT_SPRUCE_TAIGA, DENSE, FOREST, RARE, OVERWORLD);
addTypes(Biomes.GIANT_SPRUCE_TAIGA_HILLS, DENSE, FOREST, HILLS, RARE, OVERWORLD);
addTypes(Biomes.MODIFIED_GRAVELLY_MOUNTAINS, MOUNTAIN, SPARSE, RARE, OVERWORLD, MODIFIED);
addTypes(Biomes.SHATTERED_SAVANNA, HOT, DRY, SPARSE, SAVANNA, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.SHATTERED_SAVANNA_PLATEAU, HOT, DRY, SPARSE, SAVANNA, HILLS, RARE, OVERWORLD, PLATEAU);
addTypes(Biomes.ERODED_BADLANDS, HOT, DRY, SPARSE, MOUNTAIN, RARE, OVERWORLD);
addTypes(Biomes.MODIFIED_WOODED_BADLANDS_PLATEAU, HOT, DRY, SPARSE, HILLS, RARE, OVERWORLD, PLATEAU, MODIFIED);
addTypes(Biomes.MODIFIED_BADLANDS_PLATEAU, HOT, DRY, SPARSE, MOUNTAIN, RARE, OVERWORLD, PLATEAU, MODIFIED);
if (DEBUG)
{

View file

@ -218,7 +218,8 @@ public class ForgeHooks
blocks.forEach(block -> blockToolSetter.accept(block, ToolType.PICKAXE, 0));
blocks = getPrivateValue(ShovelItem.class, null, 0);
blocks.forEach(block -> blockToolSetter.accept(block, ToolType.SHOVEL, 0));
blocks = getPrivateValue(AxeItem.class, null, 0);
//TODO Axes check Material and Blocks now.
blocks = getPrivateValue(AxeItem.class, null, 1);
blocks.forEach(block -> blockToolSetter.accept(block, ToolType.AXE, 0));
//This is taken from ItemAxe, if that changes update here.
@ -796,7 +797,7 @@ public class ForgeHooks
}
@Nullable
public static LootTable loadLootTable(Gson gson, ResourceLocation name, JsonObject data, boolean custom, LootTableManager lootTableManager)
public static LootTable loadLootTable(Gson gson, ResourceLocation name, JsonElement data, boolean custom, LootTableManager lootTableManager)
{
Deque<LootTableContext> que = lootContext.get();
if (que == null)
@ -821,10 +822,8 @@ public class ForgeHooks
if (!custom)
ret = ForgeEventFactory.loadLootTable(name, ret, lootTableManager);
/* TODO:
if (ret != null)
ret.freeze();
*/
if (ret != null)
ret.freeze();
return ret;
}

View file

@ -19,6 +19,8 @@
package net.minecraftforge.common;
import net.minecraft.entity.ai.attributes.Attribute;
import net.minecraft.entity.ai.attributes.RangedAttribute;
import net.minecraft.util.SoundEvent;
import net.minecraft.world.storage.IServerConfiguration;
import net.minecraft.world.storage.IWorldInfo;
@ -33,6 +35,8 @@ import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.server.command.ConfigCommand;
import net.minecraftforge.server.command.ForgeCommand;
import net.minecraftforge.versions.forge.ForgeVersion;
@ -84,6 +88,12 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
private static final Logger LOGGER = LogManager.getLogger();
private static final Marker FORGEMOD = MarkerManager.getMarker("FORGEMOD");
private static final DeferredRegister<Attribute> ATTRIBUTES = DeferredRegister.create(Attribute.class, "forge");
public static final RegistryObject<Attribute> SWIM_SPEED = ATTRIBUTES.register("swim_speed", () -> new RangedAttribute("forge.swimSpeed", 1.0D, 0.0D, 1024.0D).func_233753_a_(true));
public static final RegistryObject<Attribute> NAMETAG_DISTANCE = ATTRIBUTES.register("nametag_distance", () -> new RangedAttribute("forge.nameTagDistance", 64.0D, 0.0D, Float.MAX_VALUE).func_233753_a_(true));
public static final RegistryObject<Attribute> ENTITY_GRAVITY = ATTRIBUTES.register("entity_gravity", () -> new RangedAttribute("forge.entity_gravity", 0.08D, -8.0D, 8.0D).func_233753_a_(true));
private static ForgeMod INSTANCE;
public static ForgeMod getInstance()
{
@ -101,6 +111,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
modEventBus.addListener(this::preInit);
modEventBus.addListener(this::gatherData);
modEventBus.register(this);
ATTRIBUTES.register(modEventBus);
MinecraftForge.EVENT_BUS.addListener(this::serverStarting);
MinecraftForge.EVENT_BUS.addListener(this::serverStopping);
MinecraftForge.EVENT_BUS.addGenericListener(SoundEvent.class, this::missingSoundMapping);

View file

@ -367,11 +367,10 @@ public interface IForgeBlock
*
* @param world The current world
* @param pos Block position in world
* @param exploder The entity that caused the explosion, can be null
* @param explosion The explosion
* @return The amount of the explosion absorbed.
*/
default float getExplosionResistance(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
default float getExplosionResistance(BlockState state, IBlockReader world, BlockPos pos, Explosion explosion)
{
return this.getBlock().getExplosionResistance();
}

View file

@ -311,13 +311,12 @@ public interface IForgeBlockState
*
* @param world The current world
* @param pos Block position in world
* @param exploder The entity that caused the explosion, can be null
* @param explosion The explosion
* @return The amount of the explosion absorbed.
*/
default float getExplosionResistance(IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
default float getExplosionResistance(IBlockReader world, BlockPos pos, Explosion explosion)
{
return getBlockState().getBlock().getExplosionResistance(getBlockState(), world, pos, exploder, explosion);
return getBlockState().getBlock().getExplosionResistance(getBlockState(), world, pos, explosion);
}
/**

View file

@ -1,266 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*package net.minecraftforge.common.extensions;
import javax.annotation.Nullable;
import net.minecraft.client.audio.MusicTicker;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.dimension.NetherDimension;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.IRenderHandler;
public interface IForgeDimension
{
default Dimension getDimension()
{
return (Dimension) this;
}
World getWorld();
/**
* Called from {@link World#initCapabilities()}, to gather capabilities for this
* world. It's safe to access world here since this is called after world is
* registered.
*
* On server, called directly after mapStorage and world data such as Scoreboard
* and VillageCollection are initialized. On client, called when world is
* constructed, just before world load event is called. Note that this method is
* always called before the world load event.
*
* @return initial holder for capabilities on the world
* /
default net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities()
{
return null;
}
/**
* The dimension's movement factor. Whenever a player or entity changes
* dimension from world A to world B, their coordinates are multiplied by
* worldA.provider.getMovementFactor() / worldB.provider.getMovementFactor()
* Example: Overworld factor is 1, nether factor is 8. Traveling from overworld
* to nether multiplies coordinates by 1/8.
*
* @return The movement factor
* /
default double getMovementFactor()
{
if (getDimension() instanceof NetherDimension)
{
return 8.0;
}
return 1.0;
}
@OnlyIn(Dist.CLIENT)
@Nullable
IRenderHandler getSkyRenderer();
@OnlyIn(Dist.CLIENT)
void setSkyRenderer(IRenderHandler skyRenderer);
@OnlyIn(Dist.CLIENT)
@Nullable
IRenderHandler getCloudRenderer();
@OnlyIn(Dist.CLIENT)
void setCloudRenderer(IRenderHandler renderer);
@OnlyIn(Dist.CLIENT)
@Nullable
IRenderHandler getWeatherRenderer();
@OnlyIn(Dist.CLIENT)
void setWeatherRenderer(IRenderHandler renderer);
/**
* Allows for manipulating the coloring of the lightmap texture.
* Will be called for each 16*16 combination of sky/block light values.
*
* @param partialTicks Progress between ticks.
* @param sunBrightness Current sun brightness.
* @param skyLight Sky light brightness factor.
* @param blockLight Block light brightness factor.
* @param colors The color values that will be used: [r, g, b].
*
* @see net.minecraft.client.renderer.GameRenderer#updateLightmap(float)
* /
default void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, Vector3f colors) {}
void resetRainAndThunder();
default boolean canDoLightning(Chunk chunk)
{
return true;
}
default boolean canDoRainSnowIce(Chunk chunk)
{
return true;
}
/**
* Called on the client to get the music type to play when in this world type.
* At the time of calling, the client player and world are guaranteed to be non-null
* @return null to use vanilla logic, otherwise a MusicType to play in this world
* /
@Nullable
@OnlyIn(Dist.CLIENT)
default MusicTicker.MusicType getMusicType()
{
return null;
}
/**
* Determines if the player can sleep in this world (or if the bed should explode for example).
*
* @param player The player that is attempting to sleep
* @param pos The location where the player tries to sleep at (the position of the clicked on bed for example)
* @return the result of a player trying to sleep at the given location
* /
default SleepResult canSleepAt(net.minecraft.entity.player.PlayerEntity player, BlockPos pos)
{
return (getDimension().canRespawnHere() && getWorld().getBiome(pos) != Biomes.NETHER) ? SleepResult.ALLOW : SleepResult.BED_EXPLODES;
}
enum SleepResult
{
ALLOW,
DENY,
BED_EXPLODES;
}
default boolean isDaytime()
{
return getDimension().getType() == DimensionType.OVERWORLD && getWorld().getSkylightSubtracted() < 4;
}
/**
* Calculates the current moon phase factor.
* This factor is effective for slimes.
* (This method do not affect the moon rendering)
* * /
default float getCurrentMoonPhaseFactor(long time)
{
return Dimension.MOON_PHASE_FACTORS[this.getDimension().getMoonPhase(time)];
}
default void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) { }
default void calculateInitialWeather()
{
getWorld().calculateInitialWeatherBody();
}
default void updateWeather(Runnable defaultLogic)
{
defaultLogic.run();
}
default long getSeed()
{
return getWorld().getWorldInfo().getSeed();
}
default long getWorldTime()
{
return getWorld().getWorldInfo().getDayTime();
}
default void setWorldTime(long time)
{
getWorld().getWorldInfo().setDayTime(time);
}
default BlockPos getSpawnPoint()
{
WorldInfo info = getWorld().getWorldInfo();
return new BlockPos(info.getSpawnX(), info.getSpawnY(), info.getSpawnZ());
}
default void setSpawnPoint(BlockPos pos)
{
getWorld().getWorldInfo().setSpawn(pos);
}
default boolean canMineBlock(PlayerEntity player, BlockPos pos)
{
return getWorld().canMineBlockBody(player, pos);
}
default boolean isHighHumidity(BlockPos pos)
{
return getWorld().getBiome(pos).isHighHumidity();
}
default int getHeight()
{
return 256;
}
default int getActualHeight()
{
return getDimension().isNether() ? 128 : 256;
}
default int getSeaLevel()
{
return 63;
}
/**
* Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether.
*
* @param entity The entity holding the map, playername, or frame-ENTITYID
* @param x X Position
* @param z Z Position
* @param rotation the regular rotation of the marker
* @return True to 'spin' the cursor
* /
default boolean shouldMapSpin(String entity, double x, double z, double rotation)
{
return getDimension().getType() == DimensionType.THE_NETHER;
}
/**
* Determines the dimension the player will be respawned in, typically this brings them back to the overworld.
*
* @param player The player that is respawning
* @return The dimension to respawn the player in
* /
default DimensionType getRespawnDimension(ServerPlayerEntity player)
{
return player.getSpawnDimension();
}
}*/

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