diff --git a/.gitignore b/.gitignore index 5681190c6..945e6b587 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,13 @@ /mdk/build #occupational hazards -/projects/ +/projects/mcp/ +/projects/clean/ +/projects/forge/ +/projects/**/build/ +/projects/**/out/ +/projects/**/run/ +/projects/**/*.launch /repo/ /buildSrc diff --git a/Jenkinsfile b/Jenkinsfile index dc09c6aa4..100626037 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,12 +71,7 @@ pipeline { KEYSTORE_STOREPASS = credentials('forge-jenkins-keystore-old-keypass') } steps { - cache(maxCacheSize: 250/*MB*/, caches: [ - [$class: 'ArbitraryFileCache', excludes: '', includes: 'output.txt', path: '${WORKSPACE}/projects/forge/build/extractRangeMap/'] //Cache the rangemap to help speed up builds - ]){ - sh './gradlew ${GRADLE_ARGS} :forge:publish -PforgeMavenUser=${FORGE_MAVEN_USR} -PforgeMavenPassword=${FORGE_MAVEN_PSW} -PkeystoreKeyPass=${KEYSTORE_KEYPASS} -PkeystoreStorePass=${KEYSTORE_STOREPASS} -Pkeystore=${KEYSTORE} -PcrowdinKey=${CROWDIN}' - } - //We're not testing anymore so don't use the test group + sh './gradlew ${GRADLE_ARGS} :forge:publish -PforgeMavenUser=${FORGE_MAVEN_USR} -PforgeMavenPassword=${FORGE_MAVEN_PSW} -PkeystoreKeyPass=${KEYSTORE_KEYPASS} -PkeystoreStorePass=${KEYSTORE_STOREPASS} -Pkeystore=${KEYSTORE} -PcrowdinKey=${CROWDIN}' sh 'curl --user ${FORGE_MAVEN} http://files.minecraftforge.net/maven/manage/promote/latest/net.minecraftforge.forge/${MYVERSION}' } } @@ -88,11 +83,7 @@ pipeline { CROWDIN = credentials('forge-crowdin') } steps { - cache(maxCacheSize: 250/*MB*/, caches: [ - [$class: 'ArbitraryFileCache', excludes: '', includes: 'output.txt', path: '${WORKSPACE}/projects/forge/build/extractRangeMap/'] //Cache the rangemap to help speed up builds - ]){ - sh './gradlew ${GRADLE_ARGS} :forge:publish -PcrowdinKey=${CROWDIN}' - } + sh './gradlew ${GRADLE_ARGS} :forge:publish -PcrowdinKey=${CROWDIN}' } } } diff --git a/build.gradle b/build.gradle index 4cb799c50..8392b1cfd 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ plugins { id 'net.minecrell.licenser' version '0.4' id 'org.ajoberstar.grgit' version '2.3.0' id 'de.undercouch.download' version '3.3.0' - id "com.github.ben-manes.versions" version '0.20.0' + id 'com.github.ben-manes.versions' version '0.20.0' } apply plugin: 'eclipse' @@ -45,13 +45,13 @@ ext { ] } MAPPING_CHANNEL = 'snapshot' - MAPPING_VERSION = '20180921-1.13' - MC_VERSION = '1.13.2' - MCP_VERSION = '20190213.203750' + MAPPING_VERSION = '20190526-1.13.2' + MC_VERSION = '1.14.2' + MCP_VERSION = '20190603.175704' } project(':mcp') { - apply plugin: 'net.minecraftforge.gradle.forgedev.mcp' + apply plugin: 'net.minecraftforge.gradle.mcp' mcp { config = MC_VERSION + '-' + MCP_VERSION pipeline = 'joined' @@ -61,11 +61,16 @@ project(':mcp') { project(':clean') { evaluationDependsOn(':mcp') apply plugin: 'eclipse' - apply plugin: 'net.minecraftforge.gradle.forgedev.patcher' + apply plugin: 'net.minecraftforge.gradle.patcher' + compileJava.sourceCompatibility = compileJava.targetCompatibility = sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. + repositories { mavenCentral() } - + + dependencies { + implementation 'net.minecraftforge:forgespi:0.13.+' + } patcher { parent = project(':mcp') mcVersion = MC_VERSION @@ -102,7 +107,7 @@ project(':forge') { apply plugin: 'java-library' apply plugin: 'maven-publish' apply plugin: 'eclipse' - apply plugin: 'net.minecraftforge.gradle.forgedev.patcher' + apply plugin: 'net.minecraftforge.gradle.patcher' apply plugin: 'net.minecrell.licenser' apply plugin: 'de.undercouch.download' @@ -133,8 +138,8 @@ project(':forge') { runtimeClasspath += sourceSets.fmllauncher.runtimeClasspath java { srcDirs = [ - "$rootDir/src/test/java", - "$rootDir/src/fmllaunchertest/java" + //"$rootDir/src/test/java", + //"$rootDir/src/fmllaunchertest/java" ] } resources { @@ -161,7 +166,7 @@ project(':forge') { } ext { - SPEC_VERSION = '25.0' // This is overwritten by git tag, but here so dev time doesnt explode + SPEC_VERSION = '26.0' // This is overwritten by git tag, but here so dev time doesnt explode // The new versioning sceme is -.. // ForgeMC is a unique identifier for every MC version we have supported. // Essentially, the same as the old, except dropping the first number, and the builds are no longer unique. @@ -321,8 +326,6 @@ project(':forge') { fmllauncherImplementation.extendsFrom(installer) } dependencies { - api 'net.minecraft:client:${MC_VERSION}:extra' - installer 'com.paulscode:soundsystem:2018+' installer 'org.ow2.asm:asm:6.2' installer 'org.ow2.asm:asm-commons:6.2' installer 'org.ow2.asm:asm-tree:6.2' @@ -345,9 +348,9 @@ project(':forge') { installer 'net.sf.jopt-simple:jopt-simple:5.0.4' fmllauncherImplementation 'com.google.guava:guava:21.0' fmllauncherImplementation 'com.google.code.gson:gson:2.8.0' - testImplementation "org.junit.jupiter:junit-jupiter-api:5.0.0" - testImplementation "org.opentest4j:opentest4j:1.0.0" // needed for junit 5 - testImplementation "org.hamcrest:hamcrest-all:1.3" // needs advanced matching for list order + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.0.0' + testImplementation 'org.opentest4j:opentest4j:1.0.0' // needed for junit 5 + testImplementation 'org.hamcrest:hamcrest-all:1.3' // needs advanced matching for list order } def extraTxts = [ diff --git a/patches/minecraft/com/mojang/blaze3d/platform/GLX.java.patch b/patches/minecraft/com/mojang/blaze3d/platform/GLX.java.patch new file mode 100644 index 000000000..220fe5600 --- /dev/null +++ b/patches/minecraft/com/mojang/blaze3d/platform/GLX.java.patch @@ -0,0 +1,24 @@ +--- a/com/mojang/blaze3d/platform/GLX.java ++++ b/com/mojang/blaze3d/platform/GLX.java +@@ -115,6 +115,10 @@ + p_212906_0_.put(1286, "Operation on incomplete framebuffer"); + }); + ++ /* Stores the last values sent into glMultiTexCoord2f */ ++ public static float lastBrightnessX = 0.0f; ++ public static float lastBrightnessY = 0.0f; ++ + public static void populateSnooperWithOpenGL(IDataHolder p_populateSnooperWithOpenGL_0_) { + p_populateSnooperWithOpenGL_0_.setFixedData("opengl_version", GlStateManager.getString(7938)); + p_populateSnooperWithOpenGL_0_.setFixedData("opengl_vendor", GlStateManager.getString(7936)); +@@ -909,6 +913,10 @@ + GL13.glMultiTexCoord2f(p_glMultiTexCoord2f_0_, p_glMultiTexCoord2f_1_, p_glMultiTexCoord2f_2_); + } + ++ if (p_glMultiTexCoord2f_0_ == GL_TEXTURE1) { ++ lastBrightnessX = p_glMultiTexCoord2f_1_; ++ lastBrightnessY = p_glMultiTexCoord2f_2_; ++ } + } + + public static void glBlendFuncSeparate(int p_glBlendFuncSeparate_0_, int p_glBlendFuncSeparate_1_, int p_glBlendFuncSeparate_2_, int p_glBlendFuncSeparate_3_) { diff --git a/patches/minecraft/com/mojang/blaze3d/platform/TextureUtil.java.patch b/patches/minecraft/com/mojang/blaze3d/platform/TextureUtil.java.patch new file mode 100644 index 000000000..745220a2d --- /dev/null +++ b/patches/minecraft/com/mojang/blaze3d/platform/TextureUtil.java.patch @@ -0,0 +1,14 @@ +--- a/com/mojang/blaze3d/platform/TextureUtil.java ++++ b/com/mojang/blaze3d/platform/TextureUtil.java +@@ -44,7 +44,10 @@ + } + + public static void prepareImage(NativeImage.PixelFormatGLCode p_prepareImage_0_, int p_prepareImage_1_, int p_prepareImage_2_, int p_prepareImage_3_, int p_prepareImage_4_) { +- bind(p_prepareImage_1_); ++ synchronized (net.minecraftforge.fml.client.SplashProgress.class) ++ { ++ bind(p_prepareImage_1_); ++ } + if (p_prepareImage_2_ >= 0) { + GlStateManager.texParameter(3553, 33085, p_prepareImage_2_); + GlStateManager.texParameter(3553, 33082, 0); diff --git a/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch b/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch index 9da06bdf9..4502c8003 100644 --- a/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch +++ b/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/advancements/AdvancementRewards.java +++ b/net/minecraft/advancements/AdvancementRewards.java -@@ -41,7 +41,7 @@ +@@ -43,7 +43,7 @@ - public void func_192113_a(EntityPlayerMP p_192113_1_) { + public void func_192113_a(ServerPlayerEntity p_192113_1_) { p_192113_1_.func_195068_e(this.field_192115_b); -- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_186472_a(p_192113_1_).func_204313_a(new BlockPos(p_192113_1_)).func_186471_a(); -+ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_186472_a(p_192113_1_).func_204313_a(new BlockPos(p_192113_1_)).func_186470_a(p_192113_1_).func_186469_a(p_192113_1_.func_184817_da()).func_186471_a(); // FORGE: add player & luck to LootContext +- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_216286_f, new BlockPos(p_192113_1_)).func_216023_a(p_192113_1_.func_70681_au()).func_216022_a(LootParameterSets.field_216265_f); ++ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_216286_f, new BlockPos(p_192113_1_)).func_216023_a(p_192113_1_.func_70681_au()).func_186469_a(p_192113_1_.func_184817_da()).func_216022_a(LootParameterSets.field_216265_f); // FORGE: luck to LootContext boolean flag = false; for(ResourceLocation resourcelocation : this.field_192116_c) { diff --git a/patches/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch b/patches/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch index 2b621a3c9..669cebbbe 100644 --- a/patches/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch +++ b/patches/minecraft/net/minecraft/advancements/PlayerAdvancements.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/advancements/PlayerAdvancements.java +++ b/net/minecraft/advancements/PlayerAdvancements.java -@@ -174,6 +174,8 @@ +@@ -186,6 +186,8 @@ } public boolean func_192750_a(Advancement p_192750_1_, String p_192750_2_) { @@ -9,9 +9,9 @@ boolean flag = false; AdvancementProgress advancementprogress = this.func_192747_a(p_192750_1_); boolean flag1 = advancementprogress.func_192105_a(); -@@ -186,6 +188,7 @@ +@@ -198,6 +200,7 @@ if (p_192750_1_.func_192068_c() != null && p_192750_1_.func_192068_c().func_193220_i() && this.field_192762_j.field_70170_p.func_82736_K().func_82766_b("announceAdvancements")) { - this.field_192756_d.func_184103_al().func_148539_a(new TextComponentTranslation("chat.type.advancement." + p_192750_1_.func_192068_c().func_192291_d().func_192307_a(), this.field_192762_j.func_145748_c_(), p_192750_1_.func_193123_j())); + this.field_192756_d.func_184103_al().func_148539_a(new TranslationTextComponent("chat.type.advancement." + p_192750_1_.func_192068_c().func_192291_d().func_192307_a(), this.field_192762_j.func_145748_c_(), p_192750_1_.func_193123_j())); } + net.minecraftforge.common.ForgeHooks.onAdvancement(this.field_192762_j, p_192750_1_); } diff --git a/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch b/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch index 15163eb09..3267ad078 100644 --- a/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch +++ b/patches/minecraft/net/minecraft/advancements/criterion/ItemPredicate.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/advancements/criterion/ItemPredicate.java +++ b/net/minecraft/advancements/criterion/ItemPredicate.java -@@ -24,6 +24,8 @@ - import net.minecraft.util.registry.IRegistry; +@@ -25,6 +25,8 @@ + import net.minecraft.util.registry.Registry; public class ItemPredicate { + private static final Map> custom_predicates = new java.util.HashMap<>(); @@ -9,14 +9,14 @@ public static final ItemPredicate field_192495_a = new ItemPredicate(); @Nullable private final Tag field_200018_b; -@@ -90,6 +92,11 @@ +@@ -93,6 +95,11 @@ public static ItemPredicate func_192492_a(@Nullable JsonElement p_192492_0_) { if (p_192492_0_ != null && !p_192492_0_.isJsonNull()) { - JsonObject jsonobject = JsonUtils.func_151210_l(p_192492_0_, "item"); + JsonObject jsonobject = JSONUtils.func_151210_l(p_192492_0_, "item"); + if (jsonobject.has("type")) { -+ final ResourceLocation rl = new ResourceLocation(JsonUtils.func_151200_h(jsonobject, "type")); -+ if (custom_predicates.containsKey(rl)) return custom_predicates.get(rl).apply(jsonobject); -+ else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl); ++ final ResourceLocation rl = new ResourceLocation(JSONUtils.func_151200_h(jsonobject, "type")); ++ if (custom_predicates.containsKey(rl)) return custom_predicates.get(rl).apply(jsonobject); ++ else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl); + } MinMaxBounds.IntBound minmaxbounds$intbound = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("count")); MinMaxBounds.IntBound minmaxbounds$intbound1 = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("durability")); @@ -30,7 +30,7 @@ + } + + public static Map> getPredicates() { -+ return unmod_predicates; ++ return unmod_predicates; + } + public static class Builder { diff --git a/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch b/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch new file mode 100644 index 000000000..5837d4464 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch @@ -0,0 +1,96 @@ +--- a/net/minecraft/block/AbstractRailBlock.java ++++ b/net/minecraft/block/AbstractRailBlock.java +@@ -35,7 +35,7 @@ + } + + public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { +- RailShape railshape = p_220053_1_.func_177230_c() == this ? p_220053_1_.func_177229_b(this.func_176560_l()) : null; ++ RailShape railshape = p_220053_1_.func_177230_c() == this ? getRailDirection(p_220053_1_, p_220053_2_, p_220053_3_, null) : null; + return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a; + } + +@@ -57,7 +57,7 @@ + + public void func_220069_a(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) { + if (!p_220069_2_.field_72995_K) { +- RailShape railshape = p_220069_1_.func_177229_b(this.func_176560_l()); ++ RailShape railshape = getRailDirection(p_220069_1_, p_220069_2_, p_220069_3_, null); + boolean flag = false; + BlockPos blockpos = p_220069_3_.func_177977_b(); + if (!func_220064_c(p_220069_2_, blockpos)) { +@@ -115,7 +115,7 @@ + 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 (!p_196243_5_) { + super.func_196243_a(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_); +- if (p_196243_1_.func_177229_b(this.func_176560_l()).func_208092_c()) { ++ if (getRailDirection(p_196243_1_, p_196243_2_, p_196243_3_, null).func_208092_c()) { + p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this); + } + +@@ -127,5 +127,66 @@ + } + } + ++ //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability + public abstract IProperty func_176560_l(); ++ ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * Return true if the rail can make corners. ++ * Used by placement logic. ++ * @param world The world. ++ * @param pos Block's position in world ++ * @return True if the rail can make corners. ++ */ ++ public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos) ++ { ++ return !this.field_196277_c; ++ } ++ ++ /** ++ * Returns true if the rail can make up and down slopes. ++ * Used by placement logic. ++ * @param world The world. ++ * @param pos Block's position in world ++ * @return True if the rail can make slopes. ++ */ ++ public boolean canMakeSlopes(BlockState state, IBlockReader world, BlockPos pos) { ++ return true; ++ } ++ ++ /** ++ * Return the rail's direction. ++ * Can be used to make the cart think the rail is a different shape, ++ * for example when making diamond junctions or switches. ++ * The cart parameter will often be null unless it it called from EntityMinecart. ++ * ++ * @param world The world. ++ * @param pos Block's position in world ++ * @param state The BlockState ++ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart. ++ * @return The direction. ++ */ ++ public RailShape getRailDirection(BlockState state, IBlockReader world, BlockPos pos, @javax.annotation.Nullable net.minecraft.entity.item.minecart.AbstractMinecartEntity cart) { ++ return state.func_177229_b(func_176560_l()); ++ } ++ ++ /** ++ * Returns the max speed of the rail at the specified position. ++ * @param world The world. ++ * @param cart The cart on the rail, may be null. ++ * @param pos Block's position in world ++ * @return The max speed of the current rail. ++ */ ++ public float getRailMaxSpeed(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart) { ++ return 0.4f; ++ } ++ ++ /** ++ * This function is called by any minecart that passes over this rail. ++ * It is called once per update tick that the minecart is on the rail. ++ * @param world The world. ++ * @param cart The cart on the rail. ++ * @param pos Block's position in world ++ */ ++ public void onMinecartPass(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart) { } + } diff --git a/patches/minecraft/net/minecraft/block/BedBlock.java.patch b/patches/minecraft/net/minecraft/block/BedBlock.java.patch new file mode 100644 index 000000000..de8f72a7e --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BedBlock.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/block/BedBlock.java ++++ b/net/minecraft/block/BedBlock.java +@@ -85,7 +85,9 @@ + } + } + +- if (p_220051_2_.field_73011_w.func_76567_e() && p_220051_2_.func_180494_b(p_220051_3_) != Biomes.field_76778_j) { ++ net.minecraftforge.common.extensions.IForgeDimension.SleepResult sleepResult = p_220051_2_.field_73011_w.canSleepAt(p_220051_4_, p_220051_3_); ++ if (sleepResult != net.minecraftforge.common.extensions.IForgeDimension.SleepResult.BED_EXPLODES) { ++ if (sleepResult == net.minecraftforge.common.extensions.IForgeDimension.SleepResult.DENY) return true; + if (p_220051_1_.func_177229_b(field_176471_b)) { + p_220051_4_.func_146105_b(new TranslationTextComponent("block.minecraft.bed.occupied"), true); + return true; diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 69ef9ac3c..5b8c849cb 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -1,28 +1,28 @@ --- a/net/minecraft/block/Block.java +++ b/net/minecraft/block/Block.java -@@ -75,9 +75,10 @@ +@@ -74,9 +74,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public class Block implements IItemProvider { +public class Block extends net.minecraftforge.registries.ForgeRegistryEntry implements IItemProvider, net.minecraftforge.common.extensions.IForgeBlock { protected static final Logger field_196273_d = LogManager.getLogger(); -- public static final ObjectIntIdentityMap field_176229_d = new ObjectIntIdentityMap<>(); +- public static final ObjectIntIdentityMap field_176229_d = new ObjectIntIdentityMap<>(); + @Deprecated //Forge: Do not use, use GameRegistry -+ public static final ObjectIntIdentityMap field_176229_d = net.minecraftforge.registries.GameData.getBlockStateIDMap(); - private static final EnumFacing[] field_212556_a = new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.DOWN, EnumFacing.UP}; - protected final int field_149784_t; - protected final float field_149782_v; -@@ -298,7 +299,7 @@ ++ public static final ObjectIntIdentityMap field_176229_d = net.minecraftforge.registries.GameData.getBlockStateIDMap(); + private static final Direction[] field_212556_a = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP}; + private static final LoadingCache field_223006_b = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader() { + public Boolean load(VoxelShape p_load_1_) { +@@ -290,7 +291,7 @@ @Deprecated - public boolean func_196253_a(IBlockState p_196253_1_, BlockItemUseContext p_196253_2_) { -- return this.field_149764_J.func_76222_j() && p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j(); -+ return p_196253_1_.func_185904_a().func_76222_j() && p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j(); + public boolean func_196253_a(BlockState p_196253_1_, BlockItemUseContext p_196253_2_) { +- return this.field_149764_J.func_76222_j() && (p_196253_2_.func_195996_i().func_190926_b() || p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j()); ++ return p_196253_1_.func_185904_a().func_76222_j() && (p_196253_2_.func_195996_i().func_190926_b() || p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j()); } @Deprecated -@@ -310,8 +311,9 @@ +@@ -302,8 +303,9 @@ return this.field_149789_z; } @@ -33,39 +33,28 @@ } @Deprecated -@@ -322,11 +324,11 @@ +@@ -314,7 +316,7 @@ @Deprecated @OnlyIn(Dist.CLIENT) - public int func_185484_c(IBlockState p_185484_1_, IWorldReader p_185484_2_, BlockPos p_185484_3_) { -- int i = p_185484_2_.func_175626_b(p_185484_3_, p_185484_1_.func_185906_d()); -+ int i = p_185484_2_.func_175626_b(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_)); - if (i == 0 && p_185484_1_.func_177230_c() instanceof BlockSlab) { - p_185484_3_ = p_185484_3_.func_177977_b(); - p_185484_1_ = p_185484_2_.func_180495_p(p_185484_3_); -- return p_185484_2_.func_175626_b(p_185484_3_, p_185484_1_.func_185906_d()); -+ return p_185484_2_.func_175626_b(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_)); - } else { - return i; - } -@@ -468,8 +470,17 @@ + public int func_220058_a(BlockState p_220058_1_, IEnviromentBlockReader p_220058_2_, BlockPos p_220058_3_) { +- return p_220058_2_.func_217338_b(p_220058_3_, p_220058_1_.func_185906_d()); ++ return p_220058_2_.func_217338_b(p_220058_3_, p_220058_1_.getLightValue(p_220058_2_, p_220058_3_)); + } + + @OnlyIn(Dist.CLIENT) +@@ -459,10 +461,9 @@ @Deprecated - public void func_196243_a(IBlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, IBlockState p_196243_4_, boolean p_196243_5_) { -+ // FORGE: Remove modded TEs when the block changes -+ if (hasTileEntity(p_196243_1_) && !(this instanceof BlockContainer // Vanilla ITEP classes, they do this themselves -+ || this instanceof net.minecraft.block.BlockBed -+ || this instanceof net.minecraft.block.BlockRedstoneDiode)) { -+ if (p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c()) { -+ p_196243_2_.func_175713_t(p_196243_3_); -+ } -+ } + 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_149716_u() && p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c()) { ++ if (p_196243_1_.hasTileEntity() && p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c()) { + p_196243_2_.func_175713_t(p_196243_3_); + } +- } -+ @Deprecated //Forge: Use fortune/location sensitive version - public int func_196264_a(IBlockState p_196264_1_, Random p_196264_2_) { - return 1; - } -@@ -484,30 +495,30 @@ + @Deprecated +@@ -471,8 +472,8 @@ if (f == -1.0F) { return 0.0F; } else { @@ -76,41 +65,25 @@ } } - @Deprecated - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { -- if (!p_196255_2_.field_72995_K) { -- int i = this.func_196251_a(p_196255_1_, p_196255_5_, p_196255_2_, p_196255_3_, p_196255_2_.field_73012_v); -- -- for(int j = 0; j < i; ++j) { -- if (!(p_196255_4_ < 1.0F) || !(p_196255_2_.field_73012_v.nextFloat() > p_196255_4_)) { -- Item item = this.func_199769_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_5_).func_199767_j(); -- if (item != Items.field_190931_a) { -- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(item)); -- } -- } -+ if (!p_196255_2_.field_72995_K && !p_196255_2_.restoringBlockSnapshots) { // do not drop items while restoring blockstates, prevents item dupe -+ NonNullList drops = NonNullList.func_191196_a(); -+ getDrops(p_196255_1_, drops, p_196255_2_, p_196255_3_, p_196255_5_); -+ p_196255_4_ = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(drops, p_196255_2_, p_196255_3_, p_196255_1_, p_196255_5_, p_196255_4_, false, harvesters.get()); -+ for (ItemStack stack : drops) { -+ if (p_196255_2_.field_73012_v.nextFloat() <= p_196255_4_) -+ func_180635_a(p_196255_2_, p_196255_3_, stack); - } -- - } +@@ -552,7 +553,7 @@ } public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) { - if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_82766_b("doTileDrops")) { -+ if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_82766_b("doTileDrops") && !p_180635_0_.restoringBlockSnapshots) {// do not drop items while restoring blockstates, prevents item dupe -+ if (captureDrops.get()) { -+ capturedDrops.get().add(p_180635_2_); -+ return; -+ } ++ if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_82766_b("doTileDrops") && !p_180635_0_.restoringBlockSnapshots) { // do not drop items while restoring blockstates, prevents item dupe float f = 0.5F; double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D; double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D; -@@ -529,6 +540,7 @@ +@@ -564,7 +565,7 @@ + } + + public void func_180637_b(World p_180637_1_, BlockPos p_180637_2_, int p_180637_3_) { +- if (!p_180637_1_.field_72995_K && p_180637_1_.func_82736_K().func_82766_b("doTileDrops")) { ++ if (!p_180637_1_.field_72995_K && p_180637_1_.func_82736_K().func_82766_b("doTileDrops") && !p_180637_1_.restoringBlockSnapshots) { // do not drop items while restoring blockstates, prevents item dupe + while(p_180637_3_ > 0) { + int i = ExperienceOrbEntity.func_70527_a(p_180637_3_); + p_180637_3_ -= i; +@@ -574,6 +575,7 @@ } @@ -118,57 +91,39 @@ public float func_149638_a() { return this.field_149781_w; } -@@ -543,7 +555,7 @@ - } - } - -- return raytraceresult; -+ return p_180636_0_.func_177230_c().getRayTraceResult(p_180636_0_, p_180636_1_, p_180636_2_, p_180636_3_, p_180636_4_, raytraceresult); - } - - public void func_180652_a(World p_180652_1_, BlockPos p_180652_2_, Explosion p_180652_3_) { -@@ -597,16 +609,22 @@ - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) { - p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this)); - p_180657_2_.func_71020_j(0.005F); -- if (this.func_149700_E() && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) { -+ if (this.canSilkHarvest(p_180657_4_, p_180657_1_, p_180657_3_, p_180657_2_) && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) { -+ NonNullList items = NonNullList.func_191196_a(); - ItemStack itemstack = this.func_180643_i(p_180657_4_); -- func_180635_a(p_180657_1_, p_180657_3_, itemstack); -+ if (!itemstack.func_190926_b()) items.add(itemstack); -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, 0, 1.0f, true, p_180657_2_); -+ items.forEach(e -> func_180635_a(p_180657_1_, p_180657_3_, e)); - } else { -+ harvesters.set(p_180657_2_); - int i = EnchantmentHelper.func_77506_a(Enchantments.field_185308_t, p_180657_6_); - p_180657_4_.func_196949_c(p_180657_1_, p_180657_3_, i); -+ harvesters.set(null); - } - - } - -+ @Deprecated //Use state sensitive version - protected boolean func_149700_E() { - return this.func_176223_P().func_185917_h() && !this.func_149716_u(); - } -@@ -663,6 +681,7 @@ - p_176216_2_.field_70181_x = 0.0D; +@@ -676,6 +678,7 @@ + p_176216_2_.func_213317_d(p_176216_2_.func_213322_ci().func_216372_d(1.0D, 0.0D, 1.0D)); } + @Deprecated // Forge: Use more sensitive version below: getPickBlock - public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) { + @OnlyIn(Dist.CLIENT) + public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) { return new ItemStack(this); +@@ -690,6 +693,7 @@ + return Fluids.field_204541_a.func_207188_f(); } -@@ -737,6 +756,7 @@ + ++ @Deprecated //Forge: Use more sensitive version + public float func_208618_m() { + return this.field_149765_K; + } +@@ -710,6 +714,7 @@ + public void func_176224_k(World p_176224_1_, BlockPos p_176224_2_) { + } + ++ @Deprecated //Forge: Use more sensitive version + public boolean func_149659_a(Explosion p_149659_1_) { + return true; + } +@@ -754,6 +759,7 @@ } } + @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) } - public SoundType func_185467_w() { + public SoundType func_220072_p(BlockState p_220072_1_) { return this.field_149762_H; } -@@ -758,11 +778,11 @@ +@@ -779,13 +785,74 @@ } public static boolean func_196252_e(Block p_196252_0_) { @@ -181,72 +136,31 @@ + return net.minecraftforge.common.Tags.Blocks.DIRT.func_199685_a_(p_196245_0_); } - public static void func_149671_p() { -@@ -1129,7 +1149,7 @@ - func_196254_a("chiseled_quartz_block", new Block(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151677_p).func_200943_b(0.8F))); - func_196254_a("quartz_pillar", new BlockRotatedPillar(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151677_p).func_200943_b(0.8F))); - func_196254_a("quartz_stairs", new BlockStairs(block42.func_176223_P(), Block.Properties.func_200950_a(block42))); -- func_196254_a("activator_rail", new BlockRailPowered(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e))); -+ func_196254_a("activator_rail", new BlockRailPowered(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e), true)); - func_196254_a("dropper", new BlockDropper(Block.Properties.func_200945_a(Material.field_151576_e).func_200943_b(3.5F))); - func_196254_a("white_terracotta", new Block(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_193561_M).func_200948_a(1.25F, 4.2F))); - func_196254_a("orange_terracotta", new Block(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_193562_N).func_200948_a(1.25F, 4.2F))); -@@ -1455,6 +1475,7 @@ - func_196254_a("bubble_column", new BlockBubbleColumn(Block.Properties.func_200945_a(Material.field_203244_i).func_200942_a())); - func_196254_a("structure_block", new BlockStructure(Block.Properties.func_200949_a(Material.field_151573_f, MaterialColor.field_197656_x).func_200948_a(-1.0F, 3600000.0F))); - -+ if(false) // Processed in GameData.BlockCallbacks#onBake - for(Block block85 : IRegistry.field_212618_g) { - for(IBlockState iblockstate : block85.func_176194_O().func_177619_a()) { - field_176229_d.func_195867_b(iblockstate); -@@ -1594,4 +1615,83 @@ - return Objects.hash(this.field_212164_a, this.field_212165_b, this.field_212166_c); - } - } + /* ======================================== FORGE START =====================================*/ + protected Random RANDOM = new Random(); -+ protected ThreadLocal harvesters = new ThreadLocal<>(); + private net.minecraftforge.common.ToolType harvestTool; + private int harvestLevel; -+ protected static ThreadLocal captureDrops = ThreadLocal.withInitial(() -> false); -+ protected static ThreadLocal> capturedDrops = ThreadLocal.withInitial(NonNullList::func_191196_a); -+ protected NonNullList captureDrops(boolean start) -+ { -+ if (start) { -+ captureDrops.set(true); -+ capturedDrops.get().clear(); -+ return NonNullList.func_191196_a(); -+ } else { -+ captureDrops.set(false); -+ return capturedDrops.get(); -+ } -+ } + + @Override -+ public float getSlipperiness(IBlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) { ++ public float getSlipperiness(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) { + return this.field_149765_K; + } + -+ @Override -+ public boolean canSilkHarvest(IBlockState state, IWorldReader world, BlockPos pos, EntityPlayer player) { -+ return this.func_149700_E() && !state.hasTileEntity(); -+ } -+ + @Nullable + @Override -+ public net.minecraftforge.common.ToolType getHarvestTool(IBlockState state) { ++ public net.minecraftforge.common.ToolType getHarvestTool(BlockState state) { + return harvestTool; //TODO: RE-Evaluate + } + + @Override -+ public int getHarvestLevel(IBlockState state) { ++ public int getHarvestLevel(BlockState state) { + return harvestLevel; //TODO: RE-Evaluate + } + + @Override -+ public boolean canSustainPlant(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing, net.minecraftforge.common.IPlantable plantable) { -+ IBlockState plant = plantable.getPlant(world, pos.func_177972_a(facing)); -+ net.minecraftforge.common.EnumPlantType type = plantable.getPlantType(world, pos.func_177972_a(facing)); ++ public boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, net.minecraftforge.common.IPlantable plantable) { ++ BlockState plant = plantable.getPlant(world, pos.func_177972_a(facing)); ++ net.minecraftforge.common.PlantType type = plantable.getPlantType(world, pos.func_177972_a(facing)); + + if (plant.func_177230_c() == Blocks.field_150434_aF) + return this.getBlock() == Blocks.field_150434_aF || this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_196611_F; @@ -254,16 +168,16 @@ + if (plant.func_177230_c() == Blocks.field_196608_cF && this == Blocks.field_196608_cF) + return true; + -+ if (plantable instanceof BlockBush && ((BlockBush)plantable).func_200014_a_(state, world, pos)) ++ if (plantable instanceof BushBlock && ((BushBlock)plantable).func_200014_a_(state, world, pos)) + return true; + + switch (type) { -+ case Desert: return this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_150405_ch || this.getBlock() instanceof BlockGlazedTerracotta; ++ case Desert: return this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_150405_ch || this.getBlock() instanceof GlazedTerracottaBlock; + case Nether: return this.getBlock() == Blocks.field_150425_aM; -+ case Crop: return this.getBlock() == Blocks.field_150458_ak; -+ case Cave: return state.func_185896_q(); ++ case Crop: return this.getBlock() == Blocks.field_150458_ak; ++ case Cave: return Block.func_220056_d(state, world, pos, Direction.UP); + case Plains: return this.getBlock() == Blocks.field_196658_i || Block.func_196245_f(this) || this.getBlock() == Blocks.field_150458_ak; -+ case Water: return state.func_185904_a() == Material.field_151586_h; //&& state.getValue(BlockLiquidWrapper) ++ case Water: return state.func_185904_a() == Material.field_151586_h; //&& state.getValue(BlockLiquidWrapper) + case Beach: + boolean isBeach = this.getBlock() == Blocks.field_196658_i || Block.func_196245_f(this) || this.getBlock() == Blocks.field_150354_m; + boolean hasWater = (world.func_180495_p(pos.func_177974_f()).func_185904_a() == Material.field_151586_h || @@ -282,4 +196,7 @@ + }); + } + /* ========================================= FORGE END ======================================*/ - } ++ + public static enum OffsetType { + NONE, + XZ, diff --git a/patches/minecraft/net/minecraft/block/BlockAbstractBanner.java.patch b/patches/minecraft/net/minecraft/block/BlockAbstractBanner.java.patch deleted file mode 100644 index e5f6e90a9..000000000 --- a/patches/minecraft/net/minecraft/block/BlockAbstractBanner.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/net/minecraft/block/BlockAbstractBanner.java -+++ b/net/minecraft/block/BlockAbstractBanner.java -@@ -51,7 +51,7 @@ - } - - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { -- func_180635_a(p_196255_2_, p_196255_3_, this.func_185473_a(p_196255_2_, p_196255_3_, p_196255_1_)); -+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_); - } - - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) { -@@ -75,4 +75,10 @@ - public EnumDyeColor func_196285_M_() { - return this.field_196286_a; - } -+ -+ @Override -+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList drops, World world, BlockPos pos, int fortune) { -+ TileEntity te = world.func_175625_s(pos); -+ drops.add((te instanceof TileEntityBanner) ? ((TileEntityBanner)te).func_190615_l(state) : func_185473_a(world, pos, state)); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockAbstractSkull.java.patch b/patches/minecraft/net/minecraft/block/BlockAbstractSkull.java.patch deleted file mode 100644 index a146148ac..000000000 --- a/patches/minecraft/net/minecraft/block/BlockAbstractSkull.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- a/net/minecraft/block/BlockAbstractSkull.java -+++ b/net/minecraft/block/BlockAbstractSkull.java -@@ -38,6 +38,7 @@ - } - - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { -+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_); - } - - public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, IBlockState p_176208_3_, EntityPlayer p_176208_4_) { -@@ -45,6 +46,7 @@ - TileEntitySkull.func_195486_a(p_176208_1_, p_176208_2_); - } - -+ this.func_196255_a(p_176208_3_, p_176208_1_, p_176208_2_, 1.0f, 0); - super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_); - } - -@@ -55,7 +57,7 @@ - public void func_196243_a(IBlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, IBlockState p_196243_4_, boolean p_196243_5_) { - if (p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c() && !p_196243_2_.field_72995_K) { - TileEntity tileentity = p_196243_2_.func_175625_s(p_196243_3_); -- if (tileentity instanceof TileEntitySkull) { -+ if (false && tileentity instanceof TileEntitySkull) { //Forge: Moved to getDrops - TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; - if (tileentityskull.func_195487_d()) { - ItemStack itemstack = this.func_185473_a(p_196243_2_, p_196243_3_, p_196243_1_); -@@ -74,6 +76,24 @@ - } - } - -+ @Override -+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList drops, World world, BlockPos pos, int fortune) { -+ TileEntity te = world.func_175625_s(pos); -+ if (te instanceof TileEntitySkull) { -+ TileEntitySkull skull = (TileEntitySkull)te; -+ if (skull.func_195487_d()) { -+ ItemStack ret = func_185473_a(world, pos, state); -+ Block block = skull.func_195044_w().func_177230_c(); -+ if ((block == Blocks.field_196710_eS || block == Blocks.field_196709_eR) && skull.func_152108_a() != null) { -+ NBTTagCompound nbt = new NBTTagCompound(); -+ NBTUtil.func_180708_a(nbt, skull.func_152108_a()); -+ ret.func_196082_o().func_74782_a("SkullOwner", nbt); -+ } -+ drops.add(ret); -+ } -+ } -+ } -+ - @OnlyIn(Dist.CLIENT) - public BlockSkull.ISkullType func_196292_N_() { - return this.field_196293_a; diff --git a/patches/minecraft/net/minecraft/block/BlockBed.java.patch b/patches/minecraft/net/minecraft/block/BlockBed.java.patch deleted file mode 100644 index c7585fca6..000000000 --- a/patches/minecraft/net/minecraft/block/BlockBed.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/block/BlockBed.java -+++ b/net/minecraft/block/BlockBed.java -@@ -67,7 +67,9 @@ - } - } - -- if (p_196250_2_.field_73011_w.func_76567_e() && p_196250_2_.func_180494_b(p_196250_3_) != Biomes.field_76778_j) { -+ net.minecraftforge.common.extensions.IForgeDimension.SleepResult sleepResult = p_196250_2_.field_73011_w.canSleepAt(p_196250_4_, p_196250_3_); -+ if (sleepResult != net.minecraftforge.common.extensions.IForgeDimension.SleepResult.BED_EXPLODES) { -+ if (sleepResult == net.minecraftforge.common.extensions.IForgeDimension.SleepResult.DENY) return true; - if (p_196250_1_.func_177229_b(field_176471_b)) { - EntityPlayer entityplayer = this.func_176470_e(p_196250_2_, p_196250_3_); - if (entityplayer != null) { diff --git a/patches/minecraft/net/minecraft/block/BlockBush.java.patch b/patches/minecraft/net/minecraft/block/BlockBush.java.patch deleted file mode 100644 index 0db69b24f..000000000 --- a/patches/minecraft/net/minecraft/block/BlockBush.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/net/minecraft/block/BlockBush.java -+++ b/net/minecraft/block/BlockBush.java -@@ -10,7 +10,7 @@ - import net.minecraft.world.IWorld; - import net.minecraft.world.IWorldReaderBase; - --public class BlockBush extends Block { -+public class BlockBush extends Block implements net.minecraftforge.common.IPlantable { - protected BlockBush(Block.Properties p_i48437_1_) { - super(p_i48437_1_); - } -@@ -26,6 +26,8 @@ - - public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) { - BlockPos blockpos = p_196260_3_.func_177977_b(); -+ if (p_196260_1_.func_177230_c() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. -+ return p_196260_2_.func_180495_p(blockpos).canSustainPlant(p_196260_2_, blockpos, EnumFacing.UP, this); - return this.func_200014_a_(p_196260_2_.func_180495_p(blockpos), p_196260_2_, blockpos); - } - -@@ -44,4 +46,11 @@ - public int func_200011_d(IBlockState p_200011_1_, IBlockReader p_200011_2_, BlockPos p_200011_3_) { - return 0; - } -+ -+ @Override -+ public IBlockState getPlant(IBlockReader world, BlockPos pos) { -+ IBlockState state = world.func_180495_p(pos); -+ if (state.func_177230_c() != this) return func_176223_P(); -+ return state; -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockChorusFlower.java.patch b/patches/minecraft/net/minecraft/block/BlockChorusFlower.java.patch deleted file mode 100644 index b739b3ed0..000000000 --- a/patches/minecraft/net/minecraft/block/BlockChorusFlower.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/block/BlockChorusFlower.java -+++ b/net/minecraft/block/BlockChorusFlower.java -@@ -42,7 +42,7 @@ - BlockPos blockpos = p_196267_3_.func_177984_a(); - if (p_196267_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) { - int i = p_196267_1_.func_177229_b(field_185607_a); -- if (i < 5) { -+ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, blockpos, p_196267_1_, true)) { - boolean flag = false; - boolean flag1 = false; - IBlockState iblockstate = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()); -@@ -99,7 +99,7 @@ - } else { - this.func_185605_c(p_196267_2_, p_196267_3_); - } -- -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); - } - } - } diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch deleted file mode 100644 index b683a062c..000000000 --- a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/net/minecraft/block/BlockCocoa.java -+++ b/net/minecraft/block/BlockCocoa.java -@@ -34,10 +34,11 @@ - } - - public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { -- if (p_196267_2_.field_73012_v.nextInt(5) == 0) { -+ if (true) { - int i = p_196267_1_.func_177229_b(field_176501_a); -- if (i < 2) { -+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_2_.field_73012_v.nextInt(5) == 0)) { - p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176501_a, Integer.valueOf(i + 1)), 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); - } - } - -@@ -90,14 +91,20 @@ - } - - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { -- int i = p_196255_1_.func_177229_b(field_176501_a); -+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_); -+ } -+ -+ @Override -+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList drops, World world, BlockPos pos, int fortune) { -+ super.getDrops(state, drops, world, pos, fortune); -+ int i = state.func_177229_b(field_176501_a); - int j = 1; - if (i >= 2) { - j = 3; - } - - for(int k = 0; k < j; ++k) { -- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(Items.field_196130_bo)); -+ drops.add(new ItemStack(Items.field_196130_bo)); - } - - } diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch deleted file mode 100644 index b5625ccff..000000000 --- a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- a/net/minecraft/block/BlockCrops.java -+++ b/net/minecraft/block/BlockCrops.java -@@ -55,12 +55,14 @@ - - public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { - super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_); -+ if (!p_196267_2_.func_205050_e(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_196267_2_.func_201669_a(p_196267_3_.func_177984_a(), 0) >= 9) { - int i = this.func_185527_x(p_196267_1_); - if (i < this.func_185526_g()) { - float f = func_180672_a(this, p_196267_2_, p_196267_3_); -- if (p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0) { -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0)) { - p_196267_2_.func_180501_a(p_196267_3_, this.func_185528_e(i + 1), 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); - } - } - } -@@ -89,9 +91,9 @@ - for(int j = -1; j <= 1; ++j) { - float f1 = 0.0F; - IBlockState iblockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j)); -- if (iblockstate.func_177230_c() == Blocks.field_150458_ak) { -+ if (iblockstate.canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)p_180672_0_)) { - f1 = 1.0F; -- if (iblockstate.func_177229_b(BlockFarmland.field_176531_a) > 0) { -+ if (iblockstate.isFertile(p_180672_1_, blockpos.func_177982_a(i, 0, j))) { - f1 = 3.0F; - } - } -@@ -135,15 +137,20 @@ - } - - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { -- super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, 0); -- if (!p_196255_2_.field_72995_K) { -- int i = this.func_185527_x(p_196255_1_); -+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_); -+ } -+ -+ @Override -+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList drops, World world, BlockPos pos, int fortune) { -+ super.getDrops(state, drops, world, pos, 0); -+ { -+ int i = this.func_185527_x(state); - if (i >= this.func_185526_g()) { -- int j = 3 + p_196255_5_; -+ int j = 3 + fortune; - - for(int k = 0; k < j; ++k) { -- if (p_196255_2_.field_73012_v.nextInt(2 * this.func_185526_g()) <= i) { -- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(this.func_199772_f())); -+ if (world.field_73012_v.nextInt(2 * this.func_185526_g()) <= i) { -+ drops.add(new ItemStack(this.func_199772_f())); - } - } - } diff --git a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch deleted file mode 100644 index be05194f9..000000000 --- a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/net/minecraft/block/BlockDeadBush.java -+++ b/net/minecraft/block/BlockDeadBush.java -@@ -14,7 +14,7 @@ - import net.minecraft.world.IBlockReader; - import net.minecraft.world.World; - --public class BlockDeadBush extends BlockBush { -+public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable { - protected static final VoxelShape field_196397_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D); - - protected BlockDeadBush(Block.Properties p_i48418_1_) { -@@ -46,4 +46,10 @@ - - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, flag ? Blocks.field_150350_a.func_176223_P() : p_180657_4_, p_180657_5_, p_180657_6_); - } -+ -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) { -+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11); -+ return java.util.Arrays.asList(new ItemStack(Blocks.field_196555_aI)); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockDirtSnowySpreadable.java.patch b/patches/minecraft/net/minecraft/block/BlockDirtSnowySpreadable.java.patch deleted file mode 100644 index 11cee0ddc..000000000 --- a/patches/minecraft/net/minecraft/block/BlockDirtSnowySpreadable.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/block/BlockDirtSnowySpreadable.java -+++ b/net/minecraft/block/BlockDirtSnowySpreadable.java -@@ -25,6 +25,7 @@ - - public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { - if (!p_196267_2_.field_72995_K) { -+ if (!p_196267_2_.func_205050_e(p_196267_3_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading - if (!func_196383_a(p_196267_2_, p_196267_3_)) { - p_196267_2_.func_175656_a(p_196267_3_, Blocks.field_150346_d.func_176223_P()); - } else { diff --git a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch deleted file mode 100644 index 57b78b853..000000000 --- a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/block/BlockDoublePlant.java -+++ b/net/minecraft/block/BlockDoublePlant.java -@@ -43,7 +43,7 @@ - @Nullable - public IBlockState func_196258_a(BlockItemUseContext p_196258_1_) { - BlockPos blockpos = p_196258_1_.func_195995_a(); -- return blockpos.func_177956_o() < 255 && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null; -+ return blockpos.func_177956_o() < p_196258_1_.func_195991_k().func_72800_K() - 1 && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null; - } - - public void func_180633_a(World p_180633_1_, BlockPos p_180633_2_, IBlockState p_180633_3_, EntityLivingBase p_180633_4_, ItemStack p_180633_5_) { -@@ -51,6 +51,7 @@ - } - - public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) { -+ if (p_196260_1_.func_177230_c() != this) return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. - if (p_196260_1_.func_177229_b(field_176492_b) != DoubleBlockHalf.UPPER) { - return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_); - } else { diff --git a/patches/minecraft/net/minecraft/block/BlockDropper.java.patch b/patches/minecraft/net/minecraft/block/BlockDropper.java.patch deleted file mode 100644 index e76a48f4a..000000000 --- a/patches/minecraft/net/minecraft/block/BlockDropper.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/block/BlockDropper.java -+++ b/net/minecraft/block/BlockDropper.java -@@ -37,7 +37,7 @@ - p_176439_1_.func_175718_b(1001, p_176439_2_, 0); - } else { - ItemStack itemstack = tileentitydispenser.func_70301_a(i); -- if (!itemstack.func_190926_b()) { -+ if (!itemstack.func_190926_b() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_176439_1_, p_176439_2_, tileentitydispenser, i, itemstack)) { - EnumFacing enumfacing = p_176439_1_.func_180495_p(p_176439_2_).func_177229_b(field_176441_a); - IInventory iinventory = TileEntityHopper.func_195484_a(p_176439_1_, p_176439_2_.func_177972_a(enumfacing)); - ItemStack itemstack1; diff --git a/patches/minecraft/net/minecraft/block/BlockEnderChest.java.patch b/patches/minecraft/net/minecraft/block/BlockEnderChest.java.patch deleted file mode 100644 index 1d0781c26..000000000 --- a/patches/minecraft/net/minecraft/block/BlockEnderChest.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/block/BlockEnderChest.java -+++ b/net/minecraft/block/BlockEnderChest.java -@@ -81,7 +81,7 @@ - InventoryEnderChest inventoryenderchest = p_196250_4_.func_71005_bN(); - TileEntity tileentity = p_196250_2_.func_175625_s(p_196250_3_); - if (inventoryenderchest != null && tileentity instanceof TileEntityEnderChest) { -- if (p_196250_2_.func_180495_p(p_196250_3_.func_177984_a()).func_185915_l()) { -+ if (p_196250_2_.func_180495_p(p_196250_3_.func_177984_a()).doesSideBlockChestOpening(p_196250_2_, p_196250_3_.func_177984_a(), EnumFacing.DOWN)) { - return true; - } else if (p_196250_2_.field_72995_K) { - return true; -@@ -173,4 +173,9 @@ - public boolean func_196266_a(IBlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { - return false; - } -+ -+ @Override -+ public boolean canSilkHarvest(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, EntityPlayer player) { -+ return true; -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch deleted file mode 100644 index 1f38e69eb..000000000 --- a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/block/BlockFalling.java -+++ b/net/minecraft/block/BlockFalling.java -@@ -48,7 +48,9 @@ - p_176503_1_.func_72838_d(entityfallingblock); - } - } else { -+ IBlockState state = func_176223_P(); - if (p_176503_1_.func_180495_p(p_176503_2_).func_177230_c() == this) { -+ state = p_176503_1_.func_180495_p(p_176503_2_); - p_176503_1_.func_175698_g(p_176503_2_); - } - -@@ -58,7 +60,7 @@ - } - - if (blockpos.func_177956_o() > 0) { -- p_176503_1_.func_175656_a(blockpos.func_177984_a(), this.func_176223_P()); -+ p_176503_1_.func_175656_a(blockpos.func_177984_a(), state); //Forge: Fix loss of state information during world gen. - } - } - diff --git a/patches/minecraft/net/minecraft/block/BlockFence.java.patch b/patches/minecraft/net/minecraft/block/BlockFence.java.patch deleted file mode 100644 index ace8048c6..000000000 --- a/patches/minecraft/net/minecraft/block/BlockFence.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- a/net/minecraft/block/BlockFence.java -+++ b/net/minecraft/block/BlockFence.java -@@ -64,15 +64,12 @@ - IBlockReader iblockreader = p_196258_1_.func_195991_k(); - BlockPos blockpos = p_196258_1_.func_195995_a(); - IFluidState ifluidstate = p_196258_1_.func_195991_k().func_204610_c(p_196258_1_.func_195995_a()); -- BlockPos blockpos1 = blockpos.func_177978_c(); -- BlockPos blockpos2 = blockpos.func_177974_f(); -- BlockPos blockpos3 = blockpos.func_177968_d(); -- BlockPos blockpos4 = blockpos.func_177976_e(); -- IBlockState iblockstate = iblockreader.func_180495_p(blockpos1); -- IBlockState iblockstate1 = iblockreader.func_180495_p(blockpos2); -- IBlockState iblockstate2 = iblockreader.func_180495_p(blockpos3); -- IBlockState iblockstate3 = iblockreader.func_180495_p(blockpos4); -- return super.func_196258_a(p_196258_1_).func_206870_a(field_196409_a, Boolean.valueOf(this.func_196416_a(iblockstate, iblockstate.func_193401_d(iblockreader, blockpos1, EnumFacing.SOUTH)))).func_206870_a(field_196411_b, Boolean.valueOf(this.func_196416_a(iblockstate1, iblockstate1.func_193401_d(iblockreader, blockpos2, EnumFacing.WEST)))).func_206870_a(field_196413_c, Boolean.valueOf(this.func_196416_a(iblockstate2, iblockstate2.func_193401_d(iblockreader, blockpos3, EnumFacing.NORTH)))).func_206870_a(field_196414_y, Boolean.valueOf(this.func_196416_a(iblockstate3, iblockstate3.func_193401_d(iblockreader, blockpos4, EnumFacing.EAST)))).func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a)); -+ return super.func_196258_a(p_196258_1_) -+ .func_206870_a(field_196409_a, canFenceConnectTo(iblockreader, blockpos, EnumFacing.NORTH)) -+ .func_206870_a(field_196411_b, canFenceConnectTo(iblockreader, blockpos, EnumFacing.EAST)) -+ .func_206870_a(field_196413_c, canFenceConnectTo(iblockreader, blockpos, EnumFacing.SOUTH)) -+ .func_206870_a(field_196414_y, canFenceConnectTo(iblockreader, blockpos, EnumFacing.WEST)) -+ .func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a)); - } - - public IBlockState func_196271_a(IBlockState p_196271_1_, EnumFacing p_196271_2_, IBlockState p_196271_3_, IWorld p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) { -@@ -80,7 +77,7 @@ - p_196271_4_.func_205219_F_().func_205360_a(p_196271_5_, Fluids.field_204546_a, Fluids.field_204546_a.func_205569_a(p_196271_4_)); - } - -- return p_196271_2_.func_176740_k().func_176716_d() == EnumFacing.Plane.HORIZONTAL ? p_196271_1_.func_206870_a(field_196415_z.get(p_196271_2_), Boolean.valueOf(this.func_196416_a(p_196271_3_, p_196271_3_.func_193401_d(p_196271_4_, p_196271_6_, p_196271_2_.func_176734_d())))) : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_); -+ return p_196271_2_.func_176740_k().func_176716_d() == EnumFacing.Plane.HORIZONTAL ? p_196271_1_.func_206870_a(field_196415_z.get(p_196271_2_), Boolean.valueOf(this.canFenceConnectTo(p_196271_4_, p_196271_5_, p_196271_2_))) : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_); - } - - protected void func_206840_a(StateContainer.Builder p_206840_1_) { -@@ -90,4 +87,16 @@ - public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) { - return p_193383_4_ != EnumFacing.UP && p_193383_4_ != EnumFacing.DOWN ? BlockFaceShape.MIDDLE_POLE : BlockFaceShape.CENTER; - } -+ -+ @Override -+ public boolean canBeConnectedTo(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing) { -+ IBlockState other = world.func_180495_p(pos.func_177972_a(facing)); -+ return func_196416_a(other, other.func_193401_d(world, pos.func_177972_a(facing), facing.func_176734_d())); -+ } -+ -+ private boolean canFenceConnectTo(IBlockReader world, BlockPos pos, EnumFacing facing) { -+ BlockPos offset = pos.func_177972_a(facing); -+ IBlockState other = world.func_180495_p(offset); -+ return other.canBeConnectedTo(world, offset, facing.func_176734_d()) || func_176223_P().canBeConnectedTo(world, pos, facing); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockFenceGate.java.patch b/patches/minecraft/net/minecraft/block/BlockFenceGate.java.patch deleted file mode 100644 index 915baaefb..000000000 --- a/patches/minecraft/net/minecraft/block/BlockFenceGate.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/block/BlockFenceGate.java -+++ b/net/minecraft/block/BlockFenceGate.java -@@ -100,7 +100,7 @@ - } - - private boolean func_196380_i(IBlockState p_196380_1_) { -- return p_196380_1_.func_177230_c() == Blocks.field_150463_bK || p_196380_1_.func_177230_c() == Blocks.field_196723_eg; -+ return p_196380_1_.func_177230_c() == Blocks.field_150463_bK || p_196380_1_.func_177230_c() == Blocks.field_196723_eg || p_196380_1_.func_177230_c() instanceof BlockWall; - } - - public boolean func_196250_a(IBlockState p_196250_1_, World p_196250_2_, BlockPos p_196250_3_, EntityPlayer p_196250_4_, EnumHand p_196250_5_, EnumFacing p_196250_6_, float p_196250_7_, float p_196250_8_, float p_196250_9_) { -@@ -145,4 +145,14 @@ - return BlockFaceShape.UNDEFINED; - } - } -+ -+ @Override -+ public boolean canBeConnectedTo(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing) { -+ if (state.func_193401_d(world, pos, facing) == BlockFaceShape.MIDDLE_POLE) { -+ Block other = world.func_180495_p(pos.func_177972_a(facing)).func_177230_c(); -+ return other instanceof BlockFence || other instanceof BlockWall; -+ } -+ return false; -+ } -+ - } diff --git a/patches/minecraft/net/minecraft/block/BlockIce.java.patch b/patches/minecraft/net/minecraft/block/BlockIce.java.patch deleted file mode 100644 index 9eb580ac7..000000000 --- a/patches/minecraft/net/minecraft/block/BlockIce.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/net/minecraft/block/BlockIce.java -+++ b/net/minecraft/block/BlockIce.java -@@ -34,8 +34,10 @@ - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) { - p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this)); - p_180657_2_.func_71020_j(0.005F); -- if (this.func_149700_E() && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) { -- func_180635_a(p_180657_1_, p_180657_3_, this.func_180643_i(p_180657_4_)); -+ if (this.canSilkHarvest(p_180657_4_, p_180657_1_, p_180657_3_, p_180657_2_) && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) { -+ net.minecraft.util.NonNullList items = net.minecraft.util.NonNullList.func_193580_a(ItemStack.field_190927_a, func_180643_i(p_180657_4_)); -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, 0, 1.0f, true, p_180657_2_); -+ items.stream().filter(e -> !e.func_190926_b()).forEach(e -> func_180635_a(p_180657_1_, p_180657_3_, e)); - } else { - if (p_180657_1_.field_73011_w.func_177500_n()) { - p_180657_1_.func_175698_g(p_180657_3_); -@@ -43,7 +45,9 @@ - } - - int i = EnchantmentHelper.func_77506_a(Enchantments.field_185308_t, p_180657_6_); -+ harvesters.set(p_180657_2_); - p_180657_4_.func_196949_c(p_180657_1_, p_180657_3_, i); -+ harvesters.set(null); - Material material = p_180657_1_.func_180495_p(p_180657_3_.func_177977_b()).func_185904_a(); - if (material.func_76230_c() || material.func_76224_d()) { - p_180657_1_.func_175656_a(p_180657_3_, Blocks.field_150355_j.func_176223_P()); diff --git a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch deleted file mode 100644 index 662f85e82..000000000 --- a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/block/BlockLadder.java -+++ b/net/minecraft/block/BlockLadder.java -@@ -151,4 +151,9 @@ - return false; - } - } -+ -+ @Override -+ public boolean isLadder(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.EntityLivingBase entity) { -+ return true; -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch deleted file mode 100644 index 6dab8ef77..000000000 --- a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- a/net/minecraft/block/BlockLeaves.java -+++ b/net/minecraft/block/BlockLeaves.java -@@ -26,7 +26,7 @@ - import net.minecraftforge.api.distmarker.Dist; - import net.minecraftforge.api.distmarker.OnlyIn; - --public class BlockLeaves extends Block { -+public class BlockLeaves extends Block implements net.minecraftforge.common.IShearable { - public static final IntegerProperty field_208494_a = BlockStateProperties.field_208514_aa; - public static final BooleanProperty field_208495_b = BlockStateProperties.field_208515_s; - protected static boolean field_196478_c; -@@ -122,28 +122,37 @@ - } - - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { -- if (!p_196255_2_.field_72995_K) { -- int i = this.func_196472_i(p_196255_1_); -- if (p_196255_5_ > 0) { -- i -= 2 << p_196255_5_; -+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_); -+ } -+ -+ @Override -+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList drops, World worldIn, BlockPos pos, int fortune) { -+ { -+ int i = this.func_196472_i(state); -+ if (fortune > 0) { -+ i -= 2 << fortune; - if (i < 10) { - i = 10; - } - } - -- if (p_196255_2_.field_73012_v.nextInt(i) == 0) { -- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(this.func_199769_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_5_))); -+ if (worldIn.field_73012_v.nextInt(i) == 0) { -+ ItemStack drop = new ItemStack(this.func_199769_a(state, worldIn, pos, fortune)); -+ if (!drop.func_190926_b()) -+ drops.add(drop); - } - - i = 200; -- if (p_196255_5_ > 0) { -- i -= 10 << p_196255_5_; -+ if (fortune > 0) { -+ i -= 10 << fortune; - if (i < 40) { - i = 40; - } - } - -- this.func_196474_a(p_196255_2_, p_196255_3_, p_196255_1_, i); -+ captureDrops(true); -+ this.func_196474_a(worldIn, pos, state, i); -+ drops.addAll(captureDrops(false)); - } - - } -@@ -173,13 +182,7 @@ - } - - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) { -- if (!p_180657_1_.field_72995_K && p_180657_6_.func_77973_b() == Items.field_151097_aZ) { -- p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this)); -- p_180657_2_.func_71020_j(0.005F); -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(this)); -- } else { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_); -- } - } - - protected void func_206840_a(StateContainer.Builder p_206840_1_) { -@@ -189,4 +192,10 @@ - public IBlockState func_196258_a(BlockItemUseContext p_196258_1_) { - return func_208493_b(this.func_176223_P().func_206870_a(field_208495_b, Boolean.valueOf(true)), p_196258_1_.func_195991_k(), p_196258_1_.func_195995_a()); - } -+ -+ @Override -+ public java.util.List onSheared(@javax.annotation.Nonnull ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) { -+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11); -+ return java.util.Arrays.asList(new ItemStack(this)); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch deleted file mode 100644 index ad0dc4aac..000000000 --- a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/net/minecraft/block/BlockMobSpawner.java -+++ b/net/minecraft/block/BlockMobSpawner.java -@@ -13,6 +13,8 @@ - import net.minecraft.world.World; - - public class BlockMobSpawner extends BlockContainer { -+ private static final java.util.Random RAND = new java.util.Random(); -+ - protected BlockMobSpawner(Block.Properties p_i48364_1_) { - super(p_i48364_1_); - } -@@ -27,10 +29,13 @@ - - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { - super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_); -- int i = 15 + p_196255_2_.field_73012_v.nextInt(15) + p_196255_2_.field_73012_v.nextInt(15); -- this.func_180637_b(p_196255_2_, p_196255_3_, i); - } - -+ @Override -+ public int getExpDrop(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune) { -+ return 15 + RAND.nextInt(15) + RAND.nextInt(15); -+ } -+ - public EnumBlockRenderType func_149645_b(IBlockState p_149645_1_) { - return EnumBlockRenderType.MODEL; - } diff --git a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch deleted file mode 100644 index 4fa801387..000000000 --- a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/block/BlockMushroom.java -+++ b/net/minecraft/block/BlockMushroom.java -@@ -64,7 +64,7 @@ - IBlockState iblockstate = p_196260_2_.func_180495_p(blockpos); - Block block = iblockstate.func_177230_c(); - if (block != Blocks.field_150391_bh && block != Blocks.field_196661_l) { -- return p_196260_2_.func_201669_a(p_196260_3_, 0) < 13 && this.func_200014_a_(iblockstate, p_196260_2_, blockpos); -+ return p_196260_2_.func_201669_a(p_196260_3_, 0) < 13 && iblockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.EnumFacing.UP, this); - } else { - return true; - } diff --git a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch deleted file mode 100644 index 6de05de96..000000000 --- a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/net/minecraft/block/BlockNetherWart.java -+++ b/net/minecraft/block/BlockNetherWart.java -@@ -33,16 +33,22 @@ - - public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { - int i = p_196267_1_.func_177229_b(field_176486_a); -- if (i < 3 && p_196267_4_.nextInt(10) == 0) { -+ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt(10) == 0)) { - p_196267_1_ = p_196267_1_.func_206870_a(field_176486_a, Integer.valueOf(i + 1)); - p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_, 2); -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); - } - - super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_); - } - - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { -- if (!p_196255_2_.field_72995_K) { -+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_); -+ } -+ -+ @Override -+ public void getDrops(IBlockState p_196255_1_, net.minecraft.util.NonNullList drops, World p_196255_2_, BlockPos p_196255_3_, int p_196255_5_) { -+ { - int i = 1; - if (p_196255_1_.func_177229_b(field_176486_a) >= 3) { - i = 2 + p_196255_2_.field_73012_v.nextInt(3); -@@ -52,7 +58,7 @@ - } - - for(int j = 0; j < i; ++j) { -- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(Items.field_151075_bm)); -+ drops.add(new ItemStack(Items.field_151075_bm)); - } - - } diff --git a/patches/minecraft/net/minecraft/block/BlockOre.java.patch b/patches/minecraft/net/minecraft/block/BlockOre.java.patch deleted file mode 100644 index 82153b9e7..000000000 --- a/patches/minecraft/net/minecraft/block/BlockOre.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/net/minecraft/block/BlockOre.java -+++ b/net/minecraft/block/BlockOre.java -@@ -49,23 +49,27 @@ - - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { - super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_); -- if (this.func_199769_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_5_) != this) { -+ } -+ -+ @Override -+ public int getExpDrop(IBlockState state, net.minecraft.world.IWorldReader reader, BlockPos pos, int fortune) { -+ World world = reader instanceof World ? (World)reader : null; -+ if (world == null || this.func_199769_a(state, world, pos, fortune) != this) { - int i = 0; - if (this == Blocks.field_150365_q) { -- i = MathHelper.func_76136_a(p_196255_2_.field_73012_v, 0, 2); -+ i = MathHelper.func_76136_a(RANDOM, 0, 2); - } else if (this == Blocks.field_150482_ag) { -- i = MathHelper.func_76136_a(p_196255_2_.field_73012_v, 3, 7); -+ i = MathHelper.func_76136_a(RANDOM, 3, 7); - } else if (this == Blocks.field_150412_bA) { -- i = MathHelper.func_76136_a(p_196255_2_.field_73012_v, 3, 7); -+ i = MathHelper.func_76136_a(RANDOM, 3, 7); - } else if (this == Blocks.field_150369_x) { -- i = MathHelper.func_76136_a(p_196255_2_.field_73012_v, 2, 5); -+ i = MathHelper.func_76136_a(RANDOM, 2, 5); - } else if (this == Blocks.field_196766_fg) { -- i = MathHelper.func_76136_a(p_196255_2_.field_73012_v, 2, 5); -+ i = MathHelper.func_76136_a(RANDOM, 2, 5); - } -- -- this.func_180637_b(p_196255_2_, p_196255_3_, i); -+ return i; - } -- -+ return 0; - } - - public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) { diff --git a/patches/minecraft/net/minecraft/block/BlockPane.java.patch b/patches/minecraft/net/minecraft/block/BlockPane.java.patch deleted file mode 100644 index 29b4ba9bd..000000000 --- a/patches/minecraft/net/minecraft/block/BlockPane.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- a/net/minecraft/block/BlockPane.java -+++ b/net/minecraft/block/BlockPane.java -@@ -25,15 +25,12 @@ - IBlockReader iblockreader = p_196258_1_.func_195991_k(); - BlockPos blockpos = p_196258_1_.func_195995_a(); - IFluidState ifluidstate = p_196258_1_.func_195991_k().func_204610_c(p_196258_1_.func_195995_a()); -- BlockPos blockpos1 = blockpos.func_177978_c(); -- BlockPos blockpos2 = blockpos.func_177968_d(); -- BlockPos blockpos3 = blockpos.func_177976_e(); -- BlockPos blockpos4 = blockpos.func_177974_f(); -- IBlockState iblockstate = iblockreader.func_180495_p(blockpos1); -- IBlockState iblockstate1 = iblockreader.func_180495_p(blockpos2); -- IBlockState iblockstate2 = iblockreader.func_180495_p(blockpos3); -- IBlockState iblockstate3 = iblockreader.func_180495_p(blockpos4); -- return this.func_176223_P().func_206870_a(field_196409_a, Boolean.valueOf(this.func_196417_a(iblockstate, iblockstate.func_193401_d(iblockreader, blockpos1, EnumFacing.SOUTH)))).func_206870_a(field_196413_c, Boolean.valueOf(this.func_196417_a(iblockstate1, iblockstate1.func_193401_d(iblockreader, blockpos2, EnumFacing.NORTH)))).func_206870_a(field_196414_y, Boolean.valueOf(this.func_196417_a(iblockstate2, iblockstate2.func_193401_d(iblockreader, blockpos3, EnumFacing.EAST)))).func_206870_a(field_196411_b, Boolean.valueOf(this.func_196417_a(iblockstate3, iblockstate3.func_193401_d(iblockreader, blockpos4, EnumFacing.WEST)))).func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a)); -+ return this.func_176223_P() -+ .func_206870_a(field_196409_a, canPaneConnectTo(iblockreader, blockpos, EnumFacing.NORTH)) -+ .func_206870_a(field_196413_c, canPaneConnectTo(iblockreader, blockpos, EnumFacing.SOUTH)) -+ .func_206870_a(field_196414_y, canPaneConnectTo(iblockreader, blockpos, EnumFacing.WEST)) -+ .func_206870_a(field_196411_b, canPaneConnectTo(iblockreader, blockpos, EnumFacing.EAST)) -+ .func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a)); - } - - public IBlockState func_196271_a(IBlockState p_196271_1_, EnumFacing p_196271_2_, IBlockState p_196271_3_, IWorld p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) { -@@ -41,7 +38,7 @@ - p_196271_4_.func_205219_F_().func_205360_a(p_196271_5_, Fluids.field_204546_a, Fluids.field_204546_a.func_205569_a(p_196271_4_)); - } - -- return p_196271_2_.func_176740_k().func_176722_c() ? p_196271_1_.func_206870_a(field_196415_z.get(p_196271_2_), Boolean.valueOf(this.func_196417_a(p_196271_3_, p_196271_3_.func_193401_d(p_196271_4_, p_196271_6_, p_196271_2_.func_176734_d())))) : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_); -+ return p_196271_2_.func_176740_k().func_176722_c() ? p_196271_1_.func_206870_a(field_196415_z.get(p_196271_2_), Boolean.valueOf(this.canPaneConnectTo(p_196271_4_, p_196271_5_, p_196271_2_))) : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_); - } - - public boolean func_149686_d(IBlockState p_149686_1_) { -@@ -87,4 +84,16 @@ - public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) { - return p_193383_4_ != EnumFacing.UP && p_193383_4_ != EnumFacing.DOWN ? BlockFaceShape.MIDDLE_POLE_THIN : BlockFaceShape.CENTER_SMALL; - } -+ -+ @Override -+ public boolean canBeConnectedTo(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing) { -+ IBlockState other = world.func_180495_p(pos.func_177972_a(facing)); -+ return func_196417_a(other, other.func_193401_d(world, pos.func_177972_a(facing), facing.func_176734_d())); -+ } -+ -+ private boolean canPaneConnectTo(IBlockReader world, BlockPos pos, EnumFacing facing) { -+ BlockPos offset = pos.func_177972_a(facing); -+ IBlockState other = world.func_180495_p(offset); -+ return other.canBeConnectedTo(world, offset, facing.func_176734_d()) || func_176223_P().canBeConnectedTo(world, pos, facing); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch deleted file mode 100644 index f3a231e4b..000000000 --- a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- a/net/minecraft/block/BlockPistonBase.java -+++ b/net/minecraft/block/BlockPistonBase.java -@@ -244,7 +244,7 @@ - return false; - } - -- return !block.func_149716_u(); -+ return !p_185646_0_.hasTileEntity(); - } else { - return false; - } -@@ -280,7 +280,9 @@ - for(int j = list2.size() - 1; j >= 0; --j) { - BlockPos blockpos2 = list2.get(j); - IBlockState iblockstate = p_176319_1_.func_180495_p(blockpos2); -- iblockstate.func_196949_c(p_176319_1_, blockpos2, 0); -+ // Forge: With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. -+ float chance = iblockstate.func_177230_c() instanceof BlockSnow ? -1.0f : 1.0f; -+ iblockstate.func_196941_a(p_176319_1_, blockpos2, chance, 0); - p_176319_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 18); - --k; - aiblockstate[k] = iblockstate; -@@ -333,6 +335,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))); - } - -+ public IBlockState rotate(IBlockState state, net.minecraft.world.IWorld world, BlockPos pos, Rotation direction) { -+ return state.func_177229_b(field_176320_b) ? state : super.rotate(state, world, pos, direction); -+ } -+ - public IBlockState func_185471_a(IBlockState p_185471_1_, Mirror p_185471_2_) { - return p_185471_1_.func_185907_a(p_185471_2_.func_185800_a(p_185471_1_.func_177229_b(field_176387_N))); - } diff --git a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch deleted file mode 100644 index 403b606c7..000000000 --- a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/block/BlockPistonMoving.java -+++ b/net/minecraft/block/BlockPistonMoving.java -@@ -86,14 +86,22 @@ - } - - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { -- if (!p_196255_2_.field_72995_K) { -+ if (false && !p_196255_2_.field_72995_K) { //Forge: Noop this out - TileEntityPiston tileentitypiston = this.func_196342_a(p_196255_2_, p_196255_3_); - if (tileentitypiston != null) { - tileentitypiston.func_200230_i().func_196949_c(p_196255_2_, p_196255_3_, 0); - } - } -+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, 1, p_196255_5_); // mimic vanilla behavior from above and ignore chance - } - -+ @Override -+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList drops, World world, BlockPos pos, int fortune) { -+ TileEntityPiston te = this.func_196342_a(world, pos); -+ if (te != null) -+ te.func_200230_i().getDrops(drops, world, pos, fortune); -+ } -+ - public VoxelShape func_196244_b(IBlockState p_196244_1_, IBlockReader p_196244_2_, BlockPos p_196244_3_) { - return VoxelShapes.func_197880_a(); - } diff --git a/patches/minecraft/net/minecraft/block/BlockPortal.java.patch b/patches/minecraft/net/minecraft/block/BlockPortal.java.patch deleted file mode 100644 index a7e88f132..000000000 --- a/patches/minecraft/net/minecraft/block/BlockPortal.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/block/BlockPortal.java -+++ b/net/minecraft/block/BlockPortal.java -@@ -76,7 +76,7 @@ - - public boolean func_176548_d(IWorld p_176548_1_, BlockPos p_176548_2_) { - BlockPortal.Size blockportal$size = this.func_201816_b(p_176548_1_, p_176548_2_); -- if (blockportal$size != null) { -+ if (blockportal$size != null && !net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_176548_1_, p_176548_2_, blockportal$size)) { - blockportal$size.func_150859_c(); - return true; - } else { diff --git a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch deleted file mode 100644 index d4e953806..000000000 --- a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/net/minecraft/block/BlockPotato.java -+++ b/net/minecraft/block/BlockPotato.java -@@ -26,7 +26,7 @@ - - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { - super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_); -- if (!p_196255_2_.field_72995_K) { -+ if (false && !p_196255_2_.field_72995_K) { //Forge: Moved to getDrops - if (this.func_185525_y(p_196255_1_) && p_196255_2_.field_73012_v.nextInt(50) == 0) { - func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(Items.field_151170_bI)); - } -@@ -34,6 +34,13 @@ - } - } - -+ @Override -+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList drops, World world, BlockPos pos, int fortune) { -+ super.getDrops(state, drops, world, pos, fortune); -+ if (this.func_185525_y(state) && world.field_73012_v.nextInt(50) == 0) -+ drops.add(new ItemStack(Items.field_151170_bI)); -+ } -+ - public VoxelShape func_196244_b(IBlockState p_196244_1_, IBlockReader p_196244_2_, BlockPos p_196244_3_) { - return field_196396_a[p_196244_1_.func_177229_b(this.func_185524_e())]; - } diff --git a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch deleted file mode 100644 index 709e354d3..000000000 --- a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch +++ /dev/null @@ -1,123 +0,0 @@ ---- a/net/minecraft/block/BlockRailBase.java -+++ b/net/minecraft/block/BlockRailBase.java -@@ -37,7 +37,7 @@ - } - - public VoxelShape func_196244_b(IBlockState p_196244_1_, IBlockReader p_196244_2_, BlockPos p_196244_3_) { -- RailShape railshape = p_196244_1_.func_177230_c() == this ? p_196244_1_.func_177229_b(this.func_176560_l()) : null; -+ RailShape railshape = p_196244_1_.func_177230_c() == this ? getRailDirection(p_196244_1_, p_196244_2_, p_196244_3_, null) : null; - return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a; - } - -@@ -50,7 +50,8 @@ - } - - public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) { -- return p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_185896_q(); -+ IBlockState down = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); -+ return down.func_185896_q() || down.func_193401_d(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID; - } - - public void func_196259_b(IBlockState p_196259_1_, World p_196259_2_, BlockPos p_196259_3_, IBlockState p_196259_4_) { -@@ -67,19 +68,19 @@ - - public void func_189540_a(IBlockState p_189540_1_, World p_189540_2_, BlockPos p_189540_3_, Block p_189540_4_, BlockPos p_189540_5_) { - if (!p_189540_2_.field_72995_K) { -- RailShape railshape = p_189540_1_.func_177229_b(this.func_176560_l()); -+ RailShape railshape = getRailDirection(p_189540_1_, p_189540_2_, p_189540_3_, null); - boolean flag = false; -- if (!p_189540_2_.func_180495_p(p_189540_3_.func_177977_b()).func_185896_q()) { -+ if (!p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_)) { - flag = true; - } - -- if (railshape == RailShape.ASCENDING_EAST && !p_189540_2_.func_180495_p(p_189540_3_.func_177974_f()).func_185896_q()) { -+ if (railshape == RailShape.ASCENDING_EAST && !p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_.func_177974_f().func_177984_a())) { - flag = true; -- } else if (railshape == RailShape.ASCENDING_WEST && !p_189540_2_.func_180495_p(p_189540_3_.func_177976_e()).func_185896_q()) { -+ } else if (railshape == RailShape.ASCENDING_WEST && !p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_.func_177976_e().func_177984_a())) { - flag = true; -- } else if (railshape == RailShape.ASCENDING_NORTH && !p_189540_2_.func_180495_p(p_189540_3_.func_177978_c()).func_185896_q()) { -+ } else if (railshape == RailShape.ASCENDING_NORTH && !p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_.func_177978_c().func_177984_a())) { - flag = true; -- } else if (railshape == RailShape.ASCENDING_SOUTH && !p_189540_2_.func_180495_p(p_189540_3_.func_177968_d()).func_185896_q()) { -+ } else if (railshape == RailShape.ASCENDING_SOUTH && !p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_.func_177968_d().func_177984_a())) { - flag = true; - } - -@@ -111,7 +112,7 @@ - public void func_196243_a(IBlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, IBlockState p_196243_4_, boolean p_196243_5_) { - if (!p_196243_5_) { - super.func_196243_a(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_); -- if (p_196243_1_.func_177229_b(this.func_176560_l()).func_208092_c()) { -+ if (getRailDirection(p_196243_1_, p_196243_2_, p_196243_3_, null).func_208092_c()) { - p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this); - } - -@@ -123,5 +124,66 @@ - } - } - -+ //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability - public abstract IProperty func_176560_l(); -+ -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Return true if the rail can make corners. -+ * Used by placement logic. -+ * @param world The world. -+ * @param pos Block's position in world -+ * @return True if the rail can make corners. -+ */ -+ public boolean isFlexibleRail(IBlockState state, IBlockReader world, BlockPos pos) -+ { -+ return !this.field_196277_c; -+ } -+ -+ /** -+ * Returns true if the rail can make up and down slopes. -+ * Used by placement logic. -+ * @param world The world. -+ * @param pos Block's position in world -+ * @return True if the rail can make slopes. -+ */ -+ public boolean canMakeSlopes(IBlockState state, IBlockReader world, BlockPos pos) { -+ return true; -+ } -+ -+ /** -+ * Return the rail's direction. -+ * Can be used to make the cart think the rail is a different shape, -+ * for example when making diamond junctions or switches. -+ * The cart parameter will often be null unless it it called from EntityMinecart. -+ * -+ * @param world The world. -+ * @param pos Block's position in world -+ * @param state The BlockState -+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart. -+ * @return The direction. -+ */ -+ public RailShape getRailDirection(IBlockState state, IBlockReader world, BlockPos pos, @javax.annotation.Nullable net.minecraft.entity.item.EntityMinecart cart) { -+ return state.func_177229_b(func_176560_l()); -+ } -+ -+ /** -+ * Returns the max speed of the rail at the specified position. -+ * @param world The world. -+ * @param cart The cart on the rail, may be null. -+ * @param pos Block's position in world -+ * @return The max speed of the current rail. -+ */ -+ public float getRailMaxSpeed(IBlockState state, World world, BlockPos pos, net.minecraft.entity.item.EntityMinecart cart) { -+ return 0.4f; -+ } -+ -+ /** -+ * This function is called by any minecart that passes over this rail. -+ * It is called once per update tick that the minecart is on the rail. -+ * @param world The world. -+ * @param cart The cart on the rail. -+ * @param pos Block's position in world -+ */ -+ public void onMinecartPass(IBlockState state, World world, BlockPos pos, net.minecraft.entity.item.EntityMinecart cart) { } - } diff --git a/patches/minecraft/net/minecraft/block/BlockRailDetector.java.patch b/patches/minecraft/net/minecraft/block/BlockRailDetector.java.patch deleted file mode 100644 index c5246eb88..000000000 --- a/patches/minecraft/net/minecraft/block/BlockRailDetector.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/block/BlockRailDetector.java -+++ b/net/minecraft/block/BlockRailDetector.java -@@ -127,6 +127,8 @@ - - public int func_180641_l(IBlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) { - if (p_180641_1_.func_177229_b(field_176574_M)) { -+ List carts = this.func_200878_a(p_180641_2_, p_180641_3_, EntityMinecart.class, null); -+ if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel(); - List list = this.func_200878_a(p_180641_2_, p_180641_3_, EntityMinecartCommandBlock.class, (Predicate)null); - if (!list.isEmpty()) { - return list.get(0).func_145822_e().func_145760_g(); diff --git a/patches/minecraft/net/minecraft/block/BlockRailPowered.java.patch b/patches/minecraft/net/minecraft/block/BlockRailPowered.java.patch deleted file mode 100644 index 4f8d7e7bc..000000000 --- a/patches/minecraft/net/minecraft/block/BlockRailPowered.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/net/minecraft/block/BlockRailPowered.java -+++ b/net/minecraft/block/BlockRailPowered.java -@@ -15,10 +15,16 @@ - public class BlockRailPowered extends BlockRailBase { - public static final EnumProperty field_176568_b = BlockStateProperties.field_208166_S; - public static final BooleanProperty field_176569_M = BlockStateProperties.field_208194_u; -+ private final boolean isActivator; - - protected BlockRailPowered(Block.Properties p_i48349_1_) { -- super(true, p_i48349_1_); -+ this(p_i48349_1_, false); -+ } -+ -+ protected BlockRailPowered(Block.Properties builder, boolean isActivator) { -+ super(true, builder); - this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176568_b, RailShape.NORTH_SOUTH).func_206870_a(field_176569_M, Boolean.valueOf(false))); -+ this.isActivator = isActivator; - } - - protected boolean func_176566_a(World p_176566_1_, BlockPos p_176566_2_, IBlockState p_176566_3_, boolean p_176566_4_, int p_176566_5_) { -@@ -100,7 +106,7 @@ - - protected boolean func_208071_a(World p_208071_1_, BlockPos p_208071_2_, boolean p_208071_3_, int p_208071_4_, RailShape p_208071_5_) { - IBlockState iblockstate = p_208071_1_.func_180495_p(p_208071_2_); -- if (iblockstate.func_177230_c() != this) { -+ if (!(iblockstate.func_177230_c() instanceof BlockRailPowered) || isActivator != ((BlockRailPowered)iblockstate.func_177230_c()).isActivator) { - return false; - } else { - RailShape railshape = iblockstate.func_177229_b(field_176568_b); diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch deleted file mode 100644 index ec5fa32f0..000000000 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/block/BlockRedstoneComparator.java -+++ b/net/minecraft/block/BlockRedstoneComparator.java -@@ -156,4 +156,16 @@ - protected void func_206840_a(StateContainer.Builder p_206840_1_) { - p_206840_1_.func_206894_a(field_185512_D, field_176463_b, field_196348_c); - } -+ -+ @Override -+ public boolean getWeakChanges(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos) { -+ return true; -+ } -+ -+ @Override -+ public void onNeighborChange(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, BlockPos neighbor) { -+ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World && !((World)world).func_201670_d()) { -+ func_189540_a(state, (World)world, pos, world.func_180495_p(neighbor).func_177230_c(), neighbor); -+ } -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch deleted file mode 100644 index aa7c44fb4..000000000 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/block/BlockRedstoneDiode.java -+++ b/net/minecraft/block/BlockRedstoneDiode.java -@@ -35,7 +35,7 @@ - } - - public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) { -- return p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_185896_q(); -+ return p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_185896_q() || p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_193401_d(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID; - } - - public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { -@@ -172,6 +172,8 @@ - protected void func_176400_h(World p_176400_1_, BlockPos p_176400_2_, IBlockState p_176400_3_) { - EnumFacing enumfacing = p_176400_3_.func_177229_b(field_185512_D); - BlockPos blockpos = p_176400_2_.func_177972_a(enumfacing.func_176734_d()); -+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_176400_1_, p_176400_2_, p_176400_1_.func_180495_p(p_176400_2_), java.util.EnumSet.of(enumfacing.func_176734_d()), false).isCanceled()) -+ return; - p_176400_1_.func_190524_a(blockpos, this, p_176400_2_); - p_176400_1_.func_175695_a(blockpos, this, enumfacing); - } diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch deleted file mode 100644 index 1eec9f14b..000000000 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/block/BlockRedstoneOre.java -+++ b/net/minecraft/block/BlockRedstoneOre.java -@@ -72,11 +72,17 @@ - - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { - super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_); -- if (this.func_199769_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_5_) != this) { -+ if (false && this.func_199769_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_5_) != this) { - int i = 1 + p_196255_2_.field_73012_v.nextInt(5); - this.func_180637_b(p_196255_2_, p_196255_3_, i); - } -+ } - -+ @Override -+ public int getExpDrop(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune) { -+ if (!(world instanceof World) || func_199769_a(state, (World)world, pos, fortune) != this) -+ return 1 + RANDOM.nextInt(5); -+ return 0; - } - - @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneTorch.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneTorch.java.patch deleted file mode 100644 index 571c0011c..000000000 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneTorch.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/block/BlockRedstoneTorch.java -+++ b/net/minecraft/block/BlockRedstoneTorch.java -@@ -24,7 +24,7 @@ - - public class BlockRedstoneTorch extends BlockTorch { - public static final BooleanProperty field_196528_a = BlockStateProperties.field_208190_q; -- private static final Map> field_196529_b = Maps.newHashMap(); -+ private static final Map> field_196529_b = new java.util.WeakHashMap>(); // FORGE - fix vanilla MC-101233 - - protected BlockRedstoneTorch(Block.Properties p_i48342_1_) { - super(p_i48342_1_); diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch deleted file mode 100644 index 07ff16751..000000000 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/net/minecraft/block/BlockRedstoneWire.java -+++ b/net/minecraft/block/BlockRedstoneWire.java -@@ -124,8 +124,8 @@ - IBlockState iblockstate = p_208074_1_.func_180495_p(p_208074_2_.func_177972_a(p_208074_3_)); - IBlockState iblockstate1 = p_208074_1_.func_180495_p(p_208074_2_.func_177984_a()); - if (!iblockstate1.func_185915_l()) { -- boolean flag = p_208074_1_.func_180495_p(blockpos).func_185896_q() || p_208074_1_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150426_aN; -- if (flag && func_176346_d(p_208074_1_.func_180495_p(blockpos.func_177984_a()))) { -+ boolean flag = iblockstate.func_193401_d(p_208074_1_, blockpos, EnumFacing.UP) == BlockFaceShape.SOLID || iblockstate.func_177230_c() == Blocks.field_150426_aN; -+ if (flag && canConnectTo(p_208074_1_.func_180495_p(blockpos.func_177984_a()), p_208074_1_, blockpos.func_177984_a(), null)) { - if (iblockstate.func_185898_k()) { - return RedstoneSide.UP; - } -@@ -134,7 +134,7 @@ - } - } - -- return !func_176343_a(p_208074_1_.func_180495_p(blockpos), p_208074_3_) && (iblockstate.func_185915_l() || !func_176346_d(p_208074_1_.func_180495_p(blockpos.func_177977_b()))) ? RedstoneSide.NONE : RedstoneSide.SIDE; -+ return !canConnectTo(p_208074_1_.func_180495_p(blockpos), p_208074_1_, blockpos, p_208074_3_) && (iblockstate.func_185915_l() || !canConnectTo(p_208074_1_.func_180495_p(blockpos.func_177977_b()), p_208074_1_, blockpos.func_177977_b(), null)) ? RedstoneSide.NONE : RedstoneSide.SIDE; - } - - public boolean func_149686_d(IBlockState p_149686_1_) { -@@ -143,7 +143,7 @@ - - public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) { - IBlockState iblockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); -- return iblockstate.func_185896_q() || iblockstate.func_177230_c() == Blocks.field_150426_aN; -+ return iblockstate.func_185896_q() || iblockstate.func_177230_c() == Blocks.field_150426_aN || iblockstate.func_193401_d(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID; - } - - private IBlockState func_176338_e(World p_176338_1_, BlockPos p_176338_2_, IBlockState p_176338_3_) { -@@ -338,26 +338,18 @@ - IBlockState iblockstate = p_176339_1_.func_180495_p(blockpos); - boolean flag = iblockstate.func_185915_l(); - boolean flag1 = p_176339_1_.func_180495_p(p_176339_2_.func_177984_a()).func_185915_l(); -- if (!flag1 && flag && func_176340_e(p_176339_1_, blockpos.func_177984_a())) { -+ if (!flag1 && flag && canConnectTo(p_176339_1_.func_180495_p(blockpos.func_177984_a()), p_176339_1_, blockpos.func_177984_a(), null)) { - return true; -- } else if (func_176343_a(iblockstate, p_176339_3_)) { -+ } else if (canConnectTo(iblockstate, p_176339_1_, blockpos, p_176339_3_)) { - return true; - } else if (iblockstate.func_177230_c() == Blocks.field_196633_cV && iblockstate.func_177229_b(BlockRedstoneDiode.field_196348_c) && iblockstate.func_177229_b(BlockRedstoneDiode.field_185512_D) == p_176339_3_) { - return true; - } else { -- return !flag && func_176340_e(p_176339_1_, blockpos.func_177977_b()); -+ return !flag && canConnectTo(p_176339_1_.func_180495_p(blockpos.func_177977_b()), p_176339_1_, blockpos.func_177977_b(), null); - } - } - -- protected static boolean func_176340_e(IBlockReader p_176340_0_, BlockPos p_176340_1_) { -- return func_176346_d(p_176340_0_.func_180495_p(p_176340_1_)); -- } -- -- protected static boolean func_176346_d(IBlockState p_176346_0_) { -- return func_176343_a(p_176346_0_, (EnumFacing)null); -- } -- -- protected static boolean func_176343_a(IBlockState p_176343_0_, @Nullable EnumFacing p_176343_1_) { -+ protected boolean canConnectTo(IBlockState p_176343_0_, IBlockReader world, BlockPos pos, @Nullable EnumFacing p_176343_1_) { - Block block = p_176343_0_.func_177230_c(); - if (block == Blocks.field_150488_af) { - return true; -@@ -367,7 +359,7 @@ - } else if (Blocks.field_190976_dk == p_176343_0_.func_177230_c()) { - return p_176343_1_ == p_176343_0_.func_177229_b(BlockObserver.field_176387_N); - } else { -- return p_176343_0_.func_185897_m() && p_176343_1_ != null; -+ return p_176343_0_.canConnectRedstone(world, pos, p_176343_1_) && p_176343_1_ != null; - } - } - diff --git a/patches/minecraft/net/minecraft/block/BlockSeaGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockSeaGrass.java.patch deleted file mode 100644 index a677e0f84..000000000 --- a/patches/minecraft/net/minecraft/block/BlockSeaGrass.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/net/minecraft/block/BlockSeaGrass.java -+++ b/net/minecraft/block/BlockSeaGrass.java -@@ -23,7 +23,7 @@ - import net.minecraft.world.IWorld; - import net.minecraft.world.World; - --public class BlockSeaGrass extends BlockBush implements IGrowable, ILiquidContainer { -+public class BlockSeaGrass extends BlockBush implements IGrowable, ILiquidContainer, net.minecraftforge.common.IShearable { - protected static final VoxelShape field_207798_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D); - - protected BlockSeaGrass(Block.Properties p_i48780_1_) { -@@ -54,11 +54,7 @@ - } - - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) { -- if (!p_180657_1_.field_72995_K && p_180657_6_.func_77973_b() == Items.field_151097_aZ) { -- p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this)); -- p_180657_2_.func_71020_j(0.005F); -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(this)); -- } else { -+ { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_); - } - -@@ -102,4 +98,15 @@ - public int func_200011_d(IBlockState p_200011_1_, IBlockReader p_200011_2_, BlockPos p_200011_3_) { - return Blocks.field_150355_j.func_176223_P().func_200016_a(p_200011_2_, p_200011_3_); - } -+ -+ @Override -+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) { -+ return true; -+ } -+ -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) { -+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11); -+ return java.util.Arrays.asList(new ItemStack(this)); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockShearableDoublePlant.java.patch b/patches/minecraft/net/minecraft/block/BlockShearableDoublePlant.java.patch deleted file mode 100644 index d01a1d347..000000000 --- a/patches/minecraft/net/minecraft/block/BlockShearableDoublePlant.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/net/minecraft/block/BlockShearableDoublePlant.java -+++ b/net/minecraft/block/BlockShearableDoublePlant.java -@@ -11,7 +11,7 @@ - import net.minecraft.util.math.BlockPos; - import net.minecraft.world.World; - --public class BlockShearableDoublePlant extends BlockDoublePlant { -+public class BlockShearableDoublePlant extends BlockDoublePlant implements net.minecraftforge.common.IShearable { - public static final EnumProperty field_208063_b = BlockDoublePlant.field_176492_b; - private final Block field_196392_b; - -@@ -26,9 +26,7 @@ - } - - protected void func_196391_a(IBlockState p_196391_1_, World p_196391_2_, BlockPos p_196391_3_, ItemStack p_196391_4_) { -- if (p_196391_4_.func_77973_b() == Items.field_151097_aZ) { -- func_180635_a(p_196391_2_, p_196391_3_, new ItemStack(this.field_196392_b, 2)); -- } else { -+ { - super.func_196391_a(p_196391_1_, p_196391_2_, p_196391_3_, p_196391_4_); - } - -@@ -37,4 +35,15 @@ - public IItemProvider func_199769_a(IBlockState p_199769_1_, World p_199769_2_, BlockPos p_199769_3_, int p_199769_4_) { - return p_199769_1_.func_177229_b(field_208063_b) == DoubleBlockHalf.LOWER && this == Blocks.field_196804_gh && p_199769_2_.field_73012_v.nextInt(8) == 0 ? Items.field_151014_N : Items.field_190931_a; - } -+ -+ @Override -+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) { -+ return true; -+ } -+ -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) { -+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11); -+ return java.util.Arrays.asList(new ItemStack(this.field_196392_b, 2)); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockSnowLayer.java.patch b/patches/minecraft/net/minecraft/block/BlockSnowLayer.java.patch deleted file mode 100644 index 1468d1d94..000000000 --- a/patches/minecraft/net/minecraft/block/BlockSnowLayer.java.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- a/net/minecraft/block/BlockSnowLayer.java -+++ b/net/minecraft/block/BlockSnowLayer.java -@@ -84,30 +84,45 @@ - - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) { - Integer integer = p_180657_4_.func_177229_b(field_176315_a); -- if (this.func_149700_E() && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) { -+ net.minecraft.util.NonNullList items = net.minecraft.util.NonNullList.func_191196_a(); -+ int fortune = EnchantmentHelper.func_77506_a(Enchantments.field_185308_t, p_180657_6_); -+ float chance = 1.0f; -+ -+ if (this.canSilkHarvest(p_180657_4_, p_180657_1_, p_180657_3_, p_180657_2_) && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) { - if (integer == 8) { -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_196604_cC)); -+ items.add(new ItemStack(Blocks.field_196604_cC)); - } else { - for(int i = 0; i < integer; ++i) { -- func_180635_a(p_180657_1_, p_180657_3_, this.func_180643_i(p_180657_4_)); -+ items.add(this.func_180643_i(p_180657_4_)); - } - } -+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, 0, 1.0f, true, p_180657_2_); - } else { -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Items.field_151126_ay, integer)); -+ getDrops(p_180657_4_, items, p_180657_1_, p_180657_3_, fortune); -+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, fortune, 1.0f, false, p_180657_2_); - } - -+ for (ItemStack item : items) { -+ if (p_180657_1_.field_73012_v.nextFloat() <= chance) -+ func_180635_a(p_180657_1_, p_180657_3_, item); -+ } -+ - p_180657_1_.func_175698_g(p_180657_3_); - p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this)); - p_180657_2_.func_71020_j(0.005F); - } - - public IItemProvider func_199769_a(IBlockState p_199769_1_, World p_199769_2_, BlockPos p_199769_3_, int p_199769_4_) { -- return Items.field_190931_a; -+ return Items.field_151126_ay; - } - -+ @Override -+ public int func_196264_a(IBlockState state, Random random) { -+ return state.func_177229_b(field_176315_a) + 1; -+ } -+ - public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { - if (p_196267_2_.func_175642_b(EnumLightType.BLOCK, p_196267_3_) > 11) { -- p_196267_1_.func_196949_c(p_196267_2_, p_196267_3_, 0); - p_196267_2_.func_175698_g(p_196267_3_); - } - diff --git a/patches/minecraft/net/minecraft/block/BlockState.java.patch b/patches/minecraft/net/minecraft/block/BlockState.java.patch new file mode 100644 index 000000000..a98f44a8a --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockState.java.patch @@ -0,0 +1,26 @@ +--- a/net/minecraft/block/BlockState.java ++++ b/net/minecraft/block/BlockState.java +@@ -51,7 +51,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public class BlockState extends StateHolder implements IStateHolder { ++public class BlockState extends StateHolder implements IStateHolder, net.minecraftforge.common.extensions.IForgeBlockState { + @Nullable + private BlockState.Cache field_215707_c; + private final int field_215708_d; +@@ -107,10 +107,14 @@ + return this.field_215708_d; + } + ++ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos) */ ++ @Deprecated + public boolean func_196958_f() { + return this.func_177230_c().func_196261_e(this); + } + ++ /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation) */ ++ @Deprecated + public MaterialColor func_185909_g(IBlockReader p_185909_1_, BlockPos p_185909_2_) { + return this.func_177230_c().func_180659_g(this, p_185909_1_, p_185909_2_); + } diff --git a/patches/minecraft/net/minecraft/block/BlockStem.java.patch b/patches/minecraft/net/minecraft/block/BlockStem.java.patch deleted file mode 100644 index 1419c26b5..000000000 --- a/patches/minecraft/net/minecraft/block/BlockStem.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- a/net/minecraft/block/BlockStem.java -+++ b/net/minecraft/block/BlockStem.java -@@ -39,22 +39,24 @@ - - public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { - super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_); -+ if (!p_196267_2_.func_205050_e(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light - if (p_196267_2_.func_201669_a(p_196267_3_.func_177984_a(), 0) >= 9) { - float f = BlockCrops.func_180672_a(this, p_196267_2_, p_196267_3_); -- if (p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0) { -+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0)) { - int i = p_196267_1_.func_177229_b(field_176484_a); - if (i < 7) { -- p_196267_1_ = p_196267_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)); -- p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_, 2); -+ p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176484_a, i + 1), 2); - } else { - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.func_179518_a(p_196267_4_); - BlockPos blockpos = p_196267_3_.func_177972_a(enumfacing); -- Block block = p_196267_2_.func_180495_p(blockpos.func_177977_b()).func_177230_c(); -- if (p_196267_2_.func_180495_p(blockpos).func_196958_f() && (block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_196660_k || block == Blocks.field_196661_l || block == Blocks.field_196658_i)) { -+ IBlockState soil = p_196267_2_.func_180495_p(blockpos.func_177977_b()); -+ Block block = soil.func_177230_c(); -+ if (p_196267_2_.func_180495_p(blockpos).isAir(p_196267_2_, blockpos) && (soil.canSustainPlant(p_196267_2_, blockpos.func_177977_b(), EnumFacing.UP, this) || block == Blocks.field_150346_d || block == Blocks.field_196660_k || block == Blocks.field_196661_l || block == Blocks.field_196658_i)) { - p_196267_2_.func_175656_a(blockpos, this.field_149877_a.func_176223_P()); - p_196267_2_.func_175656_a(p_196267_3_, this.field_149877_a.func_196523_e().func_176223_P().func_206870_a(BlockHorizontal.field_185512_D, enumfacing)); - } - } -+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); - } - - } -@@ -62,14 +64,18 @@ - - public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) { - super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_); -- if (!p_196255_2_.field_72995_K) { -+ } -+ -+ @Override -+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList drops, World world, BlockPos pos, int fortune) { -+ { - Item item = this.func_176481_j(); - if (item != null) { -- int i = p_196255_1_.func_177229_b(field_176484_a); -+ int i = state.func_177229_b(field_176484_a); - - for(int j = 0; j < 3; ++j) { -- if (p_196255_2_.field_73012_v.nextInt(15) <= i) { -- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(item)); -+ if (world.field_73012_v.nextInt(15) <= i) { -+ drops.add(new ItemStack(item)); - } - } - diff --git a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch deleted file mode 100644 index be184902d..000000000 --- a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/net/minecraft/block/BlockTallGrass.java -+++ b/net/minecraft/block/BlockTallGrass.java -@@ -15,7 +15,7 @@ - import net.minecraft.world.IBlockReader; - import net.minecraft.world.World; - --public class BlockTallGrass extends BlockBush implements IGrowable { -+public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable { - protected static final VoxelShape field_196389_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D); - - protected BlockTallGrass(Block.Properties p_i48310_1_) { -@@ -27,7 +27,7 @@ - } - - public IItemProvider func_199769_a(IBlockState p_199769_1_, World p_199769_2_, BlockPos p_199769_3_, int p_199769_4_) { -- return p_199769_2_.field_73012_v.nextInt(8) == 0 ? Items.field_151014_N : Items.field_190931_a; -+ return Items.field_190931_a; - } - - public int func_196251_a(IBlockState p_196251_1_, int p_196251_2_, World p_196251_3_, BlockPos p_196251_4_, Random p_196251_5_) { -@@ -64,4 +64,18 @@ - public Block.EnumOffsetType func_176218_Q() { - return Block.EnumOffsetType.XYZ; - } -+ -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) { -+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11); -+ return java.util.Arrays.asList(new ItemStack(this)); -+ } -+ -+ @Override -+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList drops, World world, BlockPos pos, int fortune) { -+ if (world.field_73012_v.nextInt(8) != 0) return; -+ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(world.field_73012_v, fortune); -+ if (!seed.func_190926_b()) -+ drops.add(seed); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch deleted file mode 100644 index 02a0d61d3..000000000 --- a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/block/BlockTorch.java -+++ b/net/minecraft/block/BlockTorch.java -@@ -37,9 +37,7 @@ - - public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) { - IBlockState iblockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); -- Block block = iblockstate.func_177230_c(); -- boolean flag = block instanceof BlockFence || block instanceof BlockStainedGlass || block == Blocks.field_150359_w || block == Blocks.field_150463_bK || block == Blocks.field_196723_eg || iblockstate.func_185896_q(); -- return flag && block != Blocks.field_185775_db; -+ return iblockstate.canPlaceTorchOnTop(p_196260_2_, p_196260_3_); - } - - @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch deleted file mode 100644 index dd1b91824..000000000 --- a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/block/BlockTrapDoor.java -+++ b/net/minecraft/block/BlockTrapDoor.java -@@ -186,4 +186,14 @@ - - return super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_); - } -+ -+ @Override -+ public boolean isLadder(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.EntityLivingBase entity) { -+ if (state.func_177229_b(field_176283_b)) { -+ IBlockState down = world.func_180495_p(pos.func_177977_b()); -+ if (down.func_177230_c() == net.minecraft.init.Blocks.field_150468_ap) -+ return down.func_177229_b(BlockLadder.field_176382_a) == state.func_177229_b(field_185512_D); -+ } -+ return false; -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockVine.java.patch b/patches/minecraft/net/minecraft/block/BlockVine.java.patch deleted file mode 100644 index 8caed3da8..000000000 --- a/patches/minecraft/net/minecraft/block/BlockVine.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/net/minecraft/block/BlockVine.java -+++ b/net/minecraft/block/BlockVine.java -@@ -29,7 +29,7 @@ - import net.minecraft.world.IWorldReaderBase; - import net.minecraft.world.World; - --public class BlockVine extends Block { -+public class BlockVine extends Block implements net.minecraftforge.common.IShearable { - public static final BooleanProperty field_176277_a = BlockSixWay.field_196496_z; - public static final BooleanProperty field_176273_b = BlockSixWay.field_196488_a; - public static final BooleanProperty field_176278_M = BlockSixWay.field_196490_b; -@@ -171,7 +171,7 @@ - p_196267_2_.func_175698_g(p_196267_3_); - } - -- } else if (p_196267_2_.field_73012_v.nextInt(4) == 0) { -+ } else if (p_196267_2_.field_73012_v.nextInt(4) == 0 && p_196267_2_.func_205050_e(p_196267_3_, 4)) { // Forge: check area to prevent loading unloaded chunks - EnumFacing enumfacing = EnumFacing.func_176741_a(p_196267_4_); - BlockPos blockpos = p_196267_3_.func_177984_a(); - if (enumfacing.func_176740_k().func_176722_c() && !p_196267_1_.func_177229_b(func_176267_a(enumfacing))) { -@@ -365,4 +365,15 @@ - public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) { - return BlockFaceShape.UNDEFINED; - } -+ -+ @Override -+ public boolean isLadder(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.EntityLivingBase entity) { -+ return true; -+ } -+ -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) { -+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11); -+ return java.util.Arrays.asList(new ItemStack(this)); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockWall.java.patch b/patches/minecraft/net/minecraft/block/BlockWall.java.patch deleted file mode 100644 index 754036307..000000000 --- a/patches/minecraft/net/minecraft/block/BlockWall.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/net/minecraft/block/BlockWall.java -+++ b/net/minecraft/block/BlockWall.java -@@ -51,6 +51,18 @@ - return !func_194143_e(block) && p_196421_2_ == BlockFaceShape.SOLID || flag; - } - -+ @Override -+ public boolean canBeConnectedTo(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing) { -+ IBlockState other = world.func_180495_p(pos.func_177972_a(facing)); -+ return func_196421_a(other, other.func_193401_d(world, pos.func_177972_a(facing), facing.func_176734_d())); -+ } -+ -+ private boolean canWallConnectTo(IBlockReader world, BlockPos pos, EnumFacing facing) { -+ BlockPos off = pos.func_177972_a(facing); -+ IBlockState other = world.func_180495_p(off); -+ return other.canBeConnectedTo(world, off, facing.func_176734_d()) || func_196421_a(other, other.func_193401_d(world, off, facing.func_176734_d())); -+ } -+ - public static boolean func_194143_e(Block p_194143_0_) { - return Block.func_193382_c(p_194143_0_) || p_194143_0_ == Blocks.field_180401_cv || p_194143_0_ == Blocks.field_150440_ba || p_194143_0_ == Blocks.field_150423_aK || p_194143_0_ == Blocks.field_196625_cS || p_194143_0_ == Blocks.field_196628_cT || p_194143_0_ == Blocks.field_185778_de || p_194143_0_ == Blocks.field_150335_W; - } -@@ -59,18 +71,10 @@ - IWorldReaderBase iworldreaderbase = p_196258_1_.func_195991_k(); - BlockPos blockpos = p_196258_1_.func_195995_a(); - IFluidState ifluidstate = p_196258_1_.func_195991_k().func_204610_c(p_196258_1_.func_195995_a()); -- BlockPos blockpos1 = blockpos.func_177978_c(); -- BlockPos blockpos2 = blockpos.func_177974_f(); -- BlockPos blockpos3 = blockpos.func_177968_d(); -- BlockPos blockpos4 = blockpos.func_177976_e(); -- IBlockState iblockstate = iworldreaderbase.func_180495_p(blockpos1); -- IBlockState iblockstate1 = iworldreaderbase.func_180495_p(blockpos2); -- IBlockState iblockstate2 = iworldreaderbase.func_180495_p(blockpos3); -- IBlockState iblockstate3 = iworldreaderbase.func_180495_p(blockpos4); -- boolean flag = this.func_196421_a(iblockstate, iblockstate.func_193401_d(iworldreaderbase, blockpos1, EnumFacing.SOUTH)); -- boolean flag1 = this.func_196421_a(iblockstate1, iblockstate1.func_193401_d(iworldreaderbase, blockpos2, EnumFacing.WEST)); -- boolean flag2 = this.func_196421_a(iblockstate2, iblockstate2.func_193401_d(iworldreaderbase, blockpos3, EnumFacing.NORTH)); -- boolean flag3 = this.func_196421_a(iblockstate3, iblockstate3.func_193401_d(iworldreaderbase, blockpos4, EnumFacing.EAST)); -+ boolean flag = canWallConnectTo(iworldreaderbase, blockpos, EnumFacing.NORTH); -+ boolean flag1 = canWallConnectTo(iworldreaderbase, blockpos, EnumFacing.EAST); -+ boolean flag2 = canWallConnectTo(iworldreaderbase, blockpos, EnumFacing.SOUTH); -+ boolean flag3 = canWallConnectTo(iworldreaderbase, blockpos, EnumFacing.WEST); - boolean flag4 = (!flag || flag1 || !flag2 || flag3) && (flag || !flag1 || flag2 || !flag3); - return this.func_176223_P().func_206870_a(field_176256_a, Boolean.valueOf(flag4 || !iworldreaderbase.func_175623_d(blockpos.func_177984_a()))).func_206870_a(field_196409_a, Boolean.valueOf(flag)).func_206870_a(field_196411_b, Boolean.valueOf(flag1)).func_206870_a(field_196413_c, Boolean.valueOf(flag2)).func_206870_a(field_196414_y, Boolean.valueOf(flag3)).func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a)); - } diff --git a/patches/minecraft/net/minecraft/block/BlockWeb.java.patch b/patches/minecraft/net/minecraft/block/BlockWeb.java.patch deleted file mode 100644 index 77b1e975b..000000000 --- a/patches/minecraft/net/minecraft/block/BlockWeb.java.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/net/minecraft/block/BlockWeb.java -+++ b/net/minecraft/block/BlockWeb.java -@@ -5,6 +5,7 @@ - import net.minecraft.block.state.IBlockState; - import net.minecraft.entity.Entity; - import net.minecraft.entity.player.EntityPlayer; -+import net.minecraft.init.Blocks; - import net.minecraft.init.Items; - import net.minecraft.item.ItemStack; - import net.minecraft.stats.StatList; -@@ -16,7 +17,7 @@ - import net.minecraft.world.IBlockReader; - import net.minecraft.world.World; - --public class BlockWeb extends Block { -+public class BlockWeb extends Block implements net.minecraftforge.common.IShearable { - public BlockWeb(Block.Properties p_i48296_1_) { - super(p_i48296_1_); - } -@@ -54,4 +55,10 @@ - public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) { - return BlockFaceShape.UNDEFINED; - } -+ -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) { -+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11); -+ return java.util.Arrays.asList(new ItemStack(this)); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/Blocks.java.patch b/patches/minecraft/net/minecraft/block/Blocks.java.patch new file mode 100644 index 000000000..b4716e910 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/Blocks.java.patch @@ -0,0 +1,36 @@ +--- a/net/minecraft/block/Blocks.java ++++ b/net/minecraft/block/Blocks.java +@@ -13,6 +13,7 @@ + import net.minecraft.potion.Effects; + import net.minecraft.util.registry.Registry; + ++@net.minecraftforge.registries.ObjectHolder("minecraft") + public class Blocks { + public static final Block field_150350_a = func_222382_a("air", new AirBlock(Block.Properties.func_200945_a(Material.field_151579_a).func_200942_a().func_222380_e())); + public static final Block field_150348_b = func_222382_a("stone", new Block(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151665_m).func_200948_a(1.5F, 6.0F))); +@@ -104,7 +105,7 @@ + public static final Block field_196601_az = func_222382_a("green_bed", new BedBlock(DyeColor.GREEN, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F))); + public static final Block field_196550_aA = func_222382_a("red_bed", new BedBlock(DyeColor.RED, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F))); + public static final Block field_196551_aB = func_222382_a("black_bed", new BedBlock(DyeColor.BLACK, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F))); +- public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e))); ++ public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e), true)); + public static final Block field_150319_E = func_222382_a("detector_rail", new DetectorRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e))); + public static final Block field_150320_F = func_222382_a("sticky_piston", new PistonBlock(true, Block.Properties.func_200945_a(Material.field_76233_E).func_200943_b(0.5F))); + public static final Block field_196553_aF = func_222382_a("cobweb", new WebBlock(Block.Properties.func_200945_a(Material.field_151569_G).func_200942_a().func_200943_b(4.0F))); +@@ -694,16 +695,4 @@ + private static Block func_222382_a(String p_222382_0_, Block p_222382_1_) { + return Registry.func_218325_a(Registry.field_212618_g, p_222382_0_, p_222382_1_); + } +- +- static { +- for(Block block : Registry.field_212618_g) { +- for(BlockState blockstate : block.func_176194_O().func_177619_a()) { +- blockstate.func_215692_c(); +- Block.field_176229_d.func_195867_b(blockstate); +- } +- +- block.func_220068_i(); +- } +- +- } + } diff --git a/patches/minecraft/net/minecraft/block/BushBlock.java.patch b/patches/minecraft/net/minecraft/block/BushBlock.java.patch new file mode 100644 index 000000000..fdd83e04c --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BushBlock.java.patch @@ -0,0 +1,32 @@ +--- a/net/minecraft/block/BushBlock.java ++++ b/net/minecraft/block/BushBlock.java +@@ -7,7 +7,7 @@ + import net.minecraft.world.IWorld; + import net.minecraft.world.IWorldReader; + +-public class BushBlock extends Block { ++public class BushBlock extends Block implements net.minecraftforge.common.IPlantable { + protected BushBlock(Block.Properties p_i48437_1_) { + super(p_i48437_1_); + } +@@ -23,6 +23,8 @@ + + public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { + BlockPos blockpos = p_196260_3_.func_177977_b(); ++ if (p_196260_1_.func_177230_c() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. ++ return p_196260_2_.func_180495_p(blockpos).canSustainPlant(p_196260_2_, blockpos, Direction.UP, this); + return this.func_200014_a_(p_196260_2_.func_180495_p(blockpos), p_196260_2_, blockpos); + } + +@@ -33,4 +35,11 @@ + public boolean func_200123_i(BlockState p_200123_1_, IBlockReader p_200123_2_, BlockPos p_200123_3_) { + return true; + } ++ ++ @Override ++ public BlockState getPlant(IBlockReader world, BlockPos pos) { ++ BlockState state = world.func_180495_p(pos); ++ if (state.func_177230_c() != this) return func_176223_P(); ++ return state; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches/minecraft/net/minecraft/block/CactusBlock.java.patch similarity index 53% rename from patches/minecraft/net/minecraft/block/BlockCactus.java.patch rename to patches/minecraft/net/minecraft/block/CactusBlock.java.patch index 82582bf76..c4387245c 100644 --- a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch +++ b/patches/minecraft/net/minecraft/block/CactusBlock.java.patch @@ -1,31 +1,31 @@ ---- a/net/minecraft/block/BlockCactus.java -+++ b/net/minecraft/block/BlockCactus.java -@@ -21,7 +21,7 @@ - import net.minecraft.world.IWorldReaderBase; +--- a/net/minecraft/block/CactusBlock.java ++++ b/net/minecraft/block/CactusBlock.java +@@ -19,7 +19,7 @@ + import net.minecraft.world.IWorldReader; import net.minecraft.world.World; --public class BlockCactus extends Block { -+public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable { +-public class CactusBlock extends Block { ++public class CactusBlock extends Block implements net.minecraftforge.common.IPlantable { public static final IntegerProperty field_176587_a = BlockStateProperties.field_208171_X; protected static final VoxelShape field_196400_b = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 15.0D, 15.0D); protected static final VoxelShape field_196401_c = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D); -@@ -32,6 +32,7 @@ +@@ -30,6 +30,7 @@ } - public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { -+ if (!p_196267_2_.func_205050_e(p_196267_3_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update + public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { ++ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update if (!p_196267_1_.func_196955_c(p_196267_2_, p_196267_3_)) { p_196267_2_.func_175655_b(p_196267_3_, true); } else { -@@ -44,6 +45,7 @@ +@@ -42,6 +43,7 @@ if (i < 3) { int j = p_196267_1_.func_177229_b(field_176587_a); + if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, blockpos, p_196267_1_, true)) { if (j == 15) { p_196267_2_.func_175656_a(blockpos, this.func_176223_P()); - IBlockState iblockstate = p_196267_1_.func_206870_a(field_176587_a, Integer.valueOf(0)); -@@ -52,7 +54,8 @@ + BlockState blockstate = p_196267_1_.func_206870_a(field_176587_a, Integer.valueOf(0)); +@@ -50,7 +52,8 @@ } else { p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176587_a, Integer.valueOf(j + 1)), 4); } @@ -35,29 +35,29 @@ } } } -@@ -91,8 +94,8 @@ +@@ -85,8 +88,8 @@ } } - Block block = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_177230_c(); - return (block == Blocks.field_150434_aF || block == Blocks.field_150354_m || block == Blocks.field_196611_F) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d(); -+ IBlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); -+ return soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP, this) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d(); ++ BlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); ++ return soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), Direction.UP, this) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d(); } - public void func_196262_a(IBlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) { -@@ -114,4 +117,14 @@ - public boolean func_196266_a(IBlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { + public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) { +@@ -104,4 +107,14 @@ + public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) { return false; } + + @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockReader world, BlockPos pos) { -+ return net.minecraftforge.common.EnumPlantType.Desert; ++ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) { ++ return net.minecraftforge.common.PlantType.Desert; + } + + @Override -+ public IBlockState getPlant(IBlockReader world, BlockPos pos) { -+ return func_176223_P(); ++ public BlockState getPlant(IBlockReader world, BlockPos pos) { ++ return func_176223_P(); + } } diff --git a/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch b/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch new file mode 100644 index 000000000..ea15121d2 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/ChorusFlowerBlock.java.patch @@ -0,0 +1,50 @@ +--- a/net/minecraft/block/ChorusFlowerBlock.java ++++ b/net/minecraft/block/ChorusFlowerBlock.java +@@ -30,9 +30,9 @@ + p_196267_2_.func_175655_b(p_196267_3_, true); + } else { + BlockPos blockpos = p_196267_3_.func_177984_a(); +- if (p_196267_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) { ++ if (p_196267_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < p_196267_2_.func_201675_m().getHeight()) { + int i = p_196267_1_.func_177229_b(field_185607_a); +- if (i < 5) { ++ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, blockpos, p_196267_1_, true)) { + boolean flag = false; + boolean flag1 = false; + BlockState blockstate = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()); +@@ -57,7 +57,7 @@ + if (j < 2 || j <= p_196267_4_.nextInt(flag1 ? 5 : 4)) { + flag = true; + } +- } else if (blockstate.func_196958_f()) { ++ } else if (blockstate.isAir(p_196267_2_, p_196267_3_.func_177977_b())) { + flag = true; + } + +@@ -89,7 +89,7 @@ + } else { + this.func_185605_c(p_196267_2_, p_196267_3_); + } +- ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); + } + } + } +@@ -127,7 +127,7 @@ + BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); + Block block = blockstate.func_177230_c(); + if (block != this.field_196405_b && block != Blocks.field_150377_bs) { +- if (!blockstate.func_196958_f()) { ++ if (!blockstate.isAir(p_196260_2_, p_196260_3_.func_177977_b())) { + return false; + } else { + boolean flag = false; +@@ -140,7 +140,7 @@ + } + + flag = true; +- } else if (!blockstate1.func_196958_f()) { ++ } else if (!blockstate1.isAir(p_196260_2_, p_196260_3_.func_177972_a(direction))) { + return false; + } + } diff --git a/patches/minecraft/net/minecraft/block/CocoaBlock.java.patch b/patches/minecraft/net/minecraft/block/CocoaBlock.java.patch new file mode 100644 index 000000000..ca1e160aa --- /dev/null +++ b/patches/minecraft/net/minecraft/block/CocoaBlock.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/block/CocoaBlock.java ++++ b/net/minecraft/block/CocoaBlock.java +@@ -30,10 +30,11 @@ + } + + public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { +- if (p_196267_2_.field_73012_v.nextInt(5) == 0) { ++ if (true) { + int i = p_196267_1_.func_177229_b(field_176501_a); +- if (i < 2) { ++ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_2_.field_73012_v.nextInt(5) == 0)) { + p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176501_a, Integer.valueOf(i + 1)), 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); + } + } + diff --git a/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch b/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch new file mode 100644 index 000000000..95adf31b5 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/ComparatorBlock.java.patch @@ -0,0 +1,28 @@ +--- a/net/minecraft/block/ComparatorBlock.java ++++ b/net/minecraft/block/ComparatorBlock.java +@@ -66,7 +66,7 @@ + blockstate = p_176397_1_.func_180495_p(blockpos); + if (blockstate.func_185912_n()) { + i = blockstate.func_185888_a(p_176397_1_, blockpos); +- } else if (blockstate.func_196958_f()) { ++ } else if (blockstate.isAir(p_176397_1_, blockpos)) { + ItemFrameEntity itemframeentity = this.func_176461_a(p_176397_1_, direction, blockpos); + if (itemframeentity != null) { + i = itemframeentity.func_174866_q(); +@@ -152,4 +152,16 @@ + protected void func_206840_a(StateContainer.Builder p_206840_1_) { + p_206840_1_.func_206894_a(field_185512_D, field_176463_b, field_196348_c); + } ++ ++ @Override ++ public boolean getWeakChanges(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos) { ++ return true; ++ } ++ ++ @Override ++ public void onNeighborChange(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, BlockPos neighbor) { ++ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World && !((World)world).func_201670_d()) { ++ state.func_215697_a((World)world, pos, world.func_180495_p(neighbor).func_177230_c(), neighbor, false); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/block/CropsBlock.java.patch b/patches/minecraft/net/minecraft/block/CropsBlock.java.patch new file mode 100644 index 000000000..a9aa32cbe --- /dev/null +++ b/patches/minecraft/net/minecraft/block/CropsBlock.java.patch @@ -0,0 +1,30 @@ +--- a/net/minecraft/block/CropsBlock.java ++++ b/net/minecraft/block/CropsBlock.java +@@ -58,12 +58,14 @@ + + public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { + super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_); ++ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light + if (p_196267_2_.func_201669_a(p_196267_3_, 0) >= 9) { + int i = this.func_185527_x(p_196267_1_); + if (i < this.func_185526_g()) { + float f = func_180672_a(this, p_196267_2_, p_196267_3_); +- if (p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0) { ++ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0)) { + p_196267_2_.func_180501_a(p_196267_3_, this.func_185528_e(i + 1), 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); + } + } + } +@@ -92,9 +94,9 @@ + for(int j = -1; j <= 1; ++j) { + float f1 = 0.0F; + BlockState blockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j)); +- if (blockstate.func_177230_c() == Blocks.field_150458_ak) { ++ if (blockstate.canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.Direction.UP, (net.minecraftforge.common.IPlantable)p_180672_0_)) { + f1 = 1.0F; +- if (blockstate.func_177229_b(FarmlandBlock.field_176531_a) > 0) { ++ if (blockstate.isFertile(p_180672_1_, blockpos.func_177982_a(i, 0, j))) { + f1 = 3.0F; + } + } diff --git a/patches/minecraft/net/minecraft/block/DeadBushBlock.java.patch b/patches/minecraft/net/minecraft/block/DeadBushBlock.java.patch new file mode 100644 index 000000000..341a2ad7e --- /dev/null +++ b/patches/minecraft/net/minecraft/block/DeadBushBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/DeadBushBlock.java ++++ b/net/minecraft/block/DeadBushBlock.java +@@ -5,7 +5,7 @@ + import net.minecraft.util.math.shapes.VoxelShape; + import net.minecraft.world.IBlockReader; + +-public class DeadBushBlock extends BushBlock { ++public class DeadBushBlock extends BushBlock implements net.minecraftforge.common.IShearable { + protected static final VoxelShape field_196397_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D); + + protected DeadBushBlock(Block.Properties p_i48418_1_) { diff --git a/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch b/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch new file mode 100644 index 000000000..7e77c1849 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/DetectorRailBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/DetectorRailBlock.java ++++ b/net/minecraft/block/DetectorRailBlock.java +@@ -126,6 +126,8 @@ + + public int func_180641_l(BlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) { + if (p_180641_1_.func_177229_b(field_176574_M)) { ++ List carts = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, null); ++ if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel(); + List list = this.func_200878_a(p_180641_2_, p_180641_3_, MinecartCommandBlockEntity.class, (Predicate)null); + if (!list.isEmpty()) { + return list.get(0).func_145822_e().func_145760_g(); diff --git a/patches/minecraft/net/minecraft/block/DoublePlantBlock.java.patch b/patches/minecraft/net/minecraft/block/DoublePlantBlock.java.patch new file mode 100644 index 000000000..ecf90a095 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/DoublePlantBlock.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/block/DoublePlantBlock.java ++++ b/net/minecraft/block/DoublePlantBlock.java +@@ -39,7 +39,7 @@ + @Nullable + public BlockState func_196258_a(BlockItemUseContext p_196258_1_) { + BlockPos blockpos = p_196258_1_.func_195995_a(); +- return blockpos.func_177956_o() < 255 && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null; ++ return blockpos.func_177956_o() < p_196258_1_.func_195991_k().func_201675_m().getHeight() - 1 && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null; + } + + public void func_180633_a(World p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) { +@@ -51,6 +51,7 @@ + return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_); + } else { + BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); ++ if (p_196260_1_.func_177230_c() != this) return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. + return blockstate.func_177230_c() == this && blockstate.func_177229_b(field_176492_b) == DoubleBlockHalf.LOWER; + } + } diff --git a/patches/minecraft/net/minecraft/block/DropperBlock.java.patch b/patches/minecraft/net/minecraft/block/DropperBlock.java.patch new file mode 100644 index 000000000..7271e5e1c --- /dev/null +++ b/patches/minecraft/net/minecraft/block/DropperBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/DropperBlock.java ++++ b/net/minecraft/block/DropperBlock.java +@@ -37,7 +37,7 @@ + p_176439_1_.func_217379_c(1001, p_176439_2_, 0); + } else { + ItemStack itemstack = dispensertileentity.func_70301_a(i); +- if (!itemstack.func_190926_b()) { ++ if (!itemstack.func_190926_b() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_176439_1_, p_176439_2_, dispensertileentity, i, itemstack)) { + Direction direction = p_176439_1_.func_180495_p(p_176439_2_).func_177229_b(field_176441_a); + IInventory iinventory = HopperTileEntity.func_195484_a(p_176439_1_, p_176439_2_.func_177972_a(direction)); + ItemStack itemstack1; diff --git a/patches/minecraft/net/minecraft/block/BlockEnchantmentTable.java.patch b/patches/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch similarity index 81% rename from patches/minecraft/net/minecraft/block/BlockEnchantmentTable.java.patch rename to patches/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch index c5df74a30..2e943e574 100644 --- a/patches/minecraft/net/minecraft/block/BlockEnchantmentTable.java.patch +++ b/patches/minecraft/net/minecraft/block/EnchantingTableBlock.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/block/BlockEnchantmentTable.java -+++ b/net/minecraft/block/BlockEnchantmentTable.java -@@ -49,7 +49,7 @@ +--- a/net/minecraft/block/EnchantingTableBlock.java ++++ b/net/minecraft/block/EnchantingTableBlock.java +@@ -53,7 +53,7 @@ if (p_180655_4_.nextInt(16) == 0) { for(int k = 0; k <= 1; ++k) { BlockPos blockpos = p_180655_3_.func_177982_a(i, k, j); diff --git a/patches/minecraft/net/minecraft/block/FallingBlock.java.patch b/patches/minecraft/net/minecraft/block/FallingBlock.java.patch new file mode 100644 index 000000000..dcdd9f3f0 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/FallingBlock.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/block/FallingBlock.java ++++ b/net/minecraft/block/FallingBlock.java +@@ -35,7 +35,7 @@ + } + + private void func_176503_e(World p_176503_1_, BlockPos p_176503_2_) { +- if (func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b())) && p_176503_2_.func_177956_o() >= 0) { ++ if (p_176503_1_.func_175623_d(p_176503_2_.func_177977_b()) || func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b())) && p_176503_2_.func_177956_o() >= 0) { + if (!p_176503_1_.field_72995_K) { + FallingBlockEntity fallingblockentity = new FallingBlockEntity(p_176503_1_, (double)p_176503_2_.func_177958_n() + 0.5D, (double)p_176503_2_.func_177956_o(), (double)p_176503_2_.func_177952_p() + 0.5D, p_176503_1_.func_180495_p(p_176503_2_)); + this.func_149829_a(fallingblockentity); +@@ -68,7 +68,7 @@ + public void func_180655_c(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, Random p_180655_4_) { + if (p_180655_4_.nextInt(16) == 0) { + BlockPos blockpos = p_180655_3_.func_177977_b(); +- if (func_185759_i(p_180655_2_.func_180495_p(blockpos))) { ++ if (p_180655_2_.func_175623_d(blockpos) || func_185759_i(p_180655_2_.func_180495_p(blockpos))) { + double d0 = (double)((float)p_180655_3_.func_177958_n() + p_180655_4_.nextFloat()); + double d1 = (double)p_180655_3_.func_177956_o() - 0.05D; + double d2 = (double)((float)p_180655_3_.func_177952_p() + p_180655_4_.nextFloat()); diff --git a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/block/BlockFarmland.java.patch rename to patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch index dc12cb21c..fb721ff9a 100644 --- a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ b/patches/minecraft/net/minecraft/block/FarmlandBlock.java.patch @@ -1,28 +1,28 @@ ---- a/net/minecraft/block/BlockFarmland.java -+++ b/net/minecraft/block/BlockFarmland.java -@@ -79,7 +79,7 @@ +--- a/net/minecraft/block/FarmlandBlock.java ++++ b/net/minecraft/block/FarmlandBlock.java +@@ -72,7 +72,7 @@ } public void func_180658_a(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) { -- if (!p_180658_1_.field_72995_K && p_180658_1_.field_73012_v.nextFloat() < p_180658_4_ - 0.5F && p_180658_3_ instanceof EntityLivingBase && (p_180658_3_ instanceof EntityPlayer || p_180658_1_.func_82736_K().func_82766_b("mobGriefing")) && p_180658_3_.field_70130_N * p_180658_3_.field_70130_N * p_180658_3_.field_70131_O > 0.512F) { +- if (!p_180658_1_.field_72995_K && p_180658_1_.field_73012_v.nextFloat() < p_180658_4_ - 0.5F && p_180658_3_ instanceof LivingEntity && (p_180658_3_ instanceof PlayerEntity || p_180658_1_.func_82736_K().func_82766_b("mobGriefing")) && p_180658_3_.func_213311_cf() * p_180658_3_.func_213311_cf() * p_180658_3_.func_213302_cg() > 0.512F) { + if (!p_180658_1_.field_72995_K && net.minecraftforge.common.ForgeHooks.onFarmlandTrample(p_180658_1_, p_180658_2_, Blocks.field_150346_d.func_176223_P(), p_180658_4_, p_180658_3_)) { // Forge: Move logic to Entity#canTrample func_199610_d(p_180658_1_.func_180495_p(p_180658_2_), p_180658_1_, p_180658_2_); } -@@ -90,9 +90,9 @@ +@@ -83,9 +83,9 @@ p_199610_1_.func_175656_a(p_199610_2_, func_199601_a(p_199610_0_, Blocks.field_150346_d.func_176223_P(), p_199610_1_, p_199610_2_)); } - private static boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) { - Block block = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a()).func_177230_c(); -- return block instanceof BlockCrops || block instanceof BlockStem || block instanceof BlockAttachedStem; +- return block instanceof CropsBlock || block instanceof StemBlock || block instanceof AttachedStemBlock; + private boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) { -+ IBlockState state = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a()); -+ return state.func_177230_c() instanceof net.minecraftforge.common.IPlantable && canSustainPlant(state, p_176529_0_, p_176529_1_, EnumFacing.UP, (net.minecraftforge.common.IPlantable)state.func_177230_c()); ++ BlockState state = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a()); ++ return state.func_177230_c() instanceof net.minecraftforge.common.IPlantable && canSustainPlant(state, p_176529_0_, p_176529_1_, Direction.UP, (net.minecraftforge.common.IPlantable)state.func_177230_c()); } - private static boolean func_176530_e(IWorldReaderBase p_176530_0_, BlockPos p_176530_1_) { -@@ -102,7 +102,7 @@ + private static boolean func_176530_e(IWorldReader p_176530_0_, BlockPos p_176530_1_) { +@@ -95,7 +95,7 @@ } } @@ -30,4 +30,4 @@ + return net.minecraftforge.common.FarmlandWaterManager.hasBlockWaterTicket(p_176530_0_, p_176530_1_); } - public IItemProvider func_199769_a(IBlockState p_199769_1_, World p_199769_2_, BlockPos p_199769_3_, int p_199769_4_) { + protected void func_206840_a(StateContainer.Builder p_206840_1_) { diff --git a/patches/minecraft/net/minecraft/block/BlockFire.java.patch b/patches/minecraft/net/minecraft/block/FireBlock.java.patch similarity index 55% rename from patches/minecraft/net/minecraft/block/BlockFire.java.patch rename to patches/minecraft/net/minecraft/block/FireBlock.java.patch index 53a89665e..0fa2a7de5 100644 --- a/patches/minecraft/net/minecraft/block/BlockFire.java.patch +++ b/patches/minecraft/net/minecraft/block/FireBlock.java.patch @@ -1,55 +1,47 @@ ---- a/net/minecraft/block/BlockFire.java -+++ b/net/minecraft/block/BlockFire.java -@@ -64,13 +64,13 @@ +--- a/net/minecraft/block/FireBlock.java ++++ b/net/minecraft/block/FireBlock.java +@@ -63,13 +63,13 @@ + public BlockState func_196448_a(IBlockReader p_196448_1_, BlockPos p_196448_2_) { + BlockPos blockpos = p_196448_2_.func_177977_b(); + BlockState blockstate = p_196448_1_.func_180495_p(blockpos); +- if (!this.func_196446_i(blockstate) && !Block.func_220056_d(blockstate, p_196448_1_, blockpos, Direction.UP)) { ++ if (!this.canCatchFire(p_196448_1_, p_196448_2_, Direction.UP) && !Block.func_220056_d(blockstate, p_196448_1_, blockpos, Direction.UP)) { + BlockState blockstate1 = this.func_176223_P(); - public IBlockState func_196448_a(IBlockReader p_196448_1_, BlockPos p_196448_2_) { - IBlockState iblockstate = p_196448_1_.func_180495_p(p_196448_2_.func_177977_b()); -- if (!iblockstate.func_185896_q() && !this.func_196446_i(iblockstate)) { -+ if (!iblockstate.func_185896_q() && !this.canCatchFire(p_196448_1_, p_196448_2_, EnumFacing.UP)) { - IBlockState iblockstate1 = this.func_176223_P(); - - for(EnumFacing enumfacing : EnumFacing.values()) { - BooleanProperty booleanproperty = field_196449_B.get(enumfacing); + for(Direction direction : Direction.values()) { + BooleanProperty booleanproperty = field_196449_B.get(direction); if (booleanproperty != null) { -- iblockstate1 = iblockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.func_196446_i(p_196448_1_.func_180495_p(p_196448_2_.func_177972_a(enumfacing))))); -+ iblockstate1 = iblockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.canCatchFire(p_196448_1_, p_196448_2_.func_177972_a(enumfacing), enumfacing.func_176734_d()))); +- blockstate1 = blockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.func_196446_i(p_196448_1_.func_180495_p(p_196448_2_.func_177972_a(direction))))); ++ blockstate1 = blockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.canCatchFire(p_196448_1_, p_196448_2_.func_177972_a(direction), direction.func_176734_d()))); } } -@@ -98,12 +98,13 @@ +@@ -90,12 +90,14 @@ - public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { + public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { if (p_196267_2_.func_82736_K().func_82766_b("doFireTick")) { -+ if (!p_196267_2_.func_205050_e(p_196267_3_, 2)) return; // Forge: prevent loading unloaded chunks when spreading fire ++ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 2)) return; // Forge: prevent loading unloaded chunks when spreading fire if (!p_196267_1_.func_196955_c(p_196267_2_, p_196267_3_)) { - p_196267_2_.func_175698_g(p_196267_3_); + p_196267_2_.func_217377_a(p_196267_3_, false); } -- Block block = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()).func_177230_c(); + Block block = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()).func_177230_c(); - boolean flag = p_196267_2_.field_73011_w instanceof EndDimension && block == Blocks.field_150357_h || block == Blocks.field_150424_aL || block == Blocks.field_196814_hQ; -+ IBlockState other = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()); -+ boolean flag = other.isFireSource(p_196267_2_, p_196267_3_.func_177977_b(), EnumFacing.UP); ++ BlockState other = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()); ++ boolean flag = other.isFireSource(p_196267_2_, p_196267_3_.func_177977_b(), Direction.UP); int i = p_196267_1_.func_177229_b(field_176543_a); if (!flag && p_196267_2_.func_72896_J() && this.func_176537_d(p_196267_2_, p_196267_3_) && p_196267_4_.nextFloat() < 0.2F + (float)i * 0.03F) { - p_196267_2_.func_175698_g(p_196267_3_); -@@ -117,14 +118,14 @@ - if (!flag) { - p_196267_2_.func_205220_G_().func_205360_a(p_196267_3_, this, this.func_149738_a(p_196267_2_) + p_196267_4_.nextInt(10)); - if (!this.func_196447_a(p_196267_2_, p_196267_3_)) { -- if (!p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()).func_185896_q() || i > 3) { -+ if (p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()).func_193401_d(p_196267_2_, p_196267_3_.func_177977_b(), EnumFacing.UP) != BlockFaceShape.SOLID || i > 3) { - p_196267_2_.func_175698_g(p_196267_3_); - } - + p_196267_2_.func_217377_a(p_196267_3_, false); +@@ -117,7 +119,7 @@ return; } - if (i == 15 && p_196267_4_.nextInt(4) == 0 && !this.func_196446_i(p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()))) { -+ if (i == 15 && p_196267_4_.nextInt(4) == 0 && !this.canCatchFire(p_196267_2_, p_196267_3_.func_177977_b(), EnumFacing.UP)) { - p_196267_2_.func_175698_g(p_196267_3_); ++ if (i == 15 && p_196267_4_.nextInt(4) == 0 && !this.canCatchFire(p_196267_2_, p_196267_3_.func_177977_b(), Direction.UP)) { + p_196267_2_.func_217377_a(p_196267_3_, false); return; } -@@ -132,12 +133,12 @@ +@@ -125,12 +127,12 @@ boolean flag1 = p_196267_2_.func_180502_D(p_196267_3_); int k = flag1 ? -50 : 0; @@ -59,110 +51,111 @@ - this.func_176536_a(p_196267_2_, p_196267_3_.func_177984_a(), 250 + k, p_196267_4_, i); - this.func_176536_a(p_196267_2_, p_196267_3_.func_177978_c(), 300 + k, p_196267_4_, i); - this.func_176536_a(p_196267_2_, p_196267_3_.func_177968_d(), 300 + k, p_196267_4_, i); -+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177974_f(), 300 + k, p_196267_4_, i, EnumFacing.WEST); -+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177976_e(), 300 + k, p_196267_4_, i, EnumFacing.EAST); -+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177977_b(), 250 + k, p_196267_4_, i, EnumFacing.UP); -+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177984_a(), 250 + k, p_196267_4_, i, EnumFacing.DOWN); -+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177978_c(), 300 + k, p_196267_4_, i, EnumFacing.SOUTH); -+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177968_d(), 300 + k, p_196267_4_, i, EnumFacing.NORTH); ++ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177974_f(), 300 + k, p_196267_4_, i, Direction.WEST); ++ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177976_e(), 300 + k, p_196267_4_, i, Direction.EAST); ++ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177977_b(), 250 + k, p_196267_4_, i, Direction.UP); ++ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177984_a(), 250 + k, p_196267_4_, i, Direction.DOWN); ++ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177978_c(), 300 + k, p_196267_4_, i, Direction.SOUTH); ++ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177968_d(), 300 + k, p_196267_4_, i, Direction.NORTH); BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for(int l = -1; l <= 1; ++l) { -@@ -175,16 +176,18 @@ +@@ -168,16 +170,18 @@ return p_176537_1_.func_175727_C(p_176537_2_) || p_176537_1_.func_175727_C(p_176537_2_.func_177976_e()) || p_176537_1_.func_175727_C(p_176537_2_.func_177974_f()) || p_176537_1_.func_175727_C(p_176537_2_.func_177978_c()) || p_176537_1_.func_175727_C(p_176537_2_.func_177968_d()); } -+ @Deprecated //Forge: Use IForgeBlockState.getFlammability - public int func_176532_c(Block p_176532_1_) { - return this.field_149848_b.getInt(p_176532_1_); +- private int func_220274_q(BlockState p_220274_1_) { ++ @Deprecated //Forge: Use IForgeBlockState.getFlammability, Public for default implementation only. ++ public int func_220274_q(BlockState p_220274_1_) { + return p_220274_1_.func_196959_b(BlockStateProperties.field_208198_y) && p_220274_1_.func_177229_b(BlockStateProperties.field_208198_y) ? 0 : this.field_149848_b.getInt(p_220274_1_.func_177230_c()); } +- private int func_220275_r(BlockState p_220275_1_) { + @Deprecated //Forge: Use IForgeBlockState.getFireSpreadSpeed - public int func_176534_d(Block p_176534_1_) { - return this.field_149849_a.getInt(p_176534_1_); ++ public int func_220275_r(BlockState p_220275_1_) { + return p_220275_1_.func_196959_b(BlockStateProperties.field_208198_y) && p_220275_1_.func_177229_b(BlockStateProperties.field_208198_y) ? 0 : this.field_149849_a.getInt(p_220275_1_.func_177230_c()); } - private void func_176536_a(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_) { -- int i = this.func_176532_c(p_176536_1_.func_180495_p(p_176536_2_).func_177230_c()); -+ private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, EnumFacing face) { +- int i = this.func_220274_q(p_176536_1_.func_180495_p(p_176536_2_)); ++ private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, Direction face) { + int i = p_176536_1_.func_180495_p(p_176536_2_).getFlammability(p_176536_1_, p_176536_2_, face); if (p_176536_4_.nextInt(p_176536_3_) < i) { - IBlockState iblockstate = p_176536_1_.func_180495_p(p_176536_2_); + BlockState blockstate = p_176536_1_.func_180495_p(p_176536_2_); if (p_176536_4_.nextInt(p_176536_5_ + 10) < 5 && !p_176536_1_.func_175727_C(p_176536_2_)) { -@@ -204,7 +207,7 @@ +@@ -198,7 +202,7 @@ private boolean func_196447_a(IBlockReader p_196447_1_, BlockPos p_196447_2_) { - for(EnumFacing enumfacing : EnumFacing.values()) { -- if (this.func_196446_i(p_196447_1_.func_180495_p(p_196447_2_.func_177972_a(enumfacing)))) { -+ if (this.canCatchFire(p_196447_1_, p_196447_2_.func_177972_a(enumfacing), enumfacing.func_176734_d())) { + for(Direction direction : Direction.values()) { +- if (this.func_196446_i(p_196447_1_.func_180495_p(p_196447_2_.func_177972_a(direction)))) { ++ if (this.canCatchFire(p_196447_1_, p_196447_2_.func_177972_a(direction), direction.func_176734_d())) { return true; } } -@@ -219,7 +222,7 @@ - int i = 0; +@@ -214,13 +218,14 @@ - for(EnumFacing enumfacing : EnumFacing.values()) { -- i = Math.max(this.func_176534_d(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).func_177230_c()), i); -+ i = Math.max(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).getFlammability(p_176538_1_, p_176538_2_.func_177972_a(enumfacing), enumfacing.func_176734_d()), i); + for(Direction direction : Direction.values()) { + BlockState blockstate = p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(direction)); +- i = Math.max(this.func_220275_r(blockstate), i); ++ i = Math.max(blockstate.getFlammability(p_176538_1_, p_176538_2_.func_177972_a(direction), direction.func_176734_d()), i); } return i; -@@ -230,6 +233,7 @@ - return false; + } } + @Deprecated //Forge: Use canCatchFire with more context - public boolean func_196446_i(IBlockState p_196446_1_) { - return this.func_176534_d(p_196446_1_.func_177230_c()) > 0; + public boolean func_196446_i(BlockState p_196446_1_) { + return this.func_220275_r(p_196446_1_) > 0; } -@@ -252,8 +256,8 @@ - p_180655_2_.func_184134_a((double)((float)p_180655_3_.func_177958_n() + 0.5F), (double)((float)p_180655_3_.func_177956_o() + 0.5F), (double)((float)p_180655_3_.func_177952_p() + 0.5F), SoundEvents.field_187643_bs, SoundCategory.BLOCKS, 1.0F + p_180655_4_.nextFloat(), p_180655_4_.nextFloat() * 0.7F + 0.3F, false); - } +@@ -245,8 +250,8 @@ -- if (!p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()).func_185896_q() && !this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()))) { + BlockPos blockpos = p_180655_3_.func_177977_b(); + BlockState blockstate = p_180655_2_.func_180495_p(blockpos); +- if (!this.func_196446_i(blockstate) && !Block.func_220056_d(blockstate, p_180655_2_, blockpos, Direction.UP)) { - if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177976_e()))) { -+ if (p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()).func_193401_d(p_180655_2_, p_180655_3_.func_177977_b(), EnumFacing.UP) != BlockFaceShape.SOLID && !this.canCatchFire(p_180655_2_, p_180655_3_.func_177977_b(), EnumFacing.UP)) { -+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177976_e(), EnumFacing.EAST)) { ++ if (!this.canCatchFire(p_180655_2_, blockpos, Direction.UP) && !Block.func_220056_d(blockstate, p_180655_2_, blockpos, Direction.UP)) { ++ if (this.canCatchFire(p_180655_2_, blockpos.func_177976_e(), Direction.EAST)) { for(int j = 0; j < 2; ++j) { double d3 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble() * (double)0.1F; double d8 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble(); -@@ -262,7 +266,7 @@ +@@ -255,7 +260,7 @@ } } - if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177974_f()))) { -+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177974_f(), EnumFacing.WEST)) { ++ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177974_f(), Direction.WEST)) { for(int k = 0; k < 2; ++k) { double d4 = (double)(p_180655_3_.func_177958_n() + 1) - p_180655_4_.nextDouble() * (double)0.1F; double d9 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble(); -@@ -271,7 +275,7 @@ +@@ -264,7 +269,7 @@ } } - if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177978_c()))) { -+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177978_c(), EnumFacing.SOUTH)) { ++ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177978_c(), Direction.SOUTH)) { for(int l = 0; l < 2; ++l) { double d5 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble(); double d10 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble(); -@@ -280,7 +284,7 @@ +@@ -273,7 +278,7 @@ } } - if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177968_d()))) { -+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177968_d(), EnumFacing.NORTH)) { ++ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177968_d(), Direction.NORTH)) { for(int i1 = 0; i1 < 2; ++i1) { double d6 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble(); double d11 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble(); -@@ -289,7 +293,7 @@ +@@ -282,7 +287,7 @@ } } - if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177984_a()))) { -+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177984_a(), EnumFacing.DOWN)) { ++ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177984_a(), Direction.DOWN)) { for(int j1 = 0; j1 < 2; ++j1) { double d7 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble(); double d12 = (double)(p_180655_3_.func_177956_o() + 1) - p_180655_4_.nextDouble() * (double)0.1F; -@@ -321,10 +325,23 @@ +@@ -310,10 +315,23 @@ } public void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) { @@ -179,10 +172,10 @@ + * @param face The side the fire is coming from + * @return True if the face can catch fire. + */ -+ public boolean canCatchFire(IBlockReader world, BlockPos pos, EnumFacing face) { ++ public boolean canCatchFire(IBlockReader world, BlockPos pos, Direction face) { + return world.func_180495_p(pos).isFlammable(world, pos, face); + } + public static void func_149843_e() { - BlockFire blockfire = (BlockFire)Blocks.field_150480_ab; - blockfire.func_180686_a(Blocks.field_196662_n, 5, 20); + FireBlock fireblock = (FireBlock)Blocks.field_150480_ab; + fireblock.func_180686_a(Blocks.field_196662_n, 5, 20); diff --git a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch similarity index 62% rename from patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch rename to patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch index 609f11f84..4ab964a9d 100644 --- a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch +++ b/patches/minecraft/net/minecraft/block/FlowerPotBlock.java.patch @@ -1,9 +1,9 @@ ---- a/net/minecraft/block/BlockFlowerPot.java -+++ b/net/minecraft/block/BlockFlowerPot.java -@@ -22,7 +22,7 @@ - import net.minecraft.world.World; +--- a/net/minecraft/block/FlowerPotBlock.java ++++ b/net/minecraft/block/FlowerPotBlock.java +@@ -21,7 +21,7 @@ + import net.minecraftforge.api.distmarker.OnlyIn; - public class BlockFlowerPot extends Block { + public class FlowerPotBlock extends Block { - private static final Map field_196451_b = Maps.newHashMap(); + private static final Map field_196451_b = Maps.newHashMap(); //TODO: Delegates protected static final VoxelShape field_196450_a = Block.func_208617_a(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D); diff --git a/patches/minecraft/net/minecraft/block/ITileEntityProvider.java.patch b/patches/minecraft/net/minecraft/block/ITileEntityProvider.java.patch index f169cacc2..bd96db3c6 100644 --- a/patches/minecraft/net/minecraft/block/ITileEntityProvider.java.patch +++ b/patches/minecraft/net/minecraft/block/ITileEntityProvider.java.patch @@ -4,7 +4,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockReader; -+@Deprecated //Forge: Do not use, use IBlockState.hasTileEntity/Blocks.createTileEntity ++@Deprecated //Forge: Do not use, use BlockState.hasTileEntity/Block.createTileEntity public interface ITileEntityProvider { @Nullable TileEntity func_196283_a_(IBlockReader p_196283_1_); diff --git a/patches/minecraft/net/minecraft/block/LadderBlock.java.patch b/patches/minecraft/net/minecraft/block/LadderBlock.java.patch new file mode 100644 index 000000000..2c5165c7b --- /dev/null +++ b/patches/minecraft/net/minecraft/block/LadderBlock.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/block/LadderBlock.java ++++ b/net/minecraft/block/LadderBlock.java +@@ -94,6 +94,11 @@ + return null; + } + ++ @Override ++ public boolean isLadder(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) { ++ return true; ++ } ++ + public BlockRenderLayer func_180664_k() { + return BlockRenderLayer.CUTOUT; + } diff --git a/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch b/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch new file mode 100644 index 000000000..70bfb160f --- /dev/null +++ b/patches/minecraft/net/minecraft/block/LeavesBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/LeavesBlock.java ++++ b/net/minecraft/block/LeavesBlock.java +@@ -18,7 +18,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public class LeavesBlock extends Block { ++public class LeavesBlock extends Block implements net.minecraftforge.common.IShearable { + public static final IntegerProperty field_208494_a = BlockStateProperties.field_208514_aa; + public static final BooleanProperty field_208495_b = BlockStateProperties.field_208515_s; + protected static boolean field_196478_c; diff --git a/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch b/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch new file mode 100644 index 000000000..886dca7a6 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/MushroomBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/MushroomBlock.java ++++ b/net/minecraft/block/MushroomBlock.java +@@ -62,7 +62,7 @@ + BlockState blockstate = p_196260_2_.func_180495_p(blockpos); + Block block = blockstate.func_177230_c(); + if (block != Blocks.field_150391_bh && block != Blocks.field_196661_l) { +- return p_196260_2_.func_201669_a(p_196260_3_, 0) < 13 && this.func_200014_a_(blockstate, p_196260_2_, blockpos); ++ return p_196260_2_.func_201669_a(p_196260_3_, 0) < 13 && blockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.Direction.UP, this); + } else { + return true; + } diff --git a/patches/minecraft/net/minecraft/block/NetherPortalBlock.java.patch b/patches/minecraft/net/minecraft/block/NetherPortalBlock.java.patch new file mode 100644 index 000000000..b67196800 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/NetherPortalBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/NetherPortalBlock.java ++++ b/net/minecraft/block/NetherPortalBlock.java +@@ -68,7 +68,7 @@ + + public boolean func_176548_d(IWorld p_176548_1_, BlockPos p_176548_2_) { + NetherPortalBlock.Size netherportalblock$size = this.func_201816_b(p_176548_1_, p_176548_2_); +- if (netherportalblock$size != null) { ++ if (netherportalblock$size != null && !net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_176548_1_, p_176548_2_, netherportalblock$size)) { + netherportalblock$size.func_150859_c(); + return true; + } else { diff --git a/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch b/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch new file mode 100644 index 000000000..07b7fd112 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/NetherWartBlock.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/block/NetherWartBlock.java ++++ b/net/minecraft/block/NetherWartBlock.java +@@ -33,9 +33,10 @@ + + public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { + int i = p_196267_1_.func_177229_b(field_176486_a); +- if (i < 3 && p_196267_4_.nextInt(10) == 0) { ++ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt(10) == 0)) { + p_196267_1_ = p_196267_1_.func_206870_a(field_176486_a, Integer.valueOf(i + 1)); + p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_, 2); ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); + } + + super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_); diff --git a/patches/minecraft/net/minecraft/block/BlockNote.java.patch b/patches/minecraft/net/minecraft/block/NoteBlock.java.patch similarity index 61% rename from patches/minecraft/net/minecraft/block/BlockNote.java.patch rename to patches/minecraft/net/minecraft/block/NoteBlock.java.patch index de5bb1a17..af0f3f251 100644 --- a/patches/minecraft/net/minecraft/block/BlockNote.java.patch +++ b/patches/minecraft/net/minecraft/block/NoteBlock.java.patch @@ -1,5 +1,5 @@ ---- a/net/minecraft/block/BlockNote.java -+++ b/net/minecraft/block/BlockNote.java +--- a/net/minecraft/block/NoteBlock.java ++++ b/net/minecraft/block/NoteBlock.java @@ -49,7 +49,7 @@ } @@ -10,23 +10,23 @@ } @@ -59,7 +59,9 @@ - if (p_196250_2_.field_72995_K) { + if (p_220051_2_.field_72995_K) { return true; } else { -- p_196250_1_ = p_196250_1_.func_177231_a(field_196485_c); -+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_196250_2_, p_196250_3_, p_196250_1_, p_196250_1_.func_177229_b(field_196485_c), p_196250_1_.func_177231_a(field_196485_c).func_177229_b(field_196485_c)); +- p_220051_1_ = p_220051_1_.func_177231_a(field_196485_c); ++ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_220051_2_, p_220051_3_, p_220051_1_, p_220051_1_.func_177229_b(field_196485_c), p_220051_1_.func_177231_a(field_196485_c).func_177229_b(field_196485_c)); + if (_new == -1) return false; -+ p_196250_1_ = (IBlockState)p_196250_1_.func_206870_a(field_196485_c, _new); - p_196250_2_.func_180501_a(p_196250_3_, p_196250_1_, 3); - this.func_196482_a(p_196250_2_, p_196250_3_); - p_196250_4_.func_195066_a(StatList.field_188087_U); ++ p_220051_1_ = (BlockState)p_220051_1_.func_206870_a(field_196485_c, _new); + p_220051_2_.func_180501_a(p_220051_3_, p_220051_1_, 3); + this.func_196482_a(p_220051_2_, p_220051_3_); + p_220051_4_.func_195066_a(Stats.field_188087_U); @@ -75,6 +77,9 @@ } - public boolean func_189539_a(IBlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) { + public boolean func_189539_a(BlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) { + net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_189539_2_, p_189539_3_, p_189539_1_, p_189539_1_.func_177229_b(field_196485_c), p_189539_1_.func_177229_b(field_196483_a)); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; + p_189539_1_ = p_189539_1_.func_206870_a(field_196485_c, e.getVanillaNoteId()).func_206870_a(field_196483_a, e.getInstrument()); int i = p_189539_1_.func_177229_b(field_196485_c); float f = (float)Math.pow(2.0D, (double)(i - 12) / 12.0D); - p_189539_2_.func_184133_a((EntityPlayer)null, p_189539_3_, p_189539_1_.func_177229_b(field_196483_a).func_208088_a(), SoundCategory.RECORDS, 3.0F, f); + p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, p_189539_1_.func_177229_b(field_196483_a).func_208088_a(), SoundCategory.RECORDS, 3.0F, f); diff --git a/patches/minecraft/net/minecraft/block/OreBlock.java.patch b/patches/minecraft/net/minecraft/block/OreBlock.java.patch new file mode 100644 index 000000000..fee79b59a --- /dev/null +++ b/patches/minecraft/net/minecraft/block/OreBlock.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/block/OreBlock.java ++++ b/net/minecraft/block/OreBlock.java +@@ -29,12 +29,10 @@ + + public void func_220062_a(BlockState p_220062_1_, World p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) { + super.func_220062_a(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_); +- if (EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_220062_4_) == 0) { +- int i = this.func_220281_a(p_220062_2_.field_73012_v); +- if (i > 0) { +- this.func_180637_b(p_220062_2_, p_220062_3_, i); +- } +- } ++ } + ++ @Override ++ public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader reader, BlockPos pos, int fortune, int silktouch) { ++ return silktouch == 0 ? this.func_220281_a(RANDOM) : 0; + } + } diff --git a/patches/minecraft/net/minecraft/block/PistonBlock.java.patch b/patches/minecraft/net/minecraft/block/PistonBlock.java.patch new file mode 100644 index 000000000..37a56966a --- /dev/null +++ b/patches/minecraft/net/minecraft/block/PistonBlock.java.patch @@ -0,0 +1,40 @@ +--- a/net/minecraft/block/PistonBlock.java ++++ b/net/minecraft/block/PistonBlock.java +@@ -197,7 +197,7 @@ + } + + if (!flag1) { +- if (p_189539_4_ != 1 || blockstate.func_196958_f() || !func_185646_a(blockstate, p_189539_2_, blockpos, direction.func_176734_d(), false, direction) || blockstate.func_185905_o() != PushReaction.NORMAL && block != Blocks.field_150331_J && block != Blocks.field_150320_F) { ++ if (p_189539_4_ != 1 || blockstate.isAir(p_189539_2_, blockpos) || !func_185646_a(blockstate, p_189539_2_, blockpos, direction.func_176734_d(), false, direction) || blockstate.func_185905_o() != PushReaction.NORMAL && block != Blocks.field_150331_J && block != Blocks.field_150320_F) { + p_189539_2_.func_217377_a(p_189539_3_.func_177972_a(direction), false); + } else { + this.func_176319_a(p_189539_2_, p_189539_3_, direction, false); +@@ -238,7 +238,7 @@ + return false; + } + +- return !block.func_149716_u(); ++ return !p_185646_0_.hasTileEntity(); + } else { + return false; + } +@@ -274,7 +274,7 @@ + for(int j = list2.size() - 1; j >= 0; --j) { + BlockPos blockpos2 = list2.get(j); + BlockState blockstate = p_176319_1_.func_180495_p(blockpos2); +- TileEntity tileentity = blockstate.func_177230_c().func_149716_u() ? p_176319_1_.func_175625_s(blockpos2) : null; ++ TileEntity tileentity = blockstate.hasTileEntity() ? p_176319_1_.func_175625_s(blockpos2) : null; + func_220059_a(blockstate, p_176319_1_, blockpos2, tileentity); + p_176319_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 18); + --k; +@@ -328,6 +328,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))); + } + ++ public BlockState rotate(BlockState state, net.minecraft.world.IWorld world, BlockPos pos, Rotation direction) { ++ return state.func_177229_b(field_176320_b) ? state : super.rotate(state, world, pos, direction); ++ } ++ + public BlockState func_185471_a(BlockState p_185471_1_, Mirror p_185471_2_) { + return p_185471_1_.func_185907_a(p_185471_2_.func_185800_a(p_185471_1_.func_177229_b(field_176387_N))); + } diff --git a/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch b/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch new file mode 100644 index 000000000..871ec0df0 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/block/PoweredRailBlock.java ++++ b/net/minecraft/block/PoweredRailBlock.java +@@ -14,10 +14,16 @@ + public class PoweredRailBlock extends AbstractRailBlock { + public static final EnumProperty field_176568_b = BlockStateProperties.field_208166_S; + public static final BooleanProperty field_176569_M = BlockStateProperties.field_208194_u; ++ private final boolean isActivator; + + protected PoweredRailBlock(Block.Properties p_i48349_1_) { +- super(true, p_i48349_1_); ++ this(p_i48349_1_, false); ++ } ++ ++ protected PoweredRailBlock(Block.Properties builder, boolean isActivator) { ++ super(true, builder); + this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176568_b, RailShape.NORTH_SOUTH).func_206870_a(field_176569_M, Boolean.valueOf(false))); ++ this.isActivator = isActivator; + } + + protected boolean func_176566_a(World p_176566_1_, BlockPos p_176566_2_, BlockState p_176566_3_, boolean p_176566_4_, int p_176566_5_) { +@@ -105,7 +111,7 @@ + RailShape railshape = blockstate.func_177229_b(field_176568_b); + if (p_208071_5_ != RailShape.EAST_WEST || railshape != RailShape.NORTH_SOUTH && railshape != RailShape.ASCENDING_NORTH && railshape != RailShape.ASCENDING_SOUTH) { + if (p_208071_5_ != RailShape.NORTH_SOUTH || railshape != RailShape.EAST_WEST && railshape != RailShape.ASCENDING_EAST && railshape != RailShape.ASCENDING_WEST) { +- if (blockstate.func_177229_b(field_176569_M)) { ++ if (!(blockstate.func_177230_c() instanceof PoweredRailBlock) || isActivator != ((PoweredRailBlock)blockstate.func_177230_c()).isActivator) { + return p_208071_1_.func_175640_z(p_208071_2_) ? true : this.func_176566_a(p_208071_1_, p_208071_2_, blockstate, p_208071_3_, p_208071_4_ + 1); + } else { + return false; diff --git a/patches/minecraft/net/minecraft/block/BlockRailState.java.patch b/patches/minecraft/net/minecraft/block/RailState.java.patch similarity index 67% rename from patches/minecraft/net/minecraft/block/BlockRailState.java.patch rename to patches/minecraft/net/minecraft/block/RailState.java.patch index cf5607a5b..ef79476c7 100644 --- a/patches/minecraft/net/minecraft/block/BlockRailState.java.patch +++ b/patches/minecraft/net/minecraft/block/RailState.java.patch @@ -1,16 +1,16 @@ ---- a/net/minecraft/block/BlockRailState.java -+++ b/net/minecraft/block/BlockRailState.java -@@ -16,14 +16,16 @@ - private IBlockState field_196923_d; +--- a/net/minecraft/block/RailState.java ++++ b/net/minecraft/block/RailState.java +@@ -15,14 +15,16 @@ + private BlockState field_196923_d; private final boolean field_208513_e; private final List field_196924_e = Lists.newArrayList(); + private final boolean canMakeSlopes; - public BlockRailState(World p_i47755_1_, BlockPos p_i47755_2_, IBlockState p_i47755_3_) { + public RailState(World p_i47755_1_, BlockPos p_i47755_2_, BlockState p_i47755_3_) { this.field_196920_a = p_i47755_1_; this.field_196921_b = p_i47755_2_; this.field_196923_d = p_i47755_3_; - this.field_196922_c = (BlockRailBase)p_i47755_3_.func_177230_c(); + this.field_196922_c = (AbstractRailBlock)p_i47755_3_.func_177230_c(); - RailShape railshape = p_i47755_3_.func_177229_b(this.field_196922_c.func_176560_l()); - this.field_208513_e = this.field_196922_c.func_208490_b(); + RailShape railshape = this.field_196922_c.getRailDirection(field_196923_d, p_i47755_1_, p_i47755_2_, null); @@ -19,39 +19,39 @@ this.func_208509_a(railshape); } -@@ -179,7 +181,7 @@ +@@ -178,7 +180,7 @@ } } - if (railshape == RailShape.NORTH_SOUTH) { + if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) { - if (BlockRailBase.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) { + if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) { railshape = RailShape.ASCENDING_NORTH; } -@@ -189,7 +191,7 @@ +@@ -188,7 +190,7 @@ } } - if (railshape == RailShape.EAST_WEST) { + if (railshape == RailShape.EAST_WEST && canMakeSlopes) { - if (BlockRailBase.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) { + if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) { railshape = RailShape.ASCENDING_EAST; } -@@ -299,7 +301,7 @@ +@@ -298,7 +300,7 @@ } } - if (railshape == RailShape.NORTH_SOUTH) { + if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) { - if (BlockRailBase.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) { + if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) { railshape = RailShape.ASCENDING_NORTH; } -@@ -309,7 +311,7 @@ +@@ -308,7 +310,7 @@ } } - if (railshape == RailShape.EAST_WEST) { + if (railshape == RailShape.EAST_WEST && canMakeSlopes) { - if (BlockRailBase.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) { + if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) { railshape = RailShape.ASCENDING_EAST; } diff --git a/patches/minecraft/net/minecraft/block/RedstoneDiodeBlock.java.patch b/patches/minecraft/net/minecraft/block/RedstoneDiodeBlock.java.patch new file mode 100644 index 000000000..d7f116dcf --- /dev/null +++ b/patches/minecraft/net/minecraft/block/RedstoneDiodeBlock.java.patch @@ -0,0 +1,28 @@ +--- a/net/minecraft/block/RedstoneDiodeBlock.java ++++ b/net/minecraft/block/RedstoneDiodeBlock.java +@@ -65,7 +65,7 @@ + if (p_220069_1_.func_196955_c(p_220069_2_, p_220069_3_)) { + this.func_176398_g(p_220069_2_, p_220069_3_, p_220069_1_); + } else { +- TileEntity tileentity = this.func_149716_u() ? p_220069_2_.func_175625_s(p_220069_3_) : null; ++ TileEntity tileentity = p_220069_1_.hasTileEntity() ? p_220069_2_.func_175625_s(p_220069_3_) : null; + func_220059_a(p_220069_1_, p_220069_2_, p_220069_3_, tileentity); + p_220069_2_.func_217377_a(p_220069_3_, false); + +@@ -164,6 +164,8 @@ + protected void func_176400_h(World p_176400_1_, BlockPos p_176400_2_, BlockState p_176400_3_) { + Direction direction = p_176400_3_.func_177229_b(field_185512_D); + BlockPos blockpos = p_176400_2_.func_177972_a(direction.func_176734_d()); ++ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_176400_1_, p_176400_2_, p_176400_1_.func_180495_p(p_176400_2_), java.util.EnumSet.of(direction.func_176734_d()), false).isCanceled()) ++ return; + p_176400_1_.func_190524_a(blockpos, this, p_176400_2_); + p_176400_1_.func_175695_a(blockpos, this, direction); + } +@@ -171,7 +173,6 @@ + protected boolean func_185545_A(BlockState p_185545_1_) { + return p_185545_1_.func_185897_m(); + } +- + protected int func_176408_a(IBlockReader p_176408_1_, BlockPos p_176408_2_, BlockState p_176408_3_) { + return 15; + } diff --git a/patches/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch b/patches/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch new file mode 100644 index 000000000..b714ccf60 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/RedstoneOreBlock.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/block/RedstoneOreBlock.java ++++ b/net/minecraft/block/RedstoneOreBlock.java +@@ -61,11 +61,11 @@ + + public void func_220062_a(BlockState p_220062_1_, World p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) { + super.func_220062_a(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_); +- if (EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_220062_4_) == 0) { +- int i = 1 + p_220062_2_.field_73012_v.nextInt(5); +- this.func_180637_b(p_220062_2_, p_220062_3_, i); +- } ++ } + ++ @Override ++ public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune, int silktouch) { ++ return silktouch == 0 ? 1 + RANDOM.nextInt(5) : 0; + } + + @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch b/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch new file mode 100644 index 000000000..25248b8b1 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/RedstoneWireBlock.java.patch @@ -0,0 +1,60 @@ +--- a/net/minecraft/block/RedstoneWireBlock.java ++++ b/net/minecraft/block/RedstoneWireBlock.java +@@ -124,7 +124,7 @@ + BlockState blockstate1 = p_208074_1_.func_180495_p(blockpos1); + if (!blockstate1.func_215686_e(p_208074_1_, blockpos1)) { + boolean flag = Block.func_220056_d(blockstate, p_208074_1_, blockpos, Direction.UP) || blockstate.func_177230_c() == Blocks.field_150438_bZ; +- if (flag && func_176346_d(p_208074_1_.func_180495_p(blockpos.func_177984_a()))) { ++ if (flag && canConnectTo(p_208074_1_.func_180495_p(blockpos.func_177984_a()), p_208074_1_, blockpos.func_177984_a(), null)) { + if (func_208062_a(blockstate.func_196952_d(p_208074_1_, blockpos))) { + return RedstoneSide.UP; + } +@@ -133,7 +133,7 @@ + } + } + +- return !func_176343_a(blockstate, p_208074_3_) && (blockstate.func_215686_e(p_208074_1_, blockpos) || !func_176346_d(p_208074_1_.func_180495_p(blockpos.func_177977_b()))) ? RedstoneSide.NONE : RedstoneSide.SIDE; ++ return !canConnectTo(blockstate, p_208074_1_, blockpos, p_208074_3_) && (blockstate.func_215686_e(p_208074_1_, blockpos) || !canConnectTo(p_208074_1_.func_180495_p(blockpos.func_177977_b()), p_208074_1_, blockpos.func_177977_b(), null)) ? RedstoneSide.NONE : RedstoneSide.SIDE; + } + + public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { +@@ -318,26 +318,18 @@ + boolean flag = blockstate.func_215686_e(p_176339_1_, blockpos); + BlockPos blockpos1 = p_176339_2_.func_177984_a(); + boolean flag1 = p_176339_1_.func_180495_p(blockpos1).func_215686_e(p_176339_1_, blockpos1); +- if (!flag1 && flag && func_176340_e(p_176339_1_, blockpos.func_177984_a())) { ++ if (!flag1 && flag && canConnectTo(p_176339_1_.func_180495_p(blockpos.func_177984_a()), p_176339_1_, blockpos.func_177984_a(), null)) { + return true; +- } else if (func_176343_a(blockstate, p_176339_3_)) { ++ } else if (canConnectTo(blockstate, p_176339_1_, blockpos, p_176339_3_)) { + return true; + } else if (blockstate.func_177230_c() == Blocks.field_196633_cV && blockstate.func_177229_b(RedstoneDiodeBlock.field_196348_c) && blockstate.func_177229_b(RedstoneDiodeBlock.field_185512_D) == p_176339_3_) { + return true; + } else { +- return !flag && func_176340_e(p_176339_1_, blockpos.func_177977_b()); ++ return !flag && canConnectTo(p_176339_1_.func_180495_p(blockpos.func_177977_b()), p_176339_1_, blockpos.func_177977_b(), null); + } + } + +- protected static boolean func_176340_e(IBlockReader p_176340_0_, BlockPos p_176340_1_) { +- return func_176346_d(p_176340_0_.func_180495_p(p_176340_1_)); +- } +- +- protected static boolean func_176346_d(BlockState p_176346_0_) { +- return func_176343_a(p_176346_0_, (Direction)null); +- } +- +- protected static boolean func_176343_a(BlockState p_176343_0_, @Nullable Direction p_176343_1_) { ++ protected static boolean canConnectTo(BlockState p_176343_0_, IBlockReader world, BlockPos pos, @Nullable Direction p_176343_1_) { + Block block = p_176343_0_.func_177230_c(); + if (block == Blocks.field_150488_af) { + return true; +@@ -347,7 +339,7 @@ + } else if (Blocks.field_190976_dk == p_176343_0_.func_177230_c()) { + return p_176343_1_ == p_176343_0_.func_177229_b(ObserverBlock.field_176387_N); + } else { +- return p_176343_0_.func_185897_m() && p_176343_1_ != null; ++ return p_176343_0_.canConnectRedstone(world, pos, p_176343_1_) && p_176343_1_ != null; + } + } + diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/SaplingBlock.java.patch similarity index 67% rename from patches/minecraft/net/minecraft/block/BlockSapling.java.patch rename to patches/minecraft/net/minecraft/block/SaplingBlock.java.patch index a1cbf8d3b..3f94dedfe 100644 --- a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch +++ b/patches/minecraft/net/minecraft/block/SaplingBlock.java.patch @@ -1,10 +1,10 @@ ---- a/net/minecraft/block/BlockSapling.java -+++ b/net/minecraft/block/BlockSapling.java +--- a/net/minecraft/block/SaplingBlock.java ++++ b/net/minecraft/block/SaplingBlock.java @@ -29,6 +29,7 @@ - public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { + public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_); -+ if (!p_196267_2_.func_205050_e(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light ++ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light if (p_196267_2_.func_201696_r(p_196267_3_.func_177984_a()) >= 9 && p_196267_4_.nextInt(7) == 0) { this.func_176478_d(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_); } diff --git a/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch b/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch new file mode 100644 index 000000000..c1a37307d --- /dev/null +++ b/patches/minecraft/net/minecraft/block/SeaGrassBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/SeaGrassBlock.java ++++ b/net/minecraft/block/SeaGrassBlock.java +@@ -16,7 +16,7 @@ + import net.minecraft.world.IWorld; + import net.minecraft.world.World; + +-public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer { ++public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer, net.minecraftforge.common.IShearable { + protected static final VoxelShape field_207798_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D); + + protected SeaGrassBlock(Block.Properties p_i48780_1_) { diff --git a/patches/minecraft/net/minecraft/block/ShearableDoublePlantBlock.java.patch b/patches/minecraft/net/minecraft/block/ShearableDoublePlantBlock.java.patch new file mode 100644 index 000000000..18eac1d82 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/ShearableDoublePlantBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/ShearableDoublePlantBlock.java ++++ b/net/minecraft/block/ShearableDoublePlantBlock.java +@@ -4,7 +4,7 @@ + import net.minecraft.state.EnumProperty; + import net.minecraft.state.properties.DoubleBlockHalf; + +-public class ShearableDoublePlantBlock extends DoublePlantBlock { ++public class ShearableDoublePlantBlock extends DoublePlantBlock implements net.minecraftforge.common.IShearable { + public static final EnumProperty field_208063_b = DoublePlantBlock.field_176492_b; + + public ShearableDoublePlantBlock(Block.Properties p_i49975_1_) { diff --git a/patches/minecraft/net/minecraft/block/SoundType.java.patch b/patches/minecraft/net/minecraft/block/SoundType.java.patch index 7a8e4d4bc..08e446d02 100644 --- a/patches/minecraft/net/minecraft/block/SoundType.java.patch +++ b/patches/minecraft/net/minecraft/block/SoundType.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/block/SoundType.java +++ b/net/minecraft/block/SoundType.java -@@ -2,8 +2,6 @@ - - import net.minecraft.init.SoundEvents; - import net.minecraft.util.SoundEvent; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class SoundType { - public static final SoundType field_185848_a = new SoundType(1.0F, 1.0F, SoundEvents.field_187881_gQ, SoundEvents.field_187897_gY, SoundEvents.field_187891_gV, SoundEvents.field_187889_gU, SoundEvents.field_187887_gT); -@@ -46,7 +44,6 @@ +@@ -54,7 +54,6 @@ return this.field_185861_n; } @@ -17,7 +8,7 @@ public SoundEvent func_185845_c() { return this.field_185862_o; } -@@ -59,7 +56,6 @@ +@@ -67,7 +66,6 @@ return this.field_185864_q; } diff --git a/patches/minecraft/net/minecraft/block/SpawnerBlock.java.patch b/patches/minecraft/net/minecraft/block/SpawnerBlock.java.patch new file mode 100644 index 000000000..47a6cd2ea --- /dev/null +++ b/patches/minecraft/net/minecraft/block/SpawnerBlock.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/block/SpawnerBlock.java ++++ b/net/minecraft/block/SpawnerBlock.java +@@ -21,10 +21,13 @@ + + public void func_220062_a(BlockState p_220062_1_, World p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) { + super.func_220062_a(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_); +- int i = 15 + p_220062_2_.field_73012_v.nextInt(15) + p_220062_2_.field_73012_v.nextInt(15); +- this.func_180637_b(p_220062_2_, p_220062_3_, i); + } + ++ @Override ++ public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune, int silktouch) { ++ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); ++ } ++ + public BlockRenderType func_149645_b(BlockState p_149645_1_) { + return BlockRenderType.MODEL; + } diff --git a/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch b/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch new file mode 100644 index 000000000..17e01da56 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/SpreadableSnowyDirtBlock.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/block/SpreadableSnowyDirtBlock.java ++++ b/net/minecraft/block/SpreadableSnowyDirtBlock.java +@@ -31,6 +31,7 @@ + + public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { + if (!p_196267_2_.field_72995_K) { ++ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading + if (!func_220257_b(p_196267_1_, p_196267_2_, p_196267_3_)) { + p_196267_2_.func_175656_a(p_196267_3_, Blocks.field_150346_d.func_176223_P()); + } else if (p_196267_2_.func_201696_r(p_196267_3_.func_177984_a()) >= 4) { diff --git a/patches/minecraft/net/minecraft/block/StemBlock.java.patch b/patches/minecraft/net/minecraft/block/StemBlock.java.patch new file mode 100644 index 000000000..c9b955386 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/StemBlock.java.patch @@ -0,0 +1,32 @@ +--- a/net/minecraft/block/StemBlock.java ++++ b/net/minecraft/block/StemBlock.java +@@ -39,22 +39,24 @@ + + public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) { + super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_); ++ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light + if (p_196267_2_.func_201669_a(p_196267_3_, 0) >= 9) { + float f = CropsBlock.func_180672_a(this, p_196267_2_, p_196267_3_); +- if (p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0) { ++ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0)) { + int i = p_196267_1_.func_177229_b(field_176484_a); + if (i < 7) { +- p_196267_1_ = p_196267_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)); +- p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_, 2); ++ p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)), 2); + } else { + Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_196267_4_); + BlockPos blockpos = p_196267_3_.func_177972_a(direction); +- Block block = p_196267_2_.func_180495_p(blockpos.func_177977_b()).func_177230_c(); +- if (p_196267_2_.func_180495_p(blockpos).func_196958_f() && (block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_196660_k || block == Blocks.field_196661_l || block == Blocks.field_196658_i)) { ++ BlockState soil = p_196267_2_.func_180495_p(blockpos.func_177977_b()); ++ Block block = soil.func_177230_c(); ++ if (p_196267_2_.func_180495_p(blockpos).isAir(p_196267_2_, blockpos) && (soil.canSustainPlant(p_196267_2_, blockpos.func_177977_b(), Direction.UP, this) || block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_196660_k || block == Blocks.field_196661_l || block == Blocks.field_196658_i)) { + p_196267_2_.func_175656_a(blockpos, this.field_149877_a.func_176223_P()); + p_196267_2_.func_175656_a(p_196267_3_, this.field_149877_a.func_196523_e().func_176223_P().func_206870_a(HorizontalBlock.field_185512_D, direction)); + } + } ++ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_); + } + + } diff --git a/patches/minecraft/net/minecraft/block/BlockReed.java.patch b/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/block/BlockReed.java.patch rename to patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch index 15fe18682..6db99d042 100644 --- a/patches/minecraft/net/minecraft/block/BlockReed.java.patch +++ b/patches/minecraft/net/minecraft/block/SugarCaneBlock.java.patch @@ -1,11 +1,11 @@ ---- a/net/minecraft/block/BlockReed.java -+++ b/net/minecraft/block/BlockReed.java -@@ -18,7 +18,7 @@ - import net.minecraft.world.IWorldReaderBase; +--- a/net/minecraft/block/SugarCaneBlock.java ++++ b/net/minecraft/block/SugarCaneBlock.java +@@ -16,7 +16,7 @@ + import net.minecraft.world.IWorldReader; import net.minecraft.world.World; --public class BlockReed extends Block { -+public class BlockReed extends Block implements net.minecraftforge.common.IPlantable { +-public class SugarCaneBlock extends Block { ++public class SugarCaneBlock extends Block implements net.minecraftforge.common.IPlantable { public static final IntegerProperty field_176355_a = BlockStateProperties.field_208171_X; protected static final VoxelShape field_196503_b = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 16.0D, 14.0D); @@ -25,28 +25,27 @@ } } -@@ -56,6 +59,9 @@ +@@ -60,6 +63,8 @@ } - public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) { -+ IBlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); -+ if (soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP, this)) return true; -+ + public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) { ++ BlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()); ++ if (soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), Direction.UP, this)) return true; Block block = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_177230_c(); if (block == this) { return true; -@@ -91,4 +97,14 @@ - public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) { - return BlockFaceShape.UNDEFINED; +@@ -87,4 +92,14 @@ + protected void func_206840_a(StateContainer.Builder p_206840_1_) { + p_206840_1_.func_206894_a(field_176355_a); } + + @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockReader world, BlockPos pos) { -+ return net.minecraftforge.common.EnumPlantType.Beach; ++ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) { ++ return net.minecraftforge.common.PlantType.Beach; + } + + @Override -+ public IBlockState getPlant(IBlockReader world, BlockPos pos) { ++ public BlockState getPlant(IBlockReader world, BlockPos pos) { + return func_176223_P(); + } } diff --git a/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch b/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch new file mode 100644 index 000000000..1616bfae7 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/TallGrassBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/TallGrassBlock.java ++++ b/net/minecraft/block/TallGrassBlock.java +@@ -7,7 +7,7 @@ + import net.minecraft.world.IBlockReader; + import net.minecraft.world.World; + +-public class TallGrassBlock extends BushBlock implements IGrowable { ++public class TallGrassBlock extends BushBlock implements IGrowable, net.minecraftforge.common.IShearable { + protected static final VoxelShape field_196389_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D); + + protected TallGrassBlock(Block.Properties p_i48310_1_) { diff --git a/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch b/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch new file mode 100644 index 000000000..3e251755e --- /dev/null +++ b/patches/minecraft/net/minecraft/block/TrapDoorBlock.java.patch @@ -0,0 +1,17 @@ +--- a/net/minecraft/block/TrapDoorBlock.java ++++ b/net/minecraft/block/TrapDoorBlock.java +@@ -151,4 +151,14 @@ + + return super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_); + } ++ ++ @Override ++ public boolean isLadder(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) { ++ if (state.func_177229_b(field_176283_b)) { ++ BlockState down = world.func_180495_p(pos.func_177977_b()); ++ if (down.func_177230_c() == net.minecraft.block.Blocks.field_150468_ap) ++ return down.func_177229_b(LadderBlock.field_176382_a) == state.func_177229_b(field_185512_D); ++ } ++ return false; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/VineBlock.java.patch b/patches/minecraft/net/minecraft/block/VineBlock.java.patch new file mode 100644 index 000000000..d94b5c9df --- /dev/null +++ b/patches/minecraft/net/minecraft/block/VineBlock.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/block/VineBlock.java ++++ b/net/minecraft/block/VineBlock.java +@@ -20,7 +20,7 @@ + import net.minecraft.world.IWorldReader; + import net.minecraft.world.World; + +-public class VineBlock extends Block { ++public class VineBlock extends Block implements net.minecraftforge.common.IShearable { + public static final BooleanProperty field_176277_a = SixWayBlock.field_196496_z; + public static final BooleanProperty field_176273_b = SixWayBlock.field_196488_a; + public static final BooleanProperty field_176278_M = SixWayBlock.field_196490_b; +@@ -154,7 +154,7 @@ + p_196267_2_.func_217377_a(p_196267_3_, false); + } + +- } else if (p_196267_2_.field_73012_v.nextInt(4) == 0) { ++ } else if (p_196267_2_.field_73012_v.nextInt(4) == 0 && p_196267_2_.isAreaLoaded(p_196267_3_, 4)) { // Forge: check area to prevent loading unloaded chunks + Direction direction = Direction.func_176741_a(p_196267_4_); + BlockPos blockpos = p_196267_3_.func_177984_a(); + if (direction.func_176740_k().func_176722_c() && !p_196267_1_.func_177229_b(func_176267_a(direction))) { diff --git a/patches/minecraft/net/minecraft/block/WebBlock.java.patch b/patches/minecraft/net/minecraft/block/WebBlock.java.patch new file mode 100644 index 000000000..0d8f985c9 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/WebBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/WebBlock.java ++++ b/net/minecraft/block/WebBlock.java +@@ -6,7 +6,7 @@ + import net.minecraft.util.math.Vec3d; + import net.minecraft.world.World; + +-public class WebBlock extends Block { ++public class WebBlock extends Block implements net.minecraftforge.common.IShearable { + public WebBlock(Block.Properties p_i48296_1_) { + super(p_i48296_1_); + } diff --git a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch deleted file mode 100644 index c160ea7af..000000000 --- a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- a/net/minecraft/block/state/BlockPistonStructureHelper.java -+++ b/net/minecraft/block/state/BlockPistonStructureHelper.java -@@ -51,7 +51,7 @@ - } else { - for(int i = 0; i < this.field_177258_e.size(); ++i) { - BlockPos blockpos = this.field_177258_e.get(i); -- if (this.field_177261_a.func_180495_p(blockpos).func_177230_c() == Blocks.field_180399_cE && !this.func_177250_b(blockpos)) { -+ if (this.field_177261_a.func_180495_p(blockpos).isStickyBlock() && !this.func_177250_b(blockpos)) { - return false; - } - } -@@ -62,8 +62,7 @@ - - private boolean func_177251_a(BlockPos p_177251_1_, EnumFacing p_177251_2_) { - IBlockState iblockstate = this.field_177261_a.func_180495_p(p_177251_1_); -- Block block = iblockstate.func_177230_c(); -- if (iblockstate.func_196958_f()) { -+ if (iblockstate.isAir(field_177261_a, p_177251_1_)) { - return true; - } else if (!BlockPistonBase.func_185646_a(iblockstate, this.field_177261_a, p_177251_1_, this.field_177257_d, false, p_177251_2_)) { - return true; -@@ -76,11 +75,10 @@ - if (i + this.field_177258_e.size() > 12) { - return false; - } else { -- while(block == Blocks.field_180399_cE) { -+ while(iblockstate.isStickyBlock()) { - BlockPos blockpos = p_177251_1_.func_177967_a(this.field_177257_d.func_176734_d(), i); - iblockstate = this.field_177261_a.func_180495_p(blockpos); -- block = iblockstate.func_177230_c(); -- if (iblockstate.func_196958_f() || !BlockPistonBase.func_185646_a(iblockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) { -+ if (iblockstate.isAir(field_177261_a, blockpos) || !BlockPistonBase.func_185646_a(iblockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) { - break; - } - -@@ -107,7 +105,7 @@ - - for(int l = 0; l <= k + i1; ++l) { - BlockPos blockpos2 = this.field_177258_e.get(l); -- if (this.field_177261_a.func_180495_p(blockpos2).func_177230_c() == Blocks.field_180399_cE && !this.func_177250_b(blockpos2)) { -+ if (this.field_177261_a.func_180495_p(blockpos2).isStickyBlock() && !this.func_177250_b(blockpos2)) { - return false; - } - } -@@ -116,7 +114,7 @@ - } - - iblockstate = this.field_177261_a.func_180495_p(blockpos1); -- if (iblockstate.func_196958_f()) { -+ if (iblockstate.isAir(field_177261_a, blockpos1)) { - return true; - } - diff --git a/patches/minecraft/net/minecraft/block/state/IBlockState.java.patch b/patches/minecraft/net/minecraft/block/state/IBlockState.java.patch deleted file mode 100644 index dd3c34a69..000000000 --- a/patches/minecraft/net/minecraft/block/state/IBlockState.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/net/minecraft/block/state/IBlockState.java -+++ b/net/minecraft/block/state/IBlockState.java -@@ -30,7 +30,7 @@ - import net.minecraftforge.api.distmarker.Dist; - import net.minecraftforge.api.distmarker.OnlyIn; - --public interface IBlockState extends IStateHolder { -+public interface IBlockState extends IStateHolder, net.minecraftforge.common.extensions.IForgeBlockState { - ThreadLocal> field_208776_a = ThreadLocal.withInitial(() -> { - Object2ByteOpenHashMap object2byteopenhashmap = new Object2ByteOpenHashMap<>(); - object2byteopenhashmap.defaultReturnValue((byte)127); -@@ -97,6 +97,8 @@ - return this.func_177230_c().func_149750_m(this); - } - -+ /** @deprecated use {@link IBlockState#isAir(IBlockReader, BlockPos) */ -+ @Deprecated - default boolean func_196958_f() { - return this.func_177230_c().func_196261_e(this); - } -@@ -109,6 +111,8 @@ - return this.func_177230_c().func_180659_g(this, p_185909_1_, p_185909_2_); - } - -+ /** @deprecated use {@link IBlockState#rotate(IWorld, BlockPos, Rotation) */ -+ @Deprecated - default IBlockState func_185907_a(Rotation p_185907_1_) { - return this.func_177230_c().func_185499_a(this, p_185907_1_); - } diff --git a/patches/minecraft/net/minecraft/block/state/PistonBlockStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/state/PistonBlockStructureHelper.java.patch new file mode 100644 index 000000000..db48d38bb --- /dev/null +++ b/patches/minecraft/net/minecraft/block/state/PistonBlockStructureHelper.java.patch @@ -0,0 +1,53 @@ +--- a/net/minecraft/block/state/PistonBlockStructureHelper.java ++++ b/net/minecraft/block/state/PistonBlockStructureHelper.java +@@ -52,7 +52,7 @@ + } else { + for(int i = 0; i < this.field_177258_e.size(); ++i) { + BlockPos blockpos = this.field_177258_e.get(i); +- if (this.field_177261_a.func_180495_p(blockpos).func_177230_c() == Blocks.field_180399_cE && !this.func_177250_b(blockpos)) { ++ if (this.field_177261_a.func_180495_p(blockpos).isStickyBlock() && !this.func_177250_b(blockpos)) { + return false; + } + } +@@ -63,8 +63,7 @@ + + private boolean func_177251_a(BlockPos p_177251_1_, Direction p_177251_2_) { + BlockState blockstate = this.field_177261_a.func_180495_p(p_177251_1_); +- Block block = blockstate.func_177230_c(); +- if (blockstate.func_196958_f()) { ++ if (field_177261_a.func_175623_d(p_177251_1_)) { + return true; + } else if (!PistonBlock.func_185646_a(blockstate, this.field_177261_a, p_177251_1_, this.field_177257_d, false, p_177251_2_)) { + return true; +@@ -77,11 +76,10 @@ + if (i + this.field_177258_e.size() > 12) { + return false; + } else { +- while(block == Blocks.field_180399_cE) { ++ while(blockstate.isStickyBlock()) { + BlockPos blockpos = p_177251_1_.func_177967_a(this.field_177257_d.func_176734_d(), i); + blockstate = this.field_177261_a.func_180495_p(blockpos); +- block = blockstate.func_177230_c(); +- if (blockstate.func_196958_f() || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) { ++ if (blockstate.isAir(this.field_177261_a, blockpos) || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) { + break; + } + +@@ -108,7 +106,7 @@ + + for(int l = 0; l <= k + i1; ++l) { + BlockPos blockpos2 = this.field_177258_e.get(l); +- if (this.field_177261_a.func_180495_p(blockpos2).func_177230_c() == Blocks.field_180399_cE && !this.func_177250_b(blockpos2)) { ++ if (this.field_177261_a.func_180495_p(blockpos2).isStickyBlock() && !this.func_177250_b(blockpos2)) { + return false; + } + } +@@ -117,7 +115,7 @@ + } + + blockstate = this.field_177261_a.func_180495_p(blockpos1); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(field_177261_a, blockpos1)) { + return true; + } + diff --git a/patches/minecraft/net/minecraft/block/trees/JungleTree.java.patch b/patches/minecraft/net/minecraft/block/trees/JungleTree.java.patch index caec06936..0350e68c2 100644 --- a/patches/minecraft/net/minecraft/block/trees/JungleTree.java.patch +++ b/patches/minecraft/net/minecraft/block/trees/JungleTree.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/block/trees/JungleTree.java +++ b/net/minecraft/block/trees/JungleTree.java @@ -11,11 +11,11 @@ - public class JungleTree extends AbstractBigTree { + public class JungleTree extends BigTree { @Nullable protected AbstractTreeFeature func_196936_b(Random p_196936_1_) { -- return new TreeFeature(true, 4 + p_196936_1_.nextInt(7), Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P(), false); -+ return new TreeFeature(true, 4 + p_196936_1_.nextInt(7), Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P(), false).setSapling((net.minecraft.block.BlockSapling)Blocks.field_196678_w); +- return new TreeFeature(NoFeatureConfig::func_214639_a, true, 4 + p_196936_1_.nextInt(7), Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P(), false); ++ return new TreeFeature(NoFeatureConfig::func_214639_a, true, 4 + p_196936_1_.nextInt(7), Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P(), false).setSapling((net.minecraft.block.SaplingBlock)Blocks.field_196678_w); } @Nullable protected AbstractTreeFeature func_196938_a(Random p_196938_1_) { -- return new MegaJungleFeature(true, 10, 20, Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P()); -+ return new MegaJungleFeature(true, 10, 20, Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P()).setSapling((net.minecraft.block.BlockSapling)Blocks.field_196678_w); +- return new MegaJungleFeature(NoFeatureConfig::func_214639_a, true, 10, 20, Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P()); ++ return new MegaJungleFeature(NoFeatureConfig::func_214639_a, true, 10, 20, Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P()).setSapling((net.minecraft.block.SaplingBlock)Blocks.field_196678_w); } } diff --git a/patches/minecraft/net/minecraft/client/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/GameSettings.java.patch index e40659bc7..0e3a30816 100644 --- a/patches/minecraft/net/minecraft/client/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/GameSettings.java.patch @@ -1,31 +1,23 @@ --- a/net/minecraft/client/GameSettings.java +++ b/net/minecraft/client/GameSettings.java -@@ -167,6 +167,7 @@ - public boolean field_211842_aO; +@@ -142,7 +142,7 @@ + public final KeyBinding[] field_151456_ac = new KeyBinding[]{new KeyBinding("key.hotbar.1", 49, "key.categories.inventory"), new KeyBinding("key.hotbar.2", 50, "key.categories.inventory"), new KeyBinding("key.hotbar.3", 51, "key.categories.inventory"), new KeyBinding("key.hotbar.4", 52, "key.categories.inventory"), new KeyBinding("key.hotbar.5", 53, "key.categories.inventory"), new KeyBinding("key.hotbar.6", 54, "key.categories.inventory"), new KeyBinding("key.hotbar.7", 55, "key.categories.inventory"), new KeyBinding("key.hotbar.8", 56, "key.categories.inventory"), new KeyBinding("key.hotbar.9", 57, "key.categories.inventory")}; + public final KeyBinding field_193629_ap = new KeyBinding("key.saveToolbarActivator", 67, "key.categories.creative"); + public final KeyBinding field_193630_aq = new KeyBinding("key.loadToolbarActivator", 88, "key.categories.creative"); +- public final KeyBinding[] field_74324_K = ArrayUtils.addAll(new KeyBinding[]{this.field_74312_F, this.field_74313_G, this.field_74351_w, this.field_74370_x, this.field_74368_y, this.field_74366_z, this.field_74314_A, this.field_74311_E, this.field_151444_V, this.field_74316_C, this.field_151445_Q, this.field_74310_D, this.field_74321_H, this.field_74322_I, this.field_74323_J, this.field_151447_Z, this.field_151457_aa, this.field_151458_ab, this.field_152395_am, this.field_178883_an, this.field_186718_X, this.field_193629_ap, this.field_193630_aq, this.field_194146_ao}, this.field_151456_ac); ++ public KeyBinding[] field_74324_K = ArrayUtils.addAll(new KeyBinding[]{this.field_74312_F, this.field_74313_G, this.field_74351_w, this.field_74370_x, this.field_74368_y, this.field_74366_z, this.field_74314_A, this.field_74311_E, this.field_151444_V, this.field_74316_C, this.field_151445_Q, this.field_74310_D, this.field_74321_H, this.field_74322_I, this.field_74323_J, this.field_151447_Z, this.field_151457_aa, this.field_151458_ab, this.field_152395_am, this.field_178883_an, this.field_186718_X, this.field_193629_ap, this.field_193630_aq, this.field_194146_ao}, this.field_151456_ac); + protected Minecraft field_74317_L; + private final File field_74354_ai; + public Difficulty field_74318_M = Difficulty.NORMAL; +@@ -161,6 +161,7 @@ + public String field_74363_ab = "en_us"; public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) { + setForgeKeybindProperties(); this.field_74317_L = p_i46326_1_; this.field_74354_ai = new File(p_i46326_2_, "options.txt"); if (p_i46326_1_.func_147111_S() && Runtime.getRuntime().maxMemory() >= 1000000000L) { -@@ -180,6 +181,7 @@ - } - - public GameSettings() { -+ setForgeKeybindProperties(); - } - - public void func_198014_a(KeyBinding p_198014_1_, InputMappings.Input p_198014_2_) { -@@ -236,7 +238,7 @@ - this.field_74317_L.func_147117_R().func_147633_a(this.field_151442_I); - this.field_74317_L.func_110434_K().func_110577_a(TextureMap.field_110575_b); - this.field_74317_L.func_147117_R().func_174937_a(false, this.field_151442_I > 0); -- this.field_74317_L.func_175603_A(); -+ this.needsBlockModelRefresh = true; // FORGE: fix for MC-64581 very laggy mipmap slider - } - } - -@@ -846,7 +848,11 @@ +@@ -462,7 +463,11 @@ for(KeyBinding keybinding : this.field_74324_K) { if (s1.equals("key_" + keybinding.func_151464_g())) { @@ -38,15 +30,15 @@ } } -@@ -894,6 +900,7 @@ +@@ -510,6 +515,7 @@ } public void func_74303_b() { + if (net.minecraftforge.fml.client.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted. - PrintWriter printwriter = null; - - try { -@@ -971,7 +978,7 @@ + try (PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.field_74354_ai), StandardCharsets.UTF_8))) { + printwriter.println("version:" + SharedConstants.func_215069_a().getWorldVersion()); + printwriter.println("autoJump:" + AbstractOption.field_216719_z.func_216741_b(this)); +@@ -583,7 +589,7 @@ printwriter.println("glDebugVerbosity:" + this.field_209231_W); for(KeyBinding keybinding : this.field_74324_K) { @@ -55,10 +47,14 @@ } for(SoundCategory soundcategory : SoundCategory.values()) { -@@ -1073,6 +1080,33 @@ +@@ -680,6 +686,25 @@ + } + } + ++ if (net.minecraftforge.fml.client.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted. p_198017_1_.func_198985_a(set); } - ++ + private void setForgeKeybindProperties() { + net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME; + field_74351_w.setKeyConflictContext(inGame); @@ -76,16 +72,4 @@ + field_151458_ab.setKeyConflictContext(inGame); + field_186718_X.setKeyConflictContext(inGame); + } -+ -+ // FORGE: fix for MC-64581 very laggy mipmap slider -+ private boolean needsBlockModelRefresh = false; -+ public void onGuiClosed() { -+ if (needsBlockModelRefresh) { -+ this.field_74317_L.func_152344_a(() -> net.minecraftforge.client.ForgeHooksClient.refreshResources(this.field_74317_L, net.minecraftforge.resource.VanillaResourceType.MODELS)); -+ this.needsBlockModelRefresh = false; -+ } -+ } -+ - @OnlyIn(Dist.CLIENT) - public static enum Options { - INVERT_MOUSE("options.invertMouse", false, true), + } diff --git a/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch b/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch index 8ab9e8bda..8ebf9a4ad 100644 --- a/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch +++ b/patches/minecraft/net/minecraft/client/KeyboardListener.java.patch @@ -1,42 +1,43 @@ --- a/net/minecraft/client/KeyboardListener.java +++ b/net/minecraft/client/KeyboardListener.java -@@ -246,7 +246,8 @@ +@@ -252,7 +252,9 @@ } - IGuiEventListener iguieventlistener = this.field_197972_a.field_71462_r; -- if (p_197961_5_ == 1 && (!(this.field_197972_a.field_71462_r instanceof GuiControls) || ((GuiControls)iguieventlistener).field_152177_g <= Util.func_211177_b() - 20L)) { -+ if ((!(this.field_197972_a.field_71462_r instanceof GuiControls) || ((GuiControls)iguieventlistener).field_152177_g <= Util.func_211177_b() - 20L)) { + INestedGuiEventHandler inestedguieventhandler = this.field_197972_a.field_71462_r; +- if (p_197961_5_ == 1 && (!(this.field_197972_a.field_71462_r instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).field_152177_g <= Util.func_211177_b() - 20L)) { ++ ++ if ((!(this.field_197972_a.field_71462_r instanceof ControlsScreen) || ((ControlsScreen)inestedguieventhandler).field_152177_g <= Util.func_211177_b() - 20L)) { + if (p_197961_5_ == 1) { if (this.field_197972_a.field_71474_y.field_152395_am.func_197976_a(p_197961_3_, p_197961_4_)) { this.field_197972_a.field_195558_d.func_198077_g(); - return; -@@ -264,6 +265,8 @@ + this.field_197972_a.field_71474_y.field_74353_u = this.field_197972_a.field_195558_d.func_198113_j(); +@@ -271,6 +273,8 @@ }); return; } -+ } else if (p_197961_5_ == 0 /*GLFW_RELEASE*/ && this.field_197972_a.field_71462_r instanceof GuiControls) -+ ((GuiControls)this.field_197972_a.field_71462_r).field_146491_f = null; //Forge: Unset pure modifiers. ++ } else if (p_197961_5_ == 0 /*GLFW_RELEASE*/ && this.field_197972_a.field_71462_r instanceof ControlsScreen) ++ ((ControlsScreen)this.field_197972_a.field_71462_r).field_146491_f = null; //Forge: Unset pure modifiers. } - if (iguieventlistener != null) { -@@ -271,10 +274,14 @@ - GuiScreen.func_195121_a(() -> { + boolean flag = inestedguieventhandler == null || !(inestedguieventhandler.getFocused() instanceof TextFieldWidget) || !((TextFieldWidget)inestedguieventhandler.getFocused()).func_212955_f(); +@@ -290,10 +294,14 @@ + Screen.wrapScreenError(() -> { if (p_197961_5_ != 1 && (p_197961_5_ != 2 || !this.field_197973_b)) { if (p_197961_5_ == 0) { -- aboolean[0] = iguieventlistener.keyReleased(p_197961_3_, p_197961_4_, p_197961_6_); +- aboolean[0] = inestedguieventhandler.keyReleased(p_197961_3_, p_197961_4_, p_197961_6_); + aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); -+ if (!aboolean[0]) aboolean[0] = iguieventlistener.keyReleased(p_197961_3_, p_197961_4_, p_197961_6_); ++ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.keyReleased(p_197961_3_, p_197961_4_, p_197961_6_); + if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); } } else { -- aboolean[0] = iguieventlistener.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_); +- aboolean[0] = inestedguieventhandler.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_); + aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPre(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); -+ if (!aboolean[0]) aboolean[0] = iguieventlistener.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_); ++ if (!aboolean[0]) aboolean[0] = inestedguieventhandler.keyPressed(p_197961_3_, p_197961_4_, p_197961_6_); + if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPost(this.field_197972_a.field_71462_r, p_197961_3_, p_197961_4_, p_197961_6_); } - }, "keyPressed event handler", iguieventlistener.getClass().getCanonicalName()); -@@ -341,7 +348,7 @@ + }, "keyPressed event handler", inestedguieventhandler.getClass().getCanonicalName()); +@@ -354,7 +362,7 @@ } } } @@ -45,10 +46,10 @@ } } -@@ -351,12 +358,16 @@ - if (iguieventlistener != null) { +@@ -364,12 +372,16 @@ + if (iguieventlistener != null && this.field_197972_a.func_213250_au() == null) { if (Character.charCount(p_197963_3_) == 1) { - GuiScreen.func_195121_a(() -> { + Screen.wrapScreenError(() -> { - iguieventlistener.charTyped((char)p_197963_3_, p_197963_4_); + if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, (char)p_197963_3_, p_197963_4_)) return; + if (iguieventlistener.charTyped((char)p_197963_3_, p_197963_4_)) return; @@ -56,7 +57,7 @@ }, "charTyped event handler", iguieventlistener.getClass().getCanonicalName()); } else { for(char c0 : Character.toChars(p_197963_3_)) { - GuiScreen.func_195121_a(() -> { + Screen.wrapScreenError(() -> { - iguieventlistener.charTyped(c0, p_197963_4_); + if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.field_197972_a.field_71462_r, c0, p_197963_4_)) return; + if (iguieventlistener.charTyped(c0, p_197963_4_)) return; diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 9a992fc2e..cf13a6f97 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/client/Minecraft.java +++ b/net/minecraft/client/Minecraft.java -@@ -297,6 +297,7 @@ - public Minecraft(GameConfiguration p_i45547_1_) { +@@ -316,6 +316,7 @@ + super("Client"); this.field_195556_O = p_i45547_1_.field_178743_b; field_71432_P = this; + net.minecraftforge.client.ForgeHooksClient.invalidateLog4jThreadCache(); this.field_71412_D = p_i45547_1_.field_178744_c.field_178760_a; this.field_110446_Y = p_i45547_1_.field_178744_c.field_178759_c; this.field_130070_K = p_i45547_1_.field_178744_c.field_178758_b; -@@ -314,7 +315,7 @@ - supplier = p_211818_2_; +@@ -333,7 +334,7 @@ + supplier = p_213262_2_; } -- return new ResourcePackInfoClient(p_211818_0_, p_211818_1_, supplier, p_211818_3_, p_211818_4_, p_211818_5_); -+ return new ResourcePackInfoClient(p_211818_0_, p_211818_1_, supplier, p_211818_3_, p_211818_4_, p_211818_5_, p_211818_3_.isHidden()); +- return new ClientResourcePackInfo(p_213262_0_, p_213262_1_, supplier, p_213262_3_, p_213262_4_, p_213262_5_); ++ return new ClientResourcePackInfo(p_213262_0_, p_213262_1_, supplier, p_213262_3_, p_213262_4_, p_213262_5_, p_213262_3_.isHidden()); }); this.field_110448_aq.func_198982_a(this.field_195554_ax); this.field_110448_aq.func_198982_a(new FolderPackFinder(this.field_130070_K)); -@@ -322,7 +323,6 @@ +@@ -341,7 +342,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()); @@ -25,82 +25,78 @@ 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; -@@ -409,9 +409,11 @@ - this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab); - this.field_110451_am.func_199006_a(this.field_135017_as); +@@ -451,6 +451,7 @@ + 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); this.field_71474_y.func_198017_a(this.field_110448_aq); + net.minecraftforge.fml.client.ClientModLoader.begin(this, this.field_110448_aq, this.field_110451_am, this.field_195554_ax); - this.func_110436_a(); - this.field_71446_o = new TextureManager(this.field_110451_am); - this.field_110451_am.func_199006_a(this.field_71446_o); -+ //net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.textureManager); - this.field_195558_d.func_198098_h(); - this.func_147108_a(new GuiScreenLoading()); - this.func_195547_ap(); -@@ -429,6 +431,8 @@ + this.field_110448_aq.func_198983_a(); + List list = this.field_110448_aq.func_198980_d().stream().map(ResourcePackInfo::func_195796_e).collect(Collectors.toList()); - this.field_110451_am.func_199006_a(new GrassColorReloadListener()); - this.field_110451_am.func_199006_a(new FoliageColorReloadListener()); +@@ -463,6 +464,7 @@ + this.field_135017_as.func_135043_a(list); + this.field_71446_o = new TextureManager(this.field_110451_am); + this.field_110451_am.func_219534_a(this.field_71446_o); ++ //net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.textureManager); + this.func_213226_a(); + this.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az); + this.field_71469_aa = new SaveFormat(this.field_71412_D.toPath().resolve("saves"), this.field_71412_D.toPath().resolve("backups"), this.field_184131_U); +@@ -480,11 +482,14 @@ + + this.field_110451_am.func_219534_a(new GrassColorReloadListener()); + this.field_110451_am.func_219534_a(new FoliageColorReloadListener()); + try (net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Rendering Setup", 5, true)) { + bar.step("GL Setup"); this.field_195558_d.func_198076_a("Startup"); - GlStateManager.func_179098_w(); - GlStateManager.func_179103_j(7425); -@@ -442,19 +446,24 @@ - GlStateManager.func_179096_D(); - GlStateManager.func_179128_n(5888); + GlStateManager.enableTexture(); + GlStateManager.shadeModel(7425); + GlStateManager.clearDepth(1.0D); + GlStateManager.enableDepthTest(); ++ net.minecraftforge.fml.client.ClientModLoader.complete(); + GlStateManager.depthFunc(515); + GlStateManager.enableAlphaTest(); + GlStateManager.alphaFunc(516, 0.1F); +@@ -493,19 +498,24 @@ + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); this.field_195558_d.func_198076_a("Post startup"); + bar.step("Loading Texture Map"); - this.field_147128_au = new TextureMap("textures"); + this.field_147128_au = new AtlasTexture("textures"); this.field_147128_au.func_147633_a(this.field_71474_y.field_151442_I); - this.field_71446_o.func_110580_a(TextureMap.field_110575_b, this.field_147128_au); - this.field_71446_o.func_110577_a(TextureMap.field_110575_b); + this.field_71446_o.func_110580_a(AtlasTexture.field_110575_b, this.field_147128_au); + this.field_71446_o.func_110577_a(AtlasTexture.field_110575_b); this.field_147128_au.func_174937_a(false, this.field_71474_y.field_151442_I > 0); + bar.step("Loading Model Manager"); this.field_175617_aL = new ModelManager(this.field_147128_au); - this.field_110451_am.func_199006_a(this.field_175617_aL); + this.field_110451_am.func_219534_a(this.field_175617_aL); this.field_184127_aH = BlockColors.func_186723_a(); this.field_184128_aI = ItemColors.func_186729_a(this.field_184127_aH); + bar.step("Loading Item Renderer"); this.field_175621_X = new ItemRenderer(this.field_71446_o, this.field_175617_aL, this.field_184128_aI); - this.field_175616_W = new RenderManager(this.field_71446_o, this.field_175621_X); + this.field_175616_W = new EntityRendererManager(this.field_71446_o, this.field_175621_X, this.field_110451_am); this.field_175620_Y = new FirstPersonRenderer(this); - this.field_110451_am.func_199006_a(this.field_175621_X); + this.field_110451_am.func_219534_a(this.field_175621_X); + bar.step("Loading Entity Renderer"); + //net.minecraftforge.fml.client.SplashProgress.pause(); this.field_71460_t = new GameRenderer(this, this.field_110451_am); - this.field_110451_am.func_199006_a(this.field_71460_t); + this.field_110451_am.func_219534_a(this.field_71460_t); this.field_175618_aM = new BlockRendererDispatcher(this.field_175617_aL.func_174954_c(), this.field_184127_aH); -@@ -465,7 +474,10 @@ - this.field_110451_am.func_199006_a(this.field_193995_ae); - GlStateManager.func_179083_b(0, 0, this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l()); - this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o); -- this.field_71456_v = new GuiIngame(this); +@@ -521,9 +531,13 @@ + 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); + //net.minecraftforge.fml.client.SplashProgress.resume(); + }; // Forge: end progress bar + net.minecraftforge.fml.client.ClientModLoader.end(); -+ this.field_71456_v = new net.minecraftforge.client.GuiIngameForge(this); - if (this.field_71475_ae != null) { - this.func_147108_a(new GuiConnecting(new GuiMainMenu(), this, this.field_71475_ae, this.field_71477_af)); - } else { -@@ -474,6 +486,7 @@ - ++ this.field_71456_v = new net.minecraftforge.client.ForgeIngameGui(this); this.field_184132_p = new DebugRenderer(this); - GLFW.glfwSetErrorCallback(this::func_195545_a).free(); + GLX.setGlfwErrorCallback(this::func_195545_a); + net.minecraftforge.fml.client.ClientModLoader.complete(); if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) { this.field_195558_d.func_198077_g(); - } -@@ -489,7 +502,7 @@ - }); - List list = Lists.newArrayList(); - GLFWErrorCallback glfwerrorcallback = GLFW.glfwSetErrorCallback((p_211100_1_, p_211100_2_) -> { -- list.add(String.format("GLFW error during init: [0x%X]%s", p_211100_1_, p_211100_2_)); -+ list.add(String.format("GLFW error during init: [0x%X] %s", p_211100_1_, GLFWErrorCallback.getDescription(p_211100_2_))); - }); - if (!GLFW.glfwInit()) { - throw new IllegalStateException("Failed to initialize GLFW, errors: " + Joiner.on(",").join(list)); -@@ -599,7 +612,7 @@ + this.field_71474_y.field_74353_u = this.field_195558_d.func_198113_j(); +@@ -646,7 +660,7 @@ Bootstrap.func_179870_a(p_71377_1_.func_71502_e()); if (p_71377_1_.func_71497_f() != null) { Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_1_.func_71497_f()); @@ -109,110 +105,95 @@ } else if (p_71377_1_.func_147149_a(file2)) { Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); System.exit(-1); -@@ -614,6 +627,7 @@ +@@ -661,6 +675,7 @@ return this.field_71474_y.field_211842_aO; } + @Deprecated // Forge: Use selective refreshResources method in FMLClientHandler - public void func_110436_a() { - this.field_110448_aq.func_198983_a(); - List list = this.field_110448_aq.func_198980_d().stream().map(ResourcePackInfo::func_195796_e).collect(Collectors.toList()); -@@ -668,16 +682,20 @@ + public CompletableFuture func_213237_g() { + if (this.field_213276_aV != null) { + return this.field_213276_aV; +@@ -740,16 +755,20 @@ } - public void func_147108_a(@Nullable GuiScreen p_147108_1_) { + public void func_147108_a(@Nullable Screen p_147108_1_) { - if (this.field_71462_r != null) { -- this.field_71462_r.func_146281_b(); +- this.field_71462_r.removed(); - } - if (p_147108_1_ == null && this.field_71441_e == null) { - p_147108_1_ = new GuiMainMenu(); + p_147108_1_ = new MainMenuScreen(); } else if (p_147108_1_ == null && this.field_71439_g.func_110143_aJ() <= 0.0F) { - p_147108_1_ = new GuiGameOver((ITextComponent)null); + p_147108_1_ = new DeathScreen((ITextComponent)null, this.field_71441_e.func_72912_H().func_76093_s()); } -+ GuiScreen old = this.field_71462_r; ++ 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.func_146281_b(); ++ old.removed(); + - if (p_147108_1_ instanceof GuiMainMenu || p_147108_1_ instanceof GuiMultiplayer) { + 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); -@@ -761,7 +779,7 @@ - GLFW.glfwPollEvents(); - long i1 = Util.func_211178_c() - l; - this.field_71424_I.func_76318_c("sound"); -- this.field_147127_av.func_147691_a(this.field_71439_g, this.field_71428_T.field_194147_b); -+ this.field_147127_av.setListener(this.func_175606_aa(), this.field_71428_T.field_194147_b); //Forge: MC-46445 Spectator mode particles and sounds computed from where you have been before - this.field_71424_I.func_76319_b(); - this.field_71424_I.func_76320_a("render"); - GlStateManager.func_179094_E(); -@@ -771,11 +789,13 @@ - GlStateManager.func_179098_w(); +@@ -874,11 +893,13 @@ + GlStateManager.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_76318_c("gameRenderer"); + 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_76318_c("toasts"); + 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_76319_b(); -@@ -994,8 +1014,8 @@ - if (this.field_71429_W <= 0 && !this.field_71439_g.func_184587_cr()) { - if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.field_72313_a == RayTraceResult.Type.BLOCK) { - BlockPos blockpos = this.field_71476_x.func_178782_a(); -- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f() && this.field_71442_b.func_180512_c(blockpos, this.field_71476_x.field_178784_b)) { -- this.field_71452_i.func_180532_a(blockpos, this.field_71476_x.field_178784_b); -+ if (!this.field_71441_e.func_175623_d(blockpos) && this.field_71442_b.func_180512_c(blockpos, this.field_71476_x.field_178784_b)) { -+ this.field_71452_i.addBlockHitEffects(blockpos, this.field_71476_x); - this.field_71439_g.func_184609_a(EnumHand.MAIN_HAND); + this.field_71424_I.func_219897_b(); +@@ -1146,10 +1167,10 @@ + 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()) { +- Direction direction = blockraytraceresult.func_216354_b(); ++ Direction direction = blockraytraceresult.func_216354_b(); ++ if (!this.field_71441_e.func_175623_d(blockpos) && this.field_71442_b.func_180512_c(blockpos, direction)) { + if (this.field_71442_b.func_180512_c(blockpos, direction)) { +- this.field_71452_i.func_180532_a(blockpos, direction); ++ this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult); + this.field_71439_g.func_184609_a(Hand.MAIN_HAND); + } } - -@@ -1020,7 +1040,7 @@ - break; +@@ -1176,7 +1197,7 @@ case BLOCK: - BlockPos blockpos = this.field_71476_x.func_178782_a(); + 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, this.field_71476_x.field_178784_b); ++ if (!this.field_71441_e.func_180495_p(blockpos).isAir(field_71441_e, blockpos)) { + this.field_71442_b.func_180511_b(blockpos, blockraytraceresult.func_216354_b()); break; } -@@ -1030,6 +1050,7 @@ +@@ -1186,6 +1207,7 @@ } this.field_71439_g.func_184821_cY(); + net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.field_71439_g); } - this.field_71439_g.func_184609_a(EnumHand.MAIN_HAND); -@@ -1060,7 +1081,7 @@ - break; - case BLOCK: - BlockPos blockpos = this.field_71476_x.func_178782_a(); -- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) { -+ if (!this.field_71441_e.func_180495_p(blockpos).isAir(field_71441_e, blockpos)) { - int i = itemstack.func_190916_E(); - EnumActionResult enumactionresult = this.field_71442_b.func_187099_a(this.field_71439_g, this.field_71441_e, blockpos, this.field_71476_x.field_178784_b, this.field_71476_x.field_72307_f, enumhand); - if (enumactionresult == EnumActionResult.SUCCESS) { -@@ -1079,6 +1100,9 @@ + this.field_71439_g.func_184609_a(Hand.MAIN_HAND); +@@ -1235,6 +1257,9 @@ } } -+ if (itemstack.func_190926_b() && (this.field_71476_x == null || this.field_71476_x.field_72313_a == RayTraceResult.Type.MISS)) -+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.field_71439_g, enumhand); ++ 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() && this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, enumhand) == EnumActionResult.SUCCESS) { - this.field_71460_t.field_78516_c.func_187460_a(enumhand); + if (!itemstack.func_190926_b() && this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, hand) == ActionResultType.SUCCESS) { + this.field_71460_t.field_78516_c.func_187460_a(hand); return; -@@ -1098,6 +1122,8 @@ +@@ -1254,6 +1279,8 @@ --this.field_71467_ac; } @@ -221,8 +202,8 @@ this.field_71424_I.func_76320_a("gui"); if (!this.field_71445_n) { this.field_71456_v.func_73831_a(); -@@ -1220,6 +1246,8 @@ - this.field_71424_I.func_76318_c("keyboard"); +@@ -1372,6 +1399,8 @@ + this.field_71424_I.func_219895_b("keyboard"); this.field_195559_v.func_204870_b(); this.field_71424_I.func_76319_b(); + @@ -230,103 +211,100 @@ } private void func_184117_aA() { -@@ -1378,6 +1406,14 @@ - guiscreenworking.func_200209_c(new TextComponentString("")); +@@ -1430,6 +1459,7 @@ + this.field_71439_g.func_71040_bB(Screen.hasControlDown()); } + } ++ if (field_71441_e != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e)); + boolean flag2 = this.field_71474_y.field_74343_n != ChatVisibility.HIDDEN; + if (flag2) { +@@ -1526,6 +1556,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 we're showing nothing, put the working screen back again -+ if (this.field_71462_r == null) -+ this.func_147108_a(guiscreenworking); -+ } ++ } 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); - try { -@@ -1397,7 +1433,12 @@ - networkmanager.func_150719_a(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null, (p_209507_0_) -> { +@@ -1546,11 +1582,17 @@ + networkmanager.func_150719_a(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_213261_0_) -> { })); - networkmanager.func_179290_a(new CPacketHandshake(socketaddress.toString(), 0, EnumConnectionState.LOGIN)); -- networkmanager.func_179290_a(new CPacketLoginStart(this.func_110432_I().func_148256_e())); + 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 CPacketLoginStart(gameProfile)); ++ networkmanager.func_179290_a(new CLoginStartPacket(gameProfile)); this.field_71453_ak = networkmanager; } -@@ -1411,6 +1452,7 @@ - } - - public void func_205055_a(@Nullable WorldClient p_205055_1_, GuiScreen p_205055_2_) { + 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)); - if (p_205055_1_ == null) { - NetHandlerPlayClient nethandlerplayclient = this.func_147114_u(); - if (nethandlerplayclient != null) { -@@ -1447,6 +1489,7 @@ + WorkingScreen workingscreen = new WorkingScreen(); + workingscreen.func_200210_a(new TranslationTextComponent("connect.joining")); + this.func_213241_c(workingscreen); +@@ -1623,6 +1665,7 @@ } - TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_205055_1_); + TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_213257_1_); + net.minecraftforge.client.MinecraftForgeClient.clearRenderCache(); - if (p_205055_1_ != null) { - if (!this.field_71455_al) { - AuthenticationService authenticationservice = new YggdrasilAuthenticationService(this.field_110453_aa, UUID.randomUUID().toString()); -@@ -1493,6 +1536,7 @@ - EntityPlayerSP entityplayersp = this.field_71439_g; - this.field_71439_g = this.field_71442_b.func_199681_a(this.field_71441_e, this.field_71439_g == null ? new StatisticsManager() : this.field_71439_g.func_146107_m(), this.field_71439_g == null ? new RecipeBookClient(new RecipeManager()) : this.field_71439_g.func_199507_B()); - this.field_71439_g.func_184212_Q().func_187218_a(entityplayersp.func_184212_Q().func_187231_c()); -+ this.field_71439_g.updateSyncFields(entityplayersp); // Forge: fix MC-10657 - this.field_71439_g.field_71093_bK = p_212315_1_; - this.field_175622_Z = this.field_71439_g; - this.field_71439_g.func_70065_x(); -@@ -1532,110 +1576,8 @@ + } + + public final boolean func_71355_q() { +@@ -1648,112 +1691,8 @@ private void func_147112_ai() { - if (this.field_71476_x != null && this.field_71476_x.field_72313_a != RayTraceResult.Type.MISS) { + 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 (this.field_71476_x.field_72313_a == RayTraceResult.Type.BLOCK) { -- BlockPos blockpos = this.field_71476_x.func_178782_a(); -- IBlockState iblockstate = this.field_71441_e.func_180495_p(blockpos); -- Block block = iblockstate.func_177230_c(); -- if (iblockstate.func_196958_f()) { +- 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, iblockstate); +- itemstack = block.func_185473_a(this.field_71441_e, blockpos, blockstate); - if (itemstack.func_190926_b()) { - return; - } - -- if (flag && GuiScreen.func_146271_m() && block.func_149716_u()) { +- if (flag && Screen.hasControlDown() && block.func_149716_u()) { - tileentity = this.field_71441_e.func_175625_s(blockpos); - } - } else { -- if (this.field_71476_x.field_72313_a != RayTraceResult.Type.ENTITY || this.field_71476_x.field_72308_g == null || !flag) { +- if (raytraceresult$type != RayTraceResult.Type.ENTITY || !flag) { - return; - } - -- if (this.field_71476_x.field_72308_g instanceof EntityPainting) { +- Entity entity = ((EntityRayTraceResult)this.field_71476_x).func_216348_a(); +- if (entity instanceof PaintingEntity) { - itemstack = new ItemStack(Items.field_151159_an); -- } else if (this.field_71476_x.field_72308_g instanceof EntityLeashKnot) { +- } else if (entity instanceof LeashKnotEntity) { - itemstack = new ItemStack(Items.field_151058_ca); -- } else if (this.field_71476_x.field_72308_g instanceof EntityItemFrame) { -- EntityItemFrame entityitemframe = (EntityItemFrame)this.field_71476_x.field_72308_g; -- ItemStack itemstack1 = entityitemframe.func_82335_i(); +- } 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 (this.field_71476_x.field_72308_g instanceof EntityMinecart) { -- EntityMinecart entityminecart = (EntityMinecart)this.field_71476_x.field_72308_g; +- } else if (entity instanceof AbstractMinecartEntity) { +- AbstractMinecartEntity abstractminecartentity = (AbstractMinecartEntity)entity; - Item item; -- switch(entityminecart.func_184264_v()) { +- switch(abstractminecartentity.func_184264_v()) { - case FURNACE: - item = Items.field_151109_aJ; - break; @@ -347,44 +325,44 @@ - } - - itemstack = new ItemStack(item); -- } else if (this.field_71476_x.field_72308_g instanceof EntityBoat) { -- itemstack = new ItemStack(((EntityBoat)this.field_71476_x.field_72308_g).func_184455_j()); -- } else if (this.field_71476_x.field_72308_g instanceof EntityArmorStand) { +- } 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 (this.field_71476_x.field_72308_g instanceof EntityEnderCrystal) { +- } else if (entity instanceof EnderCrystalEntity) { - itemstack = new ItemStack(Items.field_185158_cP); - } else { -- ItemSpawnEgg itemspawnegg = ItemSpawnEgg.func_200889_b(this.field_71476_x.field_72308_g.func_200600_R()); -- if (itemspawnegg == null) { +- SpawnEggItem spawneggitem = SpawnEggItem.func_200889_b(entity.func_200600_R()); +- if (spawneggitem == null) { - return; - } - -- itemstack = new ItemStack(itemspawnegg); +- itemstack = new ItemStack(spawneggitem); - } - } - - if (itemstack.func_190926_b()) { - String s = ""; -- if (this.field_71476_x.field_72313_a == RayTraceResult.Type.BLOCK) { -- s = IRegistry.field_212618_g.func_177774_c(this.field_71441_e.func_180495_p(this.field_71476_x.func_178782_a()).func_177230_c()).toString(); -- } else if (this.field_71476_x.field_72313_a == RayTraceResult.Type.ENTITY) { -- s = IRegistry.field_212629_r.func_177774_c(this.field_71476_x.field_72308_g.func_200600_R()).toString(); +- 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", this.field_71476_x.field_72313_a, s); +- field_147123_G.warn("Picking on: [{}] {} gave null item", raytraceresult$type, s); - } else { -- InventoryPlayer inventoryplayer = this.field_71439_g.field_71071_by; +- PlayerInventory playerinventory = this.field_71439_g.field_71071_by; - if (tileentity != null) { - this.func_184119_a(itemstack, tileentity); - } - -- int i = inventoryplayer.func_184429_b(itemstack); +- int i = playerinventory.func_184429_b(itemstack); - if (flag) { -- inventoryplayer.func_184434_a(itemstack); -- this.field_71442_b.func_78761_a(this.field_71439_g.func_184586_b(EnumHand.MAIN_HAND), 36 + inventoryplayer.field_70461_c); +- 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 (InventoryPlayer.func_184435_e(i)) { -- inventoryplayer.field_70461_c = i; +- if (PlayerInventory.func_184435_e(i)) { +- playerinventory.field_70461_c = i; - } else { - this.field_71442_b.func_187100_a(i); - } @@ -396,26 +374,26 @@ } } -@@ -1712,6 +1654,7 @@ +@@ -1825,6 +1764,7 @@ return field_71432_P; } + @Deprecated // Forge: Use selective scheduleResourceRefresh method in FMLClientHandler - public ListenableFuture func_175603_A() { - return this.func_152344_a(this::func_110436_a); - } -@@ -1871,6 +1814,8 @@ + public CompletableFuture func_213245_w() { + return this.func_213169_a(this::func_213237_g).thenCompose((p_213240_0_) -> { + return p_213240_0_; +@@ -1968,6 +1908,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 GuiWinGame) { + if (this.field_71462_r instanceof WinGameScreen) { return MusicTicker.MusicType.CREDITS; } else if (this.field_71439_g == null) { -@@ -2010,4 +1955,12 @@ - public FontResourceManager func_211500_ak() { - return this.field_211501_aD; +@@ -2124,4 +2066,12 @@ + public LoadingGui func_213250_au() { + return this.field_213279_p; } + + public ItemColors getItemColors() { diff --git a/patches/minecraft/net/minecraft/client/MouseHelper.java.patch b/patches/minecraft/net/minecraft/client/MouseHelper.java.patch index 78581d4de..ce8f495be 100644 --- a/patches/minecraft/net/minecraft/client/MouseHelper.java.patch +++ b/patches/minecraft/net/minecraft/client/MouseHelper.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/client/MouseHelper.java +++ b/net/minecraft/client/MouseHelper.java -@@ -76,11 +76,15 @@ - final int pFinal = p_198023_3_; - if (flag) { - GuiScreen.func_195121_a(() -> { -- aboolean[0] = this.field_198036_a.field_71462_r.mouseClicked(d0, d1, pFinal); -+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPre(this.field_198036_a.field_71462_r, d0, d1, pFinal); -+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.mouseClicked(d0, d1, pFinal); -+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.field_198036_a.field_71462_r, d0, d1, pFinal); - }, "mouseClicked event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName()); - } else { - GuiScreen.func_195121_a(() -> { -- aboolean[0] = this.field_198036_a.field_71462_r.mouseReleased(d0, d1, pFinal); -+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(this.field_198036_a.field_71462_r, d0, d1, pFinal); -+ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.mouseReleased(d0, d1, pFinal); -+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.field_198036_a.field_71462_r, d0, d1, pFinal); - }, "mouseReleased event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName()); +@@ -77,11 +77,15 @@ + int p_198023_3_f = p_198023_3_; + if (flag) { + Screen.wrapScreenError(() -> { +- aboolean[0] = this.field_198036_a.field_71462_r.mouseClicked(d0, d1, p_198023_3_f); ++ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPre(this.field_198036_a.field_71462_r, d0, d1, p_198023_3_f); ++ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.mouseClicked(d0, d1, p_198023_3_f); ++ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.field_198036_a.field_71462_r, d0, d1, p_198023_3_f); + }, "mouseClicked event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName()); + } else { + Screen.wrapScreenError(() -> { +- aboolean[0] = this.field_198036_a.field_71462_r.mouseReleased(d0, d1, p_198023_3_f); ++ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(this.field_198036_a.field_71462_r, d0, d1, p_198023_3_f); ++ if (!aboolean[0]) aboolean[0] = this.field_198036_a.field_71462_r.mouseReleased(d0, d1, p_198023_3_f); ++ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.field_198036_a.field_71462_r, d0, d1, p_198023_3_f); + }, "mouseReleased event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName()); + } } - } -@@ -103,7 +107,7 @@ +@@ -105,7 +109,7 @@ } } } @@ -27,25 +27,25 @@ } } -@@ -111,7 +115,9 @@ - if (p_198020_1_ == Minecraft.func_71410_x().field_195558_d.func_198092_i()) { - double d0 = p_198020_5_ * this.field_198036_a.field_71474_y.field_208033_V; - if (this.field_198036_a.field_71462_r != null) { -- this.field_198036_a.field_71462_r.mouseScrolled(d0); -+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPre(this, this.field_198036_a.field_71462_r, d0)) return; -+ if (this.field_198036_a.field_71462_r.mouseScrolled(d0)) return; -+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPost(this, this.field_198036_a.field_71462_r, d0); - } else if (this.field_198036_a.field_71439_g != null) { - if (this.field_200542_o != 0.0D && Math.signum(d0) != Math.signum(this.field_200542_o)) { - this.field_200542_o = 0.0D; -@@ -160,7 +166,9 @@ - double d2 = (p_198022_3_ - this.field_198040_e) * (double)this.field_198036_a.field_195558_d.func_198107_o() / (double)this.field_198036_a.field_195558_d.func_198105_m(); - double d3 = (p_198022_5_ - this.field_198041_f) * (double)this.field_198036_a.field_195558_d.func_198087_p() / (double)this.field_198036_a.field_195558_d.func_198083_n(); - GuiScreen.func_195121_a(() -> { -- iguieventlistener.mouseDragged(d0, d1, this.field_198042_g, d2, d3); +@@ -116,7 +120,9 @@ + if (this.field_198036_a.field_71462_r != null) { + double d1 = this.field_198040_e * (double)this.field_198036_a.field_195558_d.func_198107_o() / (double)this.field_198036_a.field_195558_d.func_198105_m(); + double d2 = this.field_198041_f * (double)this.field_198036_a.field_195558_d.func_198087_p() / (double)this.field_198036_a.field_195558_d.func_198083_n(); +- this.field_198036_a.field_71462_r.mouseScrolled(d1, d2, d0); ++ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPre(this, this.field_198036_a.field_71462_r, d0)) return; ++ if (this.field_198036_a.field_71462_r.mouseScrolled(d1, d2, d0)) return; ++ net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPost(this, this.field_198036_a.field_71462_r, d0); + } else if (this.field_198036_a.field_71439_g != null) { + if (this.field_200542_o != 0.0D && Math.signum(d0) != Math.signum(this.field_200542_o)) { + this.field_200542_o = 0.0D; +@@ -168,7 +174,9 @@ + double d2 = (p_198022_3_ - this.field_198040_e) * (double)this.field_198036_a.field_195558_d.func_198107_o() / (double)this.field_198036_a.field_195558_d.func_198105_m(); + double d3 = (p_198022_5_ - this.field_198041_f) * (double)this.field_198036_a.field_195558_d.func_198087_p() / (double)this.field_198036_a.field_195558_d.func_198083_n(); + Screen.wrapScreenError(() -> { +- iguieventlistener.mouseDragged(d0, d1, this.field_198042_g, d2, d3); + if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPre(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3)) return; + if (iguieventlistener.mouseDragged(d0, d1, this.field_198042_g, d2, d3)) return; + net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPost(this.field_198036_a.field_71462_r, d0, d1, this.field_198042_g, d2, d3); - }, "mouseDragged event handler", iguieventlistener.getClass().getCanonicalName()); + }, "mouseDragged event handler", iguieventlistener.getClass().getCanonicalName()); + } } - diff --git a/patches/minecraft/net/minecraft/client/audio/SoundEngine.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundEngine.java.patch new file mode 100644 index 000000000..58e3a5ec6 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/audio/SoundEngine.java.patch @@ -0,0 +1,49 @@ +--- a/net/minecraft/client/audio/SoundEngine.java ++++ b/net/minecraft/client/audio/SoundEngine.java +@@ -53,6 +53,7 @@ + this.field_148622_c = p_i50892_1_; + this.field_148619_d = p_i50892_2_; + this.field_217939_i = new AudioStreamManager(p_i50892_3_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundSetupEvent(this)); + } + + public void func_148596_a() { +@@ -68,6 +69,7 @@ + + this.func_148613_b(); + this.func_148608_i(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); + } + + private synchronized void func_148608_i() { +@@ -246,6 +248,8 @@ + + public void func_148611_c(ISound p_148611_1_) { + if (this.field_148617_f) { ++ p_148611_1_ = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_148611_1_); ++ if (p_148611_1_ == null) return; + SoundEventAccessor soundeventaccessor = p_148611_1_.func_184366_a(this.field_148622_c); + ResourceLocation resourcelocation = p_148611_1_.func_147650_b(); + if (soundeventaccessor == null) { +@@ -300,11 +304,13 @@ + p_217930_7_.func_216420_a(vec3d); + p_217930_7_.func_216432_b(flag); + }); ++ final ISound isound = p_148611_1_; + if (!sound.func_188723_h()) { + this.field_217939_i.func_217909_a(sound.func_188721_b()).thenAccept((p_217934_1_) -> { + channelmanager$entry.func_217888_a((p_217925_1_) -> { + p_217925_1_.func_216429_a(p_217934_1_); + p_217925_1_.func_216438_c(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, isound, p_217925_1_)); + }); + }); + } else { +@@ -312,6 +318,7 @@ + channelmanager$entry.func_217888_a((p_217935_1_) -> { + p_217935_1_.func_216433_a(p_217928_1_); + p_217935_1_.func_216438_c(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, isound, p_217935_1_)); + }); + }); + } diff --git a/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch index 9c27ca9d1..d930b7a5c 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch @@ -1,59 +1,50 @@ --- a/net/minecraft/client/audio/SoundHandler.java +++ b/net/minecraft/client/audio/SoundHandler.java -@@ -64,6 +64,7 @@ - public void func_195410_a(IResourceManager p_195410_1_) { - this.field_147697_e.clear(); +@@ -61,6 +61,7 @@ + SoundHandler.Loader soundhandler$loader = new SoundHandler.Loader(); + p_212854_2_.func_219894_a(); -+ java.util.List> resources = new java.util.LinkedList<>(); - for(String s : p_195410_1_.func_199001_a()) { - try { - for(IResource iresource : p_195410_1_.func_199004_b(new ResourceLocation(s, "sounds.json"))) { -@@ -71,7 +72,7 @@ - Map map = this.func_175085_a(iresource.func_199027_b()); ++ java.util.List> resources = new java.util.LinkedList<>(); + for(String s : p_212854_1_.func_199001_a()) { + p_212854_2_.func_76320_a(s); + +@@ -74,7 +75,9 @@ + p_212854_2_.func_219895_b("register"); for(Entry entry : map.entrySet()) { -- this.func_147693_a(new ResourceLocation(s, entry.getKey()), entry.getValue()); -+ resources.add(new net.minecraft.util.Tuple<>(new ResourceLocation(s, entry.getKey()), entry.getValue())); ++ resources.add(new net.minecraft.util.Tuple<>(new ResourceLocation(s, entry.getKey()), () -> { + soundhandler$loader.func_217944_a(new ResourceLocation(s, entry.getKey()), entry.getValue(), p_212854_1_); ++ })); } - } catch (RuntimeException runtimeexception) { - field_147698_b.warn("Invalid sounds.json in resourcepack: '{}'", iresource.func_199026_d(), runtimeexception); -@@ -81,7 +82,18 @@ - ; - } + + p_212854_2_.func_76319_b(); +@@ -91,6 +94,17 @@ + p_212854_2_.func_76319_b(); } -+ try (net.minecraftforge.fml.common.progress.ProgressBar resourcesBar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Loading sounds", resources.size())) { -+ resources.forEach(entry -> { -+ resourcesBar.step(entry.func_76341_a().toString()); -+ try { -+ this.func_147693_a(entry.func_76341_a(), entry.func_76340_b()); -+ } catch (RuntimeException e) { -+ field_147698_b.warn("Invalid sounds.json", e); -+ } + ++ net.minecraftforge.fml.common.progress.StartupProgressManager.start("Loading sounds", resources.size(), bar -> { ++ resources.forEach(entry -> { ++ bar.step(entry.func_76341_a().toString()); ++ try { ++ entry.func_76340_b().run(); ++ } catch (RuntimeException e) { ++ field_147698_b.warn("Invalid sounds.json", e); ++ } ++ }); + }); -+ }; // Forge: end progress bar - + - for(ResourceLocation resourcelocation : this.field_147697_e.keySet()) { - SoundEventAccessor soundeventaccessor = this.field_147697_e.get(resourcelocation); - if (soundeventaccessor.func_188712_c() instanceof TextComponentTranslation) { -@@ -211,6 +223,10 @@ - this.field_147694_f.func_148615_a(p_147691_1_, p_147691_2_); + p_212854_2_.func_219897_b(); + return soundhandler$loader; } - -+ public void setListener(net.minecraft.entity.Entity entity, float partialTicks) { -+ this.field_147694_f.setListener(entity, partialTicks); -+ } -+ - public void func_147689_b() { - this.field_147694_f.func_148610_e(); - } -@@ -258,4 +274,9 @@ - public void func_195478_a(@Nullable ResourceLocation p_195478_1_, @Nullable SoundCategory p_195478_2_) { +@@ -210,6 +224,11 @@ this.field_147694_f.func_195855_a(p_195478_1_, p_195478_2_); } -+ -+ @Override + ++ //@Override //TODO: Filtered reload + public net.minecraftforge.resource.IResourceType getResourceType() { + return net.minecraftforge.resource.VanillaResourceType.SOUNDS; + } - } ++ + public String func_215293_f() { + return this.field_147694_f.func_217932_f(); + } diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch deleted file mode 100644 index 26a43388b..000000000 --- a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- a/net/minecraft/client/audio/SoundManager.java -+++ b/net/minecraft/client/audio/SoundManager.java -@@ -69,6 +69,7 @@ - try { - SoundSystemConfig.addLibrary(LibraryLWJGL3.class); - SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundSetupEvent(this)); - } catch (SoundSystemException soundsystemexception) { - field_148621_b.error(field_148623_a, "Error linking with the LibraryJavaSound plug-in", (Throwable)soundsystemexception); - } -@@ -88,6 +89,7 @@ - - this.func_148613_b(); - this.func_148608_i(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); - } - - private synchronized void func_148608_i() { -@@ -293,6 +295,8 @@ - - public void func_148611_c(ISound p_148611_1_) { - if (this.field_148617_f) { -+ p_148611_1_ = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_148611_1_); -+ if (p_148611_1_ == null) return; - SoundEventAccessor soundeventaccessor = p_148611_1_.func_184366_a(this.field_148622_c); - ResourceLocation resourcelocation = p_148611_1_.func_147650_b(); - if (soundeventaccessor == null) { -@@ -334,8 +338,10 @@ - ResourceLocation resourcelocation1 = sound.func_188721_b(); - if (sound.func_188723_h()) { - this.field_148620_e.newStreamingSource(p_148611_1_.func_204200_l(), s, func_148612_a(resourcelocation1), resourcelocation1.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, p_148611_1_, s)); - } else { - this.field_148620_e.newSource(p_148611_1_.func_204200_l(), s, func_148612_a(resourcelocation1), resourcelocation1.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, p_148611_1_, s)); - } - - field_148621_b.debug(field_148623_a, "Playing sound {} for event {} as channel {}", sound.func_188719_a(), resourcelocation, s); -@@ -423,12 +429,16 @@ - } - - public void func_148615_a(EntityPlayer p_148615_1_, float p_148615_2_) { -- if (this.field_148617_f && p_148615_1_ != null) { -- float f = p_148615_1_.field_70127_C + (p_148615_1_.field_70125_A - p_148615_1_.field_70127_C) * p_148615_2_; -- float f1 = p_148615_1_.field_70126_B + (p_148615_1_.field_70177_z - p_148615_1_.field_70126_B) * p_148615_2_; -- double d0 = p_148615_1_.field_70169_q + (p_148615_1_.field_70165_t - p_148615_1_.field_70169_q) * (double)p_148615_2_; -- double d1 = p_148615_1_.field_70167_r + (p_148615_1_.field_70163_u - p_148615_1_.field_70167_r) * (double)p_148615_2_ + (double)p_148615_1_.func_70047_e(); -- double d2 = p_148615_1_.field_70166_s + (p_148615_1_.field_70161_v - p_148615_1_.field_70166_s) * (double)p_148615_2_; -+ setListener((net.minecraft.entity.Entity)p_148615_1_, p_148615_2_); -+ } -+ -+ public void setListener(net.minecraft.entity.Entity player, float partialTicks) { -+ if (this.field_148617_f && player != null) { -+ float f = player.field_70127_C + (player.field_70125_A - player.field_70127_C) * partialTicks; -+ float f1 = player.field_70126_B + (player.field_70177_z - player.field_70126_B) * partialTicks; -+ double d0 = player.field_70169_q + (player.field_70165_t - player.field_70169_q) * (double)partialTicks; -+ double d1 = player.field_70167_r + (player.field_70163_u - player.field_70167_r) * (double)partialTicks + (double)player.func_70047_e(); -+ double d2 = player.field_70166_s + (player.field_70161_v - player.field_70166_s) * (double)partialTicks; - float f2 = MathHelper.func_76134_b((f1 + 90.0F) * ((float)Math.PI / 180F)); - float f3 = MathHelper.func_76126_a((f1 + 90.0F) * ((float)Math.PI / 180F)); - float f4 = MathHelper.func_76134_b(-f * ((float)Math.PI / 180F)); diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch deleted file mode 100644 index 5b671cef1..000000000 --- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- a/net/minecraft/client/entity/EntityPlayerSP.java -+++ b/net/minecraft/client/entity/EntityPlayerSP.java -@@ -139,6 +139,7 @@ - } - - public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { -+ net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, p_70097_1_, p_70097_2_); - return false; - } - -@@ -468,6 +469,11 @@ - } - - public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_); -+ if (event.isCanceled() || event.getSound() == null) return; -+ p_184185_1_ = event.getSound(); -+ p_184185_2_ = event.getVolume(); -+ p_184185_3_ = event.getPitch(); - this.field_70170_p.func_184134_a(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false); - } - -@@ -673,6 +679,7 @@ - float f = 0.8F; - boolean flag2 = this.field_71158_b.field_192832_b >= 0.8F; - this.field_71158_b.func_78898_a(); -+ net.minecraftforge.client.ForgeHooksClient.onInputUpdate(this, this.field_71158_b); - this.field_71159_c.func_193032_ao().func_193293_a(this.field_71158_b); - if (this.func_184587_cr() && !this.func_184218_aH()) { - this.field_71158_b.field_78902_a *= 0.2F; -@@ -688,10 +695,14 @@ - } - - AxisAlignedBB axisalignedbb = this.func_174813_aQ(); -+ net.minecraftforge.client.event.PlayerSPPushOutOfBlocksEvent event = new net.minecraftforge.client.event.PlayerSPPushOutOfBlocksEvent(this, axisalignedbb); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { -+ axisalignedbb = event.getEntityBoundingBox(); - this.func_145771_j(this.field_70165_t - (double)this.field_70130_N * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v + (double)this.field_70130_N * 0.35D); - this.func_145771_j(this.field_70165_t - (double)this.field_70130_N * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v - (double)this.field_70130_N * 0.35D); - this.func_145771_j(this.field_70165_t + (double)this.field_70130_N * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v - (double)this.field_70130_N * 0.35D); - this.func_145771_j(this.field_70165_t + (double)this.field_70130_N * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v + (double)this.field_70130_N * 0.35D); -+ } - boolean flag4 = (float)this.func_71024_bL().func_75116_a() > 6.0F || this.field_71075_bZ.field_75101_c; - if ((this.field_70122_E || this.func_204231_K()) && !flag1 && !flag2 && this.field_71158_b.field_192832_b >= 0.8F && !this.func_70051_ag() && flag4 && !this.func_184587_cr() && !this.func_70644_a(MobEffects.field_76440_q)) { - if (this.field_71156_d <= 0 && !this.field_71159_c.field_71474_y.field_151444_V.func_151470_d()) { -@@ -979,4 +990,16 @@ - return this.field_204230_bP; - } - } -+ -+ public void updateSyncFields(EntityPlayerSP old) { -+ this.field_175172_bI = old.field_175172_bI; -+ this.field_175166_bJ = old.field_175166_bJ; -+ this.field_175167_bK = old.field_175167_bK; -+ this.field_175164_bL = old.field_175164_bL; -+ this.field_175165_bM = old.field_175165_bM; -+ this.field_184841_cd = old.field_184841_cd; -+ this.field_175170_bN = old.field_175170_bN; -+ this.field_175171_bO = old.field_175171_bO; -+ this.field_175168_bP = old.field_175168_bP; -+ } - } diff --git a/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch b/patches/minecraft/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java.patch similarity index 65% rename from patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch rename to patches/minecraft/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java.patch index 900885f57..64b90936d 100644 --- a/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java.patch @@ -1,15 +1,15 @@ ---- a/net/minecraft/client/entity/AbstractClientPlayer.java -+++ b/net/minecraft/client/entity/AbstractClientPlayer.java -@@ -114,7 +114,7 @@ +--- a/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java ++++ b/net/minecraft/client/entity/player/AbstractClientPlayerEntity.java +@@ -116,7 +116,7 @@ f = 1.0F; } - if (this.func_184587_cr() && this.func_184607_cu().func_77973_b() == Items.field_151031_f) { -+ if (this.func_184587_cr() && this.func_184607_cu().func_77973_b() instanceof net.minecraft.item.ItemBow) { ++ if (this.func_184587_cr() && this.func_184607_cu().func_77973_b() instanceof net.minecraft.item.BowItem) { int i = this.func_184612_cw(); float f1 = (float)i / 20.0F; if (f1 > 1.0F) { -@@ -126,6 +126,6 @@ +@@ -128,6 +128,6 @@ f *= 1.0F - f1 * 0.15F; } diff --git a/patches/minecraft/net/minecraft/client/entity/player/ClientPlayerEntity.java.patch b/patches/minecraft/net/minecraft/client/entity/player/ClientPlayerEntity.java.patch new file mode 100644 index 000000000..9607593c6 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/entity/player/ClientPlayerEntity.java.patch @@ -0,0 +1,62 @@ +--- a/net/minecraft/client/entity/player/ClientPlayerEntity.java ++++ b/net/minecraft/client/entity/player/ClientPlayerEntity.java +@@ -130,6 +130,7 @@ + } + + public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { ++ net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, p_70097_1_, p_70097_2_); + return false; + } + +@@ -449,6 +450,11 @@ + } + + public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_); ++ if (event.isCanceled() || event.getSound() == null) return; ++ p_184185_1_ = event.getSound(); ++ p_184185_2_ = event.getVolume(); ++ p_184185_3_ = event.getPitch(); + this.field_70170_p.func_184134_a(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false); + } + +@@ -591,6 +597,7 @@ + boolean flag2 = this.func_223110_ee(); + boolean flag3 = this.func_213287_bg() || this.func_213300_bk(); + this.field_71158_b.func_217607_a(flag3, this.func_175149_v()); ++ net.minecraftforge.client.ForgeHooksClient.onInputUpdate(this, this.field_71158_b); + this.field_71159_c.func_193032_ao().func_193293_a(this.field_71158_b); + if (this.func_184587_cr() && !this.func_184218_aH()) { + this.field_71158_b.field_78902_a *= 0.2F; +@@ -607,10 +614,14 @@ + + if (!this.field_70145_X) { + AxisAlignedBB axisalignedbb = this.func_174813_aQ(); ++ net.minecraftforge.client.event.PlayerSPPushOutOfBlocksEvent event = new net.minecraftforge.client.event.PlayerSPPushOutOfBlocksEvent(this, axisalignedbb); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { ++ axisalignedbb = event.getEntityBoundingBox(); + this.func_213282_i(this.field_70165_t - (double)this.func_213311_cf() * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v + (double)this.func_213311_cf() * 0.35D); + this.func_213282_i(this.field_70165_t - (double)this.func_213311_cf() * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v - (double)this.func_213311_cf() * 0.35D); + this.func_213282_i(this.field_70165_t + (double)this.func_213311_cf() * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v - (double)this.func_213311_cf() * 0.35D); + this.func_213282_i(this.field_70165_t + (double)this.func_213311_cf() * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v + (double)this.func_213311_cf() * 0.35D); ++ } + } + + boolean flag7 = (float)this.func_71024_bL().func_75116_a() > 6.0F || this.field_71075_bZ.field_75101_c; +@@ -950,4 +961,16 @@ + return this.field_204230_bP; + } + } ++ ++ public void updateSyncFields(ClientPlayerEntity old) { ++ this.field_175172_bI = old.field_175172_bI; ++ this.field_175166_bJ = old.field_175166_bJ; ++ this.field_175167_bK = old.field_175167_bK; ++ this.field_175164_bL = old.field_175164_bL; ++ this.field_175165_bM = old.field_175165_bM; ++ this.field_184841_cd = old.field_184841_cd; ++ this.field_175170_bN = old.field_175170_bN; ++ this.field_175171_bO = old.field_175171_bO; ++ this.field_175168_bP = old.field_175168_bP; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch b/patches/minecraft/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java.patch similarity index 55% rename from patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch rename to patches/minecraft/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java.patch index 0e3df6fe2..912082d64 100644 --- a/patches/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/client/entity/EntityOtherPlayerMP.java -+++ b/net/minecraft/client/entity/EntityOtherPlayerMP.java -@@ -29,6 +29,7 @@ +--- a/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java ++++ b/net/minecraft/client/entity/player/RemoteClientPlayerEntity.java +@@ -28,6 +28,7 @@ } public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { diff --git a/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch new file mode 100644 index 000000000..7dd61bc6f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/DisplayEffectsScreen.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/client/gui/DisplayEffectsScreen.java ++++ b/net/minecraft/client/gui/DisplayEffectsScreen.java +@@ -84,6 +84,7 @@ + int i = this.field_147009_r; + + for(EffectInstance effectinstance : p_214077_3_) { ++ if (!effectinstance.func_188419_a().shouldRender(effectinstance)) continue; + Effect effect = effectinstance.func_188419_a(); + blit(p_214077_1_ + 6, i + 7, this.blitOffset, 18, 18, potionspriteuploader.func_215288_a(effect)); + i += p_214077_2_; +@@ -95,6 +96,9 @@ + int i = this.field_147009_r; + + for(EffectInstance effectinstance : p_214078_3_) { ++ if (!effectinstance.func_188419_a().shouldRender(effectinstance)) continue; ++ effectinstance.func_188419_a().renderInventoryEffect(effectinstance, this, p_214078_1_, i, this.blitOffset); ++ if (!effectinstance.func_188419_a().shouldRenderInvText(effectinstance)) { i += p_214078_2_; continue; } + String s = I18n.func_135052_a(effectinstance.func_188419_a().func_76393_a()); + if (effectinstance.func_76458_c() >= 1 && effectinstance.func_76458_c() <= 9) { + s = s + ' ' + I18n.func_135052_a("enchantment.level." + (effectinstance.func_76458_c() + 1)); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiBossOverlay.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiBossOverlay.java.patch deleted file mode 100644 index 73e1f516a..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiBossOverlay.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/client/gui/GuiBossOverlay.java -+++ b/net/minecraft/client/gui/GuiBossOverlay.java -@@ -28,12 +28,17 @@ - - for(BossInfoClient bossinfoclient : this.field_184060_g.values()) { - int k = i / 2 - 91; -+ net.minecraftforge.client.event.RenderGameOverlayEvent.BossInfo event = -+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPre(this.field_184059_f.field_195558_d, bossinfoclient, k, j, 10 + this.field_184059_f.field_71466_p.field_78288_b); -+ if (!event.isCanceled()) { - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); - this.field_184059_f.func_110434_K().func_110577_a(field_184058_a); - this.func_184052_a(k, j, bossinfoclient); - String s = bossinfoclient.func_186744_e().func_150254_d(); - this.field_184059_f.field_71466_p.func_175063_a(s, (float)(i / 2 - this.field_184059_f.field_71466_p.func_78256_a(s) / 2), (float)(j - 9), 16777215); -- j += 10 + this.field_184059_f.field_71466_p.field_78288_b; -+ } -+ j += event.getIncrement(); -+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(this.field_184059_f.field_195558_d); - if (j >= this.field_184059_f.field_195558_d.func_198087_p() / 3) { - break; - } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch deleted file mode 100644 index 12c74f624..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/net/minecraft/client/gui/GuiButton.java -+++ b/net/minecraft/client/gui/GuiButton.java -@@ -22,6 +22,7 @@ - public boolean field_146125_m = true; - protected boolean field_146123_n; - private boolean field_194832_o; -+ public int packedFGColor; // FML - - public GuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_) { - this(p_i1020_1_, p_i1020_2_, p_i1020_3_, 200, 20, p_i1020_4_); -@@ -62,6 +63,11 @@ - this.func_73729_b(this.field_146128_h + this.field_146120_f / 2, this.field_146129_i, 200 - this.field_146120_f / 2, 46 + i * 20, this.field_146120_f / 2, this.field_146121_g); - this.func_146119_b(minecraft, p_194828_1_, p_194828_2_); - int j = 14737632; -+ if (packedFGColor != 0) -+ { -+ j = packedFGColor; -+ } -+ else - if (!this.field_146124_l) { - j = 10526880; - } else if (this.field_146123_n) { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch deleted file mode 100644 index 1a6a47f6d..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/client/gui/GuiCreateWorld.java -+++ b/net/minecraft/client/gui/GuiCreateWorld.java -@@ -158,14 +158,7 @@ - this.field_146321_E.field_146125_m = false; - this.field_146322_F = this.func_189646_b(new GuiButton(8, this.field_146294_l / 2 + 5, 120, 150, 20, I18n.func_135052_a("selectWorld.customizeType")) { - public void func_194829_a(double p_194829_1_, double p_194829_3_) { -- if (WorldType.field_77139_a[GuiCreateWorld.this.field_146331_K] == WorldType.field_77138_c) { -- GuiCreateWorld.this.field_146297_k.func_147108_a(new GuiCreateFlatWorld(GuiCreateWorld.this, GuiCreateWorld.this.field_146334_a)); -- } -- -- if (WorldType.field_77139_a[GuiCreateWorld.this.field_146331_K] == WorldType.field_205394_h) { -- GuiCreateWorld.this.field_146297_k.func_147108_a(new GuiCreateBuffetWorld(GuiCreateWorld.this, GuiCreateWorld.this.field_146334_a)); -- } -- -+ WorldType.field_77139_a[GuiCreateWorld.this.field_146331_K].onCustomizeButton(GuiCreateWorld.this.field_146297_k, GuiCreateWorld.this); - } - }); - this.field_146322_F.field_146125_m = false; -@@ -257,6 +250,7 @@ - i = (long)s.hashCode(); - } - } -+ WorldType.field_77139_a[this.field_146331_K].onGUICreateWorldPress(); - - WorldSettings worldsettings = new WorldSettings(i, GameType.func_77142_a(this.field_146342_r), this.field_146341_s, this.field_146337_w, WorldType.field_77139_a[this.field_146331_K]); - worldsettings.func_205390_a(Dynamic.convert(NBTDynamicOps.field_210820_a, JsonOps.INSTANCE, this.field_146334_a)); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiEnchantment.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiEnchantment.java.patch deleted file mode 100644 index f826c54be..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiEnchantment.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/net/minecraft/client/gui/GuiEnchantment.java -+++ b/net/minecraft/client/gui/GuiEnchantment.java -@@ -153,7 +153,7 @@ - String s1 = EnchantmentNameParts.func_178176_a().func_148334_a(this.field_146289_q, i2); - FontRenderer fontrenderer = this.field_146297_k.func_211500_ak().func_211504_a(Minecraft.field_71464_q); - int j2 = 6839882; -- if ((l < i1 + 1 || this.field_146297_k.field_71439_g.field_71068_ca < l1) && !this.field_146297_k.field_71439_g.field_71075_bZ.field_75098_d) { -+ if (((l < i1 + 1 || this.field_146297_k.field_71439_g.field_71068_ca < l1) && !this.field_146297_k.field_71439_g.field_71075_bZ.field_75098_d) || this.field_147075_G.field_185001_h[i1] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels - this.func_73729_b(j1, j + 14 + 19 * i1, 0, 185, 108, 19); - this.func_73729_b(j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16); - fontrenderer.func_78279_b(s1, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1); -@@ -193,10 +193,12 @@ - Enchantment enchantment = Enchantment.func_185262_c(this.field_147075_G.field_185001_h[j]); - int l = this.field_147075_G.field_185002_i[j]; - int i1 = j + 1; -- if (this.func_195359_a(60, 14 + 19 * j, 108, 17, (double)p_73863_1_, (double)p_73863_2_) && k > 0 && l >= 0 && enchantment != null) { -+ if (this.func_195359_a(60, 14 + 19 * j, 108, 17, (double)p_73863_1_, (double)p_73863_2_) && k > 0) { - List list = Lists.newArrayList(); -- list.add("" + TextFormatting.WHITE + TextFormatting.ITALIC + I18n.func_135052_a("container.enchant.clue", enchantment.func_200305_d(l).func_150254_d())); -- if (!flag) { -+ list.add("" + TextFormatting.WHITE + TextFormatting.ITALIC + I18n.func_135052_a("container.enchant.clue", enchantment == null ? "" : enchantment.func_200305_d(l).func_150254_d())); -+ if (enchantment == null) { -+ java.util.Collections.addAll(list, "", TextFormatting.RED + I18n.func_135052_a("forge.container.enchant.limitedEnchantability")); -+ } else if (!flag) { - list.add(""); - if (this.field_146297_k.field_71439_g.field_71068_ca < k) { - list.add(TextFormatting.RED + I18n.func_135052_a("container.enchant.level.requirement", this.field_147075_G.field_75167_g[j])); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch deleted file mode 100644 index 4f9b9d6f0..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- a/net/minecraft/client/gui/GuiIngame.java -+++ b/net/minecraft/client/gui/GuiIngame.java -@@ -323,7 +323,7 @@ - } - - BlockPos blockpos = raytraceresult.func_178782_a(); -- if (!this.field_73839_d.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149716_u() || !(this.field_73839_d.field_71441_e.func_175625_s(blockpos) instanceof IInventory)) { -+ if (!this.field_73839_d.field_71441_e.func_180495_p(blockpos).hasTileEntity() || !(this.field_73839_d.field_71441_e.func_175625_s(blockpos) instanceof IInventory)) { - return; - } - } -@@ -374,7 +374,10 @@ - - for(PotionEffect potioneffect : Ordering.natural().reverse().sortedCopy(collection)) { - Potion potion = potioneffect.func_188419_a(); -- if (potion.func_76400_d() && potioneffect.func_205348_f()) { -+ if (!potion.shouldRenderHUD(potioneffect)) continue; -+ // Rebind in case previous renderHUDEffect changed texture -+ this.field_73839_d.func_110434_K().func_110577_a(GuiContainer.field_147001_a); -+ if (potioneffect.func_205348_f()) { - int k = this.field_194811_H; - int l = 1; - if (this.field_73839_d.func_71355_q()) { -@@ -406,7 +409,10 @@ - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, f); - int l1 = i1 % 12; - int k1 = i1 / 12; -+ // FORGE - Move status icon check down from above so renderHUDEffect will still be called without a status icon -+ if (potion.func_76400_d()) - this.func_73729_b(k + 3, l + 3, l1 * 18, 198 + k1 * 18, 18, 18); -+ potion.renderHUDEffect(potioneffect, this, k, l, this.field_73735_i, f); - } - } - -@@ -548,7 +554,13 @@ - GlStateManager.func_179094_E(); - GlStateManager.func_179147_l(); - GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); -+ FontRenderer font = field_92016_l.func_77973_b().getFontRenderer(field_92016_l); -+ if (font == null) { - this.func_175179_f().func_175063_a(s, (float)i, (float)j, 16777215 + (k << 24)); -+ } else { -+ i = (this.field_194811_H - font.func_78256_a(s)) / 2; -+ font.func_175063_a(s, (float)i, (float)j, 16777215 + (k << 24)); -+ } - GlStateManager.func_179084_k(); - GlStateManager.func_179121_F(); - } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch deleted file mode 100644 index cb3e722bc..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- a/net/minecraft/client/gui/GuiKeyBindingList.java -+++ b/net/minecraft/client/gui/GuiKeyBindingList.java -@@ -41,7 +41,7 @@ - } - - protected int func_148137_d() { -- return super.func_148137_d() + 15; -+ return super.func_148137_d() + 35; - } - - public int func_148139_c() { -@@ -77,13 +77,14 @@ - private KeyEntry(final KeyBinding p_i45029_2_) { - this.field_148282_b = p_i45029_2_; - this.field_148283_c = I18n.func_135052_a(p_i45029_2_.func_151464_g()); -- this.field_148280_d = new GuiButton(0, 0, 0, 75, 20, I18n.func_135052_a(p_i45029_2_.func_151464_g())) { -+ this.field_148280_d = new GuiButton(0, 0, 0, 95, 20, I18n.func_135052_a(p_i45029_2_.func_197978_k())) { - public void func_194829_a(double p_194829_1_, double p_194829_3_) { - GuiKeyBindingList.this.field_148191_k.field_146491_f = p_i45029_2_; - } - }; - this.field_148281_e = new GuiButton(0, 0, 0, 50, 20, I18n.func_135052_a("controls.reset")) { - public void func_194829_a(double p_194829_1_, double p_194829_3_) { -+ field_148282_b.setToDefault(); - GuiKeyBindingList.this.field_148189_l.field_71474_y.func_198014_a(p_i45029_2_, p_i45029_2_.func_197977_i()); - KeyBinding.func_74508_b(); - } -@@ -95,7 +96,7 @@ - int j = this.func_195002_d(); - boolean flag = GuiKeyBindingList.this.field_148191_k.field_146491_f == this.field_148282_b; - GuiKeyBindingList.this.field_148189_l.field_71466_p.func_211126_b(this.field_148283_c, (float)(j + 90 - GuiKeyBindingList.this.field_148188_n), (float)(i + p_194999_2_ / 2 - GuiKeyBindingList.this.field_148189_l.field_71466_p.field_78288_b / 2), 16777215); -- this.field_148281_e.field_146128_h = j + 190; -+ this.field_148281_e.field_146128_h = j + 210; - this.field_148281_e.field_146129_i = i; - this.field_148281_e.field_146124_l = !this.field_148282_b.func_197985_l(); - this.field_148281_e.func_194828_a(p_194999_3_, p_194999_4_, p_194999_6_); -@@ -103,11 +104,12 @@ - this.field_148280_d.field_146129_i = i; - this.field_148280_d.field_146126_j = this.field_148282_b.func_197978_k(); - boolean flag1 = false; -+ boolean keyCodeModifierConflict = true; // less severe form of conflict, like SHIFT conflicting with SHIFT+G - if (!this.field_148282_b.func_197986_j()) { - for(KeyBinding keybinding : GuiKeyBindingList.this.field_148189_l.field_71474_y.field_74324_K) { - if (keybinding != this.field_148282_b && this.field_148282_b.func_197983_b(keybinding)) { - flag1 = true; -- break; -+ keyCodeModifierConflict &= keybinding.hasKeyCodeModifierConflict(this.field_148282_b); - } - } - } -@@ -115,7 +117,7 @@ - if (flag) { - this.field_148280_d.field_146126_j = TextFormatting.WHITE + "> " + TextFormatting.YELLOW + this.field_148280_d.field_146126_j + TextFormatting.WHITE + " <"; - } else if (flag1) { -- this.field_148280_d.field_146126_j = TextFormatting.RED + this.field_148280_d.field_146126_j; -+ this.field_148280_d.field_146126_j = (keyCodeModifierConflict ? TextFormatting.GOLD : TextFormatting.RED) + this.field_148280_d.field_146126_j; - } - - this.field_148280_d.func_194828_a(p_194999_3_, p_194999_4_, p_194999_6_); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiLanguage.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiLanguage.java.patch deleted file mode 100644 index caab4e697..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiLanguage.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/gui/GuiLanguage.java -+++ b/net/minecraft/client/gui/GuiLanguage.java -@@ -82,7 +82,7 @@ - Language language = this.field_148177_m.get(this.field_148176_l.get(p_195078_1_)); - GuiLanguage.this.field_146454_h.func_135045_a(language); - GuiLanguage.this.field_146451_g.field_74363_ab = language.func_135034_a(); -- this.field_148161_k.func_110436_a(); -+ net.minecraftforge.client.ForgeHooksClient.refreshResources(GuiLanguage.this.field_146297_k, net.minecraftforge.resource.VanillaResourceType.LANGUAGES); - GuiLanguage.this.field_146289_q.func_78275_b(GuiLanguage.this.field_146454_h.func_135044_b()); - GuiLanguage.this.field_146452_r.field_146126_j = I18n.func_135052_a("gui.done"); - GuiLanguage.this.field_211832_i.field_146126_j = GuiLanguage.this.field_146451_g.func_74297_c(GameSettings.Options.FORCE_UNICODE_FONT); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch deleted file mode 100644 index 3becbc27d..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- a/net/minecraft/client/gui/GuiMainMenu.java -+++ b/net/minecraft/client/gui/GuiMainMenu.java -@@ -59,6 +59,7 @@ - private int field_193978_M; - private int field_193979_N; - private final RenderSkybox field_209101_K = new RenderSkybox(new RenderSkyboxCube(new ResourceLocation("textures/gui/title/background/panorama"))); -+ private net.minecraftforge.client.gui.NotificationModUpdateScreen modUpdateNotification; - - public GuiMainMenu() { - this.field_73975_c = "missingno"; -@@ -176,7 +177,7 @@ - if (this.func_183501_a()) { - this.field_183503_M.func_146280_a(this.field_146297_k, this.field_146294_l, this.field_146295_m); - } -- -+ modUpdateNotification = net.minecraftforge.client.gui.NotificationModUpdateScreen.init(this, field_146292_n.stream().filter(b -> b.field_146127_k == 6).findFirst().orElse(null)); // The Mobs button is id 6 - } - - private void func_73969_a(int p_73969_1_, int p_73969_2_) { -@@ -190,11 +191,17 @@ - GuiMainMenu.this.field_146297_k.func_147108_a(new GuiMultiplayer(GuiMainMenu.this)); - } - }); -- this.func_189646_b(new GuiButton(14, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("menu.online")) { -+ this.func_189646_b(new GuiButton(14, this.field_146294_l / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.func_135052_a("menu.online")) { - public void func_194829_a(double p_194829_1_, double p_194829_3_) { - GuiMainMenu.this.func_140005_i(); - } - }); -+ this.func_189646_b(new GuiButton(6, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.func_135052_a("fml.menu.mods")) { -+ @Override -+ public void func_194829_a(double p_194829_1_, double p_194829_3_) { -+ GuiMainMenu.this.field_146297_k.func_147108_a(new net.minecraftforge.fml.client.gui.GuiModList(GuiMainMenu.this)); -+ } -+ }); - } - - private void func_73972_b(int p_73972_1_, int p_73972_2_) { -@@ -204,7 +211,7 @@ - } - }); - this.field_73973_d = this.func_189646_b(new GuiButton(12, this.field_146294_l / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.func_135052_a("menu.resetdemo")) { -- public void func_194829_a(double p_194829_1_, double p_194829_3_) { -+ public void func_194829_a(double mouseX, double mouseY) { - ISaveFormat isaveformat1 = GuiMainMenu.this.field_146297_k.func_71359_d(); - WorldInfo worldinfo1 = isaveformat1.func_75803_c("Demo_World"); - if (worldinfo1 != null) { -@@ -266,6 +273,9 @@ - - this.field_146297_k.func_110434_K().func_110577_a(field_194400_H); - func_146110_a(j + 88, 67, 0.0F, 0.0F, 98, 14, 128.0F, 16.0F); -+ -+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.field_146289_q, this.field_146294_l, this.field_146295_m); -+ - GlStateManager.func_179094_E(); - GlStateManager.func_179109_b((float)(this.field_146294_l / 2 + 90), 70.0F, 0.0F); - GlStateManager.func_179114_b(-20.0F, 0.0F, 0.0F, 1.0F); -@@ -281,7 +291,10 @@ - s = s + ("release".equalsIgnoreCase(this.field_146297_k.func_184123_d()) ? "" : "/" + this.field_146297_k.func_184123_d()); - } - -- this.func_73731_b(this.field_146289_q, s, 2, this.field_146295_m - 10, -1); -+ net.minecraftforge.fml.BrandingControl.forEachLine(true, true, (brdline, brd) -> -+ this.func_73731_b(this.field_146289_q, brd, 2, this.field_146295_m - ( 10 + brdline * (this.field_146289_q.field_78288_b + 1)), 16777215) -+ ); -+ - this.func_73731_b(this.field_146289_q, "Copyright Mojang AB. Do not distribute!", this.field_193979_N, this.field_146295_m - 10, -1); - if (p_73863_1_ > this.field_193979_N && p_73863_1_ < this.field_193979_N + this.field_193978_M && p_73863_2_ > this.field_146295_m - 10 && p_73863_2_ < this.field_146295_m) { - func_73734_a(this.field_193979_N, this.field_146295_m - 1, this.field_193979_N + this.field_193978_M, this.field_146295_m, -1); -@@ -297,6 +310,7 @@ - if (this.func_183501_a()) { - this.field_183503_M.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); - } -+ modUpdateNotification.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); - - } - diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch deleted file mode 100644 index 20e545c4d..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ /dev/null @@ -1,105 +0,0 @@ ---- a/net/minecraft/client/gui/GuiScreen.java -+++ b/net/minecraft/client/gui/GuiScreen.java -@@ -87,7 +87,10 @@ - } - - protected void func_146285_a(ItemStack p_146285_1_, int p_146285_2_, int p_146285_3_) { -- this.func_146283_a(this.func_191927_a(p_146285_1_), p_146285_2_, p_146285_3_); -+ FontRenderer font = p_146285_1_.func_77973_b().getFontRenderer(p_146285_1_); -+ net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(p_146285_1_); -+ this.drawHoveringText(this.func_191927_a(p_146285_1_), p_146285_2_, p_146285_3_, (font == null ? field_146289_q : font)); -+ net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip(); - } - - public List func_191927_a(ItemStack p_191927_1_) { -@@ -106,25 +109,30 @@ - } - - public void func_146283_a(List p_146283_1_, int p_146283_2_, int p_146283_3_) { -- if (!p_146283_1_.isEmpty()) { -+ drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146289_q); -+ } -+ -+ public void drawHoveringText(List textLines, int x, int y, FontRenderer font) { -+ net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(textLines, x, y, field_146294_l, field_146295_m, -1, font); -+ if (false && !textLines.isEmpty()) { - GlStateManager.func_179101_C(); - RenderHelper.func_74518_a(); - GlStateManager.func_179140_f(); - GlStateManager.func_179097_i(); - int i = 0; - -- for(String s : p_146283_1_) { -+ for(String s : textLines) { - int j = this.field_146289_q.func_78256_a(s); - if (j > i) { - i = j; - } - } - -- int l1 = p_146283_2_ + 12; -- int i2 = p_146283_3_ - 12; -+ int l1 = x + 12; -+ int i2 = y - 12; - int k = 8; -- if (p_146283_1_.size() > 1) { -- k += 2 + (p_146283_1_.size() - 1) * 10; -+ if (textLines.size() > 1) { -+ k += 2 + (textLines.size() - 1) * 10; - } - - if (l1 + i > this.field_146294_l) { -@@ -150,8 +158,8 @@ - this.func_73733_a(l1 - 3, i2 - 3, l1 + i + 3, i2 - 3 + 1, 1347420415, 1347420415); - this.func_73733_a(l1 - 3, i2 + k + 2, l1 + i + 3, i2 + k + 3, 1344798847, 1344798847); - -- for(int k1 = 0; k1 < p_146283_1_.size(); ++k1) { -- String s1 = p_146283_1_.get(k1); -+ for(int k1 = 0; k1 < textLines.size(); ++k1) { -+ String s1 = textLines.get(k1); - this.field_146289_q.func_175063_a(s1, (float)l1, (float)i2, -1); - if (k1 == 0) { - i2 += 2; -@@ -279,9 +287,12 @@ - } - - public void func_175281_b(String p_175281_1_, boolean p_175281_2_) { -+ p_175281_1_ = net.minecraftforge.event.ForgeEventFactory.onClientSendMessage(p_175281_1_); -+ if (p_175281_1_.isEmpty()) return; - if (p_175281_2_) { - this.field_146297_k.field_71456_v.func_146158_b().func_146239_a(p_175281_1_); - } -+ //if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.player, msg) != 0) return; //Forge: TODO Client command re-write - - this.field_146297_k.field_71439_g.func_71165_d(p_175281_1_); - } -@@ -292,9 +303,13 @@ - this.field_146289_q = p_146280_1_.field_71466_p; - this.field_146294_l = p_146280_2_; - this.field_146295_m = p_146280_3_; -+ java.util.function.Consumer remove = (b) -> { field_146292_n.remove(b); field_195124_j.remove(b); }; -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.field_146292_n, this::func_189646_b, remove))) { - this.field_146292_n.clear(); - this.field_195124_j.clear(); - this.func_73866_w_(); -+ } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.field_146292_n, this::func_189646_b, remove)); - } - - public List func_195074_b() { -@@ -318,6 +333,7 @@ - public void func_146270_b(int p_146270_1_) { - if (this.field_146297_k.field_71441_e != null) { - this.func_73733_a(0, 0, this.field_146294_l, this.field_146295_m, -1072689136, -804253680); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this)); - } else { - this.func_146278_c(p_146270_1_); - } -@@ -338,6 +354,7 @@ - bufferbuilder.func_181662_b((double)this.field_146294_l, 0.0D, 0.0D).func_187315_a((double)((float)this.field_146294_l / 32.0F), (double)p_146278_1_).func_181669_b(64, 64, 64, 255).func_181675_d(); - bufferbuilder.func_181662_b(0.0D, 0.0D, 0.0D).func_187315_a(0.0D, (double)p_146278_1_).func_181669_b(64, 64, 64, 255).func_181675_d(); - tessellator.func_78381_a(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this)); - } - - public boolean func_73868_f() { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreenResourcePacks.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreenResourcePacks.java.patch deleted file mode 100644 index 72406c772..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiScreenResourcePacks.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/client/gui/GuiScreenResourcePacks.java -+++ b/net/minecraft/client/gui/GuiScreenResourcePacks.java -@@ -84,12 +84,15 @@ - resourcepacklist.func_198983_a(); - List list = Lists.newArrayList(resourcepacklist.func_198978_b()); - list.removeAll(resourcepacklist.func_198980_d()); -+ list.removeIf(net.minecraft.resources.ResourcePackInfo::isHidden); // Forge: Hide some resource packs from the UI entirely - - for(ResourcePackInfoClient resourcepackinfoclient : list) { - this.field_146970_i.func_195095_a(new ResourcePackListEntryFound(this, resourcepackinfoclient)); - } - -- for(ResourcePackInfoClient resourcepackinfoclient1 : Lists.reverse(Lists.newArrayList(resourcepacklist.func_198980_d()))) { -+ java.util.Collection enabledList = resourcepacklist.func_198980_d(); -+ enabledList.removeIf(net.minecraft.resources.ResourcePackInfo::isHidden); // Forge: Hide some resource packs from the UI entirely -+ for(ResourcePackInfoClient resourcepackinfoclient1 : Lists.reverse(Lists.newArrayList(enabledList))) { - this.field_146967_r.func_195095_a(new ResourcePackListEntryFound(this, resourcepackinfoclient1)); - } - } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch deleted file mode 100644 index 9f5172a0f..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/gui/GuiSleepMP.java -+++ b/net/minecraft/client/gui/GuiSleepMP.java -@@ -27,7 +27,7 @@ - } else if (p_keyPressed_1_ == 257 || p_keyPressed_1_ == 335) { - String s = this.field_146415_a.func_146179_b().trim(); - if (!s.isEmpty()) { -- this.field_146297_k.field_71439_g.func_71165_d(s); -+ this.func_175275_f(s); // Forge: fix vanilla not adding messages to the sent list while sleeping - } - - this.field_146415_a.func_146180_a(""); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch deleted file mode 100644 index ecaf25bca..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/net/minecraft/client/gui/GuiSlot.java -+++ b/net/minecraft/client/gui/GuiSlot.java -@@ -144,15 +144,8 @@ - GlStateManager.func_179106_n(); - Tessellator tessellator = Tessellator.func_178181_a(); - BufferBuilder bufferbuilder = tessellator.func_178180_c(); -- this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k); -- GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); -- float f = 32.0F; -- bufferbuilder.func_181668_a(7, DefaultVertexFormats.field_181709_i); -- bufferbuilder.func_181662_b((double)this.field_148152_e, (double)this.field_148154_c, 0.0D).func_187315_a((double)((float)this.field_148152_e / 32.0F), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- bufferbuilder.func_181662_b((double)this.field_148151_d, (double)this.field_148154_c, 0.0D).func_187315_a((double)((float)this.field_148151_d / 32.0F), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- bufferbuilder.func_181662_b((double)this.field_148151_d, (double)this.field_148153_b, 0.0D).func_187315_a((double)((float)this.field_148151_d / 32.0F), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- bufferbuilder.func_181662_b((double)this.field_148152_e, (double)this.field_148153_b, 0.0D).func_187315_a((double)((float)this.field_148152_e / 32.0F), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- tessellator.func_78381_a(); -+ // Forge: background rendering moved into separate method. -+ this.drawContainerBackground(tessellator); - int k = this.field_148152_e + this.field_148155_a / 2 - this.func_148139_c() / 2 + 2; - int l = this.field_148153_b + 4 - (int)this.field_148169_q; - if (this.field_148165_u) { -@@ -369,4 +362,17 @@ - public int func_148146_j() { - return this.field_148149_f; - } -+ -+ protected void drawContainerBackground(Tessellator tessellator) { -+ BufferBuilder buffer = tessellator.func_178180_c(); -+ this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k); -+ GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); -+ float scale = 32.0F; -+ buffer.func_181668_a(7, DefaultVertexFormats.field_181709_i); -+ buffer.func_181662_b((double)this.field_148152_e, (double)this.field_148154_c, 0.0D).func_187315_a(this.field_148152_e / scale, (this.field_148154_c + (int)this.field_148169_q) / scale).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ buffer.func_181662_b((double)this.field_148151_d, (double)this.field_148154_c, 0.0D).func_187315_a(this.field_148151_d / scale, (this.field_148154_c + (int)this.field_148169_q) / scale).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ buffer.func_181662_b((double)this.field_148151_d, (double)this.field_148153_b, 0.0D).func_187315_a(this.field_148151_d / scale, (this.field_148153_b + (int)this.field_148169_q) / scale).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ buffer.func_181662_b((double)this.field_148152_e, (double)this.field_148153_b, 0.0D).func_187315_a(this.field_148152_e / scale, (this.field_148153_b + (int)this.field_148169_q) / scale).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ tessellator.func_78381_a(); -+ } - } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiVideoSettings.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiVideoSettings.java.patch deleted file mode 100644 index 468f0133e..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiVideoSettings.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/client/gui/GuiVideoSettings.java -+++ b/net/minecraft/client/gui/GuiVideoSettings.java -@@ -94,4 +94,10 @@ - this.func_73732_a(this.field_146289_q, this.field_146500_a, this.field_146294_l / 2, 5, 16777215); - super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); - } -+ -+ @Override // FORGE: fix for MC-64581 very laggy mipmap slider -+ public void func_146281_b() { -+ super.func_146281_b(); -+ this.field_146297_k.field_71474_y.onGuiClosed(); -+ } - } diff --git a/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch b/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch new file mode 100644 index 000000000..48d3ab751 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/IngameGui.java.patch @@ -0,0 +1,40 @@ +--- a/net/minecraft/client/gui/IngameGui.java ++++ b/net/minecraft/client/gui/IngameGui.java +@@ -408,6 +408,9 @@ + + for(EffectInstance effectinstance : Ordering.natural().reverse().sortedCopy(collection)) { + Effect effect = effectinstance.func_188419_a(); ++ if (!effect.shouldRenderHUD(effectinstance)) continue; ++ // Rebind in case previous renderHUDEffect changed texture ++ this.field_73839_d.func_110434_K().func_110577_a(ContainerScreen.field_147001_a); + if (effectinstance.func_205348_f()) { + int k = this.field_194811_H; + int l = 1; +@@ -439,11 +442,13 @@ + float f_f = f; + int k_f = k; + int l_f = l; ++ + TextureAtlasSprite textureatlassprite = potionspriteuploader.func_215288_a(effect); + list.add(() -> { + GlStateManager.color4f(1.0F, 1.0F, 1.0F, f_f); + blit(k_f + 3, l_f + 3, this.blitOffset, 18, 18, textureatlassprite); + }); ++ effect.renderHUDEffect(effectinstance, this, k, l, this.blitOffset, f); + } + } + +@@ -588,7 +593,13 @@ + GlStateManager.enableBlend(); + GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + fill(i - 2, j - 2, i + this.func_175179_f().func_78256_a(s) + 2, j + 9 + 2, this.field_73839_d.field_71474_y.func_216839_a(0)); ++ FontRenderer font = field_92016_l.func_77973_b().getFontRenderer(field_92016_l); ++ if (font == null) { + this.func_175179_f().func_175063_a(s, (float)i, (float)j, 16777215 + (k << 24)); ++ } else { ++ i = (this.field_194811_H - font.func_78256_a(s)) / 2; ++ font.func_175063_a(s, (float)i, (float)j, 16777215 + (k << 24)); ++ } + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + } diff --git a/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch index 9cd723fb2..2f83e7c21 100644 --- a/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/MapItemRenderer.java.patch @@ -6,5 +6,5 @@ if (!p_148237_1_ || mapdecoration.func_191180_f()) { + if (mapdecoration.render(k)) { k++; continue; } MapItemRenderer.this.field_148251_b.func_110577_a(MapItemRenderer.field_148253_a); - GlStateManager.func_179094_E(); - GlStateManager.func_179109_b(0.0F + (float)mapdecoration.func_176112_b() / 2.0F + 64.0F, 0.0F + (float)mapdecoration.func_176113_c() / 2.0F + 64.0F, -0.02F); + GlStateManager.pushMatrix(); + GlStateManager.translatef(0.0F + (float)mapdecoration.func_176112_b() / 2.0F + 64.0F, 0.0F + (float)mapdecoration.func_176113_c() / 2.0F + 64.0F, -0.02F); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch b/patches/minecraft/net/minecraft/client/gui/RenderComponentsUtil.java.patch similarity index 52% rename from patches/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch rename to patches/minecraft/net/minecraft/client/gui/RenderComponentsUtil.java.patch index b4bf8a1b4..98e7099b4 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/RenderComponentsUtil.java.patch @@ -1,10 +1,10 @@ ---- a/net/minecraft/client/gui/GuiUtilRenderComponents.java -+++ b/net/minecraft/client/gui/GuiUtilRenderComponents.java +--- a/net/minecraft/client/gui/RenderComponentsUtil.java ++++ b/net/minecraft/client/gui/RenderComponentsUtil.java @@ -54,6 +54,7 @@ s2 = ""; s3 = s4; } + s3 = TextFormatting.func_211164_a(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping. - ITextComponent itextcomponent4 = (new TextComponentString(s3)).func_150255_a(itextcomponent1.func_150256_b().func_150232_l()); + ITextComponent itextcomponent4 = (new StringTextComponent(s3)).func_150255_a(itextcomponent1.func_150256_b().func_150232_l()); list1.add(j + 1, itextcomponent4); diff --git a/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch b/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch deleted file mode 100644 index a6d90336f..000000000 --- a/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/client/gui/ServerListEntryNormal.java -+++ b/net/minecraft/client/gui/ServerListEntryNormal.java -@@ -143,6 +143,7 @@ - } else if (k1 >= p_194999_1_ - l - 15 - 2 && k1 <= p_194999_1_ - 15 - 2 && l1 >= 0 && l1 <= 8) { - this.field_148303_c.func_146793_a(s); - } -+ net.minecraftforge.fml.client.ClientHooks.drawForgePingInfo(this.field_148303_c, field_148301_e, j, i, p_194999_1_, k1, l1); - - if (this.field_148300_d.field_71474_y.field_85185_A || p_194999_5_) { - this.field_148300_d.func_110434_K().func_110577_a(field_178014_d); diff --git a/patches/minecraft/net/minecraft/client/gui/SlotGui.java.patch b/patches/minecraft/net/minecraft/client/gui/SlotGui.java.patch new file mode 100644 index 000000000..19b0176ff --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/SlotGui.java.patch @@ -0,0 +1,38 @@ +--- a/net/minecraft/client/gui/SlotGui.java ++++ b/net/minecraft/client/gui/SlotGui.java +@@ -154,15 +154,8 @@ + GlStateManager.disableFog(); + Tessellator tessellator = Tessellator.func_178181_a(); + BufferBuilder bufferbuilder = tessellator.func_178180_c(); +- this.minecraft.func_110434_K().func_110577_a(AbstractGui.BACKGROUND_LOCATION); +- GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); +- float f = 32.0F; +- bufferbuilder.func_181668_a(7, DefaultVertexFormats.field_181709_i); +- bufferbuilder.func_181662_b((double)this.x0, (double)this.y1, 0.0D).func_187315_a((double)((float)this.x0 / 32.0F), (double)((float)(this.y1 + (int)this.yo) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- bufferbuilder.func_181662_b((double)this.x1, (double)this.y1, 0.0D).func_187315_a((double)((float)this.x1 / 32.0F), (double)((float)(this.y1 + (int)this.yo) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- bufferbuilder.func_181662_b((double)this.x1, (double)this.y0, 0.0D).func_187315_a((double)((float)this.x1 / 32.0F), (double)((float)(this.y0 + (int)this.yo) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- bufferbuilder.func_181662_b((double)this.x0, (double)this.y0, 0.0D).func_187315_a((double)((float)this.x0 / 32.0F), (double)((float)(this.y0 + (int)this.yo) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- tessellator.func_78381_a(); ++ // Forge: background rendering moved into separate method. ++ this.drawContainerBackground(tessellator); + int k = this.x0 + this.width / 2 - this.getRowWidth() / 2 + 2; + int l = this.y0 + 4 - (int)this.yo; + if (this.renderHeader) { +@@ -402,4 +395,17 @@ + public int getItemHeight() { + return this.itemHeight; + } ++ ++ protected void drawContainerBackground(Tessellator tessellator) { ++ BufferBuilder buffer = tessellator.func_178180_c(); ++ this.minecraft.func_110434_K().func_110577_a(AbstractGui.BACKGROUND_LOCATION); ++ GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); ++ float scale = 32.0F; ++ buffer.func_181668_a(7, DefaultVertexFormats.field_181709_i); ++ buffer.func_181662_b((double)this.x0, (double)this.y1, 0.0D).func_187315_a(this.x0 / scale, (this.y1 + (int)this.yo) / scale).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ buffer.func_181662_b((double)this.x1, (double)this.y1, 0.0D).func_187315_a(this.x1 / scale, (this.y1 + (int)this.yo) / scale).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ buffer.func_181662_b((double)this.x1, (double)this.y0, 0.0D).func_187315_a(this.x1 / scale, (this.y0 + (int)this.yo) / scale).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ buffer.func_181662_b((double)this.x0, (double)this.y0, 0.0D).func_187315_a(this.x0 / scale, (this.y0 + (int)this.yo) / scale).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ tessellator.func_78381_a(); ++ } + } diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch deleted file mode 100644 index 32dca7037..000000000 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/client/gui/achievement/GuiStats.java -+++ b/net/minecraft/client/gui/achievement/GuiStats.java -@@ -122,8 +122,8 @@ - public void func_193026_g() { - if (this.field_146543_v) { - this.func_193028_a(); -- this.func_193029_f(); - this.field_146545_u = this.field_146550_h; -+ this.func_193029_f(); //Forge: Bugfix, initButtons adds displaySlot to children, so set it first to prevent NPE - this.field_146543_v = false; - } - diff --git a/patches/minecraft/net/minecraft/client/gui/advancements/GuiAdvancementTab.java.patch b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch similarity index 65% rename from patches/minecraft/net/minecraft/client/gui/advancements/GuiAdvancementTab.java.patch rename to patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch index ba044b3f0..9bc0f5f6b 100644 --- a/patches/minecraft/net/minecraft/client/gui/advancements/GuiAdvancementTab.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementTabGui.java.patch @@ -1,18 +1,18 @@ ---- a/net/minecraft/client/gui/advancements/GuiAdvancementTab.java -+++ b/net/minecraft/client/gui/advancements/GuiAdvancementTab.java +--- a/net/minecraft/client/gui/advancements/AdvancementTabGui.java ++++ b/net/minecraft/client/gui/advancements/AdvancementTabGui.java @@ -36,6 +36,7 @@ private int field_191814_q = Integer.MIN_VALUE; private float field_191815_r; private boolean field_192992_s; + private int page; - public GuiAdvancementTab(Minecraft p_i47589_1_, GuiScreenAdvancements p_i47589_2_, AdvancementTabType p_i47589_3_, int p_i47589_4_, Advancement p_i47589_5_, DisplayInfo p_i47589_6_) { + public AdvancementTabGui(Minecraft p_i47589_1_, AdvancementsScreen p_i47589_2_, AdvancementTabType p_i47589_3_, int p_i47589_4_, Advancement p_i47589_5_, DisplayInfo p_i47589_6_) { this.field_191802_a = p_i47589_1_; @@ -50,6 +51,15 @@ this.func_193937_a(this.field_191809_l, p_i47589_5_); } -+ public GuiAdvancementTab(Minecraft mc, GuiScreenAdvancements screen, AdvancementTabType type, int index, int page, Advancement adv, DisplayInfo info) { ++ public AdvancementTabGui(Minecraft mc, AdvancementsScreen screen, AdvancementTabType type, int index, int page, Advancement adv, DisplayInfo info) { + this(mc, screen, type, index, adv, info); + this.page = page; + } @@ -29,9 +29,9 @@ } else { for(AdvancementTabType advancementtabtype : AdvancementTabType.values()) { - if (p_193936_2_ < advancementtabtype.func_192650_a()) { -- return new GuiAdvancementTab(p_193936_0_, p_193936_1_, advancementtabtype, p_193936_2_, p_193936_3_, p_193936_3_.func_192068_c()); +- return new AdvancementTabGui(p_193936_0_, p_193936_1_, advancementtabtype, p_193936_2_, p_193936_3_, p_193936_3_.func_192068_c()); + if ((p_193936_2_ % AdvancementTabType.MAX_TABS) < advancementtabtype.func_192650_a()) { -+ return new GuiAdvancementTab(p_193936_0_, p_193936_1_, advancementtabtype, p_193936_2_ % AdvancementTabType.MAX_TABS, p_193936_2_ / AdvancementTabType.MAX_TABS, p_193936_3_, p_193936_3_.func_192068_c()); ++ return new AdvancementTabGui(p_193936_0_, p_193936_1_, advancementtabtype, p_193936_2_ % AdvancementTabType.MAX_TABS, p_193936_2_ / AdvancementTabType.MAX_TABS, p_193936_3_, p_193936_3_.func_192068_c()); } p_193936_2_ -= advancementtabtype.func_192650_a(); diff --git a/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementsScreen.java.patch new file mode 100644 index 000000000..d4f66f44c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/advancements/AdvancementsScreen.java.patch @@ -0,0 +1,72 @@ +--- a/net/minecraft/client/gui/advancements/AdvancementsScreen.java ++++ b/net/minecraft/client/gui/advancements/AdvancementsScreen.java +@@ -25,6 +25,7 @@ + private final Map field_191947_i = Maps.newLinkedHashMap(); + private AdvancementTabGui field_191940_s; + private boolean field_191944_v; ++ private static int tabPage, maxPages; + + public AdvancementsScreen(ClientAdvancementManager p_i47383_1_) { + super(NarratorChatListener.field_216868_a); +@@ -40,7 +41,13 @@ + } else { + this.field_191946_h.func_194230_a(this.field_191940_s == null ? null : this.field_191940_s.func_193935_c(), true); + } +- ++ if (this.field_191947_i.size() > AdvancementTabType.MAX_TABS) { ++ int guiLeft = (this.width - 252) / 2; ++ int guiTop = (this.height - 140) / 2; ++ addButton(new net.minecraft.client.gui.widget.button.Button(guiLeft, guiTop - 50, 20, 20, "<", b -> tabPage = Math.max(tabPage - 1, 0 ))); ++ addButton(new net.minecraft.client.gui.widget.button.Button(guiLeft + 252 - 20, guiTop - 50, 20, 20, ">", b -> tabPage = Math.min(tabPage + 1, maxPages))); ++ maxPages = this.field_191947_i.size() / AdvancementTabType.MAX_TABS; ++ } + } + + public void removed() { +@@ -58,7 +65,7 @@ + int j = (this.height - 140) / 2; + + for(AdvancementTabGui advancementtabgui : this.field_191947_i.values()) { +- if (advancementtabgui.func_195627_a(i, j, p_mouseClicked_1_, p_mouseClicked_3_)) { ++ if (advancementtabgui.getPage() == tabPage && advancementtabgui.func_195627_a(i, j, p_mouseClicked_1_, p_mouseClicked_3_)) { + this.field_191946_h.func_194230_a(advancementtabgui.func_193935_c(), true); + break; + } +@@ -83,6 +90,12 @@ + int j = (this.height - 140) / 2; + this.renderBackground(); + this.func_191936_c(p_render_1_, p_render_2_, i, j); ++ if (maxPages != 0) { ++ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); ++ int width = this.font.func_78256_a(page); ++ GlStateManager.disableLighting(); ++ this.font.func_175063_a(page, i + (252 / 2) - (width / 2), j - 44, -1); ++ } + this.func_191934_b(i, j); + this.func_191937_d(p_render_1_, p_render_2_, i, j); + } +@@ -131,6 +144,7 @@ + this.minecraft.func_110434_K().func_110577_a(field_191945_g); + + for(AdvancementTabGui advancementtabgui : this.field_191947_i.values()) { ++ if (advancementtabgui.getPage() == tabPage) + advancementtabgui.func_191798_a(p_191934_1_, p_191934_2_, advancementtabgui == this.field_191940_s); + } + +@@ -139,6 +153,7 @@ + RenderHelper.func_74520_c(); + + for(AdvancementTabGui advancementtabgui1 : this.field_191947_i.values()) { ++ if (advancementtabgui1.getPage() == tabPage) + advancementtabgui1.func_191796_a(p_191934_1_, p_191934_2_, this.itemRenderer); + } + +@@ -161,7 +176,7 @@ + + if (this.field_191947_i.size() > 1) { + for(AdvancementTabGui advancementtabgui : this.field_191947_i.values()) { +- if (advancementtabgui.func_195627_a(p_191937_3_, p_191937_4_, (double)p_191937_1_, (double)p_191937_2_)) { ++ if (advancementtabgui.getPage() == tabPage && advancementtabgui.func_195627_a(p_191937_3_, p_191937_4_, (double)p_191937_1_, (double)p_191937_2_)) { + this.renderTooltip(advancementtabgui.func_191795_d(), p_191937_1_, p_191937_2_); + } + } diff --git a/patches/minecraft/net/minecraft/client/gui/advancements/GuiScreenAdvancements.java.patch b/patches/minecraft/net/minecraft/client/gui/advancements/GuiScreenAdvancements.java.patch deleted file mode 100644 index 36cb02889..000000000 --- a/patches/minecraft/net/minecraft/client/gui/advancements/GuiScreenAdvancements.java.patch +++ /dev/null @@ -1,82 +0,0 @@ ---- a/net/minecraft/client/gui/advancements/GuiScreenAdvancements.java -+++ b/net/minecraft/client/gui/advancements/GuiScreenAdvancements.java -@@ -24,6 +24,7 @@ - private final Map field_191947_i = Maps.newLinkedHashMap(); - private GuiAdvancementTab field_191940_s; - private boolean field_191944_v; -+ private static int tabPage, maxPages; - - public GuiScreenAdvancements(ClientAdvancementManager p_i47383_1_) { - this.field_191946_h = p_i47383_1_; -@@ -38,7 +39,23 @@ - } else { - this.field_191946_h.func_194230_a(this.field_191940_s == null ? null : this.field_191940_s.func_193935_c(), true); - } -- -+ if (this.field_191947_i.size() > AdvancementTabType.MAX_TABS) { -+ int guiLeft = (this.field_146294_l - 252) / 2; -+ int guiTop = (this.field_146295_m - 140) / 2; -+ func_189646_b(new net.minecraft.client.gui.GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<") { -+ @Override -+ public void func_194829_a(double mouseX, double mouseY) { -+ tabPage = Math.max(tabPage - 1, 0); -+ } -+ }); -+ func_189646_b(new net.minecraft.client.gui.GuiButton(102, guiLeft + 252 - 20, guiTop - 50, 20, 20, ">") { -+ @Override -+ public void func_194829_a(double mouseX, double mouseY) { -+ tabPage = Math.min(tabPage + 1, maxPages); -+ } -+ }); -+ maxPages = this.field_191947_i.size() / AdvancementTabType.MAX_TABS; -+ } - } - - public void func_146281_b() { -@@ -56,7 +73,7 @@ - int j = (this.field_146295_m - 140) / 2; - - for(GuiAdvancementTab guiadvancementtab : this.field_191947_i.values()) { -- if (guiadvancementtab.func_195627_a(i, j, p_mouseClicked_1_, p_mouseClicked_3_)) { -+ if (guiadvancementtab.getPage() == tabPage && guiadvancementtab.func_195627_a(i, j, p_mouseClicked_1_, p_mouseClicked_3_)) { - this.field_191946_h.func_194230_a(guiadvancementtab.func_193935_c(), true); - break; - } -@@ -83,6 +100,12 @@ - this.func_191936_c(p_73863_1_, p_73863_2_, i, j); - this.func_191934_b(i, j); - this.func_191937_d(p_73863_1_, p_73863_2_, i, j); -+ if (maxPages != 0) { -+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); -+ int width = this.field_146289_q.func_78256_a(page); -+ GlStateManager.func_179140_f(); -+ this.field_146289_q.func_175063_a(page, i + (252 / 2) - (width / 2), j - 44, -1); -+ } - } - - public boolean mouseDragged(double p_mouseDragged_1_, double p_mouseDragged_3_, int p_mouseDragged_5_, double p_mouseDragged_6_, double p_mouseDragged_8_) { -@@ -129,6 +152,7 @@ - this.field_146297_k.func_110434_K().func_110577_a(field_191945_g); - - for(GuiAdvancementTab guiadvancementtab : this.field_191947_i.values()) { -+ if (guiadvancementtab.getPage() == tabPage) - guiadvancementtab.func_191798_a(p_191934_1_, p_191934_2_, guiadvancementtab == this.field_191940_s); - } - -@@ -137,6 +161,7 @@ - RenderHelper.func_74520_c(); - - for(GuiAdvancementTab guiadvancementtab1 : this.field_191947_i.values()) { -+ if (guiadvancementtab1.getPage() == tabPage) - guiadvancementtab1.func_191796_a(p_191934_1_, p_191934_2_, this.field_146296_j); - } - -@@ -159,7 +184,7 @@ - - if (this.field_191947_i.size() > 1) { - for(GuiAdvancementTab guiadvancementtab : this.field_191947_i.values()) { -- if (guiadvancementtab.func_195627_a(p_191937_3_, p_191937_4_, (double)p_191937_1_, (double)p_191937_2_)) { -+ if (guiadvancementtab.getPage() == tabPage && guiadvancementtab.func_195627_a(p_191937_3_, p_191937_4_, (double)p_191937_1_, (double)p_191937_2_)) { - this.func_146279_a(guiadvancementtab.func_191795_d(), p_191937_1_, p_191937_2_); - } - } diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch deleted file mode 100644 index c45f1881b..000000000 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ /dev/null @@ -1,287 +0,0 @@ ---- a/net/minecraft/client/gui/inventory/GuiContainerCreative.java -+++ b/net/minecraft/client/gui/inventory/GuiContainerCreative.java -@@ -54,6 +54,8 @@ - private CreativeCrafting field_147059_E; - private boolean field_195377_F; - private boolean field_199506_G; -+ private static int tabPage = 0; -+ private int maxPages = 0; - - public GuiContainerCreative(EntityPlayer p_i1088_1_) { - super(new GuiContainerCreative.ContainerCreative(p_i1088_1_)); -@@ -231,6 +233,22 @@ - this.func_147050_b(ItemGroup.field_78032_a[i]); - this.field_147059_E = new CreativeCrafting(this.field_146297_k); - this.field_146297_k.field_71439_g.field_71069_bz.func_75132_a(this.field_147059_E); -+ int tabCount = ItemGroup.field_78032_a.length; -+ if (tabCount > 12) { -+ func_189646_b(new net.minecraft.client.gui.GuiButton(101, field_147003_i, field_147009_r - 50, 20, 20, "<") { -+ @Override -+ public void func_194829_a(double mouseX, double mouseY) { -+ tabPage = Math.max(tabPage - 1, 0); -+ } -+ }); -+ func_189646_b(new net.minecraft.client.gui.GuiButton(102, field_147003_i + field_146999_f - 20, field_147009_r - 50, 20, 20, ">") { -+ @Override -+ public void func_194829_a(double mouseX, double mouseY) { -+ tabPage = Math.min(tabPage + 1, maxPages); -+ } -+ }); -+ maxPages = (int) Math.ceil((tabCount - 12) / 10D); -+ } - } else { - this.field_146297_k.func_147108_a(new GuiInventory(this.field_146297_k.field_71439_g)); - } -@@ -259,7 +277,7 @@ - public boolean charTyped(char p_charTyped_1_, int p_charTyped_2_) { - if (this.field_195377_F) { - return false; -- } else if (field_147058_w != ItemGroup.field_78027_g.func_78021_a()) { -+ } else if (!ItemGroup.field_78032_a[field_147058_w].hasSearchBar()) { - return false; - } else { - String s = this.field_147062_A.func_146179_b(); -@@ -277,7 +295,7 @@ - - public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) { - this.field_195377_F = false; -- if (field_147058_w != ItemGroup.field_78027_g.func_78021_a()) { -+ if (!ItemGroup.field_78032_a[field_147058_w].hasSearchBar()) { - if (this.field_146297_k.field_71474_y.field_74310_D.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) { - this.field_195377_F = true; - this.func_147050_b(ItemGroup.field_78027_g); -@@ -313,6 +331,32 @@ - private void func_147053_i() { - GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; - guicontainercreative$containercreative.field_148330_a.clear(); -+ -+ ItemGroup tab = ItemGroup.field_78032_a[field_147058_w]; -+ if (tab.hasSearchBar() && tab != ItemGroup.field_78027_g) { -+ tab.func_78018_a(guicontainercreative$containercreative.field_148330_a); -+ if (!this.field_147062_A.func_146179_b().isEmpty()) { -+ //TODO: Make this a SearchTree not a manual search -+ String search = this.field_147062_A.func_146179_b().toLowerCase(Locale.ROOT); -+ java.util.Iterator itr = guicontainercreative$containercreative.field_148330_a.iterator(); -+ while (itr.hasNext()) { -+ ItemStack stack = itr.next(); -+ boolean matches = false; -+ for (ITextComponent line : stack.func_82840_a(this.field_146297_k.field_71439_g, this.field_146297_k.field_71474_y.field_82882_x ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL)) { -+ if (TextFormatting.func_110646_a(line.getString()).toLowerCase(Locale.ROOT).contains(search)) { -+ matches = true; -+ break; -+ } -+ } -+ if (!matches) -+ itr.remove(); -+ } -+ } -+ this.field_147067_x = 0.0F; -+ guicontainercreative$containercreative.func_148329_a(0.0F); -+ return; -+ } -+ - if (this.field_147062_A.func_146179_b().isEmpty()) { - for(Item item : IRegistry.field_212630_s) { - item.func_150895_a(ItemGroup.field_78027_g, guicontainercreative$containercreative.field_148330_a); -@@ -327,9 +371,9 @@ - - protected void func_146979_b(int p_146979_1_, int p_146979_2_) { - ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w]; -- if (itemgroup.func_78019_g()) { -+ if (itemgroup != null && itemgroup.func_78019_g()) { - GlStateManager.func_179084_k(); -- this.field_146289_q.func_211126_b(I18n.func_135052_a(itemgroup.func_78024_c()), 8.0F, 6.0F, 4210752); -+ this.field_146289_q.func_211126_b(I18n.func_135052_a(itemgroup.func_78024_c()), 8.0F, 6.0F, itemgroup.getLabelColor()); - } - - } -@@ -361,7 +405,7 @@ - this.field_147066_y = false; - - for(ItemGroup itemgroup : ItemGroup.field_78032_a) { -- if (this.func_195375_a(itemgroup, d0, d1)) { -+ if (itemgroup != null && this.func_195375_a(itemgroup, d0, d1)) { - this.func_147050_b(itemgroup); - return true; - } -@@ -372,12 +416,15 @@ - } - - private boolean func_147055_p() { -+ if (ItemGroup.field_78032_a[field_147058_w] == null) return false; - return field_147058_w != ItemGroup.field_78036_m.func_78021_a() && ItemGroup.field_78032_a[field_147058_w].func_78017_i() && ((GuiContainerCreative.ContainerCreative)this.field_147002_h).func_148328_e(); - } - - private void func_147050_b(ItemGroup p_147050_1_) { -+ if (p_147050_1_ == null) return; - int i = field_147058_w; - field_147058_w = p_147050_1_.func_78021_a(); -+ slotColor = p_147050_1_.getSlotColor(); - GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; - this.field_147008_s.clear(); - guicontainercreative$containercreative.field_148330_a.clear(); -@@ -451,13 +498,15 @@ - } - - if (this.field_147062_A != null) { -- if (p_147050_1_ == ItemGroup.field_78027_g) { -+ if (p_147050_1_.hasSearchBar()) { - this.field_147062_A.func_146189_e(true); - this.field_147062_A.func_146205_d(false); - this.field_147062_A.func_146195_b(true); - if (i != p_147050_1_.func_78021_a()) { - this.field_147062_A.func_146180_a(""); - } -+ this.field_147062_A.field_146218_h = p_147050_1_.getSearchbarWidth(); -+ this.field_147062_A.field_146209_f = this.field_147003_i + (82 /*default left*/ + 89 /*default width*/) - this.field_147062_A.field_146218_h; - - this.func_147053_i(); - } else { -@@ -517,16 +566,36 @@ - this.func_146276_q_(); - super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); - -- for(ItemGroup itemgroup : ItemGroup.field_78032_a) { -+ int start = tabPage * 10; -+ int end = Math.min(ItemGroup.field_78032_a.length, ((tabPage + 1) * 10) + 2); -+ if (tabPage != 0) start += 2; -+ boolean rendered = false; -+ -+ for(ItemGroup itemgroup : java.util.Arrays.copyOfRange(ItemGroup.field_78032_a, start, end)) { -+ if (itemgroup == null) continue; - if (this.func_147052_b(itemgroup, p_73863_1_, p_73863_2_)) { -+ rendered = true; - break; - } - } - -+ if (!rendered && !func_147052_b(ItemGroup.field_78027_g, p_73863_1_, p_73863_2_)) -+ func_147052_b(ItemGroup.field_78036_m, p_73863_1_, p_73863_2_); -+ - if (this.field_147064_C != null && field_147058_w == ItemGroup.field_78036_m.func_78021_a() && this.func_195359_a(this.field_147064_C.field_75223_e, this.field_147064_C.field_75221_f, 16, 16, (double)p_73863_1_, (double)p_73863_2_)) { - this.func_146279_a(I18n.func_135052_a("inventory.binSlot"), p_73863_1_, p_73863_2_); - } - -+ if (maxPages != 0) { -+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); -+ GlStateManager.func_179140_f(); -+ this.field_73735_i = 300.0F; -+ field_146296_j.field_77023_b = 300.0F; -+ field_146289_q.func_211126_b(page, field_147003_i + (field_146999_f / 2) - (field_146289_q.func_78256_a(page) / 2), field_147009_r - 44, -1); -+ this.field_73735_i = 0.0F; -+ field_146296_j.field_77023_b = 0.0F; -+ } -+ - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.func_179140_f(); - this.func_191948_b(p_73863_1_, p_73863_2_); -@@ -568,7 +637,10 @@ - } - } - -- this.func_146283_a(list1, p_146285_2_, p_146285_3_); -+ net.minecraft.client.gui.FontRenderer font = p_146285_1_.func_77973_b().getFontRenderer(p_146285_1_); -+ net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(p_146285_1_); -+ this.drawHoveringText(list1, p_146285_2_, p_146285_3_, (font == null ? field_146289_q : font)); -+ net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip(); - } else { - super.func_146285_a(p_146285_1_, p_146285_2_, p_146285_3_); - } -@@ -580,25 +652,44 @@ - RenderHelper.func_74520_c(); - ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w]; - -- for(ItemGroup itemgroup1 : ItemGroup.field_78032_a) { -- this.field_146297_k.func_110434_K().func_110577_a(field_147061_u); -+ int start = tabPage * 10; -+ int end = Math.min(ItemGroup.field_78032_a.length, ((tabPage + 1) * 10 + 2)); -+ if (tabPage != 0) start += 2; -+ -+ for(ItemGroup itemgroup1 : java.util.Arrays.copyOfRange(ItemGroup.field_78032_a, start, end)) { -+ if (itemgroup1 == null) continue; - if (itemgroup1.func_78021_a() != field_147058_w) { -+ this.field_146297_k.func_110434_K().func_110577_a(itemgroup1.getTabsImage()); - this.func_147051_a(itemgroup1); - } - } - -- this.field_146297_k.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + itemgroup.func_78015_f())); -+ if (tabPage != 0) { -+ if (itemgroup != ItemGroup.field_78027_g) { -+ this.field_146297_k.func_110434_K().func_110577_a(ItemGroup.field_78027_g.getTabsImage()); -+ func_147051_a(ItemGroup.field_78027_g); -+ } -+ if (itemgroup != ItemGroup.field_78036_m) { -+ this.field_146297_k.func_110434_K().func_110577_a(ItemGroup.field_78036_m.getTabsImage()); -+ func_147051_a(ItemGroup.field_78036_m); -+ } -+ } -+ -+ this.field_146297_k.func_110434_K().func_110577_a(itemgroup.getBackgroundImage()); - this.func_73729_b(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g); - this.field_147062_A.func_195608_a(p_146976_2_, p_146976_3_, p_146976_1_); - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); - int i = this.field_147003_i + 175; - int j = this.field_147009_r + 18; - int k = j + 112; -- this.field_146297_k.func_110434_K().func_110577_a(field_147061_u); -+ this.field_146297_k.func_110434_K().func_110577_a(itemgroup.getTabsImage()); - if (itemgroup.func_78017_i()) { - this.func_73729_b(i, j + (int)((float)(k - j - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15); - } - -+ if ((itemgroup == null || itemgroup.getTabPage() != tabPage) && (itemgroup != ItemGroup.field_78027_g && itemgroup != ItemGroup.field_78036_m)) -+ return; -+ - this.func_147051_a(itemgroup); - if (itemgroup == ItemGroup.field_78036_m) { - GuiInventory.func_147046_a(this.field_147003_i + 88, this.field_147009_r + 45, 20, (float)(this.field_147003_i + 88 - p_146976_2_), (float)(this.field_147009_r + 45 - 30 - p_146976_3_), this.field_146297_k.field_71439_g); -@@ -607,6 +698,7 @@ - } - - protected boolean func_195375_a(ItemGroup p_195375_1_, double p_195375_2_, double p_195375_4_) { -+ if (p_195375_1_.getTabPage() != tabPage && p_195375_1_ != ItemGroup.field_78027_g && p_195375_1_ != ItemGroup.field_78036_m) return false; - int i = p_195375_1_.func_78020_k(); - int j = 28 * i; - int k = 0; -@@ -676,6 +768,8 @@ - } - - GlStateManager.func_179140_f(); -+ GlStateManager.func_179124_c(1F, 1F, 1F); //Forge: Reset color in case Items change it. -+ GlStateManager.func_179147_l(); //Forge: Make sure blend is enabled else tabs show a white border. - this.func_73729_b(l, i1, j, k, 28, 32); - this.field_73735_i = 100.0F; - this.field_146296_j.field_77023_b = 100.0F; -@@ -850,6 +944,31 @@ - public boolean func_82869_a(EntityPlayer p_82869_1_) { - return this.field_148332_b.func_82869_a(p_82869_1_); - } -+ -+ public ResourceLocation getBackgroundLocation() { -+ return this.field_148332_b.getBackgroundLocation(); -+ } -+ -+ public void setBackgroundLocation(ResourceLocation texture) { -+ this.field_148332_b.setBackgroundLocation(texture); -+ } -+ -+ public void setBackgroundName(@Nullable String name) { -+ this.field_148332_b.setBackgroundName(name); -+ } -+ -+ @Nullable -+ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() { -+ return this.field_148332_b.getBackgroundSprite(); -+ } -+ -+ public int getSlotIndex() { -+ return this.field_148332_b.getSlotIndex(); -+ } -+ -+ public boolean isSameInventory(Slot other) { -+ return this.field_148332_b.isSameInventory(other); -+ } - } - - @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch b/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch new file mode 100644 index 000000000..f92753cb6 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/overlay/BossOverlayGui.java.patch @@ -0,0 +1,23 @@ +--- a/net/minecraft/client/gui/overlay/BossOverlayGui.java ++++ b/net/minecraft/client/gui/overlay/BossOverlayGui.java +@@ -30,6 +30,9 @@ + + for(ClientBossInfo clientbossinfo : this.field_184060_g.values()) { + int k = i / 2 - 91; ++ net.minecraftforge.client.event.RenderGameOverlayEvent.BossInfo event = ++ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPre(this.field_184059_f.field_195558_d, clientbossinfo, k, j, 10 + this.field_184059_f.field_71466_p.field_78288_b); ++ if (!event.isCanceled()) { + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + this.field_184059_f.func_110434_K().func_110577_a(field_184058_a); + this.func_184052_a(k, j, clientbossinfo); +@@ -38,7 +41,9 @@ + int i1 = i / 2 - l / 2; + int j1 = j - 9; + this.field_184059_f.field_71466_p.func_175063_a(s, (float)i1, (float)j1, 16777215); +- j += 10 + 9; ++ } ++ j += event.getIncrement(); ++ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(this.field_184059_f.field_195558_d); + if (j >= this.field_184059_f.field_195558_d.func_198087_p() / 3) { + break; + } diff --git a/patches/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeBook.java.patch b/patches/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeBook.java.patch deleted file mode 100644 index 30c3ee9cc..000000000 --- a/patches/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeBook.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/gui/recipebook/GuiRecipeBook.java -+++ b/net/minecraft/client/gui/recipebook/GuiRecipeBook.java -@@ -410,7 +410,7 @@ - - languagemanager.func_135045_a(language); - this.field_191888_F.field_71474_y.field_74363_ab = language.func_135034_a(); -- this.field_191888_F.func_110436_a(); -+ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.field_191888_F, net.minecraftforge.resource.VanillaResourceType.LANGUAGES); - this.field_191888_F.field_71466_p.func_78275_b(languagemanager.func_135044_b()); - this.field_191888_F.field_71474_y.func_74303_b(); - } diff --git a/patches/minecraft/net/minecraft/client/gui/recipebook/RecipeBookGui.java.patch b/patches/minecraft/net/minecraft/client/gui/recipebook/RecipeBookGui.java.patch new file mode 100644 index 000000000..1769e0c7e --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/recipebook/RecipeBookGui.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/client/gui/recipebook/RecipeBookGui.java ++++ b/net/minecraft/client/gui/recipebook/RecipeBookGui.java +@@ -367,7 +367,7 @@ + return true; + } else if (this.field_191888_F.field_71474_y.field_74310_D.func_197976_a(p_keyPressed_1_, p_keyPressed_2_) && !this.field_193962_q.isFocused()) { + this.field_199738_u = true; +- this.field_193962_q.func_146195_b(true); ++ this.field_193962_q.setFocused(true); + return true; + } else { + return false; +@@ -421,7 +421,7 @@ + + languagemanager.func_135045_a(language); + this.field_191888_F.field_71474_y.field_74363_ab = language.getCode(); +- this.field_191888_F.func_213237_g(); ++ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.field_191888_F, net.minecraftforge.resource.VanillaResourceType.LANGUAGES); + this.field_191888_F.field_71466_p.func_78275_b(languagemanager.func_135044_b()); + this.field_191888_F.field_71474_y.func_74303_b(); + } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/AbstractCommandBlockScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/AbstractCommandBlockScreen.java.patch new file mode 100644 index 000000000..68471a71e --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/AbstractCommandBlockScreen.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/client/gui/screen/AbstractCommandBlockScreen.java ++++ b/net/minecraft/client/gui/screen/AbstractCommandBlockScreen.java +@@ -86,7 +86,7 @@ + this.field_195239_f.func_146180_a("-"); + this.children.add(this.field_195239_f); + this.func_212928_a(this.field_195237_a); +- this.field_195237_a.func_146195_b(true); ++ this.field_195237_a.setFocused(true); + this.func_209106_o(); + } + +@@ -247,7 +247,7 @@ + + if (!list.isEmpty()) { + this.field_209111_t.addAll(list); +- this.field_209112_u = MathHelper.func_76125_a(this.field_195237_a.func_195611_j(suggestioncontext.startPos), 0, this.field_195237_a.func_195611_j(0) + this.field_195237_a.func_146200_o() - i); ++ this.field_209112_u = MathHelper.func_76125_a(this.field_195237_a.func_195611_j(suggestioncontext.startPos), 0, this.field_195237_a.func_195611_j(0) + this.field_195237_a.getWidth() - i); + this.field_209113_v = i; + } + +@@ -290,7 +290,7 @@ + i = Math.max(i, this.font.func_78256_a(suggestion.getText())); + } + +- int j = MathHelper.func_76125_a(this.field_195237_a.func_195611_j(suggestions.getRange().getStart()), 0, this.field_195237_a.func_195611_j(0) + this.field_195237_a.func_146200_o() - i); ++ int j = MathHelper.func_76125_a(this.field_195237_a.func_195611_j(suggestions.getRange().getStart()), 0, this.field_195237_a.func_195611_j(0) + this.field_195237_a.getWidth() - i); + this.field_209116_y = new AbstractCommandBlockScreen.SuggestionsList(j, 72, i, suggestions); + } + } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/AddServerScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/AddServerScreen.java.patch new file mode 100644 index 000000000..714018442 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/AddServerScreen.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/gui/screen/AddServerScreen.java ++++ b/net/minecraft/client/gui/screen/AddServerScreen.java +@@ -53,7 +53,7 @@ + protected void init() { + this.minecraft.field_195559_v.func_197967_a(true); + this.field_146309_g = new TextFieldWidget(this.font, this.width / 2 - 100, 66, 200, 20, I18n.func_135052_a("addServer.enterName")); +- this.field_146309_g.func_146195_b(true); ++ this.field_146309_g.setFocused(true); + this.field_146309_g.func_146180_a(this.field_146311_h.field_78847_a); + this.field_146309_g.func_212954_a(this::func_213028_a); + this.children.add(this.field_146309_g); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/ChatScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/ChatScreen.java.patch new file mode 100644 index 000000000..e68db2487 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/ChatScreen.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/gui/screen/ChatScreen.java ++++ b/net/minecraft/client/gui/screen/ChatScreen.java +@@ -351,7 +351,7 @@ + + public void render(int p_render_1_, int p_render_2_, float p_render_3_) { + this.setFocused(this.field_146415_a); +- this.field_146415_a.func_146195_b(true); ++ this.field_146415_a.setFocused(true); + fill(2, this.height - 14, this.width - 2, this.height - 2, this.minecraft.field_71474_y.func_216839_a(Integer.MIN_VALUE)); + this.field_146415_a.render(p_render_1_, p_render_2_, p_render_3_); + if (this.field_195139_w != null) { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/ControlsScreen.java.patch similarity index 60% rename from patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch rename to patches/minecraft/net/minecraft/client/gui/screen/ControlsScreen.java.patch index dfba3fd49..1439897b0 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/ControlsScreen.java.patch @@ -1,15 +1,15 @@ ---- a/net/minecraft/client/gui/GuiControls.java -+++ b/net/minecraft/client/gui/GuiControls.java -@@ -36,7 +36,7 @@ - this.field_146493_s = this.func_189646_b(new GuiButton(201, this.field_146294_l / 2 - 155, this.field_146295_m - 29, 150, 20, I18n.func_135052_a("controls.resetAll")) { - public void func_194829_a(double p_194829_1_, double p_194829_3_) { - for(KeyBinding keybinding : GuiControls.this.field_146297_k.field_71474_y.field_74324_K) { -- keybinding.func_197979_b(keybinding.func_197977_i()); -+ keybinding.setToDefault(); - } +--- a/net/minecraft/client/gui/screen/ControlsScreen.java ++++ b/net/minecraft/client/gui/screen/ControlsScreen.java +@@ -37,7 +37,7 @@ + this.children.add(this.field_146494_r); + this.field_146493_s = this.addButton(new Button(this.width / 2 - 155, this.height - 29, 150, 20, I18n.func_135052_a("controls.resetAll"), (p_213125_1_) -> { + for(KeyBinding keybinding : this.minecraft.field_71474_y.field_74324_K) { +- keybinding.func_197979_b(keybinding.func_197977_i()); ++ keybinding.setToDefault(); + } - KeyBinding.func_74508_b(); -@@ -89,11 +89,14 @@ + KeyBinding.func_74508_b(); +@@ -61,11 +61,14 @@ public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) { if (this.field_146491_f != null) { if (p_keyPressed_1_ == 256) { diff --git a/patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch new file mode 100644 index 000000000..abb3bc951 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/CreateWorldScreen.java.patch @@ -0,0 +1,26 @@ +--- a/net/minecraft/client/gui/screen/CreateWorldScreen.java ++++ b/net/minecraft/client/gui/screen/CreateWorldScreen.java +@@ -137,14 +137,7 @@ + })); + this.field_146320_D.visible = false; + this.field_146322_F = this.addButton(new Button(this.width / 2 + 5, 120, 150, 20, I18n.func_135052_a("selectWorld.customizeType"), (p_214314_1_) -> { +- if (WorldType.field_77139_a[this.field_146331_K] == WorldType.field_77138_c) { +- this.minecraft.func_147108_a(new CreateFlatWorldScreen(this, this.field_146334_a)); +- } +- +- if (WorldType.field_77139_a[this.field_146331_K] == WorldType.field_205394_h) { +- this.minecraft.func_147108_a(new CreateBuffetWorldScreen(this, this.field_146334_a)); +- } +- ++ WorldType.field_77139_a[this.field_146331_K].onCustomizeButton(this.minecraft, CreateWorldScreen.this); + })); + this.field_146322_F.visible = false; + this.field_146321_E = this.addButton(new Button(this.width / 2 - 155, 151, 150, 20, I18n.func_135052_a("selectWorld.allowCommands"), (p_214315_1_) -> { +@@ -223,6 +216,7 @@ + i = (long)s.hashCode(); + } + } ++ WorldType.field_77139_a[this.field_146331_K].onGUICreateWorldPress(); + + WorldSettings worldsettings = new WorldSettings(i, GameType.func_77142_a(this.field_146342_r), this.field_146341_s, this.field_146337_w, WorldType.field_77139_a[this.field_146331_K]); + worldsettings.func_205390_a(Dynamic.convert(NBTDynamicOps.field_210820_a, JsonOps.INSTANCE, this.field_146334_a)); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch new file mode 100644 index 000000000..51a73912c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/EnchantmentScreen.java.patch @@ -0,0 +1,27 @@ +--- a/net/minecraft/client/gui/screen/EnchantmentScreen.java ++++ b/net/minecraft/client/gui/screen/EnchantmentScreen.java +@@ -146,7 +146,7 @@ + String s1 = EnchantmentNameParts.func_178176_a().func_148334_a(this.font, i2); + FontRenderer fontrenderer = this.minecraft.func_211500_ak().func_211504_a(Minecraft.field_71464_q); + int j2 = 6839882; +- if ((l < i1 + 1 || this.minecraft.field_71439_g.field_71068_ca < l1) && !this.minecraft.field_71439_g.field_71075_bZ.field_75098_d) { ++ if (((l < i1 + 1 || this.minecraft.field_71439_g.field_71068_ca < l1) && !this.minecraft.field_71439_g.field_71075_bZ.field_75098_d) || this.field_147002_h.field_185001_h[i1] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels + this.blit(j1, j + 14 + 19 * i1, 0, 185, 108, 19); + this.blit(j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16); + fontrenderer.func_78279_b(s1, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1); +@@ -186,10 +186,12 @@ + Enchantment enchantment = Enchantment.func_185262_c((this.field_147002_h).field_185001_h[j]); + int l = (this.field_147002_h).field_185002_i[j]; + int i1 = j + 1; +- if (this.func_195359_a(60, 14 + 19 * j, 108, 17, (double)p_render_1_, (double)p_render_2_) && k > 0 && l >= 0 && enchantment != null) { ++ if (this.func_195359_a(60, 14 + 19 * j, 108, 17, (double)p_render_1_, (double)p_render_2_) && k > 0) { + List list = Lists.newArrayList(); +- list.add("" + TextFormatting.WHITE + TextFormatting.ITALIC + I18n.func_135052_a("container.enchant.clue", enchantment.func_200305_d(l).func_150254_d())); +- if (!flag) { ++ list.add("" + TextFormatting.WHITE + TextFormatting.ITALIC + I18n.func_135052_a("container.enchant.clue", enchantment == null ? "" : enchantment.func_200305_d(l).func_150254_d())); ++ if (enchantment == null) { ++ java.util.Collections.addAll(list, "", TextFormatting.RED + I18n.func_135052_a("forge.container.enchant.limitedEnchantability")); ++ } else if (!flag) { + list.add(""); + if (this.minecraft.field_71439_g.field_71068_ca < k) { + list.add(TextFormatting.RED + I18n.func_135052_a("container.enchant.level.requirement", (this.field_147002_h).field_75167_g[j])); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/LanguageScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/LanguageScreen.java.patch new file mode 100644 index 000000000..dd03880e2 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/LanguageScreen.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/gui/screen/LanguageScreen.java ++++ b/net/minecraft/client/gui/screen/LanguageScreen.java +@@ -45,7 +45,7 @@ + if (languagescreen$list$languageentry != null && !languagescreen$list$languageentry.field_214398_b.getCode().equals(this.field_146454_h.func_135041_c().getCode())) { + this.field_146454_h.func_135045_a(languagescreen$list$languageentry.field_214398_b); + this.field_146451_g.field_74363_ab = languagescreen$list$languageentry.field_214398_b.getCode(); +- this.minecraft.func_213237_g(); ++ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.minecraft, net.minecraftforge.resource.VanillaResourceType.LANGUAGES); + this.font.func_78275_b(this.field_146454_h.func_135044_b()); + this.field_146452_r.setMessage(I18n.func_135052_a("gui.done")); + this.field_211832_i.setMessage(AbstractOption.field_216684_H.func_216743_c(this.field_146451_g)); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch new file mode 100644 index 000000000..bab84e9e8 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch @@ -0,0 +1,70 @@ +--- a/net/minecraft/client/gui/screen/MainMenuScreen.java ++++ b/net/minecraft/client/gui/screen/MainMenuScreen.java +@@ -58,6 +58,7 @@ + private final RenderSkybox field_209101_K = new RenderSkybox(field_213098_a); + private final boolean field_213102_y; + private long field_213103_z; ++ private net.minecraftforge.client.gui.NotificationModUpdateScreen modUpdateNotification; + + public MainMenuScreen() { + this(false); +@@ -108,10 +109,14 @@ + this.field_193979_N = this.width - this.field_193978_M - 2; + int i = 24; + int j = this.height / 4 + 48; ++ Button modbutton = null; + if (this.minecraft.func_71355_q()) { + this.func_73972_b(j, 24); + } else { + this.func_73969_a(j, 24); ++ modbutton = this.addButton(new Button(this.width / 2 - 100, j + 24 * 2, 98, 20, I18n.func_135052_a("fml.menu.mods"), button -> { ++ this.minecraft.func_147108_a(new net.minecraftforge.fml.client.gui.GuiModList(this)); ++ })); + } + + this.addButton(new ImageButton(this.width / 2 - 124, j + 72 + 12, 20, 20, 0, 106, 20, Button.WIDGETS_LOCATION, 256, 256, (p_213090_1_) -> { +@@ -146,6 +151,7 @@ + if (this.func_183501_a()) { + this.field_183503_M.init(this.minecraft, this.width, this.height); + } ++ modUpdateNotification = net.minecraftforge.client.gui.NotificationModUpdateScreen.init(this, modbutton); + + } + +@@ -156,7 +162,7 @@ + this.addButton(new Button(this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, 200, 20, I18n.func_135052_a("menu.multiplayer"), (p_213086_1_) -> { + this.minecraft.func_147108_a(new MultiplayerScreen(this)); + })); +- this.addButton(new Button(this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 200, 20, I18n.func_135052_a("menu.online"), (p_213095_1_) -> { ++ this.addButton(new Button(this.width / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.func_135052_a("menu.online"), (p_213095_1_) -> { + this.func_140005_i(); + })); + } +@@ -220,6 +226,7 @@ + + this.minecraft.func_110434_K().func_110577_a(field_194400_H); + blit(j + 88, 67, 0.0F, 0.0F, 98, 14, 128, 16); ++ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.font, this.width, this.height); + if (this.field_73975_c != null) { + GlStateManager.pushMatrix(); + GlStateManager.translatef((float)(this.width / 2 + 90), 70.0F, 0.0F); +@@ -238,7 +245,10 @@ + s = s + ("release".equalsIgnoreCase(this.minecraft.func_184123_d()) ? "" : "/" + this.minecraft.func_184123_d()); + } + +- this.drawString(this.font, s, 2, this.height - 10, 16777215 | l); ++ net.minecraftforge.fml.BrandingControl.forEachLine(true, true, (brdline, brd) -> ++ this.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.field_78288_b + 1)), 16777215 | l) ++ ); ++ + this.drawString(this.font, "Copyright Mojang AB. Do not distribute!", this.field_193979_N, this.height - 10, 16777215 | l); + if (p_render_1_ > this.field_193979_N && p_render_1_ < this.field_193979_N + this.field_193978_M && p_render_2_ > this.height - 10 && p_render_2_ < this.height) { + fill(this.field_193979_N, this.height - 1, this.field_193979_N + this.field_193978_M, this.height, 16777215 | l); +@@ -258,6 +268,7 @@ + if (this.func_183501_a() && f1 >= 1.0F) { + this.field_183503_M.render(p_render_1_, p_render_2_, p_render_3_); + } ++ modUpdateNotification.render(p_render_1_, p_render_2_, p_render_3_); + + } + } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/ResourcePacksScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/ResourcePacksScreen.java.patch new file mode 100644 index 000000000..784ef45b1 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/ResourcePacksScreen.java.patch @@ -0,0 +1,17 @@ +--- a/net/minecraft/client/gui/screen/ResourcePacksScreen.java ++++ b/net/minecraft/client/gui/screen/ResourcePacksScreen.java +@@ -84,11 +84,14 @@ + resourcepacklist.func_198983_a(); + List list = Lists.newArrayList(resourcepacklist.func_198978_b()); + list.removeAll(resourcepacklist.func_198980_d()); ++ list.removeIf(net.minecraft.resources.ResourcePackInfo::isHidden); // Forge: Hide some resource packs from the UI entirely + + for(ClientResourcePackInfo clientresourcepackinfo : list) { + this.field_146970_i.func_214365_a(new AbstractResourcePackList.ResourcePackEntry(this.field_146970_i, this, clientresourcepackinfo)); + } + ++ java.util.Collection enabledList = resourcepacklist.func_198980_d(); ++ enabledList.removeIf(net.minecraft.resources.ResourcePackInfo::isHidden); // Forge: Hide some resource packs from the UI entirely + for(ClientResourcePackInfo clientresourcepackinfo1 : Lists.reverse(Lists.newArrayList(resourcepacklist.func_198980_d()))) { + this.field_146967_r.func_214365_a(new AbstractResourcePackList.ResourcePackEntry(this.field_146967_r, this, clientresourcepackinfo1)); + } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch new file mode 100644 index 000000000..70c472ab5 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch @@ -0,0 +1,80 @@ +--- a/net/minecraft/client/gui/screen/Screen.java ++++ b/net/minecraft/client/gui/screen/Screen.java +@@ -109,7 +109,10 @@ + } + + protected void renderTooltip(ItemStack p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_) { +- this.renderTooltip(this.getTooltipFromItem(p_renderTooltip_1_), p_renderTooltip_2_, p_renderTooltip_3_); ++ FontRenderer font = p_renderTooltip_1_.func_77973_b().getFontRenderer(p_renderTooltip_1_); ++ net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(p_renderTooltip_1_); ++ this.renderTooltip(this.getTooltipFromItem(p_renderTooltip_1_), p_renderTooltip_2_, p_renderTooltip_3_, (font == null ? this.font : font)); ++ net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip(); + } + + public List getTooltipFromItem(ItemStack p_getTooltipFromItem_1_) { +@@ -128,7 +131,11 @@ + } + + public void renderTooltip(List p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_) { +- if (!p_renderTooltip_1_.isEmpty()) { ++ renderTooltip(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_, font); ++ } ++ public void renderTooltip(List p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_, FontRenderer font) { ++ net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_, width, height, -1, font); ++ if (false && !p_renderTooltip_1_.isEmpty()) { + GlStateManager.disableRescaleNormal(); + RenderHelper.func_74518_a(); + GlStateManager.disableLighting(); +@@ -301,9 +308,12 @@ + } + + public void sendMessage(String p_sendMessage_1_, boolean p_sendMessage_2_) { ++ p_sendMessage_1_ = net.minecraftforge.event.ForgeEventFactory.onClientSendMessage(p_sendMessage_1_); ++ if (p_sendMessage_1_.isEmpty()) return; + if (p_sendMessage_2_) { + this.minecraft.field_71456_v.func_146158_b().func_146239_a(p_sendMessage_1_); + } ++ //if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.player, msg) != 0) return; //Forge: TODO Client command re-write + + this.minecraft.field_71439_g.func_71165_d(p_sendMessage_1_); + } +@@ -314,10 +324,14 @@ + this.font = p_init_1_.field_71466_p; + this.width = p_init_2_; + this.height = p_init_3_; ++ java.util.function.Consumer remove = (b) -> { buttons.remove(b); children.remove(b); }; ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.buttons, this::addButton, remove))) { + this.buttons.clear(); + this.children.clear(); + this.setFocused((IGuiEventListener)null); + this.init(); ++ } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.buttons, this::addButton, remove)); + } + + public void setSize(int p_setSize_1_, int p_setSize_2_) { +@@ -345,6 +359,7 @@ + public void renderBackground(int p_renderBackground_1_) { + if (this.minecraft.field_71441_e != null) { + this.fillGradient(0, 0, this.width, this.height, -1072689136, -804253680); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this)); + } else { + this.renderDirtBackground(p_renderBackground_1_); + } +@@ -365,6 +380,7 @@ + bufferbuilder.func_181662_b((double)this.width, 0.0D, 0.0D).func_187315_a((double)((float)this.width / 32.0F), (double)p_renderDirtBackground_1_).func_181669_b(64, 64, 64, 255).func_181675_d(); + bufferbuilder.func_181662_b(0.0D, 0.0D, 0.0D).func_187315_a(0.0D, (double)p_renderDirtBackground_1_).func_181669_b(64, 64, 64, 255).func_181675_d(); + tessellator.func_78381_a(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this)); + } + + public boolean isPauseScreen() { +@@ -448,4 +464,8 @@ + public boolean isMouseOver(double p_isMouseOver_1_, double p_isMouseOver_3_) { + return true; + } ++ ++ public Minecraft getMinecraft() { ++ return this.minecraft; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/ServerListScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/ServerListScreen.java.patch new file mode 100644 index 000000000..01029102e --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/ServerListScreen.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/gui/screen/ServerListScreen.java ++++ b/net/minecraft/client/gui/screen/ServerListScreen.java +@@ -37,7 +37,7 @@ + })); + this.field_146302_g = new TextFieldWidget(this.font, this.width / 2 - 100, 116, 200, 20, I18n.func_135052_a("addServer.enterIp")); + this.field_146302_g.func_146203_f(128); +- this.field_146302_g.func_146195_b(true); ++ this.field_146302_g.setFocused(true); + this.field_146302_g.func_146180_a(this.minecraft.field_71474_y.field_74332_R); + this.field_146302_g.func_212954_a((p_213024_1_) -> { + this.func_195168_i(); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/ServerSelectionList.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/ServerSelectionList.java.patch new file mode 100644 index 000000000..e3bba1629 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/ServerSelectionList.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/gui/screen/ServerSelectionList.java ++++ b/net/minecraft/client/gui/screen/ServerSelectionList.java +@@ -292,6 +292,8 @@ + this.field_148303_c.func_146793_a(s); + } + ++ net.minecraftforge.fml.client.ClientHooks.drawForgePingInfo(this.field_148303_c, field_148301_e, p_render_3_, p_render_2_, p_render_4_, i1, j1); ++ + if (this.field_148300_d.field_71474_y.field_85185_A || p_render_8_) { + this.field_148300_d.func_110434_K().func_110577_a(ServerSelectionList.field_214360_d); + AbstractGui.fill(p_render_3_, p_render_2_, p_render_3_ + 32, p_render_2_ + 32, -1601138544); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/SleepInMultiplayerScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/SleepInMultiplayerScreen.java.patch new file mode 100644 index 000000000..b64c8da18 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/SleepInMultiplayerScreen.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/gui/screen/SleepInMultiplayerScreen.java ++++ b/net/minecraft/client/gui/screen/SleepInMultiplayerScreen.java +@@ -30,7 +30,7 @@ + } else if (p_keyPressed_1_ == 257 || p_keyPressed_1_ == 335) { + String s = this.field_146415_a.func_146179_b().trim(); + if (!s.isEmpty()) { +- this.minecraft.field_71439_g.func_71165_d(s); ++ this.sendMessage(s); // Forge: fix vanilla not adding messages to the sent list while sleeping + } + + this.field_146415_a.func_146180_a(""); diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/inventory/ContainerScreen.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch rename to patches/minecraft/net/minecraft/client/gui/screen/inventory/ContainerScreen.java.patch index bb3120419..c46630bb2 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/inventory/ContainerScreen.java.patch @@ -1,77 +1,69 @@ ---- a/net/minecraft/client/gui/inventory/GuiContainer.java -+++ b/net/minecraft/client/gui/inventory/GuiContainer.java -@@ -7,7 +7,6 @@ - import net.minecraft.client.renderer.OpenGlHelper; - import net.minecraft.client.renderer.RenderHelper; - import net.minecraft.client.renderer.texture.TextureAtlasSprite; --import net.minecraft.client.renderer.texture.TextureMap; - import net.minecraft.client.util.InputMappings; - import net.minecraft.entity.player.InventoryPlayer; - import net.minecraft.inventory.ClickType; -@@ -68,6 +67,7 @@ +--- a/net/minecraft/client/gui/screen/inventory/ContainerScreen.java ++++ b/net/minecraft/client/gui/screen/inventory/ContainerScreen.java +@@ -73,6 +73,7 @@ int i = this.field_147003_i; int j = this.field_147009_r; - this.func_146976_a(p_73863_3_, p_73863_1_, p_73863_2_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawBackground(this, p_73863_1_, p_73863_2_)); - GlStateManager.func_179101_C(); + this.func_146976_a(p_render_3_, p_render_1_, p_render_2_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawBackground(this, p_render_1_, p_render_2_)); + GlStateManager.disableRescaleNormal(); RenderHelper.func_74518_a(); - GlStateManager.func_179140_f(); -@@ -97,7 +97,8 @@ + GlStateManager.disableLighting(); +@@ -102,7 +103,8 @@ int j1 = slot.field_75223_e; int k1 = slot.field_75221_f; - GlStateManager.func_179135_a(true, true, true, false); -- this.func_73733_a(j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433); + GlStateManager.colorMask(true, true, true, false); +- this.fillGradient(j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433); + int slotColor = this.getSlotColor(i1); -+ this.func_73733_a(j1, k1, j1 + 16, k1 + 16, slotColor, slotColor); - GlStateManager.func_179135_a(true, true, true, true); - GlStateManager.func_179145_e(); - GlStateManager.func_179126_j(); -@@ -107,6 +108,7 @@ ++ this.fillGradient(j1, k1, j1 + 16, k1 + 16, slotColor, slotColor); + GlStateManager.colorMask(true, true, true, true); + GlStateManager.enableLighting(); + GlStateManager.enableDepthTest(); +@@ -112,6 +114,7 @@ RenderHelper.func_74518_a(); - this.func_146979_b(p_73863_1_, p_73863_2_); + this.func_146979_b(p_render_1_, p_render_2_); RenderHelper.func_74520_c(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawForeground(this, p_73863_1_, p_73863_2_)); - InventoryPlayer inventoryplayer = this.field_146297_k.field_71439_g.field_71071_by; - ItemStack itemstack = this.field_147012_x.func_190926_b() ? inventoryplayer.func_70445_o() : this.field_147012_x; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawForeground(this, p_render_1_, p_render_2_)); + PlayerInventory playerinventory = this.minecraft.field_71439_g.field_71071_by; + ItemStack itemstack = this.field_147012_x.func_190926_b() ? playerinventory.func_70445_o() : this.field_147012_x; if (!itemstack.func_190926_b()) { -@@ -158,8 +160,10 @@ - GlStateManager.func_179109_b(0.0F, 0.0F, 32.0F); - this.field_73735_i = 200.0F; - this.field_146296_j.field_77023_b = 200.0F; +@@ -163,8 +166,10 @@ + GlStateManager.translatef(0.0F, 0.0F, 32.0F); + this.blitOffset = 200; + this.itemRenderer.field_77023_b = 200.0F; + net.minecraft.client.gui.FontRenderer font = p_146982_1_.func_77973_b().getFontRenderer(p_146982_1_); -+ if (font == null) font = field_146289_q; - this.field_146296_j.func_180450_b(p_146982_1_, p_146982_2_, p_146982_3_); -- this.field_146296_j.func_180453_a(this.field_146289_q, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x.func_190926_b() ? 0 : 8), p_146982_4_); -+ this.field_146296_j.func_180453_a(font, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x.func_190926_b() ? 0 : 8), p_146982_4_); - this.field_73735_i = 0.0F; - this.field_146296_j.field_77023_b = 0.0F; ++ if (font == null) font = this.font; + this.itemRenderer.func_180450_b(p_146982_1_, p_146982_2_, p_146982_3_); +- this.itemRenderer.func_180453_a(this.font, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x.func_190926_b() ? 0 : 8), p_146982_4_); ++ this.itemRenderer.func_180453_a(font, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x.func_190926_b() ? 0 : 8), p_146982_4_); + this.blitOffset = 0; + this.itemRenderer.field_77023_b = 0.0F; } -@@ -203,11 +207,10 @@ - this.field_73735_i = 100.0F; - this.field_146296_j.field_77023_b = 100.0F; +@@ -208,11 +213,10 @@ + this.blitOffset = 100; + this.itemRenderer.field_77023_b = 100.0F; if (itemstack.func_190926_b() && p_146977_1_.func_111238_b()) { - String s1 = p_146977_1_.func_178171_c(); - if (s1 != null) { -- TextureAtlasSprite textureatlassprite = this.field_146297_k.func_147117_R().func_110572_b(s1); +- TextureAtlasSprite textureatlassprite = this.minecraft.func_147117_R().func_110572_b(s1); + TextureAtlasSprite textureatlassprite = p_146977_1_.getBackgroundSprite(); + if (textureatlassprite != null) { - GlStateManager.func_179140_f(); -- this.field_146297_k.func_110434_K().func_110577_a(TextureMap.field_110575_b); -+ this.field_146297_k.func_110434_K().func_110577_a(p_146977_1_.getBackgroundLocation()); - this.func_175175_a(i, j, textureatlassprite, 16, 16); - GlStateManager.func_179145_e(); + GlStateManager.disableLighting(); +- this.minecraft.func_110434_K().func_110577_a(AtlasTexture.field_110575_b); ++ this.minecraft.func_110434_K().func_110577_a(p_146977_1_.getBackgroundLocation()); + blit(i, j, this.blitOffset, 16, 16, textureatlassprite); + GlStateManager.enableLighting(); flag1 = true; -@@ -268,7 +271,8 @@ +@@ -273,7 +277,8 @@ if (super.mouseClicked(p_mouseClicked_1_, p_mouseClicked_3_, p_mouseClicked_5_)) { return true; } else { -- boolean flag = this.field_146297_k.field_71474_y.field_74322_I.func_197984_a(p_mouseClicked_5_); +- boolean flag = this.minecraft.field_71474_y.field_74322_I.func_197984_a(p_mouseClicked_5_); + InputMappings.Input mouseKey = InputMappings.Type.MOUSE.func_197944_a(p_mouseClicked_5_); -+ boolean flag = this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey); ++ boolean flag = this.minecraft.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey); Slot slot = this.func_195360_a(p_mouseClicked_1_, p_mouseClicked_3_); long i = Util.func_211177_b(); this.field_146993_M = this.field_146998_K == slot && i - this.field_146997_J < 250L && this.field_146992_L == p_mouseClicked_5_; -@@ -277,6 +281,7 @@ +@@ -282,6 +287,7 @@ int j = this.field_147003_i; int k = this.field_147009_r; boolean flag1 = this.func_195361_a(p_mouseClicked_1_, p_mouseClicked_3_, j, k, p_mouseClicked_5_); @@ -79,25 +71,25 @@ int l = -1; if (slot != null) { l = slot.field_75222_d; -@@ -302,7 +307,7 @@ +@@ -307,7 +313,7 @@ } } else if (!this.field_147007_t) { - if (this.field_146297_k.field_71439_g.field_71071_by.func_70445_o().func_190926_b()) { -- if (this.field_146297_k.field_71474_y.field_74322_I.func_197984_a(p_mouseClicked_5_)) { -+ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { + if (this.minecraft.field_71439_g.field_71071_by.func_70445_o().func_190926_b()) { +- if (this.minecraft.field_71474_y.field_74322_I.func_197984_a(p_mouseClicked_5_)) { ++ if (this.minecraft.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { this.func_184098_a(slot, l, p_mouseClicked_5_, ClickType.CLONE); } else { - boolean flag2 = l != -999 && (InputMappings.func_197956_a(340) || InputMappings.func_197956_a(344)); -@@ -326,7 +331,7 @@ + boolean flag2 = l != -999 && (InputMappings.func_216506_a(Minecraft.func_71410_x().field_195558_d.func_198092_i(), 340) || InputMappings.func_216506_a(Minecraft.func_71410_x().field_195558_d.func_198092_i(), 344)); +@@ -331,7 +337,7 @@ this.field_146987_F = 0; } else if (p_mouseClicked_5_ == 1) { this.field_146987_F = 1; -- } else if (this.field_146297_k.field_71474_y.field_74322_I.func_197984_a(p_mouseClicked_5_)) { -+ } else if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { +- } else if (this.minecraft.field_71474_y.field_74322_I.func_197984_a(p_mouseClicked_5_)) { ++ } else if (this.minecraft.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { this.field_146987_F = 2; } } -@@ -379,10 +384,13 @@ +@@ -384,10 +390,13 @@ } public boolean mouseReleased(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) { @@ -111,31 +103,32 @@ int k = -1; if (slot != null) { k = slot.field_75222_d; -@@ -396,7 +404,7 @@ - if (func_146272_n()) { +@@ -401,7 +410,7 @@ + if (hasShiftDown()) { if (!this.field_146994_N.func_190926_b()) { for(Slot slot2 : this.field_147002_h.field_75151_b) { -- if (slot2 != null && slot2.func_82869_a(this.field_146297_k.field_71439_g) && slot2.func_75216_d() && slot2.field_75224_c == slot.field_75224_c && Container.func_94527_a(slot2, this.field_146994_N, true)) { -+ if (slot2 != null && slot2.func_82869_a(this.field_146297_k.field_71439_g) && slot2.func_75216_d() && slot2.isSameInventory(slot) && Container.func_94527_a(slot2, this.field_146994_N, true)) { +- if (slot2 != null && slot2.func_82869_a(this.minecraft.field_71439_g) && slot2.func_75216_d() && slot2.field_75224_c == slot.field_75224_c && Container.func_94527_a(slot2, this.field_146994_N, true)) { ++ if (slot2 != null && slot2.func_82869_a(this.minecraft.field_71439_g) && slot2.func_75216_d() && slot2.isSameInventory(slot) && Container.func_94527_a(slot2, this.field_146994_N, true)) { this.func_184098_a(slot2, slot2.field_75222_d, p_mouseReleased_5_, ClickType.QUICK_MOVE); } } -@@ -460,7 +468,7 @@ +@@ -465,7 +474,7 @@ this.func_184098_a((Slot)null, -999, Container.func_94534_d(2, this.field_146987_F), ClickType.QUICK_CRAFT); - } else if (!this.field_146297_k.field_71439_g.field_71071_by.func_70445_o().func_190926_b()) { -- if (this.field_146297_k.field_71474_y.field_74322_I.func_197984_a(p_mouseReleased_5_)) { -+ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { + } else if (!this.minecraft.field_71439_g.field_71071_by.func_70445_o().func_190926_b()) { +- if (this.minecraft.field_71474_y.field_74322_I.func_197984_a(p_mouseReleased_5_)) { ++ if (this.minecraft.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { this.func_184098_a(slot, k, p_mouseReleased_5_, ClickType.CLONE); } else { - boolean flag1 = k != -999 && (InputMappings.func_197956_a(340) || InputMappings.func_197956_a(344)); -@@ -509,27 +517,31 @@ + boolean flag1 = k != -999 && (InputMappings.func_216506_a(Minecraft.func_71410_x().field_195558_d.func_198092_i(), 340) || InputMappings.func_216506_a(Minecraft.func_71410_x().field_195558_d.func_198092_i(), 344)); +@@ -514,27 +523,32 @@ if (super.keyPressed(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_)) { return true; } else { -- if (p_keyPressed_1_ == 256 || this.field_146297_k.field_71474_y.field_151445_Q.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) { -+ if (p_keyPressed_1_ == 256 || this.field_146297_k.field_71474_y.field_151445_Q.isActiveAndMatches(InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_))) { - this.field_146297_k.field_71439_g.func_71053_j(); +- if (p_keyPressed_1_ == 256 || this.minecraft.field_71474_y.field_151445_Q.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) { ++ InputMappings.Input mouseKey = InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_); ++ if (p_keyPressed_1_ == 256 || this.minecraft.field_71474_y.field_151445_Q.isActiveAndMatches(mouseKey)) { + this.minecraft.field_71439_g.func_71053_j(); + return true; // Forge MC-146650: Needs to return true when the key is handled. } @@ -143,13 +136,13 @@ + if (this.func_195363_d(p_keyPressed_1_, p_keyPressed_2_)) + return true; // Forge MC-146650: Needs to return true when the key is handled. if (this.field_147006_u != null && this.field_147006_u.func_75216_d()) { -- if (this.field_146297_k.field_71474_y.field_74322_I.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) { -+ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_))) { +- if (this.minecraft.field_71474_y.field_74322_I.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) { ++ if (this.minecraft.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) { this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, 0, ClickType.CLONE); -- } else if (this.field_146297_k.field_71474_y.field_74316_C.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) { +- } else if (this.minecraft.field_71474_y.field_74316_C.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) { + return true; // Forge MC-146650: Needs to return true when the key is handled. -+ } else if (this.field_146297_k.field_71474_y.field_74316_C.isActiveAndMatches(InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_))) { - this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, func_146271_m() ? 1 : 0, ClickType.THROW); ++ } else if (this.minecraft.field_71474_y.field_74316_C.isActiveAndMatches(mouseKey)) { + this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, hasControlDown() ? 1 : 0, ClickType.THROW); + return true; // Forge MC-146650: Needs to return true when the key is handled. } } @@ -160,16 +153,16 @@ } protected boolean func_195363_d(int p_195363_1_, int p_195363_2_) { - if (this.field_146297_k.field_71439_g.field_71071_by.func_70445_o().func_190926_b() && this.field_147006_u != null) { + if (this.minecraft.field_71439_g.field_71071_by.func_70445_o().func_190926_b() && this.field_147006_u != null) { for(int i = 0; i < 9; ++i) { -- if (this.field_146297_k.field_71474_y.field_151456_ac[i].func_197976_a(p_195363_1_, p_195363_2_)) { -+ if (this.field_146297_k.field_71474_y.field_151456_ac[i].isActiveAndMatches(InputMappings.func_197954_a(p_195363_1_, p_195363_2_))) { +- if (this.minecraft.field_71474_y.field_151456_ac[i].func_197976_a(p_195363_1_, p_195363_2_)) { ++ if (this.minecraft.field_71474_y.field_151456_ac[i].isActiveAndMatches(InputMappings.func_197954_a(p_195363_1_, p_195363_2_))) { this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, i, ClickType.SWAP); return true; } -@@ -556,4 +568,16 @@ - } - +@@ -565,4 +579,16 @@ + public T func_212873_a_() { + return this.field_147002_h; } + + @javax.annotation.Nullable @@ -179,7 +172,7 @@ + public int getXSize() { return field_146999_f; } + public int getYSize() { return field_147000_g; } + -+ public int slotColor = -2130706433; ++ protected int slotColor = -2130706433; + public int getSlotColor(int index) { + return slotColor; + } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch new file mode 100644 index 000000000..4b8e45629 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch @@ -0,0 +1,296 @@ +--- a/net/minecraft/client/gui/screen/inventory/CreativeScreen.java ++++ b/net/minecraft/client/gui/screen/inventory/CreativeScreen.java +@@ -63,6 +63,8 @@ + private boolean field_195377_F; + private boolean field_199506_G; + private final Map> field_214085_w = Maps.newTreeMap(); ++ private static int tabPage = 0; ++ private int maxPages = 0; + + public CreativeScreen(PlayerEntity p_i1088_1_) { + super(new CreativeScreen.CreativeContainer(p_i1088_1_), p_i1088_1_.field_71071_by, new StringTextComponent("")); +@@ -231,6 +233,12 @@ + if (this.minecraft.field_71442_b.func_78758_h()) { + super.init(); + this.minecraft.field_195559_v.func_197967_a(true); ++ int tabCount = ItemGroup.field_78032_a.length; ++ if (tabCount > 12) { ++ addButton(new net.minecraft.client.gui.widget.button.Button(field_147003_i, field_147009_r - 50, 20, 20, "<", b -> tabPage = Math.max(tabPage - 1, 0 ))); ++ addButton(new net.minecraft.client.gui.widget.button.Button(field_147003_i + field_146999_f - 20, field_147009_r - 50, 20, 20, ">", b -> tabPage = Math.min(tabPage + 1, maxPages))); ++ maxPages = (int) Math.ceil((tabCount - 12) / 10D); ++ } + this.field_147062_A = new TextFieldWidget(this.font, this.field_147003_i + 82, this.field_147009_r + 6, 80, 9, I18n.func_135052_a("itemGroup.search")); + this.field_147062_A.func_146203_f(50); + this.field_147062_A.func_146185_a(false); +@@ -271,7 +279,7 @@ + public boolean charTyped(char p_charTyped_1_, int p_charTyped_2_) { + if (this.field_195377_F) { + return false; +- } else if (field_147058_w != ItemGroup.field_78027_g.func_78021_a()) { ++ } else if (!ItemGroup.field_78032_a[field_147058_w].hasSearchBar()) { + return false; + } else { + String s = this.field_147062_A.func_146179_b(); +@@ -289,7 +297,7 @@ + + public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) { + this.field_195377_F = false; +- if (field_147058_w != ItemGroup.field_78027_g.func_78021_a()) { ++ if (!ItemGroup.field_78032_a[field_147058_w].hasSearchBar()) { + if (this.minecraft.field_71474_y.field_74310_D.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) { + this.field_195377_F = true; + this.func_147050_b(ItemGroup.field_78027_g); +@@ -325,6 +333,32 @@ + private void func_147053_i() { + (this.field_147002_h).field_148330_a.clear(); + this.field_214085_w.clear(); ++ ++ ItemGroup tab = ItemGroup.field_78032_a[field_147058_w]; ++ if (tab.hasSearchBar() && tab != ItemGroup.field_78027_g) { ++ tab.func_78018_a(field_147002_h.field_148330_a); ++ if (!this.field_147062_A.func_146179_b().isEmpty()) { ++ //TODO: Make this a SearchTree not a manual search ++ String search = this.field_147062_A.func_146179_b().toLowerCase(Locale.ROOT); ++ java.util.Iterator itr = field_147002_h.field_148330_a.iterator(); ++ while (itr.hasNext()) { ++ ItemStack stack = itr.next(); ++ boolean matches = false; ++ for (ITextComponent line : stack.func_82840_a(this.minecraft.field_71439_g, this.minecraft.field_71474_y.field_82882_x ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL)) { ++ if (TextFormatting.func_110646_a(line.getString()).toLowerCase(Locale.ROOT).contains(search)) { ++ matches = true; ++ break; ++ } ++ } ++ if (!matches) ++ itr.remove(); ++ } ++ } ++ this.field_147067_x = 0.0F; ++ field_147002_h.func_148329_a(0.0F); ++ return; ++ } ++ + String s = this.field_147062_A.func_146179_b(); + if (s.isEmpty()) { + for(Item item : Registry.field_212630_s) { +@@ -370,9 +404,9 @@ + + protected void func_146979_b(int p_146979_1_, int p_146979_2_) { + ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w]; +- if (itemgroup.func_78019_g()) { ++ if (itemgroup != null && itemgroup.func_78019_g()) { + GlStateManager.disableBlend(); +- this.font.func_211126_b(I18n.func_135052_a(itemgroup.func_78024_c()), 8.0F, 6.0F, 4210752); ++ this.font.func_211126_b(I18n.func_135052_a(itemgroup.func_78024_c()), 8.0F, 6.0F, itemgroup.getLabelColor()); + } + + } +@@ -383,7 +417,7 @@ + double d1 = p_mouseClicked_3_ - (double)this.field_147009_r; + + for(ItemGroup itemgroup : ItemGroup.field_78032_a) { +- if (this.func_195375_a(itemgroup, d0, d1)) { ++ if (itemgroup != null && this.func_195375_a(itemgroup, d0, d1)) { + return true; + } + } +@@ -404,7 +438,7 @@ + this.field_147066_y = false; + + for(ItemGroup itemgroup : ItemGroup.field_78032_a) { +- if (this.func_195375_a(itemgroup, d0, d1)) { ++ if (itemgroup != null && this.func_195375_a(itemgroup, d0, d1)) { + this.func_147050_b(itemgroup); + return true; + } +@@ -415,12 +449,15 @@ + } + + private boolean func_147055_p() { ++ if (ItemGroup.field_78032_a[field_147058_w] == null) return false; + return field_147058_w != ItemGroup.field_78036_m.func_78021_a() && ItemGroup.field_78032_a[field_147058_w].func_78017_i() && this.field_147002_h.func_148328_e(); + } + + private void func_147050_b(ItemGroup p_147050_1_) { ++ if (p_147050_1_ == null) return; + int i = field_147058_w; + field_147058_w = p_147050_1_.func_78021_a(); ++ slotColor = p_147050_1_.getSlotColor(); + this.field_147008_s.clear(); + (this.field_147002_h).field_148330_a.clear(); + if (p_147050_1_ == ItemGroup.field_192395_m) { +@@ -494,19 +531,21 @@ + } + + if (this.field_147062_A != null) { +- if (p_147050_1_ == ItemGroup.field_78027_g) { ++ if (p_147050_1_.hasSearchBar()) { + this.field_147062_A.func_146189_e(true); + this.field_147062_A.func_146205_d(false); +- this.field_147062_A.func_146195_b(true); ++ this.field_147062_A.setFocused(true); + if (i != p_147050_1_.func_78021_a()) { + this.field_147062_A.func_146180_a(""); + } ++ this.field_147062_A.setWidth(p_147050_1_.getSearchbarWidth()); ++ this.field_147062_A.x = this.field_147003_i + (82 /*default left*/ + 89 /*default width*/) - this.field_147062_A.getWidth(); + + this.func_147053_i(); + } else { + this.field_147062_A.func_146189_e(false); + this.field_147062_A.func_146205_d(true); +- this.field_147062_A.func_146195_b(false); ++ this.field_147062_A.setFocused(false); + this.field_147062_A.func_146180_a(""); + } + } +@@ -560,16 +599,35 @@ + this.renderBackground(); + super.render(p_render_1_, p_render_2_, p_render_3_); + +- for(ItemGroup itemgroup : ItemGroup.field_78032_a) { +- if (this.func_147052_b(itemgroup, p_render_1_, p_render_2_)) { ++ int start = tabPage * 10; ++ int end = Math.min(ItemGroup.field_78032_a.length, ((tabPage + 1) * 10) + 2); ++ if (tabPage != 0) start += 2; ++ boolean rendered = false; ++ ++ for (int x = start; x < end; x++) { ++ ItemGroup itemgroup = ItemGroup.field_78032_a[x]; ++ if (itemgroup != null && this.func_147052_b(itemgroup, p_render_1_, p_render_2_)) { ++ rendered = true; + break; + } + } ++ if (!rendered && !func_147052_b(ItemGroup.field_78027_g, p_render_1_, p_render_2_)) ++ func_147052_b(ItemGroup.field_78036_m, p_render_1_, p_render_2_); + + if (this.field_147064_C != null && field_147058_w == ItemGroup.field_78036_m.func_78021_a() && this.func_195359_a(this.field_147064_C.field_75223_e, this.field_147064_C.field_75221_f, 16, 16, (double)p_render_1_, (double)p_render_2_)) { + this.renderTooltip(I18n.func_135052_a("inventory.binSlot"), p_render_1_, p_render_2_); + } + ++ if (maxPages != 0) { ++ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); ++ GlStateManager.disableLighting(); ++ this.blitOffset = 300; ++ this.itemRenderer.field_77023_b = 300.0F; ++ font.func_211126_b(page, field_147003_i + (field_146999_f / 2) - (font.func_78256_a(page) / 2), field_147009_r - 44, -1); ++ this.blitOffset = 0; ++ this.itemRenderer.field_77023_b = 0.0F; ++ } ++ + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableLighting(); + this.func_191948_b(p_render_1_, p_render_2_); +@@ -618,7 +676,11 @@ + } + } + +- this.renderTooltip(list1, p_renderTooltip_2_, p_renderTooltip_3_); ++ ++ net.minecraft.client.gui.FontRenderer font = p_renderTooltip_1_.func_77973_b().getFontRenderer(p_renderTooltip_1_); ++ net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(p_renderTooltip_1_); ++ this.renderTooltip(list1, p_renderTooltip_2_, p_renderTooltip_3_, (font == null ? this.font : font)); ++ net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip(); + } else { + super.renderTooltip(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_); + } +@@ -630,25 +692,44 @@ + RenderHelper.func_74520_c(); + ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w]; + +- for(ItemGroup itemgroup1 : ItemGroup.field_78032_a) { +- this.minecraft.func_110434_K().func_110577_a(field_147061_u); +- if (itemgroup1.func_78021_a() != field_147058_w) { ++ int start = tabPage * 10; ++ int end = Math.min(ItemGroup.field_78032_a.length, ((tabPage + 1) * 10 + 2)); ++ if (tabPage != 0) start += 2; ++ ++ for (int idx = start; idx < end; idx++) { ++ ItemGroup itemgroup1 = ItemGroup.field_78032_a[idx]; ++ if (itemgroup1 != null && itemgroup1.func_78021_a() != field_147058_w) { ++ this.minecraft.func_110434_K().func_110577_a(itemgroup1.getTabsImage()); + this.func_147051_a(itemgroup1); + } + } + +- this.minecraft.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + itemgroup.func_78015_f())); ++ if (tabPage != 0) { ++ if (itemgroup != ItemGroup.field_78027_g) { ++ this.minecraft.func_110434_K().func_110577_a(ItemGroup.field_78027_g.getTabsImage()); ++ func_147051_a(ItemGroup.field_78027_g); ++ } ++ if (itemgroup != ItemGroup.field_78036_m) { ++ this.minecraft.func_110434_K().func_110577_a(ItemGroup.field_78036_m.getTabsImage()); ++ func_147051_a(ItemGroup.field_78036_m); ++ } ++ } ++ ++ this.minecraft.func_110434_K().func_110577_a(itemgroup.getBackgroundImage()); + this.blit(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g); + this.field_147062_A.render(p_146976_2_, p_146976_3_, p_146976_1_); + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + int i = this.field_147003_i + 175; + int j = this.field_147009_r + 18; + int k = j + 112; +- this.minecraft.func_110434_K().func_110577_a(field_147061_u); ++ this.minecraft.func_110434_K().func_110577_a(itemgroup.getTabsImage()); + if (itemgroup.func_78017_i()) { + this.blit(i, j + (int)((float)(k - j - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15); + } + ++ if ((itemgroup == null || itemgroup.getTabPage() != tabPage) && (itemgroup != ItemGroup.field_78027_g && itemgroup != ItemGroup.field_78036_m)) ++ return; ++ + this.func_147051_a(itemgroup); + if (itemgroup == ItemGroup.field_78036_m) { + InventoryScreen.func_147046_a(this.field_147003_i + 88, this.field_147009_r + 45, 20, (float)(this.field_147003_i + 88 - p_146976_2_), (float)(this.field_147009_r + 45 - 30 - p_146976_3_), this.minecraft.field_71439_g); +@@ -657,6 +738,7 @@ + } + + protected boolean func_195375_a(ItemGroup p_195375_1_, double p_195375_2_, double p_195375_4_) { ++ if (p_195375_1_.getTabPage() != tabPage && p_195375_1_ != ItemGroup.field_78027_g && p_195375_1_ != ItemGroup.field_78036_m) return false; + int i = p_195375_1_.func_78020_k(); + int j = 28 * i; + int k = 0; +@@ -726,6 +808,8 @@ + } + + GlStateManager.disableLighting(); ++ GlStateManager.color3f(1F, 1F, 1F); //Forge: Reset color in case Items change it. ++ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. + this.blit(l, i1, j, k, 28, 32); + this.blitOffset = 100; + this.itemRenderer.field_77023_b = 100.0F; +@@ -897,6 +981,31 @@ + public boolean func_82869_a(PlayerEntity p_82869_1_) { + return this.field_148332_b.func_82869_a(p_82869_1_); + } ++ ++ public ResourceLocation getBackgroundLocation() { ++ return this.field_148332_b.getBackgroundLocation(); ++ } ++ ++ public void setBackgroundLocation(ResourceLocation texture) { ++ this.field_148332_b.setBackgroundLocation(texture); ++ } ++ ++ public void setBackgroundName(@Nullable String name) { ++ this.field_148332_b.setBackgroundName(name); ++ } ++ ++ @Nullable ++ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() { ++ return this.field_148332_b.getBackgroundSprite(); ++ } ++ ++ public int getSlotIndex() { ++ return this.field_148332_b.getSlotIndex(); ++ } ++ ++ public boolean isSameInventory(Slot other) { ++ return this.field_148332_b.isSameInventory(other); ++ } + } + + @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java.patch b/patches/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java.patch index f4c33443b..754784d69 100644 --- a/patches/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/toasts/RecipeToast.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/gui/toasts/RecipeToast.java +++ b/net/minecraft/client/gui/toasts/RecipeToast.java -@@ -38,7 +38,7 @@ +@@ -36,7 +36,7 @@ p_193653_1_.func_192989_b().field_71466_p.func_211126_b(I18n.func_135052_a("recipe.toast.title"), 30.0F, 7.0F, -11534256); p_193653_1_.func_192989_b().field_71466_p.func_211126_b(I18n.func_135052_a("recipe.toast.description"), 30.0F, 18.0F, -16777216); RenderHelper.func_74520_c(); -- IRecipe irecipe = this.field_202906_c.get((int)(p_193653_2_ / (5000L / (long)this.field_202906_c.size()) % (long)this.field_202906_c.size())); -+ IRecipe irecipe = this.field_202906_c.get((int)((p_193653_2_ * (long)this.field_202906_c.size() / 5000L) % (long)this.field_202906_c.size())); //Forge: fix math so that it doesn't divide by 0 when there are more than 5000 recipes - ItemStack itemstack; - if (irecipe instanceof FurnaceRecipe) { - itemstack = new ItemStack(Blocks.field_150460_al); +- IRecipe irecipe = this.field_202906_c.get((int)(p_193653_2_ / (5000L / (long)this.field_202906_c.size()) % (long)this.field_202906_c.size())); ++ IRecipe irecipe = this.field_202906_c.get((int)((p_193653_2_ * (long)this.field_202906_c.size() / 5000L) % (long)this.field_202906_c.size())); //Forge: fix math so that it doesn't divide by 0 when there are more than 5000 recipes + ItemStack itemstack = irecipe.func_222128_h(); + GlStateManager.pushMatrix(); + GlStateManager.scalef(0.6F, 0.6F, 1.0F); diff --git a/patches/minecraft/net/minecraft/client/gui/widget/TextFieldWidget.java.patch b/patches/minecraft/net/minecraft/client/gui/widget/TextFieldWidget.java.patch new file mode 100644 index 000000000..c26625a4b --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/widget/TextFieldWidget.java.patch @@ -0,0 +1,56 @@ +--- a/net/minecraft/client/gui/widget/TextFieldWidget.java ++++ b/net/minecraft/client/gui/widget/TextFieldWidget.java +@@ -349,7 +349,7 @@ + } else { + boolean flag = p_mouseClicked_1_ >= (double)this.x && p_mouseClicked_1_ < (double)(this.x + this.width) && p_mouseClicked_3_ >= (double)this.y && p_mouseClicked_3_ < (double)(this.y + this.height); + if (this.field_146212_n) { +- this.func_146195_b(flag); ++ this.setFocused(flag); + } + + if (this.isFocused() && flag && p_mouseClicked_5_ == 0) { +@@ -358,7 +358,7 @@ + i -= 4; + } + +- String s = this.field_146211_a.func_78269_a(this.field_146216_j.substring(this.field_146225_q), this.func_146200_o()); ++ String s = this.field_146211_a.func_78269_a(this.field_146216_j.substring(this.field_146225_q), this.getWidth()); + this.func_146190_e(this.field_146211_a.func_78269_a(s, i).length() + this.field_146225_q); + return true; + } else { +@@ -367,7 +367,7 @@ + } + } + +- public void func_146195_b(boolean p_146195_1_) { ++ public void setFocused(boolean p_146195_1_) { + super.setFocused(p_146195_1_); + } + +@@ -381,7 +381,7 @@ + int i = this.field_146226_p ? this.field_146222_t : this.field_146221_u; + int j = this.field_146224_r - this.field_146225_q; + int k = this.field_146223_s - this.field_146225_q; +- String s = this.field_146211_a.func_78269_a(this.field_146216_j.substring(this.field_146225_q), this.func_146200_o()); ++ String s = this.field_146211_a.func_78269_a(this.field_146216_j.substring(this.field_146225_q), this.getWidth()); + boolean flag = j >= 0 && j <= s.length(); + boolean flag1 = this.isFocused() && this.field_146214_l / 6 % 2 == 0 && flag; + int l = this.field_146215_m ? this.x + 4 : this.x; +@@ -522,7 +522,7 @@ + this.field_146226_p = p_146184_1_; + } + +- public int func_146200_o() { ++ public int getWidth() { + return this.func_146181_i() ? this.width - 8 : this.width; + } + +@@ -534,7 +534,7 @@ + this.field_146225_q = i; + } + +- int j = this.func_146200_o(); ++ int j = this.getWidth(); + String s = this.field_146211_a.func_78269_a(this.field_146216_j.substring(this.field_146225_q), j); + int k = s.length() + this.field_146225_q; + if (this.field_146223_s == this.field_146225_q) { diff --git a/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch b/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch new file mode 100644 index 000000000..69ea8b740 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/widget/Widget.java.patch @@ -0,0 +1,50 @@ +--- a/net/minecraft/client/gui/widget/Widget.java ++++ b/net/minecraft/client/gui/widget/Widget.java +@@ -110,12 +110,7 @@ + this.blit(this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height); + this.blit(this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height); + this.renderBg(minecraft, p_renderButton_1_, p_renderButton_2_); +- int j = 14737632; +- if (!this.active) { +- j = 10526880; +- } else if (this.isHovered()) { +- j = 16777120; +- } ++ int j = getFGColor(); + + this.drawCenteredString(fontrenderer, this.message, this.x + this.width / 2, this.y + (this.height - 8) / 2, j | MathHelper.func_76123_f(this.alpha * 255.0F) << 24); + } +@@ -211,6 +206,14 @@ + this.width = p_setWidth_1_; + } + ++ public int getHeight() { ++ return this.height; ++ } ++ ++ public void setHeight(int value) { ++ this.height = value; ++ } ++ + public void setAlpha(float p_setAlpha_1_) { + this.alpha = p_setAlpha_1_; + } +@@ -234,4 +237,18 @@ + protected void setFocused(boolean p_setFocused_1_) { + this.focused = p_setFocused_1_; + } ++ ++ protected int packedFGColor = 0; ++ public int getFGColor() { ++ if (packedFGColor != 0) return packedFGColor; ++ int ret = 14737632; ++ if (!this.active) ++ ret = 10526880; ++ else if (this.isHovered()) ++ ret = 16777120; ++ return ret; ++ } ++ public void setFGColor(int color) { ++ this.packedFGColor = color; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/gui/widget/list/AbstractList.java.patch b/patches/minecraft/net/minecraft/client/gui/widget/list/AbstractList.java.patch new file mode 100644 index 000000000..66e1a2f04 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/widget/list/AbstractList.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/client/gui/widget/list/AbstractList.java ++++ b/net/minecraft/client/gui/widget/list/AbstractList.java +@@ -451,6 +451,13 @@ + return flag; + } + ++ public int getWidth() { return this.width; } ++ public int getHeight() { return this.height; } ++ public int getTop() { return this.y0; } ++ public int getBottom() { return this.y1; } ++ public int getLeft() { return this.x1; } ++ public int getRight() { return this.x0; } ++ + @OnlyIn(Dist.CLIENT) + public abstract static class AbstractListEntry> implements IGuiEventListener { + @Deprecated diff --git a/patches/minecraft/net/minecraft/client/gui/widget/list/KeyBindingList.java.patch b/patches/minecraft/net/minecraft/client/gui/widget/list/KeyBindingList.java.patch new file mode 100644 index 000000000..62adf284f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/widget/list/KeyBindingList.java.patch @@ -0,0 +1,60 @@ +--- a/net/minecraft/client/gui/widget/list/KeyBindingList.java ++++ b/net/minecraft/client/gui/widget/list/KeyBindingList.java +@@ -45,7 +45,7 @@ + } + + protected int getScrollbarPosition() { +- return super.getScrollbarPosition() + 15; ++ return super.getScrollbarPosition() + 15 + 20; + } + + public int getRowWidth() { +@@ -89,7 +89,7 @@ + private KeyEntry(final KeyBinding p_i45029_2_) { + this.field_148282_b = p_i45029_2_; + this.field_148283_c = I18n.func_135052_a(p_i45029_2_.func_151464_g()); +- this.field_148280_d = new Button(0, 0, 75, 20, this.field_148283_c, (p_214386_2_) -> { ++ this.field_148280_d = new Button(0, 0, 75 + 20 /*Forge: add space*/, 20, this.field_148283_c, (p_214386_2_) -> { + KeyBindingList.this.field_148191_k.field_146491_f = p_i45029_2_; + }) { + protected String getNarrationMessage() { +@@ -97,6 +97,7 @@ + } + }; + this.field_148281_e = new Button(0, 0, 50, 20, I18n.func_135052_a("controls.reset"), (p_214387_2_) -> { ++ field_148282_b.setToDefault(); + KeyBindingList.this.minecraft.field_71474_y.func_198014_a(p_i45029_2_, p_i45029_2_.func_197977_i()); + KeyBinding.func_74508_b(); + }) { +@@ -109,7 +110,7 @@ + public void render(int p_render_1_, int p_render_2_, int p_render_3_, int p_render_4_, int p_render_5_, int p_render_6_, int p_render_7_, boolean p_render_8_, float p_render_9_) { + boolean flag = KeyBindingList.this.field_148191_k.field_146491_f == this.field_148282_b; + KeyBindingList.this.minecraft.field_71466_p.func_211126_b(this.field_148283_c, (float)(p_render_3_ + 90 - KeyBindingList.this.field_148188_n), (float)(p_render_2_ + p_render_5_ / 2 - 9 / 2), 16777215); +- this.field_148281_e.x = p_render_3_ + 190; ++ this.field_148281_e.x = p_render_3_ + 190 + 20; + this.field_148281_e.y = p_render_2_; + this.field_148281_e.active = !this.field_148282_b.func_197985_l(); + this.field_148281_e.render(p_render_6_, p_render_7_, p_render_9_); +@@ -117,11 +118,12 @@ + this.field_148280_d.y = p_render_2_; + this.field_148280_d.setMessage(this.field_148282_b.func_197978_k()); + boolean flag1 = false; ++ boolean keyCodeModifierConflict = true; // less severe form of conflict, like SHIFT conflicting with SHIFT+G + if (!this.field_148282_b.func_197986_j()) { + for(KeyBinding keybinding : KeyBindingList.this.minecraft.field_71474_y.field_74324_K) { + if (keybinding != this.field_148282_b && this.field_148282_b.func_197983_b(keybinding)) { + flag1 = true; +- break; ++ keyCodeModifierConflict &= keybinding.hasKeyCodeModifierConflict(this.field_148282_b); + } + } + } +@@ -129,7 +131,7 @@ + if (flag) { + this.field_148280_d.setMessage(TextFormatting.WHITE + "> " + TextFormatting.YELLOW + this.field_148280_d.getMessage() + TextFormatting.WHITE + " <"); + } else if (flag1) { +- this.field_148280_d.setMessage(TextFormatting.RED + this.field_148280_d.getMessage()); ++ this.field_148280_d.setMessage((keyCodeModifierConflict ? TextFormatting.GOLD : TextFormatting.RED) + this.field_148280_d.getMessage()); + } + + this.field_148280_d.render(p_render_6_, p_render_7_, p_render_9_); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch deleted file mode 100644 index 6141732f9..000000000 --- a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/client/multiplayer/ChunkProviderClient.java -+++ b/net/minecraft/client/multiplayer/ChunkProviderClient.java -@@ -59,6 +59,7 @@ - return new Chunk(this.field_73235_d, p_212474_1_, p_212474_2_, new Biome[256]); - }); - chunk.func_186033_a(p_212474_3_, p_212474_4_, p_212474_5_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); - chunk.func_177417_c(true); - return chunk; - } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch new file mode 100644 index 000000000..898c60945 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkProvider.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/client/multiplayer/ClientChunkProvider.java ++++ b/net/minecraft/client/multiplayer/ClientChunkProvider.java +@@ -72,6 +72,7 @@ + if (this.field_217256_d.func_217183_b(p_212849_1_, p_212849_2_)) { + Chunk chunk = this.field_217256_d.func_217192_a(this.field_217256_d.func_217191_a(p_212849_1_, p_212849_2_)); + if (func_217249_a(chunk, p_212849_1_, p_212849_2_)) { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); + return chunk; + } + } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch new file mode 100644 index 000000000..0b29384f1 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch @@ -0,0 +1,90 @@ +--- a/net/minecraft/client/multiplayer/PlayerController.java ++++ b/net/minecraft/client/multiplayer/PlayerController.java +@@ -104,6 +104,8 @@ + } + } + ++ if (field_78776_a.field_71439_g.func_184614_ca().onBlockStartBreak(p_187103_1_, field_78776_a.field_71439_g)) return false; ++ + World world = this.field_78776_a.field_71441_e; + BlockState blockstate = world.func_180495_p(p_187103_1_); + if (!this.field_78776_a.field_71439_g.func_184614_ca().func_77973_b().func_195938_a(blockstate, world, p_187103_1_, this.field_78776_a.field_71439_g)) { +@@ -112,7 +114,7 @@ + Block block = blockstate.func_177230_c(); + if ((block instanceof CommandBlockBlock || block instanceof StructureBlock || block instanceof JigsawBlock) && !this.field_78776_a.field_71439_g.func_195070_dx()) { + return false; +- } else if (blockstate.func_196958_f()) { ++ } else if (blockstate.isAir(world, p_187103_1_)) { + return false; + } else { + block.func_176208_a(world, p_187103_1_, blockstate, this.field_78776_a.field_71439_g); +@@ -209,13 +211,13 @@ + return true; + } else if (this.func_178893_a(p_180512_1_)) { + BlockState blockstate = this.field_78776_a.field_71441_e.func_180495_p(p_180512_1_); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(this.field_78776_a.field_71441_e, p_180512_1_)) { + this.field_78778_j = false; + return false; + } else { + this.field_78770_f += blockstate.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180512_1_); + if (this.field_78780_h % 4.0F == 0.0F) { +- SoundType soundtype = blockstate.func_215695_r(); ++ SoundType soundtype = blockstate.getSoundType(this.field_78776_a.field_71441_e, p_180512_1_, this.field_78776_a.field_71439_g); + this.field_78776_a.func_147118_V().func_147682_a(new SimpleSound(soundtype.func_185846_f(), SoundCategory.NEUTRAL, (soundtype.func_185843_a() + 1.0F) / 8.0F, soundtype.func_185847_b() * 0.5F, p_180512_1_)); + } + +@@ -239,7 +241,8 @@ + } + + public float func_78757_d() { +- return this.field_78779_k.func_77145_d() ? 5.0F : 4.5F; ++ float attrib = (float)field_78776_a.field_71439_g.func_110148_a(PlayerEntity.REACH_DISTANCE).func_111126_e(); ++ return this.field_78779_k.func_77145_d() ? attrib : attrib - 0.5F; + } + + public void func_78765_e() { +@@ -256,7 +259,7 @@ + ItemStack itemstack = this.field_78776_a.field_71439_g.func_184614_ca(); + boolean flag = this.field_85183_f.func_190926_b() && itemstack.func_190926_b(); + if (!this.field_85183_f.func_190926_b() && !itemstack.func_190926_b()) { +- flag = itemstack.func_77973_b() == this.field_85183_f.func_77973_b() && ItemStack.func_77970_a(itemstack, this.field_85183_f) && (itemstack.func_77984_f() || itemstack.func_77952_i() == this.field_85183_f.func_77952_i()); ++ flag = !this.field_85183_f.shouldCauseBlockBreakReset(itemstack); + } + + return p_178893_1_.equals(this.field_178895_c) && flag; +@@ -320,11 +323,14 @@ + if (p_187101_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) { + return ActionResultType.PASS; + } else { ++ ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187101_1_, p_187101_3_); ++ if (cancelResult != null) return cancelResult; + int i = itemstack.func_190916_E(); + ActionResult actionresult = itemstack.func_77957_a(p_187101_2_, p_187101_1_, p_187101_3_); + ItemStack itemstack1 = actionresult.func_188398_b(); + if (itemstack1 != itemstack || itemstack1.func_190916_E() != i) { + p_187101_1_.func_184611_a(p_187101_3_, itemstack1); ++ if (itemstack1.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_3_); + } + + return actionresult.func_188397_a(); +@@ -349,6 +355,9 @@ + public ActionResultType func_187097_a(PlayerEntity p_187097_1_, Entity p_187097_2_, Hand p_187097_3_) { + this.func_78750_j(); + this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187097_2_, p_187097_3_)); ++ if (this.field_78779_k == GameType.SPECTATOR) return ActionResultType.PASS; // don't fire for spectators to match non-specific EntityInteract ++ ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntity(p_187097_1_, p_187097_2_, p_187097_3_); ++ if(cancelResult != null) return cancelResult; + return this.field_78779_k == GameType.SPECTATOR ? ActionResultType.PASS : p_187097_1_.func_190775_a(p_187097_2_, p_187097_3_); + } + +@@ -356,6 +365,9 @@ + this.func_78750_j(); + Vec3d vec3d = p_187102_3_.func_216347_e().func_178786_a(p_187102_2_.field_70165_t, p_187102_2_.field_70163_u, p_187102_2_.field_70161_v); + this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187102_2_, p_187102_4_, vec3d)); ++ if (this.field_78779_k == GameType.SPECTATOR) return ActionResultType.PASS; // don't fire for spectators to match non-specific EntityInteract ++ ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAt(p_187102_1_, p_187102_2_, p_187102_3_, p_187102_4_); ++ if(cancelResult != null) return cancelResult; + return this.field_78779_k == GameType.SPECTATOR ? ActionResultType.PASS : p_187102_2_.func_184199_a(p_187102_1_, vec3d, p_187102_4_); + } + diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch deleted file mode 100644 index 8e9769ea3..000000000 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ /dev/null @@ -1,188 +0,0 @@ ---- a/net/minecraft/client/multiplayer/PlayerControllerMP.java -+++ b/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -105,6 +105,8 @@ - } - } - -+ if (field_78776_a.field_71439_g.func_184614_ca().onBlockStartBreak(p_187103_1_, field_78776_a.field_71439_g)) return false; -+ - World world = this.field_78776_a.field_71441_e; - IBlockState iblockstate = world.func_180495_p(p_187103_1_); - if (!this.field_78776_a.field_71439_g.func_184614_ca().func_77973_b().func_195938_a(iblockstate, world, p_187103_1_, this.field_78776_a.field_71439_g)) { -@@ -116,24 +118,23 @@ - } else if (iblockstate.func_196958_f()) { - return false; - } else { -- block.func_176208_a(world, p_187103_1_, iblockstate, this.field_78776_a.field_71439_g); - IFluidState ifluidstate = world.func_204610_c(p_187103_1_); -- boolean flag = world.func_180501_a(p_187103_1_, ifluidstate.func_206883_i(), 11); -- if (flag) { -- block.func_176206_d(world, p_187103_1_, iblockstate); -- } - - this.field_178895_c = new BlockPos(this.field_178895_c.func_177958_n(), -1, this.field_178895_c.func_177952_p()); - if (!this.field_78779_k.func_77145_d()) { - ItemStack itemstack1 = this.field_78776_a.field_71439_g.func_184614_ca(); -+ ItemStack copyBeforeUse = itemstack1.func_77946_l(); - if (!itemstack1.func_190926_b()) { - itemstack1.func_179548_a(world, iblockstate, p_187103_1_, this.field_78776_a.field_71439_g); - if (itemstack1.func_190926_b()) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_78776_a.field_71439_g, copyBeforeUse, EnumHand.MAIN_HAND); - this.field_78776_a.field_71439_g.func_184611_a(EnumHand.MAIN_HAND, ItemStack.field_190927_a); - } - } - } - -+ boolean flag = iblockstate.removedByPlayer(world, p_187103_1_, field_78776_a.field_71439_g, false, ifluidstate); -+ if (flag) block.func_176206_d(world, p_187103_1_, iblockstate); - return flag; - } - } -@@ -164,21 +165,25 @@ - if (this.field_78779_k.func_77145_d()) { - this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_), 1.0F); - this.field_78774_b.func_147297_a(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_)); -+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(this.field_78776_a.field_71439_g, func_78757_d() + 1)).isCanceled()) - func_178891_a(this.field_78776_a, this, p_180511_1_, p_180511_2_); - this.field_78781_i = 5; - } else if (!this.field_78778_j || !this.func_178893_a(p_180511_1_)) { - if (this.field_78778_j) { - this.field_78774_b.func_147297_a(new CPacketPlayerDigging(CPacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.field_178895_c, p_180511_2_)); - } -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(this.field_78776_a.field_71439_g, func_78757_d() + 1)); - - IBlockState iblockstate = this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_); - this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, iblockstate, 0.0F); - this.field_78774_b.func_147297_a(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_)); - boolean flag = !iblockstate.func_196958_f(); - if (flag && this.field_78770_f == 0.0F) { -+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) - iblockstate.func_196942_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71439_g); - } - -+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; - if (flag && iblockstate.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180511_1_) >= 1.0F) { - this.func_187103_a(p_180511_1_); - } else { -@@ -227,7 +232,7 @@ - } else { - this.field_78770_f += iblockstate.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180512_1_); - if (this.field_78780_h % 4.0F == 0.0F) { -- SoundType soundtype = block.func_185467_w(); -+ SoundType soundtype = iblockstate.getSoundType(field_78776_a.field_71441_e, p_180512_1_, field_78776_a.field_71439_g); - this.field_78776_a.func_147118_V().func_147682_a(new SimpleSound(soundtype.func_185846_f(), SoundCategory.NEUTRAL, (soundtype.func_185843_a() + 1.0F) / 8.0F, soundtype.func_185847_b() * 0.5F, p_180512_1_)); - } - -@@ -251,7 +256,8 @@ - } - - public float func_78757_d() { -- return this.field_78779_k.func_77145_d() ? 5.0F : 4.5F; -+ float attrib = (float)field_78776_a.field_71439_g.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e(); -+ return this.field_78779_k.func_77145_d() ? attrib : attrib - 0.5F; - } - - public void func_78765_e() { -@@ -268,7 +274,7 @@ - ItemStack itemstack = this.field_78776_a.field_71439_g.func_184614_ca(); - boolean flag = this.field_85183_f.func_190926_b() && itemstack.func_190926_b(); - if (!this.field_85183_f.func_190926_b() && !itemstack.func_190926_b()) { -- flag = itemstack.func_77973_b() == this.field_85183_f.func_77973_b() && ItemStack.func_77970_a(itemstack, this.field_85183_f) && (itemstack.func_77984_f() || itemstack.func_77952_i() == this.field_85183_f.func_77952_i()); -+ flag = !this.field_85183_f.shouldCauseBlockBreakReset(itemstack); - } - - return p_178893_1_.equals(this.field_178895_c) && flag; -@@ -292,17 +298,35 @@ - float f = (float)(p_187099_5_.field_72450_a - (double)p_187099_3_.func_177958_n()); - float f1 = (float)(p_187099_5_.field_72448_b - (double)p_187099_3_.func_177956_o()); - float f2 = (float)(p_187099_5_.field_72449_c - (double)p_187099_3_.func_177952_p()); -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks -+ .onRightClickBlock(p_187099_1_, p_187099_6_, p_187099_3_, p_187099_4_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(p_187099_1_, func_78757_d() + 1)); -+ if (event.isCanceled()) { -+ // Give the server a chance to fire event as well. That way server event is not dependant on client event. -+ this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); -+ return event.getCancellationResult(); -+ } - if (this.field_78779_k == GameType.SPECTATOR) { - this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); - return EnumActionResult.SUCCESS; - } else { -- boolean flag = !p_187099_1_.func_184614_ca().func_190926_b() || !p_187099_1_.func_184592_cb().func_190926_b(); -+ EnumActionResult ret = itemstack.onItemUseFirst(new ItemUseContext(p_187099_1_, p_187099_1_.func_184586_b(p_187099_6_), p_187099_3_, p_187099_4_, f, f1, f2)); -+ if (ret != EnumActionResult.PASS) { -+ // The server needs to process the item use as well. Otherwise onItemUseFirst won't ever be called on the server without causing weird bugs -+ this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); -+ return ret; -+ } -+ boolean flag = !(p_187099_1_.func_184614_ca().doesSneakBypassUse(p_187099_2_, p_187099_3_, p_187099_1_) && p_187099_1_.func_184592_cb().doesSneakBypassUse(p_187099_2_, p_187099_3_, p_187099_1_)); - boolean flag1 = p_187099_1_.func_70093_af() && flag; -- if (!flag1 && p_187099_2_.func_180495_p(p_187099_3_).func_196943_a(p_187099_2_, p_187099_3_, p_187099_1_, p_187099_6_, p_187099_4_, f, f1, f2)) { -+ if (!flag1 || event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW) { -+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) { -+ if (p_187099_2_.func_180495_p(p_187099_3_).func_196943_a(p_187099_2_, p_187099_3_, p_187099_1_, p_187099_6_, p_187099_4_, f, f1, f2)) { -+ this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); -+ return EnumActionResult.SUCCESS; -+ } -+ } -+ } -+ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) { - this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); -- return EnumActionResult.SUCCESS; -- } else { -- this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); - if (!itemstack.func_190926_b() && !p_187099_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) { - ItemUseContext itemusecontext = new ItemUseContext(p_187099_1_, p_187099_1_.func_184586_b(p_187099_6_), p_187099_3_, p_187099_4_, f, f1, f2); - EnumActionResult enumactionresult; -@@ -311,7 +335,9 @@ - enumactionresult = itemstack.func_196084_a(itemusecontext); - itemstack.func_190920_e(i); - } else { -+ ItemStack copyForUse = itemstack.func_77946_l(); - enumactionresult = itemstack.func_196084_a(itemusecontext); -+ if (itemstack.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187099_1_, copyForUse, p_187099_6_); - } - - return enumactionresult; -@@ -319,6 +345,7 @@ - return EnumActionResult.PASS; - } - } -+ return EnumActionResult.PASS; - } - } - } -@@ -333,11 +360,14 @@ - if (p_187101_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) { - return EnumActionResult.PASS; - } else { -+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187101_1_, p_187101_3_); -+ if (cancelResult != null) return cancelResult; - int i = itemstack.func_190916_E(); - ActionResult actionresult = itemstack.func_77957_a(p_187101_2_, p_187101_1_, p_187101_3_); - ItemStack itemstack1 = actionresult.func_188398_b(); - if (itemstack1 != itemstack || itemstack1.func_190916_E() != i) { - p_187101_1_.func_184611_a(p_187101_3_, itemstack1); -+ if (itemstack1.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_3_); - } - - return actionresult.func_188397_a(); -@@ -362,6 +392,9 @@ - public EnumActionResult func_187097_a(EntityPlayer p_187097_1_, Entity p_187097_2_, EnumHand p_187097_3_) { - this.func_78750_j(); - this.field_78774_b.func_147297_a(new CPacketUseEntity(p_187097_2_, p_187097_3_)); -+ if (this.field_78779_k == GameType.SPECTATOR) return EnumActionResult.PASS; // don't fire for spectators to match non-specific EntityInteract -+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntity(p_187097_1_, p_187097_2_, p_187097_3_); -+ if(cancelResult != null) return cancelResult; - return this.field_78779_k == GameType.SPECTATOR ? EnumActionResult.PASS : p_187097_1_.func_190775_a(p_187097_2_, p_187097_3_); - } - -@@ -369,6 +402,9 @@ - this.func_78750_j(); - Vec3d vec3d = new Vec3d(p_187102_3_.field_72307_f.field_72450_a - p_187102_2_.field_70165_t, p_187102_3_.field_72307_f.field_72448_b - p_187102_2_.field_70163_u, p_187102_3_.field_72307_f.field_72449_c - p_187102_2_.field_70161_v); - this.field_78774_b.func_147297_a(new CPacketUseEntity(p_187102_2_, p_187102_4_, vec3d)); -+ if (this.field_78779_k == GameType.SPECTATOR) return EnumActionResult.PASS; // don't fire for spectators to match non-specific EntityInteract -+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAt(p_187102_1_, p_187102_2_, p_187102_3_, p_187102_4_); -+ if(cancelResult != null) return cancelResult; - return this.field_78779_k == GameType.SPECTATOR ? EnumActionResult.PASS : p_187102_2_.func_184199_a(p_187102_1_, vec3d, p_187102_4_); - } - diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch index 69f93e02a..334cd67c3 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ServerData.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/ServerData.java +++ b/net/minecraft/client/multiplayer/ServerData.java -@@ -20,6 +20,7 @@ +@@ -22,6 +22,7 @@ private ServerData.ServerResourceMode field_152587_j = ServerData.ServerResourceMode.PROMPT; private String field_147411_m; private boolean field_181042_l; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch deleted file mode 100644 index 2c981d1f7..000000000 --- a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/net/minecraft/client/multiplayer/WorldClient.java -+++ b/net/minecraft/client/multiplayer/WorldClient.java -@@ -76,11 +76,13 @@ - this.field_200261_M = new Scoreboard(); - this.field_73035_a = p_i49845_1_; - this.func_72912_H().func_176144_a(p_i49845_4_); -- this.func_175652_B(new BlockPos(8, 64, 8)); - this.field_73011_w.func_76558_a(this); -+ this.func_175652_B(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect. - this.field_73020_y = this.func_72970_h(); - this.func_72966_v(); - this.func_72947_a(); -+ this.initCapabilities(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this)); - } - - public void func_72835_b(BooleanSupplier p_72835_1_) { -@@ -179,6 +181,11 @@ - - public void func_72900_e(Entity p_72900_1_) { - super.func_72900_e(p_72900_1_); -+ } -+ -+ @Override -+ public void removeEntity(Entity p_72900_1_, boolean keepData) { -+ super.removeEntity(p_72900_1_, keepData); - this.field_73032_d.remove(p_72900_1_); - } - diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch deleted file mode 100644 index fc51355c6..000000000 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/client/network/NetHandlerHandshakeMemory.java -+++ b/net/minecraft/client/network/NetHandlerHandshakeMemory.java -@@ -20,6 +20,7 @@ - } - - public void func_147383_a(CPacketHandshake p_147383_1_) { -+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(p_147383_1_, this.field_147384_b)) return; - this.field_147384_b.func_150723_a(p_147383_1_.func_149594_c()); - this.field_147384_b.func_150719_a(new NetHandlerLoginServer(this.field_147385_a, this.field_147384_b)); - } diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch deleted file mode 100644 index 09506aeb6..000000000 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/net/minecraft/client/network/NetHandlerLoginClient.java -+++ b/net/minecraft/client/network/NetHandlerLoginClient.java -@@ -98,6 +98,7 @@ - this.field_209525_d.accept(new TextComponentTranslation("connect.joining")); - this.field_175091_e = p_147390_1_.func_179730_a(); - this.field_147393_d.func_150723_a(EnumConnectionState.PLAY); -+ net.minecraftforge.fml.network.NetworkHooks.handleClientLoginSuccess(this.field_147393_d); - this.field_147393_d.func_150719_a(new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d, this.field_175091_e)); - } - -@@ -122,6 +123,7 @@ - } - - public void func_209521_a(SPacketCustomPayloadLogin p_209521_1_) { -+ if (net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209521_1_, this.field_147393_d)) return; - this.field_209525_d.accept(new TextComponentTranslation("connect.negotiating")); - this.field_147393_d.func_179290_a(new CPacketCustomPayloadLogin(p_209521_1_.func_209918_a(), (PacketBuffer)null)); - } diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch deleted file mode 100644 index 6553efa86..000000000 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ /dev/null @@ -1,74 +0,0 @@ ---- a/net/minecraft/client/network/NetHandlerPlayClient.java -+++ b/net/minecraft/client/network/NetHandlerPlayClient.java -@@ -659,7 +659,7 @@ - int j = p_147263_1_.func_149271_f(); - Chunk chunk = this.field_147300_g.func_72863_F().func_212474_a(i, j, p_147263_1_.func_186946_a(), p_147263_1_.func_149276_g(), p_147263_1_.func_149274_i()); - this.field_147300_g.func_147458_c(i << 4, 0, j << 4, (i << 4) + 15, 256, (j << 4) + 15); -- if (!p_147263_1_.func_149274_i() || !(this.field_147300_g.field_73011_w instanceof OverworldDimension)) { -+ if (!p_147263_1_.func_149274_i() || this.field_147300_g.field_73011_w.shouldClientCheckLighting()) { - chunk.func_76613_n(); - } - -@@ -667,7 +667,7 @@ - BlockPos blockpos = new BlockPos(nbttagcompound.func_74762_e("x"), nbttagcompound.func_74762_e("y"), nbttagcompound.func_74762_e("z")); - TileEntity tileentity = this.field_147300_g.func_175625_s(blockpos); - if (tileentity != null) { -- tileentity.func_145839_a(nbttagcompound); -+ tileentity.handleUpdateTag(nbttagcompound); - } - } - -@@ -735,7 +735,9 @@ - - public void func_147251_a(SPacketChat p_147251_1_) { - PacketThreadUtil.func_180031_a(p_147251_1_, this, this.field_147299_f); -- this.field_147299_f.field_71456_v.func_191742_a(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c()); -+ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c()); -+ if (message == null) return; -+ this.field_147299_f.field_71456_v.func_191742_a(p_147251_1_.func_192590_c(), message); - } - - public void func_147279_a(SPacketAnimation p_147279_1_) { -@@ -1017,6 +1019,12 @@ - boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock; - if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox || i == 11 && tileentity instanceof TileEntityBed || i == 5 && tileentity instanceof TileEntityConduit) { - tileentity.func_145839_a(p_147273_1_.func_148857_g()); -+ } 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 (flag && this.field_147299_f.field_71462_r instanceof GuiCommandBlock) { -@@ -1191,6 +1199,7 @@ - recipebookclient.func_199644_c(); - recipebookclient.func_199642_d().forEach(searchtree::func_194043_a); - searchtree.func_194040_a(); -+ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(); - } - - public void func_200232_a(SPacketPlayerLook p_200232_1_) { -@@ -1281,7 +1290,7 @@ - PacketThreadUtil.func_180031_a(p_147260_1_, this, this.field_147299_f); - Entity entity = this.field_147300_g.func_73045_a(p_147260_1_.func_149426_d()); - if (entity instanceof EntityLivingBase) { -- Potion potion = Potion.func_188412_a(p_147260_1_.func_149427_e()); -+ Potion potion = Potion.func_188412_a(p_147260_1_.func_149427_e() & 0xFF); - if (potion != null) { - PotionEffect potioneffect = new PotionEffect(potion, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), p_147260_1_.func_186984_g(), p_147260_1_.func_179707_f(), p_147260_1_.func_205527_h()); - potioneffect.func_100012_b(p_147260_1_.func_149429_c()); -@@ -1607,10 +1616,12 @@ - ((DebugRendererWorldGenAttempts)this.field_147299_f.field_184132_p.field_201750_j).func_201734_a(packetbuffer.func_179259_c(), packetbuffer.readFloat(), packetbuffer.readFloat(), packetbuffer.readFloat(), packetbuffer.readFloat(), packetbuffer.readFloat()); - field_147301_d.warn("Unknown custom packed identifier: {}", (Object)resourcelocation); - } else { -+ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147240_1_, this.field_147302_e)) - field_147301_d.warn("Unknown custom packed identifier: {}", (Object)resourcelocation); - } - } finally { - if (packetbuffer != null) { -+ if (false) // Forge: let packet handle releasing buffer - packetbuffer.release(); - } - diff --git a/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch b/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch index 9687fa241..112890700 100644 --- a/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch +++ b/patches/minecraft/net/minecraft/client/network/ServerPinger.java.patch @@ -7,5 +7,5 @@ + net.minecraftforge.fml.client.ClientHooks.processForgeListPingData(serverstatusresponse, p_147224_1_); + this.field_175092_e = Util.func_211177_b(); - networkmanager.func_179290_a(new CPacketPing(this.field_175092_e)); + networkmanager.func_179290_a(new CPingPacket(this.field_175092_e)); this.field_147403_d = true; diff --git a/patches/minecraft/net/minecraft/client/network/handshake/ClientHandshakeNetHandler.java.patch b/patches/minecraft/net/minecraft/client/network/handshake/ClientHandshakeNetHandler.java.patch new file mode 100644 index 000000000..0316cf024 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/network/handshake/ClientHandshakeNetHandler.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/client/network/handshake/ClientHandshakeNetHandler.java ++++ b/net/minecraft/client/network/handshake/ClientHandshakeNetHandler.java +@@ -20,6 +20,7 @@ + } + + public void func_147383_a(CHandshakePacket p_147383_1_) { ++ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(p_147383_1_, this.field_147384_b)) return; + this.field_147384_b.func_150723_a(p_147383_1_.func_149594_c()); + this.field_147384_b.func_150719_a(new ServerLoginNetHandler(this.field_147385_a, this.field_147384_b)); + } diff --git a/patches/minecraft/net/minecraft/client/network/login/ClientLoginNetHandler.java.patch b/patches/minecraft/net/minecraft/client/network/login/ClientLoginNetHandler.java.patch new file mode 100644 index 000000000..d5854974a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/network/login/ClientLoginNetHandler.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/client/network/login/ClientLoginNetHandler.java ++++ b/net/minecraft/client/network/login/ClientLoginNetHandler.java +@@ -98,6 +98,7 @@ + this.field_209525_d.accept(new TranslationTextComponent("connect.joining")); + this.field_175091_e = p_147390_1_.func_179730_a(); + this.field_147393_d.func_150723_a(ProtocolType.PLAY); ++ net.minecraftforge.fml.network.NetworkHooks.handleClientLoginSuccess(this.field_147393_d); + this.field_147393_d.func_150719_a(new ClientPlayNetHandler(this.field_147394_b, this.field_147395_c, this.field_147393_d, this.field_175091_e)); + } + +@@ -122,6 +123,7 @@ + } + + public void func_209521_a(SCustomPayloadLoginPacket p_209521_1_) { ++ if (net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209521_1_, this.field_147393_d)) return; + this.field_209525_d.accept(new TranslationTextComponent("connect.negotiating")); + this.field_147393_d.func_179290_a(new CCustomPayloadLoginPacket(p_209521_1_.func_209918_a(), (PacketBuffer)null)); + } diff --git a/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch b/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch new file mode 100644 index 000000000..b75f19b4f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/network/play/ClientPlayNetHandler.java.patch @@ -0,0 +1,73 @@ +--- a/net/minecraft/client/network/play/ClientPlayNetHandler.java ++++ b/net/minecraft/client/network/play/ClientPlayNetHandler.java +@@ -712,7 +712,7 @@ + BlockPos blockpos = new BlockPos(compoundnbt.func_74762_e("x"), compoundnbt.func_74762_e("y"), compoundnbt.func_74762_e("z")); + TileEntity tileentity = this.field_147300_g.func_175625_s(blockpos); + if (tileentity != null) { +- tileentity.func_145839_a(compoundnbt); ++ tileentity.handleUpdateTag(compoundnbt); + } + } + +@@ -784,7 +784,9 @@ + + public void func_147251_a(SChatPacket p_147251_1_) { + PacketThreadUtil.func_218797_a(p_147251_1_, this, this.field_147299_f); +- this.field_147299_f.field_71456_v.func_191742_a(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c()); ++ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c()); ++ if (message == null) return; ++ this.field_147299_f.field_71456_v.func_191742_a(p_147251_1_.func_192590_c(), message); + } + + public void func_147279_a(SAnimateHandPacket p_147279_1_) { +@@ -956,6 +958,7 @@ + this.field_147299_f.field_71439_g = clientplayerentity1; + this.field_147299_f.field_175622_Z = clientplayerentity1; + clientplayerentity1.func_184212_Q().func_187218_a(clientplayerentity.func_184212_Q().func_187231_c()); ++ clientplayerentity1.updateSyncFields(clientplayerentity); // Forge: fix MC-10657 + clientplayerentity1.func_70065_x(); + clientplayerentity1.func_175158_f(s); + this.field_147300_g.func_217408_a(i, clientplayerentity1); +@@ -1078,6 +1081,12 @@ + boolean flag = i == 2 && tileentity instanceof CommandBlockTileEntity; + if (i == 1 && tileentity instanceof MobSpawnerTileEntity || flag || i == 3 && tileentity instanceof BeaconTileEntity || i == 4 && tileentity instanceof SkullTileEntity || i == 6 && tileentity instanceof BannerTileEntity || i == 7 && tileentity instanceof StructureBlockTileEntity || i == 8 && tileentity instanceof EndGatewayTileEntity || i == 9 && tileentity instanceof SignTileEntity || i == 11 && tileentity instanceof BedTileEntity || i == 5 && tileentity instanceof ConduitTileEntity || i == 12 && tileentity instanceof JigsawTileEntity || i == 13 && tileentity instanceof CampfireTileEntity) { + tileentity.func_145839_a(p_147273_1_.func_148857_g()); ++ } 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 (flag && this.field_147299_f.field_71462_r instanceof CommandBlockScreen) { +@@ -1252,6 +1261,7 @@ + clientrecipebook.func_199644_c(); + clientrecipebook.func_199642_d().forEach(imutablesearchtree::func_217872_a); + imutablesearchtree.func_194040_a(); ++ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(); + } + + public void func_200232_a(SPlayerLookPacket p_200232_1_) { +@@ -1332,7 +1342,7 @@ + PacketThreadUtil.func_218797_a(p_147260_1_, this, this.field_147299_f); + Entity entity = this.field_147300_g.func_73045_a(p_147260_1_.func_149426_d()); + if (entity instanceof LivingEntity) { +- Effect effect = Effect.func_188412_a(p_147260_1_.func_149427_e()); ++ Effect effect = Effect.func_188412_a(p_147260_1_.func_149427_e() & 0xFF); + if (effect != null) { + EffectInstance effectinstance = new EffectInstance(effect, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), p_147260_1_.func_186984_g(), p_147260_1_.func_179707_f(), p_147260_1_.func_205527_h()); + effectinstance.func_100012_b(p_147260_1_.func_149429_c()); +@@ -1757,10 +1767,12 @@ + + this.field_147299_f.field_184132_p.field_217741_m.func_217692_a(pointofinterestdebugrenderer$braininfo); + } else { ++ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147240_1_, this.field_147302_e)) + field_147301_d.warn("Unknown custom packed identifier: {}", (Object)resourcelocation); + } + } finally { + if (packetbuffer != null) { ++ if (false) // Forge: let packet handle releasing buffer + packetbuffer.release(); + } + diff --git a/patches/minecraft/net/minecraft/client/particle/Particle.java.patch b/patches/minecraft/net/minecraft/client/particle/Particle.java.patch index 52b28f271..f25ad0581 100644 --- a/patches/minecraft/net/minecraft/client/particle/Particle.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/Particle.java.patch @@ -1,22 +1,14 @@ --- a/net/minecraft/client/particle/Particle.java +++ b/net/minecraft/client/particle/Particle.java -@@ -249,6 +249,8 @@ - +@@ -156,6 +156,7 @@ public void func_187110_a(double p_187110_1_, double p_187110_3_, double p_187110_5_) { - double d0 = p_187110_3_; -+ double origX = p_187110_1_; + double d0 = p_187110_1_; + double d1 = p_187110_3_; + double origZ = p_187110_5_; - if (this.field_190017_n && (p_187110_1_ != 0.0D || p_187110_3_ != 0.0D || p_187110_5_ != 0.0D)) { - ReuseableStream reuseablestream = new ReuseableStream<>(this.field_187122_b.func_199406_a((Entity)null, this.func_187116_l(), p_187110_1_, p_187110_3_, p_187110_5_)); - p_187110_3_ = VoxelShapes.func_212437_a(EnumFacing.Axis.Y, this.func_187116_l(), reuseablestream.func_212761_a(), p_187110_3_); -@@ -267,12 +269,12 @@ - } - - this.func_187118_j(); -- this.field_187132_l = p_187110_3_ != p_187110_3_ && d0 < 0.0D; -- if (p_187110_1_ != p_187110_1_) { -+ this.field_187132_l = d0 != p_187110_3_ && d0 < 0.0D; -+ if (origX != p_187110_1_) { + if (this.field_190017_n && p_187110_1_ != 0.0D || p_187110_3_ != 0.0D || p_187110_5_ != 0.0D) { + Vec3d vec3d = Entity.func_213313_a(new Vec3d(p_187110_1_, p_187110_3_, p_187110_5_), this.func_187116_l(), this.field_187122_b, ISelectionContext.func_216377_a(), new ReuseableStream<>(Stream.empty())); + p_187110_1_ = vec3d.field_72450_a; +@@ -173,7 +174,7 @@ this.field_187129_i = 0.0D; } diff --git a/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch b/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch index 58a0f01fb..54c5f6691 100644 --- a/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/ParticleManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/particle/ParticleManager.java +++ b/net/minecraft/client/particle/ParticleManager.java -@@ -146,6 +146,7 @@ +@@ -235,6 +235,7 @@ } public void func_78873_a(Particle p_78873_1_) { @@ -8,23 +8,25 @@ this.field_187241_h.add(p_78873_1_); } -@@ -337,7 +338,7 @@ +@@ -342,7 +343,7 @@ } - public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) { + public void func_180533_a(BlockPos p_180533_1_, BlockState p_180533_2_) { - if (!p_180533_2_.func_196958_f()) { + if (!p_180533_2_.isAir(this.field_78878_a, p_180533_1_)) { VoxelShape voxelshape = p_180533_2_.func_196954_c(this.field_78878_a, p_180533_1_); double d0 = 0.25D; voxelshape.func_197755_b((p_199284_3_, p_199284_5_, p_199284_7_, p_199284_9_, p_199284_11_, p_199284_13_) -> { -@@ -416,4 +417,10 @@ - - return String.valueOf(i); +@@ -414,6 +415,12 @@ + return String.valueOf(this.field_78876_b.values().stream().mapToInt(Collection::size).sum()); } -+ -+ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.math.RayTraceResult target) { -+ IBlockState state = field_78878_a.func_180495_p(pos); + ++ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.math.BlockRayTraceResult target) { ++ BlockState state = field_78878_a.func_180495_p(pos); + if (!state.addHitEffects(field_78878_a, target, this)) -+ func_180532_a(pos, target.field_178784_b); ++ func_180532_a(pos, target.func_216354_b()); + } - } ++ + @OnlyIn(Dist.CLIENT) + class AnimatedSpriteImpl implements IAnimatedSprite { + private List field_217594_b; diff --git a/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch b/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch index 57b851cfd..5b83dc9cc 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java.patch @@ -1,36 +1,14 @@ --- a/net/minecraft/client/renderer/ActiveRenderInfo.java +++ b/net/minecraft/client/renderer/ActiveRenderInfo.java -@@ -23,6 +23,10 @@ - private static float field_74596_h; - - public static void func_197924_a(EntityPlayer p_197924_0_, boolean p_197924_1_, float p_197924_2_) { -+ updateRenderInfo((Entity) p_197924_0_, p_197924_1_, p_197924_2_); -+ } -+ -+ public static void updateRenderInfo(Entity p_197924_0_, boolean p_197924_1_, float p_197924_2_) { - field_178812_b.clear(); - GlStateManager.func_179111_a(2982, field_178812_b); - Matrix4f matrix4f = new Matrix4f(); -@@ -65,7 +69,7 @@ - } - } - -- return iblockstate; -+ return iblockstate.func_177230_c().getStateAtViewpoint(iblockstate, p_186703_0_, blockpos, vec3d); +@@ -174,4 +174,11 @@ + this.field_216791_c = null; + this.field_216789_a = false; } - - public static IFluidState func_206243_b(IBlockReader p_206243_0_, Entity p_206243_1_, float p_206243_2_) { -@@ -101,4 +105,13 @@ - public static float func_178807_f() { - return field_74596_h; - } -+ -+ /* ======================================== FORGE START =====================================*/ + -+ /** -+ * Vector from render view entity position (corrected for partialTickTime) to the middle of screen -+ */ -+ public static Vec3d getCameraPosition() { -+ return field_178811_e; ++ public net.minecraft.block.BlockState getBlockAtCamera() { ++ if (!this.field_216789_a) ++ return net.minecraft.block.Blocks.field_150350_a.func_176223_P(); ++ else ++ return this.field_216790_b.func_180495_p(this.field_216793_e).getStateAtViewpoint(this.field_216790_b, this.field_216793_e, this.field_216792_d); + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockFluidRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockFluidRenderer.java.patch deleted file mode 100644 index 550909cfa..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/BlockFluidRenderer.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/client/renderer/BlockFluidRenderer.java -+++ b/net/minecraft/client/renderer/BlockFluidRenderer.java -@@ -219,8 +219,8 @@ - BlockPos blockpos = p_205346_2_.func_177972_a(enumfacing); - TextureAtlasSprite textureatlassprite2 = atextureatlassprite[1]; - if (!flag) { -- Block block = p_205346_1_.func_180495_p(blockpos).func_177230_c(); -- if (block == Blocks.field_150359_w || block instanceof BlockStainedGlass) { -+ IBlockState blockstate = p_205346_1_.func_180495_p(blockpos); -+ if (blockstate.func_193401_d(p_205346_1_, blockpos, enumfacing) == net.minecraft.block.state.BlockFaceShape.SOLID) { - textureatlassprite2 = this.field_187501_d; - } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch index 8f442af36..a79557926 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch @@ -1,100 +1,100 @@ --- a/net/minecraft/client/renderer/BlockModelRenderer.java +++ b/net/minecraft/client/renderer/BlockModelRenderer.java -@@ -44,11 +44,17 @@ +@@ -37,11 +37,17 @@ this.field_187499_a = p_i46575_1_; } -+ @Deprecated - public boolean func_199324_a(IWorldReader p_199324_1_, IBakedModel p_199324_2_, IBlockState p_199324_3_, BlockPos p_199324_4_, BufferBuilder p_199324_5_, boolean p_199324_6_, Random p_199324_7_, long p_199324_8_) { -- boolean flag = Minecraft.func_71379_u() && p_199324_3_.func_185906_d() == 0 && p_199324_2_.func_177555_b(); -+ return renderModel(p_199324_1_, p_199324_2_, p_199324_3_, p_199324_4_, p_199324_5_, p_199324_6_, p_199324_7_, p_199324_8_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); ++ @Deprecated //Forge: Model data argument + public boolean func_217631_a(IEnviromentBlockReader p_217631_1_, IBakedModel p_217631_2_, BlockState p_217631_3_, BlockPos p_217631_4_, BufferBuilder p_217631_5_, boolean p_217631_6_, Random p_217631_7_, long p_217631_8_) { +- boolean flag = Minecraft.func_71379_u() && p_217631_3_.func_185906_d() == 0 && p_217631_2_.func_177555_b(); ++ return renderModel(p_217631_1_, p_217631_2_, p_217631_3_, p_217631_4_, p_217631_5_, p_217631_6_, p_217631_7_, p_217631_8_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } -+ public boolean renderModel(IWorldReader p_199324_1_, IBakedModel p_199324_2_, IBlockState p_199324_3_, BlockPos p_199324_4_, BufferBuilder p_199324_5_, boolean p_199324_6_, Random p_199324_7_, long p_199324_8_, net.minecraftforge.client.model.data.IModelData modelData) { -+ boolean flag = Minecraft.func_71379_u() && p_199324_3_.getLightValue(p_199324_1_, p_199324_4_) == 0 && p_199324_2_.isAmbientOcclusion(p_199324_3_); -+ modelData = p_199324_2_.getModelData(p_199324_1_, p_199324_4_, p_199324_3_, modelData); ++ public boolean renderModel(IEnviromentBlockReader p_217631_1_, IBakedModel p_217631_2_, BlockState p_217631_3_, BlockPos p_217631_4_, BufferBuilder p_217631_5_, boolean p_217631_6_, Random p_217631_7_, long p_217631_8_, net.minecraftforge.client.model.data.IModelData modelData) { ++ boolean flag = Minecraft.func_71379_u() && p_217631_3_.getLightValue(p_217631_1_, p_217631_4_) == 0 && p_217631_2_.func_177555_b(); ++ modelData = p_217631_2_.getModelData(p_217631_1_, p_217631_4_, p_217631_3_, modelData); + try { -- return flag ? this.func_199326_b(p_199324_1_, p_199324_2_, p_199324_3_, p_199324_4_, p_199324_5_, p_199324_6_, p_199324_7_, p_199324_8_) : this.func_199325_c(p_199324_1_, p_199324_2_, p_199324_3_, p_199324_4_, p_199324_5_, p_199324_6_, p_199324_7_, p_199324_8_); -+ return flag ? this.renderModelSmooth(p_199324_1_, p_199324_2_, p_199324_3_, p_199324_4_, p_199324_5_, p_199324_6_, p_199324_7_, p_199324_8_, modelData) : this.renderModelFlat(p_199324_1_, p_199324_2_, p_199324_3_, p_199324_4_, p_199324_5_, p_199324_6_, p_199324_7_, p_199324_8_, modelData); +- return flag ? this.func_217634_b(p_217631_1_, p_217631_2_, p_217631_3_, p_217631_4_, p_217631_5_, p_217631_6_, p_217631_7_, p_217631_8_) : this.func_217635_c(p_217631_1_, p_217631_2_, p_217631_3_, p_217631_4_, p_217631_5_, p_217631_6_, p_217631_7_, p_217631_8_); ++ return flag ? this.renderModelSmooth(p_217631_1_, p_217631_2_, p_217631_3_, p_217631_4_, p_217631_5_, p_217631_6_, p_217631_7_, p_217631_8_, modelData) : this.renderModelFlat(p_217631_1_, p_217631_2_, p_217631_3_, p_217631_4_, p_217631_5_, p_217631_6_, p_217631_7_, p_217631_8_, modelData); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.func_85055_a(throwable, "Tesselating block model"); CrashReportCategory crashreportcategory = crashreport.func_85058_a("Block model being tesselated"); -@@ -58,7 +64,12 @@ +@@ -51,7 +57,12 @@ } } -+ @Deprecated - public boolean func_199326_b(IWorldReader p_199326_1_, IBakedModel p_199326_2_, IBlockState p_199326_3_, BlockPos p_199326_4_, BufferBuilder p_199326_5_, boolean p_199326_6_, Random p_199326_7_, long p_199326_8_) { -+ return renderModelSmooth(p_199326_1_, p_199326_2_, p_199326_3_, p_199326_4_, p_199326_5_, p_199326_6_, p_199326_7_, p_199326_8_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); ++ @Deprecated //Forge: Model data argument + public boolean func_217634_b(IEnviromentBlockReader p_217634_1_, IBakedModel p_217634_2_, BlockState p_217634_3_, BlockPos p_217634_4_, BufferBuilder p_217634_5_, boolean p_217634_6_, Random p_217634_7_, long p_217634_8_) { ++ return renderModelSmooth(p_217634_1_, p_217634_2_, p_217634_3_, p_217634_4_, p_217634_5_, p_217634_6_, p_217634_7_, p_217634_8_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } + -+ public boolean renderModelSmooth(IWorldReader p_199326_1_, IBakedModel p_199326_2_, IBlockState p_199326_3_, BlockPos p_199326_4_, BufferBuilder p_199326_5_, boolean p_199326_6_, Random p_199326_7_, long p_199326_8_, net.minecraftforge.client.model.data.IModelData modelData) { ++ public boolean renderModelSmooth(IEnviromentBlockReader p_217634_1_, IBakedModel p_217634_2_, BlockState p_217634_3_, BlockPos p_217634_4_, BufferBuilder p_217634_5_, boolean p_217634_6_, Random p_217634_7_, long p_217634_8_, net.minecraftforge.client.model.data.IModelData modelData) { boolean flag = false; - float[] afloat = new float[EnumFacing.values().length * 2]; + float[] afloat = new float[Direction.values().length * 2]; BitSet bitset = new BitSet(3); -@@ -66,7 +77,7 @@ +@@ -59,7 +70,7 @@ - for(EnumFacing enumfacing : EnumFacing.values()) { - p_199326_7_.setSeed(p_199326_8_); -- List list = p_199326_2_.func_200117_a(p_199326_3_, enumfacing, p_199326_7_); -+ List list = p_199326_2_.getQuads(p_199326_3_, enumfacing, p_199326_7_, modelData); - if (!list.isEmpty() && (!p_199326_6_ || Block.func_176225_a(p_199326_3_, p_199326_1_, p_199326_4_, enumfacing))) { - this.func_187492_a(p_199326_1_, p_199326_3_, p_199326_4_, p_199326_5_, list, afloat, bitset, blockmodelrenderer$ambientocclusionface); + for(Direction direction : Direction.values()) { + p_217634_7_.setSeed(p_217634_8_); +- List list = p_217634_2_.func_200117_a(p_217634_3_, direction, p_217634_7_); ++ List list = p_217634_2_.getQuads(p_217634_3_, direction, p_217634_7_, modelData); + if (!list.isEmpty() && (!p_217634_6_ || Block.func_176225_a(p_217634_3_, p_217634_1_, p_217634_4_, direction))) { + this.func_217630_a(p_217634_1_, p_217634_3_, p_217634_4_, p_217634_5_, list, afloat, bitset, blockmodelrenderer$ambientocclusionface); flag = true; -@@ -74,7 +85,7 @@ +@@ -67,7 +78,7 @@ } - p_199326_7_.setSeed(p_199326_8_); -- List list1 = p_199326_2_.func_200117_a(p_199326_3_, (EnumFacing)null, p_199326_7_); -+ List list1 = p_199326_2_.getQuads(p_199326_3_, (EnumFacing)null, p_199326_7_, modelData); + p_217634_7_.setSeed(p_217634_8_); +- List list1 = p_217634_2_.func_200117_a(p_217634_3_, (Direction)null, p_217634_7_); ++ List list1 = p_217634_2_.getQuads(p_217634_3_, (Direction)null, p_217634_7_, modelData); if (!list1.isEmpty()) { - this.func_187492_a(p_199326_1_, p_199326_3_, p_199326_4_, p_199326_5_, list1, afloat, bitset, blockmodelrenderer$ambientocclusionface); + this.func_217630_a(p_217634_1_, p_217634_3_, p_217634_4_, p_217634_5_, list1, afloat, bitset, blockmodelrenderer$ambientocclusionface); flag = true; -@@ -83,13 +94,18 @@ +@@ -76,13 +87,18 @@ return flag; } -+ @Deprecated - public boolean func_199325_c(IWorldReader p_199325_1_, IBakedModel p_199325_2_, IBlockState p_199325_3_, BlockPos p_199325_4_, BufferBuilder p_199325_5_, boolean p_199325_6_, Random p_199325_7_, long p_199325_8_) { -+ return renderModelFlat(p_199325_1_, p_199325_2_, p_199325_3_, p_199325_4_, p_199325_5_, p_199325_6_, p_199325_7_, p_199325_8_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); ++ @Deprecated //Forge: Model data Argument + public boolean func_217635_c(IEnviromentBlockReader p_217635_1_, IBakedModel p_217635_2_, BlockState p_217635_3_, BlockPos p_217635_4_, BufferBuilder p_217635_5_, boolean p_217635_6_, Random p_217635_7_, long p_217635_8_) { ++ return renderModelFlat(p_217635_1_, p_217635_2_, p_217635_3_, p_217635_4_, p_217635_5_, p_217635_6_, p_217635_7_, p_217635_8_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } + -+ public boolean renderModelFlat(IWorldReader p_199325_1_, IBakedModel p_199325_2_, IBlockState p_199325_3_, BlockPos p_199325_4_, BufferBuilder p_199325_5_, boolean p_199325_6_, Random p_199325_7_, long p_199325_8_, net.minecraftforge.client.model.data.IModelData modelData) { ++ public boolean renderModelFlat(IEnviromentBlockReader p_217635_1_, IBakedModel p_217635_2_, BlockState p_217635_3_, BlockPos p_217635_4_, BufferBuilder p_217635_5_, boolean p_217635_6_, Random p_217635_7_, long p_217635_8_, net.minecraftforge.client.model.data.IModelData modelData) { boolean flag = false; BitSet bitset = new BitSet(3); - for(EnumFacing enumfacing : EnumFacing.values()) { - p_199325_7_.setSeed(p_199325_8_); -- List list = p_199325_2_.func_200117_a(p_199325_3_, enumfacing, p_199325_7_); -+ List list = p_199325_2_.getQuads(p_199325_3_, enumfacing, p_199325_7_, modelData); - if (!list.isEmpty() && (!p_199325_6_ || Block.func_176225_a(p_199325_3_, p_199325_1_, p_199325_4_, enumfacing))) { - int i = p_199325_3_.func_185889_a(p_199325_1_, p_199325_4_.func_177972_a(enumfacing)); - this.func_187496_a(p_199325_1_, p_199325_3_, p_199325_4_, i, false, p_199325_5_, list, bitset); -@@ -98,7 +114,7 @@ + for(Direction direction : Direction.values()) { + p_217635_7_.setSeed(p_217635_8_); +- List list = p_217635_2_.func_200117_a(p_217635_3_, direction, p_217635_7_); ++ List list = p_217635_2_.getQuads(p_217635_3_, direction, p_217635_7_, modelData); + if (!list.isEmpty() && (!p_217635_6_ || Block.func_176225_a(p_217635_3_, p_217635_1_, p_217635_4_, direction))) { + int i = p_217635_3_.func_215684_a(p_217635_1_, p_217635_4_.func_177972_a(direction)); + this.func_217636_a(p_217635_1_, p_217635_3_, p_217635_4_, i, false, p_217635_5_, list, bitset); +@@ -91,7 +107,7 @@ } - p_199325_7_.setSeed(p_199325_8_); -- List list1 = p_199325_2_.func_200117_a(p_199325_3_, (EnumFacing)null, p_199325_7_); -+ List list1 = p_199325_2_.getQuads(p_199325_3_, (EnumFacing)null, p_199325_7_, modelData); + p_217635_7_.setSeed(p_217635_8_); +- List list1 = p_217635_2_.func_200117_a(p_217635_3_, (Direction)null, p_217635_7_); ++ List list1 = p_217635_2_.getQuads(p_217635_3_, (Direction)null, p_217635_7_, modelData); if (!list1.isEmpty()) { - this.func_187496_a(p_199325_1_, p_199325_3_, p_199325_4_, -1, true, p_199325_5_, list1, bitset); + this.func_217636_a(p_217635_1_, p_217635_3_, p_217635_4_, -1, true, p_217635_5_, list1, bitset); flag = true; -@@ -120,6 +136,13 @@ - p_187492_8_.func_187491_a(p_187492_1_, p_187492_2_, p_187492_3_, bakedquad.func_178210_d(), p_187492_6_, p_187492_7_); - p_187492_4_.func_178981_a(bakedquad.func_178209_a()); - p_187492_4_.func_178962_a(p_187492_8_.field_178207_c[0], p_187492_8_.field_178207_c[1], p_187492_8_.field_178207_c[2], p_187492_8_.field_178207_c[3]); +@@ -113,6 +129,13 @@ + p_217630_8_.func_217629_a(p_217630_1_, p_217630_2_, p_217630_3_, bakedquad.func_178210_d(), p_217630_6_, p_217630_7_); + p_217630_4_.func_178981_a(bakedquad.func_178209_a()); + p_217630_4_.func_178962_a(p_217630_8_.field_178207_c[0], p_217630_8_.field_178207_c[1], p_217630_8_.field_178207_c[2], p_217630_8_.field_178207_c[3]); + if(bakedquad.shouldApplyDiffuseLighting()) { + float diffuse = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(bakedquad.func_178210_d()); -+ p_187492_8_.field_178206_b[0] *= diffuse; -+ p_187492_8_.field_178206_b[1] *= diffuse; -+ p_187492_8_.field_178206_b[2] *= diffuse; -+ p_187492_8_.field_178206_b[3] *= diffuse; ++ p_217630_8_.field_178206_b[0] *= diffuse; ++ p_217630_8_.field_178206_b[1] *= diffuse; ++ p_217630_8_.field_178206_b[2] *= diffuse; ++ p_217630_8_.field_178206_b[3] *= diffuse; + } if (bakedquad.func_178212_b()) { - int k = this.field_187499_a.func_186724_a(p_187492_2_, p_187492_1_, p_187492_3_, bakedquad.func_178211_c()); + int k = this.field_187499_a.func_216860_a(p_217630_2_, p_217630_1_, p_217630_3_, bakedquad.func_178211_c()); float f = (float)(k >> 16 & 255) / 255.0F; -@@ -229,10 +252,22 @@ +@@ -222,10 +245,22 @@ float f = (float)(k >> 16 & 255) / 255.0F; float f1 = (float)(k >> 8 & 255) / 255.0F; float f2 = (float)(k & 255) / 255.0F; @@ -104,16 +104,16 @@ + f1 *= diffuse; + f2 *= diffuse; + } - p_187496_6_.func_178978_a(f, f1, f2, 4); - p_187496_6_.func_178978_a(f, f1, f2, 3); - p_187496_6_.func_178978_a(f, f1, f2, 2); - p_187496_6_.func_178978_a(f, f1, f2, 1); + p_217636_6_.func_178978_a(f, f1, f2, 4); + p_217636_6_.func_178978_a(f, f1, f2, 3); + p_217636_6_.func_178978_a(f, f1, f2, 2); + p_217636_6_.func_178978_a(f, f1, f2, 1); + } else if(bakedquad.shouldApplyDiffuseLighting()) { + float diffuse = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(bakedquad.func_178210_d()); -+ p_187496_6_.func_178978_a(diffuse, diffuse, diffuse, 4); -+ p_187496_6_.func_178978_a(diffuse, diffuse, diffuse, 3); -+ p_187496_6_.func_178978_a(diffuse, diffuse, diffuse, 2); -+ p_187496_6_.func_178978_a(diffuse, diffuse, diffuse, 1); ++ p_217636_6_.func_178978_a(diffuse, diffuse, diffuse, 4); ++ p_217636_6_.func_178978_a(diffuse, diffuse, diffuse, 3); ++ p_217636_6_.func_178978_a(diffuse, diffuse, diffuse, 2); ++ p_217636_6_.func_178978_a(diffuse, diffuse, diffuse, 1); } - p_187496_6_.func_178987_a(d0, d1, d2); + p_217636_6_.func_178987_a(d0, d1, d2); diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch index b69d16d6b..6fb67bc0f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -6,38 +6,37 @@ this.field_175028_a = p_i46577_1_; - this.field_175027_c = new BlockModelRenderer(p_i46577_2_); + this.field_175027_c = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(p_i46577_2_); - this.field_175025_e = new BlockFluidRenderer(); + this.field_175025_e = new FluidBlockRenderer(); } -@@ -40,12 +40,17 @@ - if (p_175020_1_.func_185901_i() == EnumBlockRenderType.MODEL) { - IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(p_175020_1_); - long i = p_175020_1_.func_209533_a(p_175020_2_); -- IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(p_175020_1_, ibakedmodel, p_175020_3_, this.field_195476_e, i)).func_177645_b(); -+ IBakedModel ibakedmodel1 = net.minecraftforge.client.ForgeHooksClient.getDamageModel(ibakedmodel, p_175020_3_, p_175020_1_, p_175020_4_, p_175020_2_); - this.field_175027_c.func_199324_a(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.func_178181_a().func_178180_c(), true, this.field_195476_e, i); +@@ -40,12 +40,16 @@ + if (p_215329_1_.func_185901_i() == BlockRenderType.MODEL) { + IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(p_215329_1_); + long i = p_215329_1_.func_209533_a(p_215329_2_); +- IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(p_215329_1_, ibakedmodel, p_215329_3_, this.field_195476_e, i)).func_177645_b(); ++ IBakedModel ibakedmodel1 = net.minecraftforge.client.ForgeHooksClient.getDamageModel(ibakedmodel, p_215329_3_, p_215329_1_, p_215329_4_, p_215329_2_, i); + this.field_175027_c.func_217631_a(p_215329_4_, ibakedmodel1, p_215329_1_, p_215329_2_, Tessellator.func_178181_a().func_178180_c(), true, this.field_195476_e, i); } } -+ @Deprecated - public boolean func_195475_a(IBlockState p_195475_1_, BlockPos p_195475_2_, IWorldReader p_195475_3_, BufferBuilder p_195475_4_, Random p_195475_5_) { -+ return renderBlock(p_195475_1_, p_195475_2_, p_195475_3_, p_195475_4_, p_195475_5_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); ++ @Deprecated //Forge: Model parameter + public boolean func_215330_a(BlockState p_215330_1_, BlockPos p_215330_2_, IEnviromentBlockReader p_215330_3_, BufferBuilder p_215330_4_, Random p_215330_5_) { ++ return renderBlock(p_215330_1_, p_215330_2_, p_215330_3_, p_215330_4_, p_215330_5_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + } -+ -+ public boolean renderBlock(IBlockState p_195475_1_, BlockPos p_195475_2_, IWorldReader p_195475_3_, BufferBuilder p_195475_4_, Random p_195475_5_, net.minecraftforge.client.model.data.IModelData modelData) { ++ public boolean renderBlock(BlockState p_215330_1_, BlockPos p_215330_2_, IEnviromentBlockReader p_215330_3_, BufferBuilder p_215330_4_, Random p_215330_5_, net.minecraftforge.client.model.data.IModelData modelData) { try { - EnumBlockRenderType enumblockrendertype = p_195475_1_.func_185901_i(); - if (enumblockrendertype == EnumBlockRenderType.INVISIBLE) { -@@ -53,7 +58,7 @@ + BlockRenderType blockrendertype = p_215330_1_.func_185901_i(); + if (blockrendertype == BlockRenderType.INVISIBLE) { +@@ -53,7 +57,7 @@ } else { - switch(enumblockrendertype) { + switch(blockrendertype) { case MODEL: -- return this.field_175027_c.func_199324_a(p_195475_3_, this.func_184389_a(p_195475_1_), p_195475_1_, p_195475_2_, p_195475_4_, true, p_195475_5_, p_195475_1_.func_209533_a(p_195475_2_)); -+ return this.field_175027_c.renderModel(p_195475_3_, this.func_184389_a(p_195475_1_), p_195475_1_, p_195475_2_, p_195475_4_, true, p_195475_5_, p_195475_1_.func_209533_a(p_195475_2_), modelData); +- return this.field_175027_c.func_217631_a(p_215330_3_, this.func_184389_a(p_215330_1_), p_215330_1_, p_215330_2_, p_215330_4_, true, p_215330_5_, p_215330_1_.func_209533_a(p_215330_2_)); ++ return this.field_175027_c.renderModel(p_215330_3_, this.func_184389_a(p_215330_1_), p_215330_1_, p_215330_2_, p_215330_4_, true, p_215330_5_, p_215330_1_.func_209533_a(p_215330_2_), modelData); case ENTITYBLOCK_ANIMATED: return false; default: -@@ -105,4 +110,9 @@ +@@ -105,4 +109,9 @@ public void func_195410_a(IResourceManager p_195410_1_) { this.field_175025_e.func_178268_a(); } diff --git a/patches/minecraft/net/minecraft/client/renderer/BufferBuilder.java.patch b/patches/minecraft/net/minecraft/client/renderer/BufferBuilder.java.patch index ca16ff197..f85739627 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BufferBuilder.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BufferBuilder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/BufferBuilder.java +++ b/net/minecraft/client/renderer/BufferBuilder.java -@@ -107,7 +107,8 @@ +@@ -120,7 +120,8 @@ bitset.set(i1); } @@ -10,7 +10,7 @@ } public BufferBuilder.State func_181672_a() { -@@ -438,15 +439,15 @@ +@@ -459,15 +460,15 @@ break; case USHORT: case SHORT: @@ -32,7 +32,7 @@ } this.func_181667_k(); -@@ -521,4 +522,23 @@ +@@ -542,4 +543,23 @@ return this.field_179018_e; } } diff --git a/patches/minecraft/net/minecraft/client/renderer/ChestRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ChestRenderer.java.patch index b7fc50aea..03689c3c1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ChestRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ChestRenderer.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/renderer/ChestRenderer.java +++ b/net/minecraft/client/renderer/ChestRenderer.java -@@ -11,6 +11,7 @@ +@@ -12,6 +12,7 @@ public void func_178175_a(Block p_178175_1_, float p_178175_2_) { - GlStateManager.func_179131_c(p_178175_2_, p_178175_2_, p_178175_2_, 1.0F); - GlStateManager.func_179114_b(90.0F, 0.0F, 1.0F, 0.0F); -- TileEntityItemStackRenderer.field_147719_a.func_179022_a(new ItemStack(p_178175_1_)); + GlStateManager.color4f(p_178175_2_, p_178175_2_, p_178175_2_, 1.0F); + GlStateManager.rotatef(90.0F, 0.0F, 1.0F, 0.0F); +- ItemStackTileEntityRenderer.field_147719_a.func_179022_a(new ItemStack(p_178175_1_)); + ItemStack stack = new ItemStack(p_178175_1_); + stack.func_77973_b().getTileEntityItemStackRenderer().func_179022_a(stack); } diff --git a/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch index 42cfa2ff6..caf582994 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FirstPersonRenderer.java.patch @@ -1,57 +1,79 @@ --- a/net/minecraft/client/renderer/FirstPersonRenderer.java +++ b/net/minecraft/client/renderer/FirstPersonRenderer.java -@@ -273,7 +273,7 @@ +@@ -276,7 +276,7 @@ boolean flag1 = true; - if (abstractclientplayer.func_184587_cr()) { - ItemStack itemstack = abstractclientplayer.func_184607_cu(); -- if (itemstack.func_77973_b() == Items.field_151031_f) { -+ if (itemstack.func_77973_b() instanceof net.minecraft.item.ItemBow) { - flag = abstractclientplayer.func_184600_cs() == EnumHand.MAIN_HAND; + if (abstractclientplayerentity.func_184587_cr()) { + ItemStack itemstack = abstractclientplayerentity.func_184607_cu(); +- if (itemstack.func_77973_b() == Items.field_151031_f || itemstack.func_77973_b() == Items.field_222114_py) { ++ if (itemstack.func_77973_b() instanceof net.minecraft.item.ShootableItem) { + flag = abstractclientplayerentity.func_184600_cs() == Hand.MAIN_HAND; flag1 = !flag; } -@@ -286,12 +286,14 @@ +@@ -284,18 +284,18 @@ + Hand hand1 = abstractclientplayerentity.func_184600_cs(); + if (hand1 == Hand.MAIN_HAND) { + ItemStack itemstack1 = abstractclientplayerentity.func_184592_cb(); +- if (itemstack1.func_77973_b() == Items.field_222114_py && CrossbowItem.func_220012_d(itemstack1)) { ++ if (itemstack1.func_77973_b() instanceof net.minecraft.item.CrossbowItem && CrossbowItem.func_220012_d(itemstack1)) { + flag1 = false; + } + } + } else { + ItemStack itemstack2 = abstractclientplayerentity.func_184614_ca(); + ItemStack itemstack3 = abstractclientplayerentity.func_184592_cb(); +- if (itemstack2.func_77973_b() == Items.field_222114_py && CrossbowItem.func_220012_d(itemstack2)) { ++ if (itemstack2.func_77973_b() instanceof net.minecraft.item.CrossbowItem && CrossbowItem.func_220012_d(itemstack2)) { + flag1 = !flag; + } + +- if (itemstack3.func_77973_b() == Items.field_222114_py && CrossbowItem.func_220012_d(itemstack3)) { ++ if (itemstack3.func_77973_b() instanceof net.minecraft.item.CrossbowItem && CrossbowItem.func_220012_d(itemstack3)) { + flag = !itemstack2.func_190926_b(); + flag1 = !flag; + } +@@ -308,12 +308,14 @@ if (flag) { - float f4 = enumhand == EnumHand.MAIN_HAND ? f : 0.0F; - float f3 = 1.0F - (this.field_187470_g + (this.field_187469_f - this.field_187470_g) * p_78440_1_); -+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(EnumHand.MAIN_HAND, p_78440_1_, f1, f4, f3, this.field_187467_d)) - this.func_187457_a(abstractclientplayer, p_78440_1_, f1, EnumHand.MAIN_HAND, f4, this.field_187467_d, f3); + float f3 = hand == Hand.MAIN_HAND ? f : 0.0F; + float f5 = 1.0F - MathHelper.func_219799_g(p_78440_1_, this.field_187470_g, this.field_187469_f); ++ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.MAIN_HAND, p_78440_1_, f1, f3, f5, this.field_187467_d)) + this.func_187457_a(abstractclientplayerentity, p_78440_1_, f1, Hand.MAIN_HAND, f3, this.field_187467_d, f5); } if (flag1) { - float f5 = enumhand == EnumHand.OFF_HAND ? f : 0.0F; - float f6 = 1.0F - (this.field_187472_i + (this.field_187471_h - this.field_187472_i) * p_78440_1_); -+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(EnumHand.OFF_HAND, p_78440_1_, f1, f5, f6, this.field_187468_e)) - this.func_187457_a(abstractclientplayer, p_78440_1_, f1, EnumHand.OFF_HAND, f5, this.field_187468_e, f6); + float f4 = hand == Hand.OFF_HAND ? f : 0.0F; + float f6 = 1.0F - MathHelper.func_219799_g(p_78440_1_, this.field_187472_i, this.field_187471_h); ++ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(Hand.MAIN_HAND, p_78440_1_, f1, f4, f6, this.field_187467_d)) + this.func_187457_a(abstractclientplayerentity, p_78440_1_, f1, Hand.OFF_HAND, f4, this.field_187468_e, f6); } -@@ -307,7 +309,7 @@ +@@ -329,7 +331,7 @@ if (flag && !p_187457_1_.func_82150_aj()) { - this.func_187456_a(p_187457_7_, p_187457_5_, enumhandside); + this.func_187456_a(p_187457_7_, p_187457_5_, handside); } - } else if (p_187457_6_.func_77973_b() == Items.field_151098_aY) { -+ } else if (p_187457_6_.func_77973_b() instanceof net.minecraft.item.ItemMap) { ++ } else if (p_187457_6_.func_77973_b() instanceof net.minecraft.item.FilledMapItem) { if (flag && this.field_187468_e.func_190926_b()) { this.func_187463_a(p_187457_3_, p_187457_7_, p_187457_5_); } else { -@@ -402,6 +404,7 @@ - GlStateManager.func_179118_c(); +@@ -465,6 +467,7 @@ if (this.field_78455_a.field_71439_g.func_70094_T()) { - IBlockState iblockstate = this.field_78455_a.field_71441_e.func_180495_p(new BlockPos(this.field_78455_a.field_71439_g)); + BlockState blockstate = this.field_78455_a.field_71441_e.func_180495_p(new BlockPos(this.field_78455_a.field_71439_g)); + PlayerEntity playerentity = this.field_78455_a.field_71439_g; + BlockPos overlayPos = new BlockPos(this.field_78455_a.field_71439_g); - EntityPlayer entityplayer = this.field_78455_a.field_71439_g; for(int i = 0; i < 8; ++i) { -@@ -412,20 +415,24 @@ - IBlockState iblockstate1 = this.field_78455_a.field_71441_e.func_180495_p(blockpos); - if (iblockstate1.func_191058_s()) { - iblockstate = iblockstate1; + double d0 = playerentity.field_70165_t + (double)(((float)((i >> 0) % 2) - 0.5F) * playerentity.func_213311_cf() * 0.8F); +@@ -474,20 +477,24 @@ + BlockState blockstate1 = this.field_78455_a.field_71441_e.func_180495_p(blockpos); + if (blockstate1.func_215696_m(this.field_78455_a.field_71441_e, blockpos)) { + blockstate = blockstate1; + overlayPos = blockpos; } } - if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) - this.func_178108_a(this.field_78455_a.func_175602_ab().func_175023_a().func_178122_a(iblockstate)); + if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE) { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, blockstate, overlayPos)) + this.func_178108_a(this.field_78455_a.func_175602_ab().func_175023_a().func_178122_a(blockstate)); } } @@ -66,12 +88,20 @@ this.func_78442_d(); } } -@@ -538,6 +545,15 @@ +@@ -544,6 +551,7 @@ + bufferbuilder.func_181662_b(1.0D, 1.0D, -0.5D).func_187315_a((double)(0.0F + f7), (double)(0.0F + f8)).func_181675_d(); + bufferbuilder.func_181662_b(-1.0D, 1.0D, -0.5D).func_187315_a((double)(4.0F + f7), (double)(0.0F + f8)).func_181675_d(); + tessellator.func_78381_a(); ++ + GlStateManager.popMatrix(); + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); +@@ -600,6 +608,15 @@ this.field_187471_h = MathHelper.func_76131_a(this.field_187471_h - 0.4F, 0.0F, 1.0F); } else { - float f = entityplayersp.func_184825_o(1.0F); + float f = clientplayerentity.func_184825_o(1.0F); + -+ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, entityplayersp.field_71071_by.field_70461_c); ++ 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 && !Objects.equals(this.field_187467_d, itemstack)) diff --git a/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch index 0979d2e52..3a118390c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/FogRenderer.java +++ b/net/minecraft/client/renderer/FogRenderer.java -@@ -103,6 +103,9 @@ +@@ -101,6 +101,9 @@ f3 = 1.0F / this.field_205095_e; } @@ -10,7 +10,7 @@ this.field_205093_c = this.field_205093_c * (1.0F - f1) + this.field_205093_c * f3 * f1; this.field_205094_d = this.field_205094_d * (1.0F - f1) + this.field_205094_d * f3 * f1; this.field_205095_e = this.field_205095_e * (1.0F - f1) + this.field_205095_e * f3 * f1; -@@ -117,11 +120,21 @@ +@@ -115,11 +118,21 @@ f4 = 1.0F / this.field_205095_e; } @@ -22,32 +22,41 @@ this.field_205095_e = this.field_205095_e * (1.0F - f2) + this.field_205095_e * f4 * f2; } -+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, this.field_205104_n, entity, ActiveRenderInfo.func_186703_a(world, entity, p_78466_1_), ifluidstate, p_78466_1_, this.field_205093_c, this.field_205094_d, this.field_205095_e); ++ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, this.field_205104_n, p_217619_1_, p_217619_2_, this.field_205093_c, this.field_205094_d, this.field_205095_e); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + + this.field_205093_c = event.getRed(); + this.field_205094_d = event.getGreen(); + this.field_205095_e = event.getBlue(); + - GlStateManager.func_179082_a(this.field_205093_c, this.field_205094_d, this.field_205095_e, 0.0F); + GlStateManager.clearColor(this.field_205093_c, this.field_205094_d, this.field_205095_e, 0.0F); } -@@ -213,6 +226,10 @@ - GlStateManager.func_187432_a(0.0F, -1.0F, 0.0F); - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); - IFluidState ifluidstate = ActiveRenderInfo.func_206243_b(this.field_205105_o.field_71441_e, entity, p_78468_2_); -+ net.minecraft.block.state.IBlockState iblockstate = ActiveRenderInfo.func_186703_a(this.field_205105_o.field_71441_e, entity, p_78468_2_); -+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, this.field_205104_n, entity, iblockstate, ifluidstate, p_78468_2_, 0.1F); -+ if (hook >= 0) GlStateManager.func_179095_a(hook); +@@ -205,11 +218,19 @@ + + } + ++ @Deprecated //Forge: pass in partial ticks to setupFog + public void func_217618_a(ActiveRenderInfo p_217618_1_, int p_217618_2_) { ++ setupFog(p_217618_1_, p_217618_2_, 0F); ++ } ++ ++ public void setupFog(ActiveRenderInfo p_217618_1_, int p_217618_2_, float partialTicks) { + this.func_205090_a(false); + GlStateManager.normal3f(0.0F, -1.0F, 0.0F); + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + IFluidState ifluidstate = p_217618_1_.func_216771_k(); ++ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, this.field_205104_n, p_217618_1_, partialTicks, 0.1F); ++ if (hook >= 0) GlStateManager.fogDensity(hook); + else - if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(MobEffects.field_76440_q)) { + if (p_217618_1_.func_216773_g() instanceof LivingEntity && ((LivingEntity)p_217618_1_.func_216773_g()).func_70644_a(Effects.field_76440_q)) { float f2 = 5.0F; - int i = ((EntityLivingBase)entity).func_70660_b(MobEffects.field_76440_q).func_76459_b(); -@@ -272,6 +289,7 @@ - GlStateManager.func_179102_b(f1 * 0.05F); - GlStateManager.func_179153_c(Math.min(f1, 192.0F) * 0.5F); + int i = ((LivingEntity)p_217618_1_.func_216773_g()).func_70660_b(Effects.field_76440_q).func_76459_b(); +@@ -264,6 +285,7 @@ + GlStateManager.fogStart(f1 * 0.05F); + GlStateManager.fogEnd(Math.min(f1, 192.0F) * 0.5F); } -+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, this.field_205104_n, entity, iblockstate, ifluidstate, p_78468_2_, p_78468_1_, f1); ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, this.field_205104_n, p_217618_1_, partialTicks, p_217618_2_, f1); } - GlStateManager.func_179142_g(); + GlStateManager.enableColorMaterial(); diff --git a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch index 687fd1256..63d4ce7e2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch @@ -1,138 +1,133 @@ --- a/net/minecraft/client/renderer/GameRenderer.java +++ b/net/minecraft/client/renderer/GameRenderer.java -@@ -171,6 +171,8 @@ +@@ -170,6 +170,8 @@ this.func_175069_a(new ResourceLocation("shaders/post/spider.json")); - } else if (p_175066_1_ instanceof EntityEnderman) { + } else if (p_175066_1_ instanceof EndermanEntity) { this.func_175069_a(new ResourceLocation("shaders/post/invert.json")); + } else { + net.minecraftforge.client.ForgeHooksClient.loadEntityShader(p_175066_1_, this); } } -@@ -309,7 +311,7 @@ - } else if (raytraceresult != null) { - double d3 = vec3d.func_72438_d(raytraceresult.field_72307_f); - if (d3 < d2 || d2 == 0.0D) { -- if (entity1.func_184208_bv() == entity.func_184208_bv()) { -+ if (entity1.func_184208_bv() == entity.func_184208_bv() && !entity1.canRiderInteract()) { - if (d2 == 0.0D) { - this.field_78528_u = entity1; - vec3d3 = raytraceresult.field_72307_f; -@@ -380,7 +382,7 @@ +@@ -351,7 +353,7 @@ d0 = d0 * 60.0D / 70.0D; } - return d0; -+ return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(this, entity, ActiveRenderInfo.func_186703_a(this.field_78531_r.field_71441_e, entity, p_195459_1_), ifluidstate, p_195459_1_, d0); ++ return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(this, p_215311_1_, p_215311_2_, d0); } } -@@ -487,8 +489,16 @@ - } - - if (!this.field_78531_r.field_71474_y.field_74325_U) { -- GlStateManager.func_179114_b(entity.func_195050_f(p_78467_1_), 1.0F, 0.0F, 0.0F); -- GlStateManager.func_179114_b(entity.func_195046_g(p_78467_1_) + 180.0F, 0.0F, 1.0F, 0.0F); -+ float yaw = entity.func_195046_g(p_78467_1_) + 180F; -+ float pitch = entity.func_195050_f(p_78467_1_); -+ float roll = 0.0F; -+ IBlockState state = ActiveRenderInfo.func_186703_a(this.field_78531_r.field_71441_e, entity, p_78467_1_); -+ IFluidState fluidState = ActiveRenderInfo.func_206243_b(this.field_78531_r.field_71441_e, entity, p_78467_1_); -+ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, state, fluidState, p_78467_1_, yaw, pitch, roll); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ GlStateManager.func_179114_b(event.getRoll(), 0.0F, 0.0F, 1.0F); -+ GlStateManager.func_179114_b(event.getPitch(), 1.0F, 0.0F, 0.0F); -+ GlStateManager.func_179114_b(event.getYaw(), 0.0F, 1.0F, 0.0F); - } - - GlStateManager.func_179109_b(0.0F, -f, 0.0F); -@@ -542,6 +552,7 @@ +@@ -437,6 +439,7 @@ } - boolean flag = this.field_78531_r.func_175606_aa() instanceof EntityLivingBase && ((EntityLivingBase)this.field_78531_r.func_175606_aa()).func_70608_bn(); -+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(field_78531_r.field_71438_f, p_195457_1_)) + boolean flag = this.field_78531_r.func_175606_aa() instanceof LivingEntity && ((LivingEntity)this.field_78531_r.func_175606_aa()).func_70608_bn(); ++ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(field_78531_r.field_71438_f, p_215308_2_)) if (this.field_78531_r.field_71474_y.field_74320_O == 0 && !flag && !this.field_78531_r.field_71474_y.field_74319_N && this.field_78531_r.field_71442_b.func_178889_l() != GameType.SPECTATOR) { this.func_180436_i(); - this.field_78516_c.func_78440_a(p_195457_1_); -@@ -630,13 +641,17 @@ - GlStateManager.func_179128_n(5888); - GlStateManager.func_179096_D(); - this.field_78531_r.field_195558_d.func_198094_a(); + this.field_78516_c.func_78440_a(p_215308_2_); +@@ -525,6 +528,10 @@ + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + this.field_78531_r.field_195558_d.func_216522_a(Minecraft.field_142025_a); + // Forge: Fix MC-112292 + net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.field_147556_a.field_147553_e = this.field_78531_r.func_110434_K(); + // Forge: also fix rendering text before entering world (not part of MC-112292, but the same reason) + net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.field_147556_a.field_147557_n = this.field_78531_r.field_71466_p; } - if (this.field_78531_r.field_71462_r != null) { - GlStateManager.func_179086_m(256); + if (this.field_78531_r.field_213279_p != null) { +@@ -544,7 +551,7 @@ + GlStateManager.clear(256, Minecraft.field_142025_a); try { -- this.field_78531_r.field_71462_r.func_73863_a(i, j, this.field_78531_r.func_193989_ak()); +- this.field_78531_r.field_71462_r.render(i, j, this.field_78531_r.func_193989_ak()); + net.minecraftforge.client.ForgeHooksClient.drawScreen(this.field_78531_r.field_71462_r, i, j, this.field_78531_r.func_193989_ak()); } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.func_85055_a(throwable, "Rendering screen"); - CrashReportCategory crashreportcategory = crashreport.func_85058_a("Screen render details"); -@@ -700,9 +715,9 @@ - ItemStack itemstack = ((EntityPlayer)entity).func_184614_ca(); - if (this.field_78531_r.field_71476_x != null && this.field_78531_r.field_71476_x.field_72313_a == RayTraceResult.Type.BLOCK) { - BlockPos blockpos = this.field_78531_r.field_71476_x.func_178782_a(); -- Block block = this.field_78531_r.field_71441_e.func_180495_p(blockpos).func_177230_c(); -+ IBlockState state = this.field_78531_r.field_71441_e.func_180495_p(blockpos); - if (this.field_78531_r.field_71442_b.func_178889_l() == GameType.SPECTATOR) { -- flag = block.func_149716_u() && this.field_78531_r.field_71441_e.func_175625_s(blockpos) instanceof IInventory; -+ flag = state.hasTileEntity() && this.field_78531_r.field_71441_e.func_175625_s(blockpos) instanceof IInventory; - } else { - BlockWorldState blockworldstate = new BlockWorldState(this.field_78531_r.field_71441_e, blockpos, false); - flag = !itemstack.func_190926_b() && (itemstack.func_206848_a(this.field_78531_r.field_71441_e.func_205772_D(), blockworldstate) || itemstack.func_206847_b(this.field_78531_r.field_71441_e.func_205772_D(), blockworldstate)); -@@ -740,7 +755,7 @@ - GlStateManager.func_179086_m(16640); - this.field_78531_r.field_71424_I.func_76318_c("camera"); - this.func_195460_g(p_181560_1_); -- ActiveRenderInfo.func_197924_a(this.field_78531_r.field_71439_g, this.field_78531_r.field_71474_y.field_74320_O == 2, this.field_78530_s); -+ ActiveRenderInfo.updateRenderInfo(this.field_78531_r.func_175606_aa(), this.field_78531_r.field_71474_y.field_74320_O == 2, this.field_78530_s); - this.field_78531_r.field_71424_I.func_76318_c("frustum"); - ClippingHelperImpl.func_78558_a(); - this.field_78531_r.field_71424_I.func_76318_c("culling"); -@@ -784,7 +799,9 @@ - GlStateManager.func_179118_c(); - worldrenderer.func_195464_a(BlockRenderLayer.SOLID, (double)p_181560_1_, entity); - GlStateManager.func_179141_d(); -+ this.field_78531_r.func_110434_K().func_110581_b(TextureMap.field_110575_b).func_174936_b(false, this.field_78531_r.field_71474_y.field_151442_I > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings - worldrenderer.func_195464_a(BlockRenderLayer.CUTOUT_MIPPED, (double)p_181560_1_, entity); -+ this.field_78531_r.func_110434_K().func_110581_b(TextureMap.field_110575_b).func_174935_a(); - this.field_78531_r.func_110434_K().func_110581_b(TextureMap.field_110575_b).func_174936_b(false, false); - worldrenderer.func_195464_a(BlockRenderLayer.CUTOUT, (double)p_181560_1_, entity); - this.field_78531_r.func_110434_K().func_110581_b(TextureMap.field_110575_b).func_174935_a(); -@@ -795,7 +812,9 @@ - GlStateManager.func_179094_E(); - RenderHelper.func_74519_b(); - this.field_78531_r.field_71424_I.func_76318_c("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - worldrenderer.func_180446_a(entity, icamera, p_181560_1_); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - RenderHelper.func_74518_a(); - this.func_175072_h(); - GlStateManager.func_179128_n(5888); -@@ -804,6 +823,7 @@ - EntityPlayer entityplayer = (EntityPlayer)entity; - GlStateManager.func_179118_c(); - this.field_78531_r.field_71424_I.func_76318_c("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(worldrenderer, entityplayer, field_78531_r.field_71476_x, 0, p_181560_1_)) - worldrenderer.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_181560_1_); - GlStateManager.func_179141_d(); - } -@@ -854,6 +874,9 @@ - this.func_195456_a(worldrenderer, p_181560_1_, d0, d1, d2); + CrashReport crashreport1 = CrashReport.func_85055_a(throwable, "Rendering screen"); + CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Screen render details"); +@@ -655,7 +662,7 @@ + double d2 = activerenderinfo.func_216785_c().field_72449_c; + icamera.func_78547_a(d0, d1, d2); + if (this.field_78531_r.field_71474_y.field_151451_c >= 4) { +- this.field_205003_A.func_217618_a(activerenderinfo, -1); ++ this.field_205003_A.setupFog(activerenderinfo, -1, p_181560_1_); + this.field_78531_r.func_213239_aq().func_219895_b("sky"); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); +@@ -668,14 +675,14 @@ + GlStateManager.matrixMode(5888); } -+ this.field_78531_r.field_71424_I.func_76318_c("forge_render_last"); +- this.field_205003_A.func_217618_a(activerenderinfo, 0); ++ this.field_205003_A.setupFog(activerenderinfo, 0, p_181560_1_); + GlStateManager.shadeModel(7425); + if (activerenderinfo.func_216785_c().field_72448_b < 128.0D) { + this.func_215313_a(activerenderinfo, worldrenderer, p_181560_1_, d0, d1, d2); + } + + this.field_78531_r.func_213239_aq().func_219895_b("prepareterrain"); +- this.field_205003_A.func_217618_a(activerenderinfo, 0); ++ this.field_205003_A.setupFog(activerenderinfo, 0, p_181560_1_); + this.field_78531_r.func_110434_K().func_110577_a(AtlasTexture.field_110575_b); + RenderHelper.func_74518_a(); + this.field_78531_r.func_213239_aq().func_219895_b("terrain_setup"); +@@ -689,7 +696,9 @@ + GlStateManager.disableAlphaTest(); + worldrenderer.func_215323_a(BlockRenderLayer.SOLID, activerenderinfo); + GlStateManager.enableAlphaTest(); ++ this.field_78531_r.func_110434_K().func_110581_b(AtlasTexture.field_110575_b).func_174936_b(false, this.field_78531_r.field_71474_y.field_151442_I > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings + worldrenderer.func_215323_a(BlockRenderLayer.CUTOUT_MIPPED, activerenderinfo); ++ this.field_78531_r.func_110434_K().func_110581_b(AtlasTexture.field_110575_b).func_174935_a(); + this.field_78531_r.func_110434_K().func_110581_b(AtlasTexture.field_110575_b).func_174936_b(false, false); + worldrenderer.func_215323_a(BlockRenderLayer.CUTOUT, activerenderinfo); + this.field_78531_r.func_110434_K().func_110581_b(AtlasTexture.field_110575_b).func_174935_a(); +@@ -708,6 +717,7 @@ + if (flag && this.field_78531_r.field_71476_x != null) { + GlStateManager.disableAlphaTest(); + this.field_78531_r.func_213239_aq().func_219895_b("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(worldrenderer, activerenderinfo, field_78531_r.field_71476_x, 0, p_181560_1_)) + worldrenderer.func_215325_a(activerenderinfo, this.field_78531_r.field_71476_x, 0); + GlStateManager.enableAlphaTest(); + } +@@ -724,7 +734,7 @@ + this.field_78531_r.func_110434_K().func_110581_b(AtlasTexture.field_110575_b).func_174935_a(); + GlStateManager.disableBlend(); + this.func_180436_i(); +- this.field_205003_A.func_217618_a(activerenderinfo, 0); ++ this.field_205003_A.setupFog(activerenderinfo, 0, p_181560_1_); + this.field_78531_r.func_213239_aq().func_219895_b("particles"); + particlemanager.func_215233_a(activerenderinfo, p_181560_1_); + this.func_175072_h(); +@@ -738,7 +748,7 @@ + GlStateManager.enableCull(); + GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.alphaFunc(516, 0.1F); +- this.field_205003_A.func_217618_a(activerenderinfo, 0); ++ this.field_205003_A.setupFog(activerenderinfo, 0, p_181560_1_); + GlStateManager.enableBlend(); + GlStateManager.depthMask(false); + this.field_78531_r.func_110434_K().func_110577_a(AtlasTexture.field_110575_b); +@@ -755,6 +765,9 @@ + this.func_215313_a(activerenderinfo, worldrenderer, p_181560_1_, d0, d1, d2); + } + ++ this.field_78531_r.func_213239_aq().func_219895_b("forge_render_last"); + net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(worldrenderer, p_181560_1_); + - this.field_78531_r.field_71424_I.func_76318_c("hand"); + this.field_78531_r.func_213239_aq().func_219895_b("hand"); if (this.field_175074_C) { - GlStateManager.func_179086_m(256); -@@ -957,6 +980,11 @@ + GlStateManager.clear(256, Minecraft.field_142025_a); +@@ -771,7 +784,7 @@ + GlStateManager.multMatrix(Matrix4f.func_195876_a(this.func_215311_a(p_215313_1_, p_215313_3_, true), (float)this.field_78531_r.field_195558_d.func_198109_k() / (float)this.field_78531_r.field_195558_d.func_198091_l(), 0.05F, this.field_78530_s * 4.0F)); + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); +- this.field_205003_A.func_217618_a(p_215313_1_, 0); ++ this.field_205003_A.setupFog(p_215313_1_, 0, p_215313_3_); + p_215313_2_.func_195466_a(p_215313_3_, p_215313_4_, p_215313_6_, p_215313_8_); + GlStateManager.disableFog(); + GlStateManager.popMatrix(); +@@ -857,6 +870,11 @@ } protected void func_78474_d(float p_78474_1_) { @@ -144,9 +139,9 @@ float f = this.field_78531_r.field_71441_e.func_72867_j(p_78474_1_); if (!(f <= 0.0F)) { this.func_180436_i(); -@@ -1184,4 +1212,9 @@ - public float func_205001_m() { - return this.field_78530_s; +@@ -1089,4 +1107,9 @@ + public ActiveRenderInfo func_215316_n() { + return this.field_215317_L; } + + @Override diff --git a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch deleted file mode 100644 index 78a64e170..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- a/net/minecraft/client/renderer/InventoryEffectRenderer.java -+++ b/net/minecraft/client/renderer/InventoryEffectRenderer.java -@@ -25,10 +25,16 @@ - } - - protected void func_175378_g() { -- if (this.field_146297_k.field_71439_g.func_70651_bq().isEmpty()) { -+ boolean hasVisibleEffect = false; -+ for(PotionEffect potioneffect : this.field_146297_k.field_71439_g.func_70651_bq()) { -+ Potion potion = potioneffect.func_188419_a(); -+ if(potion.shouldRender(potioneffect)) { hasVisibleEffect = true; break; } -+ } -+ if (this.field_146297_k.field_71439_g.func_70651_bq().isEmpty() || !hasVisibleEffect) { - this.field_147003_i = (this.field_146294_l - this.field_146999_f) / 2; - this.field_147045_u = false; - } else { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.PotionShiftEvent(this))) this.field_147003_i = (this.field_146294_l - this.field_146999_f) / 2; else - this.field_147003_i = 160 + (this.field_146294_l - this.field_146999_f - 200) / 2; - this.field_147045_u = true; - } -@@ -58,6 +64,7 @@ - - for(PotionEffect potioneffect : Ordering.natural().sortedCopy(collection)) { - Potion potion = potioneffect.func_188419_a(); -+ if(!potion.shouldRender(potioneffect)) continue; - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146297_k.func_110434_K().func_110577_a(field_147001_a); - this.func_73729_b(i, j, 0, 166, 140, 32); -@@ -66,6 +73,8 @@ - this.func_73729_b(i + 6, j + 7, i1 % 12 * 18, 198 + i1 / 12 * 18, 18, 18); - } - -+ potion.renderInventoryEffect(potioneffect, this, i, j, this.field_73735_i); -+ if (!potion.shouldRenderInvText(potioneffect)) { j += l; continue; } - String s1 = I18n.func_135052_a(potion.func_76393_a()); - if (potioneffect.func_76458_c() == 1) { - s1 = s1 + ' ' + I18n.func_135052_a("enchantment.level.2"); diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch index 9980e5f68..6a5c5ca23 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch @@ -4,9 +4,9 @@ public TextureAtlasSprite func_199309_a(ItemStack p_199309_1_) { IBakedModel ibakedmodel = this.func_178089_a(p_199309_1_); -- return (ibakedmodel == this.field_178090_d.func_174951_a() || ibakedmodel.func_188618_c()) && p_199309_1_.func_77973_b() instanceof ItemBlock ? this.field_178090_d.func_174954_c().func_178122_a(((ItemBlock)p_199309_1_.func_77973_b()).func_179223_d().func_176223_P()) : ibakedmodel.func_177554_e(); +- return (ibakedmodel == this.field_178090_d.func_174951_a() || ibakedmodel.func_188618_c()) && p_199309_1_.func_77973_b() instanceof BlockItem ? this.field_178090_d.func_174954_c().func_178122_a(((BlockItem)p_199309_1_.func_77973_b()).func_179223_d().func_176223_P()) : ibakedmodel.func_177554_e(); + // FORGE: Make sure to call the item overrides -+ return (ibakedmodel == this.field_178090_d.func_174951_a() || ibakedmodel.func_188618_c()) && p_199309_1_.func_77973_b() instanceof ItemBlock ? this.field_178090_d.func_174954_c().func_178122_a(((ItemBlock)p_199309_1_.func_77973_b()).func_179223_d().func_176223_P()) : ibakedmodel.func_188617_f().func_209581_a(ibakedmodel, p_199309_1_, null, null).func_177554_e(); ++ return (ibakedmodel == this.field_178090_d.func_174951_a() || ibakedmodel.func_188618_c()) && p_199309_1_.func_77973_b() instanceof BlockItem ? this.field_178090_d.func_174954_c().func_178122_a(((BlockItem)p_199309_1_.func_77973_b()).func_179223_d().func_176223_P()) : ibakedmodel.func_188617_f().func_209581_a(ibakedmodel, p_199309_1_, null, null).func_177554_e(); } public IBakedModel func_178089_a(ItemStack p_178089_1_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index 0f9f5767a..bfe7a7b55 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/client/renderer/ItemRenderer.java +++ b/net/minecraft/client/renderer/ItemRenderer.java -@@ -50,13 +50,14 @@ +@@ -51,13 +51,14 @@ public ItemRenderer(TextureManager p_i46552_1_, ModelManager p_i46552_2_, ItemColors p_i46552_3_) { this.field_175057_n = p_i46552_1_; - this.field_175059_m = new ItemModelMesher(p_i46552_2_); + this.field_175059_m = new net.minecraftforge.client.ItemModelMesherForge(p_i46552_2_); - for(Item item : IRegistry.field_212630_s) { + for(Item item : Registry.field_212630_s) { if (!field_195411_c.contains(item)) { - this.field_175059_m.func_199311_a(item, new ModelResourceLocation(IRegistry.field_212630_s.func_177774_c(item), "inventory")); + this.field_175059_m.func_199311_a(item, new ModelResourceLocation(Registry.field_212630_s.func_177774_c(item), "inventory")); } } + net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.field_175059_m); this.field_184395_f = p_i46552_3_; } -@@ -74,6 +75,10 @@ +@@ -75,6 +76,10 @@ } private void func_191967_a(IBakedModel p_191967_1_, int p_191967_2_, ItemStack p_191967_3_) { @@ -27,16 +27,16 @@ Tessellator tessellator = Tessellator.func_178181_a(); BufferBuilder bufferbuilder = tessellator.func_178180_c(); bufferbuilder.func_181668_a(7, DefaultVertexFormats.field_176599_b); -@@ -97,7 +102,7 @@ +@@ -98,7 +103,7 @@ if (p_180454_2_.func_188618_c()) { - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.func_179091_B(); -- TileEntityItemStackRenderer.field_147719_a.func_179022_a(p_180454_1_); + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableRescaleNormal(); +- ItemStackTileEntityRenderer.field_147719_a.func_179022_a(p_180454_1_); + p_180454_1_.func_77973_b().getTileEntityItemStackRenderer().func_179022_a(p_180454_1_); } else { this.func_191961_a(p_180454_2_, p_180454_1_); if (p_180454_1_.func_77962_s()) { -@@ -163,7 +168,7 @@ +@@ -164,7 +169,7 @@ k = k | -16777216; } @@ -45,30 +45,30 @@ } } -@@ -224,11 +229,8 @@ - GlStateManager.func_179147_l(); - GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.func_179094_E(); +@@ -225,11 +230,8 @@ + GlStateManager.enableBlend(); + GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.pushMatrix(); - ItemCameraTransforms itemcameratransforms = p_184394_2_.func_177552_f(); - ItemCameraTransforms.func_188034_a(itemcameratransforms.func_181688_b(p_184394_3_), p_184394_4_); - if (this.func_183005_a(itemcameratransforms.func_181688_b(p_184394_3_))) { -- GlStateManager.func_187407_a(GlStateManager.CullFace.FRONT); +- GlStateManager.cullFace(GlStateManager.CullFace.FRONT); - } + // TODO: check if negative scale is a thing + p_184394_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184394_2_, p_184394_3_, p_184394_4_); this.func_180454_a(p_184394_1_, p_184394_2_); - GlStateManager.func_187407_a(GlStateManager.CullFace.BACK); -@@ -259,7 +261,7 @@ - GlStateManager.func_187401_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.cullFace(GlStateManager.CullFace.BACK); +@@ -260,7 +262,7 @@ + GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); this.func_180452_a(p_191962_2_, p_191962_3_, p_191962_4_.func_177556_c()); - p_191962_4_.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GUI); + p_191962_4_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_191962_4_, ItemCameraTransforms.TransformType.GUI, false); this.func_180454_a(p_191962_1_, p_191962_4_); - GlStateManager.func_179118_c(); - GlStateManager.func_179101_C(); -@@ -298,6 +300,7 @@ + GlStateManager.disableAlphaTest(); + GlStateManager.disableRescaleNormal(); +@@ -299,6 +301,7 @@ crashreportcategory.func_189529_a("Item Type", () -> { return String.valueOf((Object)p_184391_2_.func_77973_b()); }); @@ -76,22 +76,22 @@ crashreportcategory.func_189529_a("Item Damage", () -> { return String.valueOf(p_184391_2_.func_77952_i()); }); -@@ -329,9 +332,12 @@ - GlStateManager.func_179147_l(); - GlStateManager.func_179145_e(); - GlStateManager.func_179126_j(); +@@ -330,9 +333,12 @@ + GlStateManager.enableBlend(); + GlStateManager.enableLighting(); + GlStateManager.enableDepthTest(); + // Fixes opaque cooldown overlay a bit lower + // TODO: check if enabled blending still screws things up down the line. -+ GlStateManager.func_179147_l(); ++ GlStateManager.enableBlend(); } - if (p_180453_2_.func_77951_h()) { + if (p_180453_2_.func_77973_b().showDurabilityBar(p_180453_2_)) { - GlStateManager.func_179140_f(); - GlStateManager.func_179097_i(); - GlStateManager.func_179090_x(); -@@ -339,11 +345,9 @@ - GlStateManager.func_179084_k(); + GlStateManager.disableLighting(); + GlStateManager.disableDepthTest(); + GlStateManager.disableTexture(); +@@ -340,11 +346,9 @@ + GlStateManager.disableBlend(); Tessellator tessellator = Tessellator.func_178181_a(); BufferBuilder bufferbuilder = tessellator.func_178180_c(); - float f = (float)p_180453_2_.func_77952_i(); @@ -104,8 +104,8 @@ + int j = p_180453_2_.func_77973_b().getRGBDurabilityForDisplay(p_180453_2_); this.func_181565_a(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0, 0, 0, 255); this.func_181565_a(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, i, 1, j >> 16 & 255, j >> 8 & 255, j & 255, 255); - GlStateManager.func_179147_l(); -@@ -382,4 +386,9 @@ + GlStateManager.enableBlend(); +@@ -383,4 +387,9 @@ public void func_195410_a(IResourceManager p_195410_1_) { this.field_175059_m.func_178085_b(); } diff --git a/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch b/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch index 15ad71f34..1d9e9644b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/LightTexture.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/LightTexture.java +++ b/net/minecraft/client/renderer/LightTexture.java -@@ -112,6 +112,15 @@ +@@ -114,6 +114,15 @@ f12 = 0.25F + f9 * 0.75F; } diff --git a/patches/minecraft/net/minecraft/client/renderer/Matrix4f.java.patch b/patches/minecraft/net/minecraft/client/renderer/Matrix4f.java.patch new file mode 100644 index 000000000..18471fb54 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/Matrix4f.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/client/renderer/Matrix4f.java ++++ b/net/minecraft/client/renderer/Matrix4f.java +@@ -106,6 +106,10 @@ + + } + ++ public float get(int col, int row) { ++ return this.field_195888_a[col + 4 * row]; ++ } ++ + public void func_195878_a(int p_195878_1_, int p_195878_2_, float p_195878_3_) { + this.field_195888_a[p_195878_1_ + 4 * p_195878_2_] = p_195878_3_; + } diff --git a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch deleted file mode 100644 index 4b8bdc2ce..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/net/minecraft/client/renderer/OpenGlHelper.java -+++ b/net/minecraft/client/renderer/OpenGlHelper.java -@@ -98,6 +98,10 @@ - p_203093_0_.put(1286, "Operation on incomplete framebuffer"); - }); - -+ /* Stores the last values sent into glMultiTexCoord2f */ -+ public static float lastBrightnessX = 0.0f; -+ public static float lastBrightnessY = 0.0f; -+ - public static void func_77474_a() { - GLCapabilities glcapabilities = GL.getCapabilities(); - field_153215_z = glcapabilities.GL_ARB_multitexture && !glcapabilities.OpenGL13; -@@ -705,6 +709,10 @@ - GL13.glMultiTexCoord2f(p_77475_0_, p_77475_1_, p_77475_2_); - } - -+ if (p_77475_0_ == field_77476_b) { -+ lastBrightnessX = p_77475_1_; -+ lastBrightnessY = p_77475_2_; -+ } - } - - public static void func_148821_a(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch index d89c0ea18..92a25fb48 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -1,110 +1,57 @@ --- a/net/minecraft/client/renderer/WorldRenderer.java +++ b/net/minecraft/client/renderer/WorldRenderer.java -@@ -507,7 +507,9 @@ - } - - public void func_180446_a(Entity p_180446_1_, ICamera p_180446_2_, float p_180446_3_) { -+ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass(); - if (this.field_72740_G > 0) { -+ if (pass > 0) return; - --this.field_72740_G; - } else { - double d0 = p_180446_1_.field_70169_q + (p_180446_1_.field_70165_t - p_180446_1_.field_70169_q) * (double)p_180446_3_; -@@ -516,9 +518,11 @@ - this.field_72769_h.field_72984_F.func_76320_a("prepare"); - TileEntityRendererDispatcher.field_147556_a.func_190056_a(this.field_72769_h, this.field_72777_q.func_110434_K(), this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), this.field_72777_q.field_71476_x, p_180446_3_); - this.field_175010_j.func_180597_a(this.field_72769_h, this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), this.field_72777_q.field_147125_j, this.field_72777_q.field_71474_y, p_180446_3_); -+ if (pass == 0) { - this.field_72748_H = 0; - this.field_72749_I = 0; - this.field_72750_J = 0; -+ } - Entity entity = this.field_72777_q.func_175606_aa(); - double d3 = entity.field_70142_S + (entity.field_70165_t - entity.field_70142_S) * (double)p_180446_3_; - double d4 = entity.field_70137_T + (entity.field_70163_u - entity.field_70137_T) * (double)p_180446_3_; -@@ -529,10 +533,12 @@ - this.field_175010_j.func_178628_a(d3, d4, d5); - this.field_72777_q.field_71460_t.func_180436_i(); - this.field_72769_h.field_72984_F.func_76318_c("global"); -+ if (pass == 0) { - this.field_72748_H = this.field_72769_h.func_212419_R(); -- -+ } - for(int i = 0; i < this.field_72769_h.field_73007_j.size(); ++i) { - Entity entity1 = this.field_72769_h.field_73007_j.get(i); -+ if (!entity1.shouldRenderInPass(pass)) continue; - ++this.field_72749_I; - if (entity1.func_145770_h(d0, d1, d2)) { - this.field_175010_j.func_188388_a(entity1, p_180446_3_, false); -@@ -549,6 +555,7 @@ - ClassInheritanceMultiMap classinheritancemultimap = chunk.func_177429_s()[worldrenderer$containerlocalrenderinformation.field_178036_a.func_178568_j().func_177956_o() / 16]; - if (!classinheritancemultimap.isEmpty()) { - for(Entity entity2 : classinheritancemultimap) { -+ if (!entity2.shouldRenderInPass(pass)) continue; - boolean flag = this.field_175010_j.func_178635_a(entity2, p_180446_2_, d0, d1, d2) || entity2.func_184215_y(this.field_72777_q.field_71439_g); - if (flag) { - boolean flag1 = this.field_72777_q.func_175606_aa() instanceof EntityLivingBase && ((EntityLivingBase)this.field_72777_q.func_175606_aa()).func_70608_bn(); -@@ -575,7 +582,7 @@ - } - } - -- if (this.func_174985_d() && (!list.isEmpty() || this.field_184386_ad)) { -+ if (pass == 0 && this.func_174985_d() && (!list.isEmpty() || this.field_184386_ad)) { - this.field_72769_h.field_72984_F.func_76318_c("entityOutlines"); - this.field_175015_z.func_147614_f(); - this.field_184386_ad = !list.isEmpty(); -@@ -610,10 +617,12 @@ - this.field_72769_h.field_72984_F.func_76318_c("blockentities"); +@@ -589,10 +589,12 @@ + this.field_72769_h.func_217381_Z().func_219895_b("blockentities"); RenderHelper.func_74519_b(); + TileEntityRendererDispatcher.field_147556_a.preDrawBatch(); - for(WorldRenderer.ContainerLocalRenderInformation worldrenderer$containerlocalrenderinformation1 : this.field_72755_R) { - List list2 = worldrenderer$containerlocalrenderinformation1.field_178036_a.func_178571_g().func_178485_b(); + for(WorldRenderer.LocalRenderInformationContainer worldrenderer$localrenderinformationcontainer : this.field_72755_R) { + List list2 = worldrenderer$localrenderinformationcontainer.field_178036_a.func_178571_g().func_178485_b(); if (!list2.isEmpty()) { - for(TileEntity tileentity1 : list2) { -+ if (!tileentity1.shouldRenderInPass(pass) || !p_180446_2_.func_78546_a(tileentity1.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity1, p_180446_3_, -1); + for(TileEntity tileentity : list2) { ++ if (!p_215326_2_.func_78546_a(tileentity.getRenderBoundingBox())) continue; + TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_215326_3_, -1); } } -@@ -621,16 +630,18 @@ +@@ -600,16 +602,18 @@ synchronized(this.field_181024_n) { - for(TileEntity tileentity : this.field_181024_n) { -+ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.func_78546_a(tileentity.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_180446_3_, -1); + for(TileEntity tileentity1 : this.field_181024_n) { ++ if (!p_215326_2_.func_78546_a(tileentity1.getRenderBoundingBox())) continue; + TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity1, p_215326_3_, -1); } } -+ TileEntityRendererDispatcher.field_147556_a.drawBatch(pass); ++ TileEntityRendererDispatcher.field_147556_a.drawBatch(); this.func_180443_s(); for(DestroyBlockProgress destroyblockprogress : this.field_72738_E.values()) { BlockPos blockpos = destroyblockprogress.func_180246_b(); - IBlockState iblockstate = this.field_72769_h.func_180495_p(blockpos); -- if (iblockstate.func_177230_c().func_149716_u()) { -+ if (iblockstate.hasTileEntity()) { + BlockState blockstate = this.field_72769_h.func_180495_p(blockpos); +- if (blockstate.func_177230_c().func_149716_u()) { ++ if (blockstate.hasTileEntity()) { TileEntity tileentity2 = this.field_72769_h.func_175625_s(blockpos); - if (tileentity2 instanceof TileEntityChest && iblockstate.func_177229_b(BlockChest.field_196314_b) == ChestType.LEFT) { - blockpos = blockpos.func_177972_a(iblockstate.func_177229_b(BlockChest.field_176459_a).func_176746_e()); -@@ -766,7 +777,7 @@ + if (tileentity2 instanceof ChestTileEntity && blockstate.func_177229_b(ChestBlock.field_196314_b) == ChestType.LEFT) { + blockpos = blockpos.func_177972_a(blockstate.func_177229_b(ChestBlock.field_176459_a).func_176746_e()); +@@ -730,7 +734,7 @@ for(int j = -this.field_72739_F; j <= this.field_72739_F; ++j) { for(int k = -this.field_72739_F; k <= this.field_72739_F; ++k) { - RenderChunk renderchunk1 = this.field_175008_n.func_178161_a(new BlockPos((j << 4) + 8, i, (k << 4) + 8)); -- if (renderchunk1 != null && p_195473_3_.func_78546_a(renderchunk1.field_178591_c)) { -+ if (renderchunk1 != null && p_195473_3_.func_78546_a(renderchunk1.field_178591_c.func_72321_a(0.0, blockpos1.func_177956_o() > 0 ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY, 0.0))) { // Forge: fix MC-73139 - renderchunk1.func_178577_a(p_195473_4_); - queue.add(new WorldRenderer.ContainerLocalRenderInformation(renderchunk1, (EnumFacing)null, 0)); + ChunkRender chunkrender1 = this.field_175008_n.func_178161_a(new BlockPos((j << 4) + 8, i, (k << 4) + 8)); +- if (chunkrender1 != null && p_215320_2_.func_78546_a(chunkrender1.field_178591_c)) { ++ if (chunkrender1 != null && p_215320_2_.func_78546_a(chunkrender1.field_178591_c.func_72321_a(0.0, blockpos1.func_177956_o() > 0 ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY, 0.0))) { // Forge: fix MC-73139 + chunkrender1.func_178577_a(p_215320_3_); + queue.add(new WorldRenderer.LocalRenderInformationContainer(chunkrender1, (Direction)null, 0)); } -@@ -811,7 +822,7 @@ +@@ -775,7 +779,7 @@ this.field_147595_R = true; - BlockPos blockpos2 = renderchunk4.func_178568_j().func_177982_a(8, 8, 8); + BlockPos blockpos2 = chunkrender4.func_178568_j().func_177982_a(8, 8, 8); boolean flag3 = blockpos2.func_177951_i(blockpos1) < 768.0D; -- if (!renderchunk4.func_188281_o() && !flag3) { -+ if (net.minecraftforge.common.ForgeMod.alwaysSetupTerrainOffThread || !renderchunk4.func_188281_o() && !flag3) { - this.field_175009_l.add(renderchunk4); +- if (!chunkrender4.func_188281_o() && !flag3) { ++ if (net.minecraftforge.common.ForgeMod.alwaysSetupTerrainOffThread || !chunkrender4.func_188281_o() && !flag3) { + this.field_175009_l.add(chunkrender4); } else { - this.field_72777_q.field_71424_I.func_76320_a("build near"); -@@ -1031,6 +1042,11 @@ + this.field_72777_q.func_213239_aq().func_76320_a("build near"); +@@ -969,6 +973,11 @@ } public void func_195465_a(float p_195465_1_) { @@ -116,57 +63,55 @@ if (this.field_72777_q.field_71441_e.field_73011_w.func_186058_p() == DimensionType.THE_END) { this.func_180448_r(); } else if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) { -@@ -1175,6 +1191,7 @@ +@@ -1113,6 +1122,7 @@ } public void func_195466_a(float p_195466_1_, double p_195466_2_, double p_195466_4_, double p_195466_6_) { -+ if (net.minecraftforge.client.CloudRenderer.renderClouds(this.field_72773_u, p_195466_1_, this.field_72769_h, field_72777_q)) return; ++// if (net.minecraftforge.client.CloudRenderer.renderClouds(this.ticks, partialTicks, this.world, mc)) return; if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) { float f = 12.0F; float f1 = 4.0F; -@@ -1551,7 +1568,11 @@ +@@ -1488,7 +1498,11 @@ DestroyBlockProgress destroyblockprogress = iterator.next(); BlockPos blockpos = destroyblockprogress.func_180246_b(); Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); -- if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockAbstractSkull)) { +- if (!(block instanceof ChestBlock) && !(block instanceof EnderChestBlock) && !(block instanceof AbstractSignBlock) && !(block instanceof AbstractSkullBlock)) { + TileEntity te = this.field_72769_h.func_175625_s(blockpos); -+ boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockAbstractSkull; ++ boolean hasBreak = block instanceof ChestBlock || block instanceof EnderChestBlock || block instanceof AbstractSignBlock || block instanceof AbstractSkullBlock; + if (!hasBreak) hasBreak = te != null && te.canRenderBreaking(); + + if (!hasBreak) { double d3 = (double)blockpos.func_177958_n() - d0; double d4 = (double)blockpos.func_177956_o() - d1; double d5 = (double)blockpos.func_177952_p() - d2; -@@ -1559,7 +1580,7 @@ +@@ -1496,7 +1510,7 @@ iterator.remove(); } else { - IBlockState iblockstate = this.field_72769_h.func_180495_p(blockpos); -- if (!iblockstate.func_196958_f()) { -+ if (!iblockstate.isAir(field_72769_h, blockpos)) { + BlockState blockstate = this.field_72769_h.func_180495_p(blockpos); +- if (!blockstate.func_196958_f()) { ++ if (!blockstate.isAir(this.field_72769_h, blockpos)) { int i = destroyblockprogress.func_73106_e(); TextureAtlasSprite textureatlassprite = this.field_94141_F[i]; BlockRendererDispatcher blockrendererdispatcher = this.field_72777_q.func_175602_ab(); -@@ -1580,7 +1601,7 @@ - if (p_72731_3_ == 0 && p_72731_2_.field_72313_a == RayTraceResult.Type.BLOCK) { - BlockPos blockpos = p_72731_2_.func_178782_a(); - IBlockState iblockstate = this.field_72769_h.func_180495_p(blockpos); -- if (!iblockstate.func_196958_f() && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) { -+ if (!iblockstate.isAir(field_72769_h, blockpos) && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) { - GlStateManager.func_179147_l(); - GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.func_187441_d(Math.max(2.5F, (float)this.field_72777_q.field_195558_d.func_198109_k() / 1920.0F * 2.5F)); -@@ -2006,8 +2027,8 @@ +@@ -1517,7 +1531,7 @@ + if (p_215325_3_ == 0 && p_215325_2_.func_216346_c() == RayTraceResult.Type.BLOCK) { + BlockPos blockpos = ((BlockRayTraceResult)p_215325_2_).func_216350_a(); + BlockState blockstate = this.field_72769_h.func_180495_p(blockpos); +- if (!blockstate.func_196958_f() && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) { ++ if (!blockstate.isAir(this.field_72769_h, blockpos) && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) { + GlStateManager.enableBlend(); + GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.lineWidth(Math.max(2.5F, (float)this.field_72777_q.field_195558_d.func_198109_k() / 1920.0F * 2.5F)); +@@ -1984,7 +1998,7 @@ break; case 2001: - IBlockState iblockstate = Block.func_196257_b(p_180439_4_); -- if (!iblockstate.func_196958_f()) { -- SoundType soundtype = iblockstate.func_177230_c().func_185467_w(); -+ if (!iblockstate.isAir(field_72769_h, p_180439_3_)) { -+ SoundType soundtype = iblockstate.getSoundType(field_72769_h, p_180439_3_, null); + BlockState blockstate = Block.func_196257_b(p_180439_4_); +- if (!blockstate.func_196958_f()) { ++ if (!blockstate.isAir(this.field_72769_h, p_180439_3_)) { + SoundType soundtype = blockstate.func_215695_r(); 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); } - -@@ -2127,6 +2148,11 @@ +@@ -2108,6 +2122,11 @@ } } @@ -176,5 +121,5 @@ + } + @OnlyIn(Dist.CLIENT) - class ContainerLocalRenderInformation { - private final RenderChunk field_178036_a; + class LocalRenderInformationContainer { + private final ChunkRender field_178036_a; diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch index 4ccf84c36..eb466d367 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch @@ -1,57 +1,59 @@ --- a/net/minecraft/client/renderer/WorldVertexBufferUploader.java +++ b/net/minecraft/client/renderer/WorldVertexBufferUploader.java -@@ -22,25 +22,9 @@ - int k = vertexformatelement.func_177367_b().func_177397_c(); - int l = vertexformatelement.func_177369_e(); - bytebuffer.position(vertexformat.func_181720_d(j)); -- switch(vertexformatelement$enumusage) { +@@ -20,29 +20,7 @@ + + for(int j = 0; j < list.size(); ++j) { + VertexFormatElement vertexformatelement = list.get(j); +- VertexFormatElement.Usage vertexformatelement$usage = vertexformatelement.func_177375_c(); +- int k = vertexformatelement.func_177367_b().func_177397_c(); +- int l = vertexformatelement.func_177369_e(); +- bytebuffer.position(vertexformat.func_181720_d(j)); +- switch(vertexformatelement$usage) { - case POSITION: -- GlStateManager.func_187427_b(vertexformatelement.func_177370_d(), k, i, bytebuffer); -- GlStateManager.func_187410_q(32884); +- GlStateManager.vertexPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); +- GlStateManager.enableClientState(32884); - break; - case UV: -- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + l); -- GlStateManager.func_187404_a(vertexformatelement.func_177370_d(), k, i, bytebuffer); -- GlStateManager.func_187410_q(32888); -- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); +- GLX.glClientActiveTexture(GLX.GL_TEXTURE0 + l); +- GlStateManager.texCoordPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); +- GlStateManager.enableClientState(32888); +- GLX.glClientActiveTexture(GLX.GL_TEXTURE0); - break; - case COLOR: -- GlStateManager.func_187400_c(vertexformatelement.func_177370_d(), k, i, bytebuffer); -- GlStateManager.func_187410_q(32886); +- GlStateManager.colorPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); +- GlStateManager.enableClientState(32886); - break; - case NORMAL: -- GlStateManager.func_187446_a(k, i, bytebuffer); -- GlStateManager.func_187410_q(32885); +- GlStateManager.normalPointer(k, i, bytebuffer); +- GlStateManager.enableClientState(32885); - } -+ -+ // moved to VertexFormatElement.preDraw -+ vertexformatelement.func_177375_c().preDraw(vertexformat, j, i, bytebuffer); ++ vertexformatelement.func_177375_c().preDraw(vertexformat, j, i, bytebuffer); // moved to VertexFormatElement.preDraw } - GlStateManager.func_187439_f(p_181679_1_.func_178979_i(), 0, p_181679_1_.func_178989_h()); -@@ -50,22 +34,9 @@ + GlStateManager.drawArrays(p_181679_1_.func_178979_i(), 0, p_181679_1_.func_178989_h()); +@@ -50,24 +28,7 @@ + + for(int j1 = list.size(); i1 < j1; ++i1) { VertexFormatElement vertexformatelement1 = list.get(i1); - VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.func_177375_c(); - int k1 = vertexformatelement1.func_177369_e(); -- switch(vertexformatelement$enumusage1) { +- VertexFormatElement.Usage vertexformatelement$usage1 = vertexformatelement1.func_177375_c(); +- int k1 = vertexformatelement1.func_177369_e(); +- switch(vertexformatelement$usage1) { - case POSITION: -- GlStateManager.func_187429_p(32884); +- GlStateManager.disableClientState(32884); - break; - case UV: -- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + k1); -- GlStateManager.func_187429_p(32888); -- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); +- GLX.glClientActiveTexture(GLX.GL_TEXTURE0 + k1); +- GlStateManager.disableClientState(32888); +- GLX.glClientActiveTexture(GLX.GL_TEXTURE0); - break; - case COLOR: -- GlStateManager.func_187429_p(32886); -- GlStateManager.func_179117_G(); +- GlStateManager.disableClientState(32886); +- GlStateManager.clearCurrentColor(); - break; - case NORMAL: -- GlStateManager.func_187429_p(32885); +- GlStateManager.disableClientState(32885); - } -+ -+ // moved to VertexFormatElement.postDraw -+ vertexformatelement1.func_177375_c().postDraw(vertexformat, i1, i, bytebuffer); ++ vertexformatelement1.func_177375_c().postDraw(vertexformat, i1, i, bytebuffer); // moved to VertexFormatElement.postDraw } } diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRender.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch rename to patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRender.java.patch index 2553faf97..34150e6fc 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRender.java.patch @@ -1,61 +1,51 @@ ---- a/net/minecraft/client/renderer/chunk/RenderChunk.java -+++ b/net/minecraft/client/renderer/chunk/RenderChunk.java -@@ -36,7 +36,7 @@ +--- a/net/minecraft/client/renderer/chunk/ChunkRender.java ++++ b/net/minecraft/client/renderer/chunk/ChunkRender.java +@@ -33,7 +33,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) --public class RenderChunk { -+public class RenderChunk implements net.minecraftforge.client.extensions.IForgeRenderChunk { +-public class ChunkRender { ++public class ChunkRender implements net.minecraftforge.client.extensions.IForgeRenderChunk { private volatile World field_178588_d; private final WorldRenderer field_178589_e; public static int field_178592_a; -@@ -125,7 +125,8 @@ - p_178581_4_.func_178540_f().unlock(); - } - -- RenderChunkCache lvt_10_1_ = RenderChunkCache.func_212397_a(world, blockpos.func_177982_a(-1, -1, -1), blockpos.func_177982_a(16, 16, 16), 1); -+ RenderChunkCache lvt_10_1_ = createRegionRenderCache(world, blockpos.func_177982_a(-1, -1, -1), blockpos.func_177982_a(16, 16, 16), 1); -+ net.minecraftforge.client.MinecraftForgeClient.onRebuildChunk(this.field_178588_d, this.field_178586_f, lvt_10_1_); - VisGraph lvt_11_1_ = new VisGraph(); - HashSet lvt_12_1_ = Sets.newHashSet(); - if (lvt_10_1_ != null) { -@@ -142,22 +143,24 @@ - lvt_11_1_.func_178606_a(blockpos$mutableblockpos); +@@ -151,22 +151,24 @@ + lvt_10_1_.func_178606_a(blockpos2); } - if (block.func_149716_u()) { -+ if (iblockstate.hasTileEntity()) { - TileEntity tileentity = lvt_10_1_.func_212399_a(blockpos$mutableblockpos, Chunk.EnumCreateEntityType.CHECK); ++ if (blockstate.hasTileEntity()) { + TileEntity tileentity = lvt_12_1_.func_212399_a(blockpos2, Chunk.CreateEntityType.CHECK); if (tileentity != null) { TileEntityRenderer tileentityrenderer = TileEntityRendererDispatcher.field_147556_a.func_147547_b(tileentity); if (tileentityrenderer != null) { - compiledchunk.func_178490_a(tileentity); if (tileentityrenderer.func_188185_a(tileentity)) { - lvt_12_1_.add(tileentity); + lvt_11_1_.add(tileentity); } + else compiledchunk.func_178490_a(tileentity); // FORGE: Fix MC-112730 } } } - IFluidState ifluidstate = lvt_10_1_.func_204610_c(blockpos$mutableblockpos); + IFluidState ifluidstate = lvt_12_1_.func_204610_c(blockpos2); - if (!ifluidstate.func_206888_e()) { - BlockRenderLayer blockrenderlayer1 = ifluidstate.func_180664_k(); -+ net.minecraftforge.client.model.data.IModelData modelData = p_178581_4_.getModelData(blockpos$mutableblockpos); ++ net.minecraftforge.client.model.data.IModelData modelData = p_178581_4_.getModelData(blockpos2); + for(BlockRenderLayer blockrenderlayer1 : BlockRenderLayer.values()) { + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(blockrenderlayer1); + if (!ifluidstate.func_206888_e() && ifluidstate.canRenderInLayer(blockrenderlayer1)) { int j = blockrenderlayer1.ordinal(); BufferBuilder bufferbuilder = p_178581_4_.func_178545_d().func_179039_a(j); if (!compiledchunk.func_178492_d(blockrenderlayer1)) { -@@ -168,17 +171,18 @@ - aboolean[j] |= blockrendererdispatcher.func_205318_a(blockpos$mutableblockpos, lvt_10_1_, bufferbuilder, ifluidstate); +@@ -177,17 +179,18 @@ + aboolean[j] |= blockrendererdispatcher.func_215331_a(blockpos2, lvt_12_1_, bufferbuilder, ifluidstate); } -- if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) { +- if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE) { - BlockRenderLayer blockrenderlayer2 = block.func_180664_k(); - int k = blockrenderlayer2.ordinal(); -+ if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE && iblockstate.canRenderInLayer(blockrenderlayer1)) { ++ if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE && blockstate.canRenderInLayer(blockrenderlayer1)) { + int k = blockrenderlayer1.ordinal(); BufferBuilder bufferbuilder1 = p_178581_4_.func_178545_d().func_179039_a(k); - if (!compiledchunk.func_178492_d(blockrenderlayer2)) { @@ -65,11 +55,21 @@ this.func_178573_a(bufferbuilder1, blockpos); } -- aboolean[k] |= blockrendererdispatcher.func_195475_a(iblockstate, blockpos$mutableblockpos, lvt_10_1_, bufferbuilder1, random); -+ aboolean[k] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, lvt_10_1_, bufferbuilder1, random, modelData); +- aboolean[k] |= blockrendererdispatcher.func_215330_a(blockstate, blockpos2, lvt_12_1_, bufferbuilder1, random); ++ aboolean[k] |= blockrendererdispatcher.renderBlock(blockstate, blockpos2, lvt_12_1_, bufferbuilder1, random, modelData); } + } + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null); } for(BlockRenderLayer blockrenderlayer : BlockRenderLayer.values()) { +@@ -247,7 +250,8 @@ + this.func_178578_b(); + BlockPos blockpos = this.field_178586_f.func_185334_h(); + int i = 1; +- ChunkRenderCache chunkrendercache = ChunkRenderCache.func_212397_a(this.field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos.func_177982_a(16, 16, 16), 1); ++ ChunkRenderCache chunkrendercache = createRegionRenderCache(field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos.func_177982_a(16, 16, 16), 1); ++ + this.field_178599_i = new ChunkRenderTask(this, ChunkRenderTask.Type.REBUILD_CHUNK, this.func_188280_f(), chunkrendercache); + chunkrendertask = this.field_178599_i; + } finally { diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch index 748ce4600..a422103e1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java +++ b/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java -@@ -44,9 +44,14 @@ - private final ChunkRenderWorker field_178525_i; +@@ -45,10 +45,14 @@ + private Vec3d field_217672_l = Vec3d.field_186680_a; - public ChunkRenderDispatcher() { -+ this(-1); + public ChunkRenderDispatcher(boolean p_i51518_1_) { ++ this(p_i51518_1_,-1); + } -+ -+ public ChunkRenderDispatcher(int countRenderBuilders) { - int i = Math.max(1, (int)((double)Runtime.getRuntime().maxMemory() * 0.3D) / 10485760); - int j = Math.max(1, MathHelper.func_76125_a(Runtime.getRuntime().availableProcessors(), 1, i / 5)); -- this.field_188249_c = MathHelper.func_76125_a(j * 10, 1, i); -+ if(countRenderBuilders < 0) countRenderBuilders = MathHelper.func_76125_a(j * 10, 1, i); -+ this.field_188249_c = countRenderBuilders; - if (j > 1) { - for(int k = 0; k < j; ++k) { - ChunkRenderWorker chunkrenderworker = new ChunkRenderWorker(this); ++ ++ public ChunkRenderDispatcher(boolean p_i51518_1_, int countRenderBuilders) { + int i = Math.max(1, (int)((double)Runtime.getRuntime().maxMemory() * 0.3D) / 10485760 - 1); + int j = Runtime.getRuntime().availableProcessors(); + int k = p_i51518_1_ ? j : Math.min(j, 4); +- int l = Math.max(1, Math.min(k * 3, i)); ++ int l = countRenderBuilders < 0 ? Math.max(1, Math.min(k * 3, i)) : countRenderBuilders; + this.field_178525_i = new ChunkRenderWorker(this, new RegionRenderCacheBuilder()); + List list = Lists.newArrayListWithExpectedSize(l); + diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderTask.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderTask.java.patch index d94eab3f9..43014f89e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderTask.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderTask.java.patch @@ -1,21 +1,22 @@ --- a/net/minecraft/client/renderer/chunk/ChunkRenderTask.java +++ b/net/minecraft/client/renderer/chunk/ChunkRenderTask.java -@@ -19,11 +19,14 @@ +@@ -22,12 +22,15 @@ private CompiledChunk field_178547_f; private ChunkRenderTask.Status field_178548_g = ChunkRenderTask.Status.PENDING; private boolean field_178554_h; + private java.util.Map modelData; - public ChunkRenderTask(RenderChunk p_i46560_1_, ChunkRenderTask.Type p_i46560_2_, double p_i46560_3_) { - this.field_178553_a = p_i46560_1_; - this.field_178549_d = p_i46560_2_; - this.field_188229_e = p_i46560_3_; -+ -+ modelData = net.minecraftforge.client.model.ModelDataManager.getModelData(net.minecraft.client.Minecraft.func_71410_x().field_71441_e, new net.minecraft.util.math.ChunkPos(p_i46560_1_.func_178568_j())); + public ChunkRenderTask(ChunkRender p_i50980_1_, ChunkRenderTask.Type p_i50980_2_, double p_i50980_3_, @Nullable ChunkRenderCache p_i50980_5_) { + this.field_178553_a = p_i50980_1_; + this.field_178549_d = p_i50980_2_; + this.field_188229_e = p_i50980_3_; + this.field_217668_f = p_i50980_5_; ++ ++ modelData = net.minecraftforge.client.model.ModelDataManager.getModelData(net.minecraft.client.Minecraft.func_71410_x().field_71441_e, new net.minecraft.util.math.ChunkPos(p_i50980_1_.func_178568_j())); } public ChunkRenderTask.Status func_178546_a() { -@@ -128,4 +131,8 @@ +@@ -140,4 +143,8 @@ REBUILD_CHUNK, RESORT_TRANSPARENCY; } diff --git a/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch b/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch index d5e998c5e..8bbcb88be 100644 --- a/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/color/BlockColors.java.patch @@ -18,24 +18,24 @@ return blockcolors; } - public int func_189991_a(IBlockState p_189991_1_, World p_189991_2_, BlockPos p_189991_3_) { -- IBlockColor iblockcolor = this.field_186725_a.func_148745_a(IRegistry.field_212618_g.func_148757_b(p_189991_1_.func_177230_c())); + public int func_189991_a(BlockState p_189991_1_, World p_189991_2_, BlockPos p_189991_3_) { +- IBlockColor iblockcolor = this.field_186725_a.func_148745_a(Registry.field_212618_g.func_148757_b(p_189991_1_.func_177230_c())); + IBlockColor iblockcolor = this.field_186725_a.get(p_189991_1_.func_177230_c().delegate); if (iblockcolor != null) { - return iblockcolor.getColor(p_189991_1_, (IWorldReaderBase)null, (BlockPos)null, 0); + return iblockcolor.getColor(p_189991_1_, (IEnviromentBlockReader)null, (BlockPos)null, 0); } else { @@ -77,13 +79,13 @@ } - public int func_186724_a(IBlockState p_186724_1_, @Nullable IWorldReaderBase p_186724_2_, @Nullable BlockPos p_186724_3_, int p_186724_4_) { -- IBlockColor iblockcolor = this.field_186725_a.func_148745_a(IRegistry.field_212618_g.func_148757_b(p_186724_1_.func_177230_c())); -+ IBlockColor iblockcolor = this.field_186725_a.get(p_186724_1_.func_177230_c().delegate); - return iblockcolor == null ? -1 : iblockcolor.getColor(p_186724_1_, p_186724_2_, p_186724_3_, p_186724_4_); + public int func_216860_a(BlockState p_216860_1_, @Nullable IEnviromentBlockReader p_216860_2_, @Nullable BlockPos p_216860_3_, int p_216860_4_) { +- IBlockColor iblockcolor = this.field_186725_a.func_148745_a(Registry.field_212618_g.func_148757_b(p_216860_1_.func_177230_c())); ++ IBlockColor iblockcolor = this.field_186725_a.get(p_216860_1_.func_177230_c().delegate); + return iblockcolor == null ? -1 : iblockcolor.getColor(p_216860_1_, p_216860_2_, p_216860_3_, p_216860_4_); } public void func_186722_a(IBlockColor p_186722_1_, Block... p_186722_2_) { for(Block block : p_186722_2_) { -- this.field_186725_a.func_148746_a(p_186722_1_, IRegistry.field_212618_g.func_148757_b(block)); +- this.field_186725_a.func_148746_a(p_186722_1_, Registry.field_212618_g.func_148757_b(block)); + this.field_186725_a.put(block.delegate, p_186722_1_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch b/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch index fe118925a..4eff1c423 100644 --- a/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/color/ItemColors.java.patch @@ -12,14 +12,14 @@ ItemColors itemcolors = new ItemColors(); @@ -80,17 +81,18 @@ itemcolors.func_199877_a((p_210237_0_, p_210237_1_) -> { - return p_210237_1_ == 0 ? -1 : ItemMap.func_190907_h(p_210237_0_); + return p_210237_1_ == 0 ? -1 : FilledMapItem.func_190907_h(p_210237_0_); }, Items.field_151098_aY); + net.minecraftforge.client.ForgeHooksClient.onItemColorsInit(itemcolors, p_186729_0_); return itemcolors; } public int func_186728_a(ItemStack p_186728_1_, int p_186728_2_) { -- IItemColor iitemcolor = this.field_186732_a.func_148745_a(IRegistry.field_212630_s.func_148757_b(p_186728_1_.func_77973_b())); +- IItemColor iitemcolor = this.field_186732_a.func_148745_a(Registry.field_212630_s.func_148757_b(p_186728_1_.func_77973_b())); + IItemColor iitemcolor = this.field_186732_a.get(p_186728_1_.func_77973_b().delegate); return iitemcolor == null ? -1 : iitemcolor.getColor(p_186728_1_, p_186728_2_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch new file mode 100644 index 000000000..c0699f100 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRendererManager.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/client/renderer/entity/EntityRendererManager.java ++++ b/net/minecraft/client/renderer/entity/EntityRendererManager.java +@@ -255,8 +255,13 @@ + this.field_178637_m = new PlayerRenderer(this); + this.field_178636_l.put("default", this.field_178637_m); + this.field_178636_l.put("slim", new PlayerRenderer(this, true)); ++ net.minecraftforge.fml.client.registry.RenderingRegistry.loadEntityRenderers(this, this.field_78729_o); + } + ++ public Map getSkinMap() { ++ return (Map) java.util.Collections.unmodifiableMap(field_178636_l); ++ } ++ + public void func_178628_a(double p_178628_1_, double p_178628_3_, double p_178628_5_) { + this.field_78725_b = p_178628_1_; + this.field_78726_c = p_178628_3_; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/FishRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/FishRenderer.java.patch new file mode 100644 index 000000000..7e6818e86 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/FishRenderer.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/renderer/entity/FishRenderer.java ++++ b/net/minecraft/client/renderer/entity/FishRenderer.java +@@ -59,7 +59,7 @@ + GlStateManager.popMatrix(); + int i = playerentity.func_184591_cq() == HandSide.RIGHT ? 1 : -1; + ItemStack itemstack = playerentity.func_184614_ca(); +- if (itemstack.func_77973_b() != Items.field_151112_aM) { ++ if (!(itemstack.func_77973_b() instanceof net.minecraft.item.FishingRodItem)) { + i = -i; + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItemFrame.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch similarity index 54% rename from patches/minecraft/net/minecraft/client/renderer/entity/RenderItemFrame.java.patch rename to patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch index cef74d839..db32c26da 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItemFrame.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch @@ -1,41 +1,41 @@ ---- a/net/minecraft/client/renderer/entity/RenderItemFrame.java -+++ b/net/minecraft/client/renderer/entity/RenderItemFrame.java -@@ -45,7 +45,7 @@ - this.field_76990_c.field_78724_e.func_110577_a(TextureMap.field_110575_b); +--- a/net/minecraft/client/renderer/entity/ItemFrameRenderer.java ++++ b/net/minecraft/client/renderer/entity/ItemFrameRenderer.java +@@ -44,7 +44,7 @@ + this.field_76990_c.field_78724_e.func_110577_a(AtlasTexture.field_110575_b); BlockRendererDispatcher blockrendererdispatcher = this.field_147917_g.func_175602_ab(); ModelManager modelmanager = blockrendererdispatcher.func_175023_a().func_178126_b(); - ModelResourceLocation modelresourcelocation = p_76986_1_.func_82335_i().func_77973_b() == Items.field_151098_aY ? field_209586_g : field_209585_f; -+ ModelResourceLocation modelresourcelocation = p_76986_1_.func_82335_i().func_77973_b() instanceof ItemMap ? field_209586_g : field_209585_f; - GlStateManager.func_179094_E(); - GlStateManager.func_179109_b(-0.5F, -0.5F, -0.5F); ++ ModelResourceLocation modelresourcelocation = p_76986_1_.func_82335_i().func_77973_b() instanceof FilledMapItem ? field_209586_g : field_209585_f; + GlStateManager.pushMatrix(); + GlStateManager.translatef(-0.5F, -0.5F, -0.5F); if (this.field_188301_f) { -@@ -87,17 +87,17 @@ +@@ -86,17 +86,17 @@ ItemStack itemstack = p_82402_1_.func_82335_i(); if (!itemstack.func_190926_b()) { - GlStateManager.func_179094_E(); + GlStateManager.pushMatrix(); - boolean flag = itemstack.func_77973_b() == Items.field_151098_aY; - int i = flag ? p_82402_1_.func_82333_j() % 4 * 2 : p_82402_1_.func_82333_j(); -+ MapData mapdata = ItemMap.func_195950_a(itemstack, p_82402_1_.field_70170_p); ++ MapData mapdata = FilledMapItem.func_195950_a(itemstack, p_82402_1_.field_70170_p); + int i = mapdata != null ? p_82402_1_.func_82333_j() % 4 * 2 : p_82402_1_.func_82333_j(); - GlStateManager.func_179114_b((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotatef((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); - if (flag) { + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderItemInFrameEvent(p_82402_1_, this))) { + if (mapdata != null) { - GlStateManager.func_179140_f(); + GlStateManager.disableLighting(); this.field_76990_c.field_78724_e.func_110577_a(field_110789_a); - GlStateManager.func_179114_b(180.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotatef(180.0F, 0.0F, 0.0F, 1.0F); float f = 0.0078125F; - GlStateManager.func_179152_a(0.0078125F, 0.0078125F, 0.0078125F); - GlStateManager.func_179109_b(-64.0F, -64.0F, 0.0F); -- MapData mapdata = ItemMap.func_195950_a(itemstack, p_82402_1_.field_70170_p); - GlStateManager.func_179109_b(0.0F, 0.0F, -1.0F); + GlStateManager.scalef(0.0078125F, 0.0078125F, 0.0078125F); + GlStateManager.translatef(-64.0F, -64.0F, 0.0F); +- MapData mapdata = FilledMapItem.func_195950_a(itemstack, p_82402_1_.field_70170_p); + GlStateManager.translatef(0.0F, 0.0F, -1.0F); if (mapdata != null) { this.field_147917_g.field_71460_t.func_147701_i().func_148250_a(mapdata, true); -@@ -106,6 +106,7 @@ - GlStateManager.func_179152_a(0.5F, 0.5F, 0.5F); +@@ -105,6 +105,7 @@ + GlStateManager.scalef(0.5F, 0.5F, 0.5F); this.field_177074_h.func_181564_a(itemstack, ItemCameraTransforms.TransformType.FIXED); } + } - GlStateManager.func_179121_F(); + GlStateManager.popMatrix(); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch similarity index 73% rename from patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch rename to patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch index 3e6fa5923..13a1c1fc5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch @@ -1,17 +1,17 @@ ---- a/net/minecraft/client/renderer/entity/RenderEntityItem.java -+++ b/net/minecraft/client/renderer/entity/RenderEntityItem.java -@@ -37,7 +37,7 @@ +--- a/net/minecraft/client/renderer/entity/ItemRenderer.java ++++ b/net/minecraft/client/renderer/entity/ItemRenderer.java +@@ -36,7 +36,7 @@ boolean flag = p_177077_9_.func_177556_c(); int i = this.func_177078_a(itemstack); float f = 0.25F; - float f1 = MathHelper.func_76126_a(((float)p_177077_1_.func_174872_o() + p_177077_8_) / 10.0F + p_177077_1_.field_70290_d) * 0.1F + 0.1F; + float f1 = shouldBob() ? MathHelper.func_76126_a(((float)p_177077_1_.func_174872_o() + p_177077_8_) / 10.0F + p_177077_1_.field_70290_d) * 0.1F + 0.1F : 0; float f2 = p_177077_9_.func_177552_f().func_181688_b(ItemCameraTransforms.TransformType.GROUND).field_178363_d.func_195900_b(); - GlStateManager.func_179109_b((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); + GlStateManager.translatef((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); if (flag || this.field_76990_c.field_78733_k != null) { -@@ -83,14 +83,11 @@ - GlStateManager.func_179094_E(); - IBakedModel ibakedmodel = this.field_177080_a.func_184393_a(itemstack, p_76986_1_.field_70170_p, (EntityLivingBase)null); +@@ -82,14 +82,11 @@ + GlStateManager.pushMatrix(); + IBakedModel ibakedmodel = this.field_177080_a.func_184393_a(itemstack, p_76986_1_.field_70170_p, (LivingEntity)null); int j = this.func_177077_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_9_, ibakedmodel); - float f = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.func_195899_a(); - float f1 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.func_195900_b(); @@ -24,41 +24,41 @@ + float f3 = -0.0F * (float)(j - 1) * 0.5F; + float f4 = -0.0F * (float)(j - 1) * 0.5F; + float f5 = -0.09375F * (float)(j - 1) * 0.5F; - GlStateManager.func_179109_b(f3, f4, f5); + GlStateManager.translatef(f3, f4, f5); } -@@ -106,11 +103,11 @@ +@@ -105,11 +102,11 @@ float f7 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; float f9 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; float f6 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -- GlStateManager.func_179109_b(f7, f9, f6); -+ GlStateManager.func_179109_b(shouldSpreadItems() ? f7 : 0, shouldSpreadItems() ? f9 : 0, f6); +- GlStateManager.translatef(f7, f9, f6); ++ GlStateManager.translatef(shouldSpreadItems() ? f7 : 0, shouldSpreadItems() ? f9 : 0, f6); } - ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND); - this.field_177080_a.func_180454_a(itemstack, ibakedmodel); + IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); + this.field_177080_a.func_180454_a(itemstack, transformedModel); - GlStateManager.func_179121_F(); + GlStateManager.popMatrix(); } else { - GlStateManager.func_179094_E(); -@@ -120,10 +117,10 @@ - GlStateManager.func_179109_b(f8, f10, 0.0F); + GlStateManager.pushMatrix(); +@@ -119,10 +116,10 @@ + GlStateManager.translatef(f8, f10, 0.0F); } - ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND); - this.field_177080_a.func_180454_a(itemstack, ibakedmodel); + IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); + this.field_177080_a.func_180454_a(itemstack, transformedModel); - GlStateManager.func_179121_F(); -- GlStateManager.func_179109_b(0.0F * f, 0.0F * f1, 0.09375F * f2); -+ GlStateManager.func_179109_b(0.0F, 0.0F, 0.09375F); + GlStateManager.popMatrix(); +- GlStateManager.translatef(0.0F * f, 0.0F * f1, 0.09375F * f2); ++ GlStateManager.translatef(0.0F, 0.0F, 0.09375F); } } -@@ -146,4 +143,21 @@ - protected ResourceLocation func_110775_a(EntityItem p_110775_1_) { - return TextureMap.field_110575_b; +@@ -145,4 +142,21 @@ + protected ResourceLocation func_110775_a(ItemEntity p_110775_1_) { + return AtlasTexture.field_110575_b; } + + /*==================================== FORGE START ===========================================*/ diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch new file mode 100644 index 000000000..7a139de12 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/LivingRenderer.java.patch @@ -0,0 +1,48 @@ +--- a/net/minecraft/client/renderer/entity/LivingRenderer.java ++++ b/net/minecraft/client/renderer/entity/LivingRenderer.java +@@ -59,17 +59,19 @@ + } + + public void func_76986_a(T p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_))) return; + GlStateManager.pushMatrix(); + GlStateManager.disableCull(); + this.field_77045_g.field_217112_c = this.func_77040_d(p_76986_1_, p_76986_9_); +- this.field_77045_g.field_217113_d = p_76986_1_.func_184218_aH(); ++ boolean shouldSit = p_76986_1_.func_184218_aH() && (p_76986_1_.func_184187_bx() != null && p_76986_1_.func_184187_bx().shouldRiderSit()); ++ this.field_77045_g.field_217113_d = shouldSit; + this.field_77045_g.field_217114_e = p_76986_1_.func_70631_g_(); + + try { + float f = MathHelper.func_219805_h(p_76986_9_, p_76986_1_.field_70760_ar, p_76986_1_.field_70761_aq); + float f1 = MathHelper.func_219805_h(p_76986_9_, p_76986_1_.field_70758_at, p_76986_1_.field_70759_as); + float f2 = f1 - f; +- if (p_76986_1_.func_184218_aH() && p_76986_1_.func_184187_bx() instanceof LivingEntity) { ++ if (shouldSit && p_76986_1_.func_184187_bx() instanceof LivingEntity) { + LivingEntity livingentity = (LivingEntity)p_76986_1_.func_184187_bx(); + f = MathHelper.func_219805_h(p_76986_9_, livingentity.field_70760_ar, livingentity.field_70761_aq); + f2 = f1 - f; +@@ -153,6 +155,7 @@ + GlStateManager.enableCull(); + GlStateManager.popMatrix(); + super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_)); + } + + public float func_188322_c(T p_188322_1_, float p_188322_2_) { +@@ -408,6 +411,7 @@ + } + + public void func_177067_a(T p_177067_1_, double p_177067_2_, double p_177067_4_, double p_177067_6_) { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_))) return; + if (this.func_177070_b(p_177067_1_)) { + double d0 = p_177067_1_.func_195048_a(this.field_76990_c.field_217783_c.func_216785_c()); + float f = p_177067_1_.func_213287_bg() ? 32.0F : 64.0F; +@@ -417,6 +421,7 @@ + this.func_188296_a(p_177067_1_, p_177067_2_, p_177067_4_, p_177067_6_, s, d0); + } + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_)); + } + + protected boolean func_177070_b(T p_177070_1_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch rename to patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch index dd4f8c37f..b9ddd8c4a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/PlayerRenderer.java.patch @@ -1,18 +1,18 @@ ---- a/net/minecraft/client/renderer/entity/RenderPlayer.java -+++ b/net/minecraft/client/renderer/entity/RenderPlayer.java +--- a/net/minecraft/client/renderer/entity/PlayerRenderer.java ++++ b/net/minecraft/client/renderer/entity/PlayerRenderer.java @@ -52,6 +52,7 @@ - } - - public void func_76986_a(AbstractClientPlayer p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_))) return; - if (!p_76986_1_.func_175144_cb() || this.field_76990_c.field_78734_h == p_76986_1_) { + public void func_76986_a(AbstractClientPlayerEntity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { + if (!p_76986_1_.func_175144_cb() || this.field_76990_c.field_217783_c.func_216773_g() == p_76986_1_) { double d0 = p_76986_4_; - if (p_76986_1_.func_70093_af()) { -@@ -63,6 +64,7 @@ ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_))) return; + if (p_76986_1_.func_213287_bg()) { + d0 = p_76986_4_ - 0.125D; + } +@@ -61,6 +62,7 @@ super.func_76986_a(p_76986_1_, p_76986_2_, d0, p_76986_6_, p_76986_8_, p_76986_9_); - GlStateManager.func_187440_b(GlStateManager.Profile.PLAYER_SKIN); + GlStateManager.unsetProfile(GlStateManager.Profile.PLAYER_SKIN); } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_)); } - private void func_177137_d(AbstractClientPlayer p_177137_1_) { + private void func_177137_d(AbstractClientPlayerEntity p_177137_1_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderFish.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderFish.java.patch deleted file mode 100644 index d00c48574..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderFish.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/renderer/entity/RenderFish.java -+++ b/net/minecraft/client/renderer/entity/RenderFish.java -@@ -65,7 +65,7 @@ - GlStateManager.func_179121_F(); - int k = entityplayer.func_184591_cq() == EnumHandSide.RIGHT ? 1 : -1; - ItemStack itemstack = entityplayer.func_184614_ca(); -- if (itemstack.func_77973_b() != Items.field_151112_aM) { -+ if (!(itemstack.func_77973_b() instanceof net.minecraft.item.ItemFishingRod)) { - k = -k; - } - diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch deleted file mode 100644 index e155336c0..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- a/net/minecraft/client/renderer/entity/RenderLivingBase.java -+++ b/net/minecraft/client/renderer/entity/RenderLivingBase.java -@@ -70,17 +70,19 @@ - } - - public void func_76986_a(T p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_))) return; - GlStateManager.func_179094_E(); - GlStateManager.func_179129_p(); - this.field_77045_g.field_78095_p = this.func_77040_d(p_76986_1_, p_76986_9_); -- this.field_77045_g.field_78093_q = p_76986_1_.func_184218_aH(); -+ boolean shouldSit = p_76986_1_.func_184218_aH() && (p_76986_1_.func_184187_bx() != null && p_76986_1_.func_184187_bx().shouldRiderSit()); -+ this.field_77045_g.field_78093_q = shouldSit; - this.field_77045_g.field_78091_s = p_76986_1_.func_70631_g_(); - - try { - float f = this.func_77034_a(p_76986_1_.field_70760_ar, p_76986_1_.field_70761_aq, p_76986_9_); - float f1 = this.func_77034_a(p_76986_1_.field_70758_at, p_76986_1_.field_70759_as, p_76986_9_); - float f2 = f1 - f; -- if (p_76986_1_.func_184218_aH() && p_76986_1_.func_184187_bx() instanceof EntityLivingBase) { -+ if (shouldSit && p_76986_1_.func_184187_bx() instanceof EntityLivingBase) { - EntityLivingBase entitylivingbase = (EntityLivingBase)p_76986_1_.func_184187_bx(); - f = this.func_77034_a(entitylivingbase.field_70760_ar, entitylivingbase.field_70761_aq, p_76986_9_); - f2 = f1 - f; -@@ -164,6 +166,7 @@ - GlStateManager.func_179089_o(); - GlStateManager.func_179121_F(); - super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_)); - } - - public float func_188322_c(T p_188322_1_, float p_188322_2_) { -@@ -386,15 +389,18 @@ - } - - public void func_177067_a(T p_177067_1_, double p_177067_2_, double p_177067_4_, double p_177067_6_) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_))) return; - if (this.func_177070_b(p_177067_1_)) { - double d0 = p_177067_1_.func_70068_e(this.field_76990_c.field_78734_h); -- float f = p_177067_1_.func_70093_af() ? 32.0F : 64.0F; -+ float f = (float) p_177067_1_.func_110148_a(EntityLivingBase.NAMETAG_DISTANCE).func_111126_e(); -+ if (p_177067_1_.func_70093_af()) f /= 2; - if (!(d0 >= (double)(f * f))) { - String s = p_177067_1_.func_145748_c_().func_150254_d(); - GlStateManager.func_179092_a(516, 0.1F); - this.func_188296_a(p_177067_1_, p_177067_2_, p_177067_4_, p_177067_6_, s, d0); - } - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_)); - } - - protected boolean func_177070_b(T p_177070_1_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch deleted file mode 100644 index a01b81cf5..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/net/minecraft/client/renderer/entity/RenderManager.java -+++ b/net/minecraft/client/renderer/entity/RenderManager.java -@@ -241,8 +241,13 @@ - this.field_178637_m = new RenderPlayer(this); - this.field_178636_l.put("default", this.field_178637_m); - this.field_178636_l.put("slim", new RenderPlayer(this, true)); -+ net.minecraftforge.fml.client.registry.RenderingRegistry.loadEntityRenderers(this, this.field_78729_o); - } - -+ public Map getSkinMap() { -+ return (Map) java.util.Collections.unmodifiableMap(field_178636_l); -+ } -+ - public void func_178628_a(double p_178628_1_, double p_178628_3_, double p_178628_5_) { - this.field_78725_b = p_178628_1_; - this.field_78726_c = p_178628_3_; -@@ -277,10 +282,11 @@ - this.field_147941_i = p_180597_4_; - this.field_78736_p = p_180597_2_; - if (p_180597_3_ instanceof EntityLivingBase && ((EntityLivingBase)p_180597_3_).func_70608_bn()) { -- IBlockState iblockstate = p_180597_1_.func_180495_p(new BlockPos(p_180597_3_)); -+ BlockPos pos = new BlockPos(p_180597_3_); -+ IBlockState iblockstate = p_180597_1_.func_180495_p(pos); - Block block = iblockstate.func_177230_c(); -- if (block instanceof BlockBed) { -- int i = iblockstate.func_177229_b(BlockBed.field_185512_D).func_176736_b(); -+ if (block.isBed(iblockstate, p_180597_1_, pos, p_180597_3_)) { -+ int i = block.getBedDirection(iblockstate, p_180597_1_, pos).func_176736_b(); - this.field_78735_i = (float)(i * 90 + 180); - this.field_78732_j = 0.0F; - } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch deleted file mode 100644 index 167b46393..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/client/renderer/entity/RenderVillager.java -+++ b/net/minecraft/client/renderer/entity/RenderVillager.java -@@ -27,6 +27,7 @@ - } - - protected ResourceLocation func_110775_a(EntityVillager p_110775_1_) { -+ if (true) return p_110775_1_.getProfessionForge().getSkin(); - switch(p_110775_1_.func_70946_n()) { - case 0: - return field_110904_g; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderZombieVillager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderZombieVillager.java.patch deleted file mode 100644 index 4deff848d..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderZombieVillager.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/client/renderer/entity/RenderZombieVillager.java -+++ b/net/minecraft/client/renderer/entity/RenderZombieVillager.java -@@ -22,6 +22,7 @@ - } - - protected ResourceLocation func_110775_a(EntityZombieVillager p_110775_1_) { -+ if (true) return p_110775_1_.getProfessionForge().getZombieSkin(); - switch(p_110775_1_.func_190736_dl()) { - case 0: - return field_188330_l; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/ArmorLayer.java.patch similarity index 56% rename from patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch rename to patches/minecraft/net/minecraft/client/renderer/entity/layers/ArmorLayer.java.patch index e37e43b0a..1e8c02f6a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/ArmorLayer.java.patch @@ -1,54 +1,52 @@ ---- a/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -+++ b/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -@@ -51,12 +51,13 @@ - ItemArmor itemarmor = (ItemArmor)itemstack.func_77973_b(); - if (itemarmor.func_185083_B_() == p_188361_9_) { - T t = this.func_188360_a(p_188361_9_); -+ t = getArmorModelHook(p_188361_1_, itemstack, p_188361_9_, t); - t.func_178686_a(this.field_177190_a.func_177087_b()); - t.func_78086_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_4_); - this.func_188359_a(t, p_188361_9_); +--- a/net/minecraft/client/renderer/entity/layers/ArmorLayer.java ++++ b/net/minecraft/client/renderer/entity/layers/ArmorLayer.java +@@ -55,12 +55,13 @@ + ArmorItem armoritem = (ArmorItem)itemstack.func_77973_b(); + if (armoritem.func_185083_B_() == p_188361_9_) { + A a = this.func_215337_a(p_188361_9_); ++ a = getArmorModelHook(p_188361_1_, itemstack, p_188361_9_, a); + ((BipedModel)this.func_215332_c()).func_217148_a(a); + a.func_212843_a_(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_4_); + this.func_188359_a(a, p_188361_9_); boolean flag = this.func_188363_b(p_188361_9_); -- this.field_177190_a.func_110776_a(this.func_177181_a(itemarmor, flag)); -- if (itemarmor instanceof ItemArmorDyeable) { -+ this.field_177190_a.func_110776_a(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, null)); -+ if (itemarmor instanceof ItemArmorDyeable) { // Allow this for anything, not only cloth - int i = ((ItemArmorDyeable)itemarmor).func_200886_f(itemstack); +- this.func_215333_a(this.func_177181_a(armoritem, flag)); +- if (armoritem instanceof DyeableArmorItem) { ++ this.func_215333_a(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, null)); ++ if (armoritem instanceof net.minecraft.item.IDyeableArmorItem) { // Allow this for anything, not only cloth + int i = ((DyeableArmorItem)armoritem).func_200886_f(itemstack); float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; -@@ -68,7 +69,7 @@ +@@ -72,7 +73,7 @@ - GlStateManager.func_179131_c(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); - t.func_78088_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); + GlStateManager.color4f(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); + a.func_78088_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); - if (!this.field_177193_i && itemstack.func_77948_v()) { + if (!this.field_177193_i && itemstack.func_77962_s()) { - func_188364_a(this.field_177190_a, p_188361_1_, t, p_188361_2_, p_188361_3_, p_188361_4_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); + func_215338_a(this::func_215333_a, p_188361_1_, a, p_188361_2_, p_188361_3_, p_188361_4_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_); } -@@ -120,10 +121,12 @@ - Minecraft.func_71410_x().field_71460_t.func_191514_d(false); +@@ -125,15 +126,60 @@ + gamerenderer.func_191514_d(false); } + @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation func_177181_a(ItemArmor p_177181_1_, boolean p_177181_2_) { + private ResourceLocation func_177181_a(ArmorItem p_177181_1_, boolean p_177181_2_) { return this.func_177178_a(p_177181_1_, p_177181_2_, (String)null); } + @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation func_177178_a(ItemArmor p_177178_1_, boolean p_177178_2_, @Nullable String p_177178_3_) { + private ResourceLocation func_177178_a(ArmorItem p_177178_1_, boolean p_177178_2_, @Nullable String p_177178_3_) { String s = "textures/models/armor/" + p_177178_1_.func_200880_d().func_200897_d() + "_layer_" + (p_177178_2_ ? 2 : 1) + (p_177178_3_ == null ? "" : "_" + p_177178_3_) + ".png"; return field_177191_j.computeIfAbsent(s, ResourceLocation::new); -@@ -132,4 +135,47 @@ - protected abstract void func_177177_a(); + } - protected abstract void func_188359_a(T p_188359_1_, EntityEquipmentSlot p_188359_2_); + + /*=================================== FORGE START =========================================*/ + + /** + * Hook to allow item-sensitive armor model. for LayerBipedArmor. + */ -+ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, EntityEquipmentSlot slot, T model) { ++ protected A getArmorModelHook(LivingEntity entity, ItemStack itemStack, EquipmentSlotType slot, A model) { + return model; + } + @@ -61,8 +59,8 @@ + * @param type Subtype, can be null or "overlay" + * @return ResourceLocation pointing at the armor's texture + */ -+ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, EntityEquipmentSlot slot, @javax.annotation.Nullable String type) { -+ ItemArmor item = (ItemArmor)stack.func_77973_b(); ++ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, EquipmentSlotType slot, @javax.annotation.Nullable String type) { ++ ArmorItem item = (ArmorItem)stack.func_77973_b(); + String texture = item.func_200880_d().func_200897_d(); + String domain = "minecraft"; + int idx = texture.indexOf(':'); @@ -85,4 +83,6 @@ + return resourcelocation; + } + /*=================================== FORGE END ===========================================*/ - } + protected abstract void func_188359_a(A p_188359_1_, EquipmentSlotType p_188359_2_); + + protected abstract void func_177194_a(A p_177194_1_); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java.patch new file mode 100644 index 000000000..a84e06329 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java ++++ b/net/minecraft/client/renderer/entity/layers/BipedArmorLayer.java +@@ -40,4 +40,9 @@ + protected void func_177194_a(A p_177194_1_) { + p_177194_1_.func_178719_a(false); + } ++ ++ @Override ++ protected A getArmorModelHook(net.minecraft.entity.LivingEntity entity, net.minecraft.item.ItemStack itemStack, EquipmentSlotType slot, A model) { ++ return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model); ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/HeldItemLayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/HeldItemLayer.java.patch new file mode 100644 index 000000000..0fa5728d4 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/HeldItemLayer.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/client/renderer/entity/layers/HeldItemLayer.java ++++ b/net/minecraft/client/renderer/entity/layers/HeldItemLayer.java +@@ -39,11 +39,12 @@ + private void func_188358_a(LivingEntity p_188358_1_, ItemStack p_188358_2_, ItemCameraTransforms.TransformType p_188358_3_, HandSide p_188358_4_) { + if (!p_188358_2_.func_190926_b()) { + GlStateManager.pushMatrix(); +- this.func_191361_a(p_188358_4_); + if (p_188358_1_.func_213287_bg()) { + GlStateManager.translatef(0.0F, 0.2F, 0.0F); + } + ++ // Forge: moved this call down, fixes incorrect offset while sneaking. ++ this.func_191361_a(p_188358_4_); + GlStateManager.rotatef(-90.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotatef(180.0F, 0.0F, 1.0F, 0.0F); + boolean flag = p_188358_4_ == HandSide.LEFT; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch deleted file mode 100644 index f87a06b2c..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java -+++ b/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java -@@ -44,4 +44,9 @@ - protected void func_177194_a(ModelBiped p_177194_1_) { - p_177194_1_.func_178719_a(false); - } -+ -+ @Override -+ protected ModelBiped getArmorModelHook(net.minecraft.entity.EntityLivingBase entity, net.minecraft.item.ItemStack itemStack, EntityEquipmentSlot slot, ModelBiped model) { -+ return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model); -+ } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java.patch deleted file mode 100644 index 1bad65a81..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java -+++ b/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java -@@ -40,11 +40,12 @@ - private void func_188358_a(EntityLivingBase p_188358_1_, ItemStack p_188358_2_, ItemCameraTransforms.TransformType p_188358_3_, EnumHandSide p_188358_4_) { - if (!p_188358_2_.func_190926_b()) { - GlStateManager.func_179094_E(); -- this.func_191361_a(p_188358_4_); - if (p_188358_1_.func_70093_af()) { - GlStateManager.func_179109_b(0.0F, 0.2F, 0.0F); - } - -+ // Forge: moved this call down, fixes incorrect offset while sneaking. -+ this.func_191361_a(p_188358_4_); - GlStateManager.func_179114_b(-90.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.func_179114_b(180.0F, 0.0F, 1.0F, 0.0F); - boolean flag = p_188358_4_ == EnumHandSide.LEFT; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItemWitch.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItemWitch.java.patch deleted file mode 100644 index 20ff39eb4..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItemWitch.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/client/renderer/entity/layers/LayerHeldItemWitch.java -+++ b/net/minecraft/client/renderer/entity/layers/LayerHeldItemWitch.java -@@ -43,7 +43,7 @@ - GlStateManager.func_179114_b(-5.0F, 0.0F, 1.0F, 0.0F); - float f1 = 0.375F; - GlStateManager.func_179152_a(0.375F, -0.375F, 0.375F); -- } else if (item == Items.field_151031_f) { -+ } else if (item instanceof net.minecraft.item.ItemBow) { - GlStateManager.func_179109_b(0.0F, 0.125F, -0.125F); - GlStateManager.func_179114_b(-45.0F, 0.0F, 1.0F, 0.0F); - float f2 = 0.625F; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/WitchHeldItemLayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/WitchHeldItemLayer.java.patch new file mode 100644 index 000000000..4599712ec --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/WitchHeldItemLayer.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/renderer/entity/layers/WitchHeldItemLayer.java ++++ b/net/minecraft/client/renderer/entity/layers/WitchHeldItemLayer.java +@@ -41,7 +41,7 @@ + GlStateManager.rotatef(-5.0F, 0.0F, 1.0F, 0.0F); + float f1 = 0.375F; + GlStateManager.scalef(0.375F, -0.375F, 0.375F); +- } else if (item == Items.field_151031_f) { ++ } else if (item instanceof net.minecraft.item.BowItem) { + GlStateManager.translatef(0.0F, 0.125F, -0.125F); + GlStateManager.rotatef(-45.0F, 0.0F, 1.0F, 0.0F); + float f2 = 0.625F; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/model/ModelSkeleton.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/model/ModelSkeleton.java.patch deleted file mode 100644 index 486ad28f7..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/model/ModelSkeleton.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/client/renderer/entity/model/ModelSkeleton.java -+++ b/net/minecraft/client/renderer/entity/model/ModelSkeleton.java -@@ -42,7 +42,7 @@ - this.field_187076_m = ModelBiped.ArmPose.EMPTY; - this.field_187075_l = ModelBiped.ArmPose.EMPTY; - ItemStack itemstack = p_78086_1_.func_184586_b(EnumHand.MAIN_HAND); -- if (itemstack.func_77973_b() == Items.field_151031_f && ((AbstractSkeleton)p_78086_1_).func_184725_db()) { -+ if (itemstack.func_77973_b() instanceof net.minecraft.item.ItemBow && ((AbstractSkeleton)p_78086_1_).func_184725_db()) { - if (p_78086_1_.func_184591_cq() == EnumHandSide.RIGHT) { - this.field_187076_m = ModelBiped.ArmPose.BOW_AND_ARROW; - } else { -@@ -57,7 +57,7 @@ - super.func_78087_a(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, p_78087_7_); - ItemStack itemstack = ((EntityLivingBase)p_78087_7_).func_184614_ca(); - AbstractSkeleton abstractskeleton = (AbstractSkeleton)p_78087_7_; -- if (abstractskeleton.func_184725_db() && (itemstack.func_190926_b() || itemstack.func_77973_b() != Items.field_151031_f)) { -+ if (abstractskeleton.func_184725_db() && (itemstack.func_190926_b() || !(itemstack.func_77973_b() instanceof net.minecraft.item.ItemBow))) { - float f = MathHelper.func_76126_a(this.field_78095_p * (float)Math.PI); - float f1 = MathHelper.func_76126_a((1.0F - (1.0F - this.field_78095_p) * (1.0F - this.field_78095_p)) * (float)Math.PI); - this.field_178723_h.field_78808_h = 0.0F; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/model/SkeletonModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/model/SkeletonModel.java.patch new file mode 100644 index 000000000..16800282a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/model/SkeletonModel.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/client/renderer/entity/model/SkeletonModel.java ++++ b/net/minecraft/client/renderer/entity/model/SkeletonModel.java +@@ -41,7 +41,7 @@ + this.field_187076_m = BipedModel.ArmPose.EMPTY; + this.field_187075_l = BipedModel.ArmPose.EMPTY; + ItemStack itemstack = p_212843_1_.func_184586_b(Hand.MAIN_HAND); +- if (itemstack.func_77973_b() == Items.field_151031_f && p_212843_1_.func_213398_dR()) { ++ if (itemstack.func_77973_b() instanceof net.minecraft.item.BowItem && p_212843_1_.func_213398_dR()) { + if (p_212843_1_.func_184591_cq() == HandSide.RIGHT) { + this.field_187076_m = BipedModel.ArmPose.BOW_AND_ARROW; + } else { +@@ -55,7 +55,7 @@ + public void func_212844_a_(T p_212844_1_, float p_212844_2_, float p_212844_3_, float p_212844_4_, float p_212844_5_, float p_212844_6_, float p_212844_7_) { + super.func_212844_a_(p_212844_1_, p_212844_2_, p_212844_3_, p_212844_4_, p_212844_5_, p_212844_6_, p_212844_7_); + ItemStack itemstack = p_212844_1_.func_184614_ca(); +- if (p_212844_1_.func_213398_dR() && (itemstack.func_190926_b() || itemstack.func_77973_b() != Items.field_151031_f)) { ++ if (p_212844_1_.func_213398_dR() && (itemstack.func_190926_b() || !(itemstack.func_77973_b() instanceof net.minecraft.item.BowItem))) { + float f = MathHelper.func_76126_a(this.field_217112_c * (float)Math.PI); + float f1 = MathHelper.func_76126_a((1.0F - (1.0F - this.field_217112_c) * (1.0F - this.field_217112_c)) * (float)Math.PI); + this.field_178723_h.field_78808_h = 0.0F; diff --git a/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch index 54b0c55e6..d8f607690 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/BakedQuad.java.patch @@ -8,25 +8,25 @@ +public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer { protected final int[] field_178215_a; protected final int field_178213_b; - protected final EnumFacing field_178214_c; + protected final Direction field_178214_c; protected final TextureAtlasSprite field_187509_d; + /** + * @deprecated Use constructor with the format argument. + */ + @Deprecated - public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_) { + public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, Direction p_i46574_3_, TextureAtlasSprite p_i46574_4_) { + this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, true, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176600_a); + } + -+ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_, boolean applyDiffuseLighting, net.minecraft.client.renderer.vertex.VertexFormat format) { ++ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, Direction p_i46574_3_, TextureAtlasSprite p_i46574_4_, boolean applyDiffuseLighting, net.minecraft.client.renderer.vertex.VertexFormat format) { + this.format = format; + this.applyDiffuseLighting = applyDiffuseLighting; this.field_178215_a = p_i46574_1_; this.field_178213_b = p_i46574_2_; this.field_178214_c = p_i46574_3_; @@ -38,4 +48,20 @@ - public EnumFacing func_178210_d() { + public Direction func_178210_d() { return this.field_178214_c; } + diff --git a/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch new file mode 100644 index 000000000..fa6773a8b --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/model/BlockModel.java.patch @@ -0,0 +1,69 @@ +--- a/net/minecraft/client/renderer/model/BlockModel.java ++++ b/net/minecraft/client/renderer/model/BlockModel.java +@@ -75,6 +75,9 @@ + return this.field_178314_g.isEmpty() && this.field_178315_d != null ? this.field_178315_d.func_178298_a() : this.field_178314_g; + } + ++ @Nullable ++ public ResourceLocation getParentLocation() { return field_178316_e; } ++ + public boolean func_178309_b() { + return this.field_178315_d != null ? this.field_178315_d.func_178309_b() : this.field_178322_i; + } +@@ -87,6 +90,10 @@ + return this.field_187968_k; + } + ++ public ItemOverrideList getOverrides(BlockModel model, Function modelGetter, Function spriteGetter) { ++ return this.field_187968_k.isEmpty() ? ItemOverrideList.field_188022_a : new ItemOverrideList(model, modelGetter, this.field_187968_k, spriteGetter); ++ } ++ + private ItemOverrideList func_217646_a(ModelBakery p_217646_1_, BlockModel p_217646_2_) { + return this.field_187968_k.isEmpty() ? ItemOverrideList.field_188022_a : new ItemOverrideList(p_217646_1_, p_217646_2_, p_217646_1_::func_209597_a, this.field_187968_k); + } +@@ -160,25 +167,26 @@ + return set1; + } + +- public IBakedModel func_217641_a(ModelBakery p_217641_1_, Function p_217641_2_, ISprite p_217641_3_) { +- return this.func_217644_a(p_217641_1_, this, p_217641_2_, p_217641_3_); +- } ++ @Nullable ++ @Override ++ public IBakedModel bake(Function p_217644_1_, Function p_217644_3_, ISprite p_217644_2_, net.minecraft.client.renderer.vertex.VertexFormat format) { ++ if (!net.minecraftforge.client.model.Attributes.moreSpecific(format, net.minecraftforge.client.model.Attributes.DEFAULT_BAKED_FORMAT)) ++ throw new IllegalArgumentException("Cannot bake vanilla model to format other than BLOCK"); + +- public IBakedModel func_217644_a(ModelBakery p_217644_1_, BlockModel p_217644_2_, Function p_217644_3_, ISprite p_217644_4_) { + TextureAtlasSprite textureatlassprite = p_217644_3_.apply(new ResourceLocation(this.func_178308_c("particle"))); + if (this.func_178310_f() == ModelBakery.field_177616_r) { +- return new BuiltInModel(this.func_181682_g(), this.func_217646_a(p_217644_1_, p_217644_2_), textureatlassprite); ++ return new BuiltInModel(this.func_181682_g(), this.getOverrides(this, p_217644_1_, p_217644_3_), textureatlassprite); + } else { +- SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(this, this.func_217646_a(p_217644_1_, p_217644_2_))).func_177646_a(textureatlassprite); ++ SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(this, this.getOverrides(this, p_217644_1_, p_217644_3_))).func_177646_a(textureatlassprite); + + for(BlockPart blockpart : this.func_178298_a()) { + for(Direction direction : blockpart.field_178240_c.keySet()) { + BlockPartFace blockpartface = blockpart.field_178240_c.get(direction); + TextureAtlasSprite textureatlassprite1 = p_217644_3_.apply(new ResourceLocation(this.func_178308_c(blockpartface.field_178242_d))); + if (blockpartface.field_178244_b == null) { +- simplebakedmodel$builder.func_177648_a(func_217645_a(blockpart, blockpartface, textureatlassprite1, direction, p_217644_4_)); ++ simplebakedmodel$builder.func_177648_a(makeBakedQuad(blockpart, blockpartface, textureatlassprite1, direction, p_217644_2_)); + } else { +- simplebakedmodel$builder.func_177650_a(p_217644_4_.func_188048_b().func_177523_a(blockpartface.field_178244_b), func_217645_a(blockpart, blockpartface, textureatlassprite1, direction, p_217644_4_)); ++ simplebakedmodel$builder.func_177650_a(p_217644_2_.getState().apply(java.util.Optional.empty()).map(trsr -> trsr.rotate(direction)).orElse(direction), makeBakedQuad(blockpart, blockpartface, textureatlassprite1, direction, p_217644_2_)); + } + } + } +@@ -191,6 +199,10 @@ + return field_217647_g.func_217648_a(p_217645_0_.field_178241_a, p_217645_0_.field_178239_b, p_217645_1_, p_217645_2_, p_217645_3_, p_217645_4_, p_217645_0_.field_178237_d, p_217645_0_.field_178238_e); + } + ++ public static BakedQuad makeBakedQuad(BlockPart p_209567_0, BlockPartFace partFace, TextureAtlasSprite sprite, Direction face, ISprite isprite) { ++ return field_217647_g.makeBakedQuad(p_209567_0.field_178241_a, p_209567_0.field_178239_b, partFace, sprite, face, new net.minecraftforge.client.model.BasicState(isprite.getState().apply(java.util.Optional.empty()).orElse(net.minecraftforge.common.model.TRSRTransformation.identity()), isprite.func_188049_c()), p_209567_0.field_178237_d, p_209567_0.field_178238_e); ++ } ++ + public boolean func_178300_b(String p_178300_1_) { + return !MissingTextureSprite.func_195675_b().toString().equals(this.func_178308_c(p_178300_1_)); + } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ModelBlockDefinition.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/BlockModelDefinition.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/client/renderer/model/ModelBlockDefinition.java.patch rename to patches/minecraft/net/minecraft/client/renderer/model/BlockModelDefinition.java.patch index 1555e7b6c..49d3007c6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelBlockDefinition.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/BlockModelDefinition.java.patch @@ -1,19 +1,19 @@ ---- a/net/minecraft/client/renderer/model/ModelBlockDefinition.java -+++ b/net/minecraft/client/renderer/model/ModelBlockDefinition.java -@@ -30,10 +30,15 @@ +--- a/net/minecraft/client/renderer/model/BlockModelDefinition.java ++++ b/net/minecraft/client/renderer/model/BlockModelDefinition.java +@@ -29,10 +29,15 @@ private final Map field_178332_b = Maps.newLinkedHashMap(); private Multipart field_188005_c; + @Deprecated - public static ModelBlockDefinition func_209577_a(ModelBlockDefinition.ContainerHolder p_209577_0_, Reader p_209577_1_) { -- return JsonUtils.func_193839_a(p_209577_0_.field_209575_a, p_209577_1_, ModelBlockDefinition.class); + public static BlockModelDefinition func_209577_a(BlockModelDefinition.ContainerHolder p_209577_0_, Reader p_209577_1_) { +- return JSONUtils.func_193839_a(p_209577_0_.field_209575_a, p_209577_1_, BlockModelDefinition.class); + return fromJson(p_209577_0_, p_209577_1_, null); } -+ public static ModelBlockDefinition fromJson(ModelBlockDefinition.ContainerHolder containerHolderIn, Reader readerIn, @Nullable net.minecraft.util.ResourceLocation location) { ++ public static BlockModelDefinition fromJson(BlockModelDefinition.ContainerHolder containerHolderIn, Reader readerIn, @Nullable net.minecraft.util.ResourceLocation location) { + return net.minecraftforge.client.model.BlockStateLoader.load(readerIn, location, containerHolderIn.field_209575_a); + } + - public ModelBlockDefinition(Map p_i46572_1_, Multipart p_i46572_2_) { + public BlockModelDefinition(Map p_i46572_1_, Multipart p_i46572_2_) { this.field_188005_c = p_i46572_2_; this.field_178332_b.putAll(p_i46572_1_); diff --git a/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch index 02b347694..623247161 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch @@ -1,40 +1,48 @@ --- a/net/minecraft/client/renderer/model/FaceBakery.java +++ b/net/minecraft/client/renderer/model/FaceBakery.java -@@ -39,18 +39,23 @@ +@@ -40,9 +40,15 @@ }; - public BakedQuad func_199332_a(Vector3f p_199332_1_, Vector3f p_199332_2_, BlockPartFace p_199332_3_, TextureAtlasSprite p_199332_4_, EnumFacing p_199332_5_, ModelRotation p_199332_6_, @Nullable BlockPartRotation p_199332_7_, boolean p_199332_8_, boolean p_199332_9_) { -+ return makeBakedQuad(p_199332_1_, p_199332_2_, p_199332_3_, p_199332_4_, p_199332_5_, (net.minecraftforge.common.model.ITransformation)p_199332_6_, p_199332_7_, p_199332_8_, p_199332_9_); + public BakedQuad func_217648_a(Vector3f p_217648_1_, Vector3f p_217648_2_, BlockPartFace p_217648_3_, TextureAtlasSprite p_217648_4_, Direction p_217648_5_, ISprite p_217648_6_, @Nullable BlockPartRotation p_217648_7_, boolean p_217648_8_) { ++ return makeBakedQuad(p_217648_1_, p_217648_2_, p_217648_3_, p_217648_4_, p_217648_5_, p_217648_6_, p_217648_7_, p_217648_8_); + } + -+ public BakedQuad makeBakedQuad(Vector3f p_199332_1_, Vector3f p_199332_2_, BlockPartFace p_199332_3_, TextureAtlasSprite p_199332_4_, EnumFacing p_199332_5_, net.minecraftforge.common.model.ITransformation p_199332_6_, BlockPartRotation p_199332_7_, boolean p_199332_8_, boolean p_199332_9_) { - BlockFaceUV blockfaceuv = p_199332_3_.field_178243_e; - if (p_199332_8_) { -- blockfaceuv = this.func_188010_a(p_199332_3_.field_178243_e, p_199332_5_, p_199332_6_); -+ blockfaceuv = net.minecraftforge.client.ForgeHooksClient.applyUVLock(p_199332_3_.field_178243_e, p_199332_5_, p_199332_6_); ++ public BakedQuad makeBakedQuad(Vector3f p_217648_1_, Vector3f p_217648_2_, BlockPartFace p_217648_3_, TextureAtlasSprite p_217648_4_, Direction p_217648_5_, ISprite p_217648_6_, @Nullable BlockPartRotation p_217648_7_, boolean p_217648_8_) { + BlockFaceUV blockfaceuv = p_217648_3_.field_178243_e; ++ net.minecraftforge.common.model.TRSRTransformation transform = p_217648_6_.getState().apply(java.util.Optional.empty()) ++ .orElse(net.minecraftforge.common.model.TRSRTransformation.identity()); + if (p_217648_6_.func_188049_c()) { +- blockfaceuv = this.func_188010_a(p_217648_3_.field_178243_e, p_217648_5_, p_217648_6_.func_188048_b()); ++ blockfaceuv = net.minecraftforge.client.ForgeHooksClient.applyUVLock(p_217648_3_.field_178243_e, p_217648_5_, transform); } -- int[] aint = this.func_188012_a(blockfaceuv, p_199332_4_, p_199332_5_, this.func_199337_a(p_199332_1_, p_199332_2_), p_199332_6_, p_199332_7_, p_199332_9_); -+ int[] aint = this.makeQuadVertexData(blockfaceuv, p_199332_4_, p_199332_5_, this.func_199337_a(p_199332_1_, p_199332_2_), p_199332_6_, p_199332_7_, false); - EnumFacing enumfacing = func_178410_a(aint); - if (p_199332_7_ == null) { - this.func_178408_a(aint, enumfacing); + float[] afloat = new float[blockfaceuv.field_178351_a.length]; +@@ -56,14 +62,15 @@ + blockfaceuv.field_178351_a[2] = MathHelper.func_219799_g(f2, blockfaceuv.field_178351_a[2], f3); + blockfaceuv.field_178351_a[1] = MathHelper.func_219799_g(f2, blockfaceuv.field_178351_a[1], f4); + blockfaceuv.field_178351_a[3] = MathHelper.func_219799_g(f2, blockfaceuv.field_178351_a[3], f4); +- int[] aint = this.func_188012_a(blockfaceuv, p_217648_4_, p_217648_5_, this.func_199337_a(p_217648_1_, p_217648_2_), p_217648_6_.func_188048_b(), p_217648_7_, p_217648_8_); ++ int[] aint = this.makeQuadVertexData(blockfaceuv, p_217648_4_, p_217648_5_, this.func_199337_a(p_217648_1_, p_217648_2_), transform, p_217648_7_, false); // FORGE: *Must* pass false here, shade value is applied at render time + Direction direction = func_178410_a(aint); + System.arraycopy(afloat, 0, blockfaceuv.field_178351_a, 0, afloat.length); + if (p_217648_7_ == null) { + this.func_178408_a(aint, direction); } -- return new BakedQuad(aint, p_199332_3_.field_178245_c, enumfacing, p_199332_4_); -+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); -+ return new BakedQuad(aint, p_199332_3_.field_178245_c, enumfacing, p_199332_4_, p_199332_9_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); +- return new BakedQuad(aint, p_217648_3_.field_178245_c, direction, p_217648_4_); ++ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction); ++ return new BakedQuad(aint, p_217648_3_.field_178245_c, direction, p_217648_4_, p_217648_8_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); } - private BlockFaceUV func_188010_a(BlockFaceUV p_188010_1_, EnumFacing p_188010_2_, ModelRotation p_188010_3_) { -@@ -58,10 +63,14 @@ + private BlockFaceUV func_188010_a(BlockFaceUV p_188010_1_, Direction p_188010_2_, ModelRotation p_188010_3_) { +@@ -71,10 +78,14 @@ } - private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, @Nullable BlockPartRotation p_188012_6_, boolean p_188012_7_) { + private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, Direction p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, @Nullable BlockPartRotation p_188012_6_, boolean p_188012_7_) { + return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.common.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_); + } + -+ private int[] makeQuadVertexData(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, net.minecraftforge.common.model.ITransformation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) { ++ private int[] makeQuadVertexData(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, Direction p_188012_3_, float[] p_188012_4_, net.minecraftforge.common.model.ITransformation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) { int[] aint = new int[28]; for(int i = 0; i < 4; ++i) { @@ -43,26 +51,26 @@ } return aint; -@@ -102,12 +111,16 @@ +@@ -115,12 +126,16 @@ } - private void func_188015_a(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, @Nullable BlockPartRotation p_188015_8_, boolean p_188015_9_) { -- EnumFacing enumfacing = p_188015_7_.func_177523_a(p_188015_3_); + private void func_188015_a(int[] p_188015_1_, int p_188015_2_, Direction p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, @Nullable BlockPartRotation p_188015_8_, boolean p_188015_9_) { +- Direction direction = p_188015_7_.func_177523_a(p_188015_3_); + fillVertexData(p_188015_1_, p_188015_2_, p_188015_3_, p_188015_4_, p_188015_5_, p_188015_6_, (net.minecraftforge.common.model.ITransformation)p_188015_7_, p_188015_8_, p_188015_9_); + } + -+ private void fillVertexData(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, net.minecraftforge.common.model.ITransformation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) { -+ EnumFacing enumfacing = p_188015_7_.rotate(p_188015_3_); - int i = p_188015_9_ ? this.func_178413_a(enumfacing) : -1; - EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.func_179027_a(p_188015_3_).func_179025_a(p_188015_2_); - Vector3f vector3f = new Vector3f(p_188015_5_[enumfacedirection$vertexinformation.field_179184_a], p_188015_5_[enumfacedirection$vertexinformation.field_179182_b], p_188015_5_[enumfacedirection$vertexinformation.field_179183_c]); ++ private void fillVertexData(int[] p_188015_1_, int p_188015_2_, Direction p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, net.minecraftforge.common.model.ITransformation p_188015_7_, @Nullable BlockPartRotation p_188015_8_, boolean p_188015_9_) { ++ Direction direction = p_188015_7_.rotate(p_188015_3_); + int i = p_188015_9_ ? this.func_178413_a(direction) : -1; + FaceDirection.VertexInformation facedirection$vertexinformation = FaceDirection.func_179027_a(p_188015_3_).func_179025_a(p_188015_2_); + Vector3f vector3f = new Vector3f(p_188015_5_[facedirection$vertexinformation.field_179184_a], p_188015_5_[facedirection$vertexinformation.field_179182_b], p_188015_5_[facedirection$vertexinformation.field_179183_c]); this.func_199336_a(vector3f, p_188015_8_); - int j = this.func_199335_a(vector3f, p_188015_3_, p_188015_2_, p_188015_7_); + int j = this.rotateVertex(vector3f, p_188015_3_, p_188015_2_, p_188015_7_); this.func_199333_a(p_188015_1_, j, p_188015_2_, vector3f, i, p_188015_6_, p_188015_4_); } -@@ -117,8 +130,8 @@ +@@ -130,8 +145,8 @@ p_199333_1_[i + 1] = Float.floatToRawIntBits(p_199333_4_.func_195900_b()); p_199333_1_[i + 2] = Float.floatToRawIntBits(p_199333_4_.func_195902_c()); p_199333_1_[i + 3] = p_199333_5_; @@ -73,18 +81,18 @@ } private void func_199336_a(Vector3f p_199336_1_, @Nullable BlockPartRotation p_199336_2_) { -@@ -160,11 +173,15 @@ +@@ -173,11 +188,15 @@ } - public int func_199335_a(Vector3f p_199335_1_, EnumFacing p_199335_2_, int p_199335_3_, ModelRotation p_199335_4_) { + public int func_199335_a(Vector3f p_199335_1_, Direction p_199335_2_, int p_199335_3_, ModelRotation p_199335_4_) { + return rotateVertex(p_199335_1_, p_199335_2_, p_199335_3_, (net.minecraftforge.common.model.ITransformation)p_199335_4_); + } + -+ public int rotateVertex(Vector3f p_199335_1_, EnumFacing p_199335_2_, int p_199335_3_, net.minecraftforge.common.model.ITransformation p_199335_4_) { ++ public int rotateVertex(Vector3f p_199335_1_, Direction p_199335_2_, int p_199335_3_, net.minecraftforge.common.model.ITransformation p_199335_4_) { if (p_199335_4_ == ModelRotation.X0_Y0) { return p_199335_3_; } else { -- this.func_199334_a(p_199335_1_, new Vector3f(0.5F, 0.5F, 0.5F), p_199335_4_.func_195820_a(), new Vector3f(1.0F, 1.0F, 1.0F)); +- this.func_199334_a(p_199335_1_, new Vector3f(0.5F, 0.5F, 0.5F), p_199335_4_.func_217650_a(), new Vector3f(1.0F, 1.0F, 1.0F)); - return p_199335_4_.func_177520_a(p_199335_2_, p_199335_3_); + net.minecraftforge.client.ForgeHooksClient.transform(p_199335_1_, p_199335_4_.getMatrixVec()); + return p_199335_4_.rotate(p_199335_2_, p_199335_3_); diff --git a/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch index cce5f56a5..5587eecc2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch @@ -8,7 +8,7 @@ +public interface IBakedModel extends net.minecraftforge.client.extensions.IForgeBakedModel { + + @Deprecated - List func_200117_a(@Nullable IBlockState p_200117_1_, @Nullable EnumFacing p_200117_2_, Random p_200117_3_); + List func_200117_a(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_); boolean func_177555_b(); @@ -21,7 +23,8 @@ diff --git a/patches/minecraft/net/minecraft/client/renderer/model/IUnbakedModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/IUnbakedModel.java.patch index d64a8487a..7ded4fae6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/IUnbakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/IUnbakedModel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/model/IUnbakedModel.java +++ b/net/minecraft/client/renderer/model/IUnbakedModel.java -@@ -10,11 +10,17 @@ +@@ -11,11 +11,17 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) @@ -11,12 +11,12 @@ Collection func_209559_a(Function p_209559_1_, Set p_209559_2_); + /** -+ * @deprecated Use {@link #bake(Function, Function, IModelState, boolean)}. ++ * @deprecated Use {@link #bake(Function, Function, net.minecraftforge.common.model.IModelState, boolean, net.minecraft.client.renderer.vertex.VertexFormat)}. + */ @Nullable -- IBakedModel func_209558_a(Function p_209558_1_, Function p_209558_2_, ModelRotation p_209558_3_, boolean p_209558_4_); +- IBakedModel func_217641_a(ModelBakery p_217641_1_, Function p_217641_2_, ISprite p_217641_3_); + @Deprecated -+ default IBakedModel func_209558_a(Function p_209558_1_, Function p_209558_2_, ModelRotation p_209558_3_, boolean p_209558_4_) { -+ return bake(p_209558_1_, p_209558_2_, p_209558_3_, p_209558_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); ++ default IBakedModel func_217641_a(ModelBakery p_217641_1_, Function p_217641_2_, ISprite p_217641_3_) { ++ return bake(p_217641_1_::func_209597_a, p_217641_2_, p_217641_3_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch index 180f98621..20a1546d9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch @@ -5,7 +5,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; +/** -+ * @deprecated use {@link net.minecraft.client.renderer.block.model.IBakedModel#handlePerspective(TransformType)} instead ++ * @deprecated use {@link net.minecraft.client.renderer.model.IBakedModel#handlePerspective(TransformType)} instead + */ +@Deprecated @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ItemOverrideList.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ItemOverrideList.java.patch index 92917c140..0a7113536 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ItemOverrideList.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ItemOverrideList.java.patch @@ -1,16 +1,25 @@ --- a/net/minecraft/client/renderer/model/ItemOverrideList.java +++ b/net/minecraft/client/renderer/model/ItemOverrideList.java -@@ -25,7 +25,8 @@ +@@ -24,10 +24,17 @@ this.field_209582_c = Collections.emptyList(); } -- public ItemOverrideList(ModelBlock p_i49525_1_, Function p_i49525_2_, Function p_i49525_3_, List p_i49525_4_) { -+ // FORGE: No reason for first param to be limited to ModelBlock -+ public ItemOverrideList(IUnbakedModel p_i49525_1_, Function p_i49525_2_, Function p_i49525_3_, List p_i49525_4_) { - this.field_209582_c = p_i49525_4_.stream().map((p_209580_3_) -> { - IUnbakedModel iunbakedmodel = p_i49525_2_.apply(p_209580_3_.func_188026_a()); - return Objects.equals(iunbakedmodel, p_i49525_1_) ? null : iunbakedmodel.func_209558_a(p_i49525_2_, p_i49525_3_, ModelRotation.X0_Y0, false); -@@ -56,4 +57,8 @@ ++ @Deprecated //Forge: Use IUnbakedModel + public ItemOverrideList(ModelBakery p_i50984_1_, BlockModel p_i50984_2_, Function p_i50984_3_, List p_i50984_4_) { ++ this(p_i50984_1_, (IUnbakedModel)p_i50984_2_, p_i50984_3_, p_i50984_4_); ++ } ++ public ItemOverrideList(ModelBakery p_i50984_1_, IUnbakedModel p_i50984_2_, Function p_i50984_3_, List p_i50984_4_) { ++ this(p_i50984_2_, p_i50984_3_, p_i50984_4_, net.minecraftforge.client.model.ModelLoader.defaultTextureGetter()); ++ } ++ public ItemOverrideList(IUnbakedModel p_i50984_2_, Function p_i50984_3_, List p_i50984_4_, Function spriteGetter) { + this.field_209582_c = p_i50984_4_.stream().map((p_217649_3_) -> { + IUnbakedModel iunbakedmodel = p_i50984_3_.apply(p_217649_3_.func_188026_a()); +- return Objects.equals(iunbakedmodel, p_i50984_2_) ? null : p_i50984_1_.func_217845_a(p_217649_3_.func_188026_a(), ModelRotation.X0_Y0); ++ return Objects.equals(iunbakedmodel, p_i50984_2_) ? null : p_i50984_3_.apply(p_217649_3_.func_188026_a()).bake(p_i50984_3_, spriteGetter, ModelRotation.X0_Y0, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); + }).collect(Collectors.toList()); + Collections.reverse(this.field_209582_c); + +@@ -55,4 +62,8 @@ return p_209581_1_; } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ItemTransformVec3f.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ItemTransformVec3f.java.patch index 67b3031ea..c2b1503f5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ItemTransformVec3f.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ItemTransformVec3f.java.patch @@ -5,7 +5,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; +/** -+ * @deprecated use {@link net.minecraftforge.client.model.IModelState} and {@link net.minecraftforge.client.model.TRSRTransformation} ++ * @deprecated use {@link net.minecraftforge.common.model.IModelState} and {@link net.minecraftforge.common.model.TRSRTransformation} + */ @OnlyIn(Dist.CLIENT) -public class ItemTransformVec3f { diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ModelBakery.java.patch index 8757fdf84..be1fee696 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ModelBakery.java.patch @@ -1,11 +1,38 @@ --- a/net/minecraft/client/renderer/model/ModelBakery.java +++ b/net/minecraft/client/renderer/model/ModelBakery.java -@@ -198,7 +198,7 @@ +@@ -87,7 +87,7 @@ + private final Set field_217848_D = Sets.newHashSet(); + private final BlockModelDefinition.ContainerHolder field_209610_F = new BlockModelDefinition.ContainerHolder(); + private final Map field_217849_F = Maps.newHashMap(); +- private final Map, IBakedModel> field_217850_G = Maps.newHashMap(); ++ private final Map, IBakedModel> field_217850_G = Maps.newHashMap(); + private final Map field_217851_H = Maps.newHashMap(); + private final Map field_217852_I = Maps.newHashMap(); + private final AtlasTexture.SheetData field_217853_J; +@@ -269,7 +269,7 @@ flag = true; - lvt_9_4_ = this.field_177598_f.func_199004_b(resourcelocation1).stream().map((p_209591_1_) -> { - try (InputStream inputstream = p_209591_1_.func_199027_b()) { -- return Pair.of(p_209591_1_.func_199026_d(), ModelBlockDefinition.func_209577_a(this.field_209610_F, new InputStreamReader(inputstream, StandardCharsets.UTF_8))); -+ return Pair.of(p_209591_1_.func_199026_d(), ModelBlockDefinition.fromJson(this.field_209610_F, new InputStreamReader(inputstream, StandardCharsets.UTF_8), p_209598_1_)); + lvt_9_4_ = this.field_177598_f.func_199004_b(resourcelocation1).stream().map((p_217839_1_) -> { + try (InputStream inputstream = p_217839_1_.func_199027_b()) { +- Pair pair1 = Pair.of(p_217839_1_.func_199026_d(), BlockModelDefinition.func_209577_a(this.field_209610_F, new InputStreamReader(inputstream, StandardCharsets.UTF_8))); ++ Pair pair1 = Pair.of(p_217839_1_.func_199026_d(), BlockModelDefinition.fromJson(this.field_209610_F, new InputStreamReader(inputstream, StandardCharsets.UTF_8), p_209598_1_)); + return pair1; } catch (Exception exception1) { - throw new ModelBakery.BlockStateDefinitionException(String.format("Exception loading blockstate definition: '%s' in resourcepack: '%s': %s", p_209591_1_.func_199029_a(), p_209591_1_.func_199026_d(), exception1.getMessage())); - } + throw new ModelBakery.BlockStateDefinitionException(String.format("Exception loading blockstate definition: '%s' in resourcepack: '%s': %s", p_217839_1_.func_199029_a(), p_217839_1_.func_199026_d(), exception1.getMessage())); +@@ -381,7 +381,7 @@ + + @Nullable + public IBakedModel func_217845_a(ResourceLocation p_217845_1_, ISprite p_217845_2_) { +- Triple triple = Triple.of(p_217845_1_, p_217845_2_.func_188048_b(), p_217845_2_.func_188049_c()); ++ Triple triple = Triple.of(p_217845_1_, p_217845_2_.getState(), p_217845_2_.func_188049_c()); + if (this.field_217850_G.containsKey(triple)) { + return this.field_217850_G.get(triple); + } else { +@@ -389,7 +389,7 @@ + if (iunbakedmodel instanceof BlockModel) { + BlockModel blockmodel = (BlockModel)iunbakedmodel; + if (blockmodel.func_178310_f() == field_177606_o) { +- return field_217854_z.func_209579_a(this.field_177609_j::func_195424_a, blockmodel).func_217644_a(this, blockmodel, this.field_177609_j::func_195424_a, p_217845_2_); ++ return field_217854_z.func_209579_a(this.field_177609_j::func_195424_a, blockmodel).bake(this::func_209597_a, this.field_177609_j::func_195424_a, p_217845_2_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b); + } + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ModelBlock.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ModelBlock.java.patch deleted file mode 100644 index 66d8679f3..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelBlock.java.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/net/minecraft/client/renderer/model/ModelBlock.java -+++ b/net/minecraft/client/renderer/model/ModelBlock.java -@@ -79,6 +79,9 @@ - return this.field_178315_d != null; - } - -+ @Nullable -+ public ResourceLocation getParentLocation() { return field_178316_e; } -+ - public boolean func_178309_b() { - return this.func_178295_k() ? this.field_178315_d.func_178309_b() : this.field_178322_i; - } -@@ -178,14 +181,18 @@ - return set1; - } - -- public IBakedModel func_209558_a(Function p_209558_1_, Function p_209558_2_, ModelRotation p_209558_3_, boolean p_209558_4_) { -- return this.func_209565_a(this, p_209558_1_, p_209558_2_, p_209558_3_, p_209558_4_); -+ @Override -+ public IBakedModel bake(Function p_209558_1_, Function p_209558_2_, net.minecraftforge.common.model.IModelState p_209558_3_, boolean p_209558_4_, net.minecraft.client.renderer.vertex.VertexFormat format) { -+ if (!net.minecraftforge.client.model.Attributes.moreSpecific(format, net.minecraftforge.client.model.Attributes.DEFAULT_BAKED_FORMAT)) { -+ throw new IllegalArgumentException("Cannot bake vanilla model to format other than BLOCK"); - } -+ return bake(this, p_209558_1_, p_209558_2_, p_209558_3_, p_209558_4_); -+ } - -- private IBakedModel func_209565_a(ModelBlock p_209565_1_, Function p_209565_2_, Function p_209565_3_, ModelRotation p_209565_4_, boolean p_209565_5_) { -+ private IBakedModel bake(ModelBlock p_209565_1_, Function p_209565_2_, Function p_209565_3_, net.minecraftforge.common.model.IModelState p_209565_4_, boolean p_209565_5_) { - ModelBlock modelblock = this.func_178310_f(); - if (modelblock == ModelBakery.field_177606_o) { -- return field_209571_g.func_209579_a(p_209565_3_, this).func_209565_a(p_209565_1_, p_209565_2_, p_209565_3_, p_209565_4_, p_209565_5_); -+ return field_209571_g.func_209579_a(p_209565_3_, this).bake(p_209565_1_, p_209565_2_, p_209565_3_, p_209565_4_, p_209565_5_); - } else if (modelblock == ModelBakery.field_177616_r) { - return new BuiltInModel(this.func_181682_g(), this.func_209568_a(p_209565_1_, p_209565_2_, p_209565_3_)); - } else { -@@ -197,9 +204,10 @@ - BlockPartFace blockpartface = blockpart.field_178240_c.get(enumfacing); - TextureAtlasSprite textureatlassprite1 = p_209565_3_.apply(new ResourceLocation(this.func_178308_c(blockpartface.field_178242_d))); - if (blockpartface.field_178244_b == null) { -- simplebakedmodel$builder.func_177648_a(func_209567_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_209565_4_, p_209565_5_)); -+ simplebakedmodel$builder.func_177648_a(makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_209565_4_, p_209565_5_)); - } else { -- simplebakedmodel$builder.func_177650_a(p_209565_4_.func_177523_a(blockpartface.field_178244_b), func_209567_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_209565_4_, p_209565_5_)); -+ -+ simplebakedmodel$builder.func_177650_a(p_209565_4_.apply(java.util.Optional.empty()).map(trsr -> trsr.rotate(enumfacing)).orElse(enumfacing), makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_209565_4_, p_209565_5_)); - } - } - } -@@ -209,9 +217,13 @@ - } - - private static BakedQuad func_209567_a(BlockPart p_209567_0_, BlockPartFace p_209567_1_, TextureAtlasSprite p_209567_2_, EnumFacing p_209567_3_, ModelRotation p_209567_4_, boolean p_209567_5_) { -- return field_209572_h.func_199332_a(p_209567_0_.field_178241_a, p_209567_0_.field_178239_b, p_209567_1_, p_209567_2_, p_209567_3_, p_209567_4_, p_209567_0_.field_178237_d, p_209567_5_, p_209567_0_.field_178238_e); -+ return makeBakedQuad(p_209567_0_, p_209567_1_, p_209567_2_, p_209567_3_, (net.minecraftforge.common.model.IModelState) p_209567_4_, p_209567_5_); - } - -+ public static BakedQuad makeBakedQuad(BlockPart p_209567_0, BlockPartFace p_209567_1_, TextureAtlasSprite p_209567_2_, EnumFacing p_209567_3_, net.minecraftforge.common.model.IModelState p_209567_4_, boolean p_209567_5_) { -+ return field_209572_h.makeBakedQuad(p_209567_0.field_178241_a, p_209567_0.field_178239_b, p_209567_1_, p_209567_2_, p_209567_3_, p_209567_4_.apply(java.util.Optional.empty()).orElse(net.minecraftforge.common.model.TRSRTransformation.identity()), p_209567_0.field_178237_d, p_209567_5_, p_209567_0.field_178238_e); -+ } -+ - public boolean func_178300_b(String p_178300_1_) { - return !MissingTextureSprite.func_195677_a().func_195668_m().toString().equals(this.func_178308_c(p_178300_1_)); - } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ModelManager.java.patch index a632f871e..3070d9a44 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ModelManager.java.patch @@ -1,24 +1,28 @@ --- a/net/minecraft/client/renderer/model/ModelManager.java +++ b/net/minecraft/client/renderer/model/ModelManager.java -@@ -21,9 +21,10 @@ - } +@@ -12,7 +12,7 @@ - public void func_195410_a(IResourceManager p_195410_1_) { -- ModelBakery modelbakery = new ModelBakery(p_195410_1_, this.field_174956_b); -+ net.minecraftforge.client.model.ModelLoader modelbakery = new net.minecraftforge.client.model.ModelLoader(p_195410_1_, this.field_174956_b); - this.field_174958_a = modelbakery.func_177570_a(); - this.field_174955_d = this.field_174958_a.get(ModelBakery.field_177604_a); -+ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.field_174958_a, modelbakery); - this.field_174957_c.func_178124_c(); - } - -@@ -38,4 +39,9 @@ - public BlockModelShapes func_174954_c() { + @OnlyIn(Dist.CLIENT) + public class ModelManager extends ReloadListener { +- private Map field_174958_a; ++ private Map field_174958_a = new java.util.HashMap<>(); + private final AtlasTexture field_174956_b; + private final BlockModelShapes field_174957_c; + private IBakedModel field_174955_d; +@@ -34,9 +34,15 @@ return this.field_174957_c; } -+ -+ @Override + ++ // TODO ++ //@Override + public net.minecraftforge.resource.IResourceType getResourceType() { + return net.minecraftforge.resource.VanillaResourceType.MODELS; + } - } ++ + protected ModelBakery func_212854_a_(IResourceManager p_212854_1_, IProfiler p_212854_2_) { + p_212854_2_.func_219894_a(); +- ModelBakery modelbakery = new ModelBakery(p_212854_1_, this.field_174956_b, p_212854_2_); ++ net.minecraftforge.client.model.ModelLoader modelbakery = new net.minecraftforge.client.model.ModelLoader(p_212854_1_, this.field_174956_b, p_212854_2_); + p_212854_2_.func_219897_b(); + return modelbakery; + } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ModelResourceLocation.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ModelResourceLocation.java.patch index f953097c3..2f2882e15 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelResourceLocation.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ModelResourceLocation.java.patch @@ -1,11 +1,8 @@ --- a/net/minecraft/client/renderer/model/ModelResourceLocation.java +++ b/net/minecraft/client/renderer/model/ModelResourceLocation.java -@@ -2,10 +2,7 @@ - - import java.util.Locale; - import net.minecraft.util.ResourceLocation; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; +@@ -5,7 +5,6 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; -@OnlyIn(Dist.CLIENT) public class ModelResourceLocation extends ResourceLocation { diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ModelRotation.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ModelRotation.java.patch index 2d7ed7b61..a8dc7a96f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ModelRotation.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ModelRotation.java.patch @@ -1,21 +1,21 @@ --- a/net/minecraft/client/renderer/model/ModelRotation.java +++ b/net/minecraft/client/renderer/model/ModelRotation.java -@@ -12,7 +12,7 @@ +@@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) --public enum ModelRotation { -+public enum ModelRotation implements net.minecraftforge.common.model.IModelState, net.minecraftforge.common.model.ITransformation { +-public enum ModelRotation implements ISprite { ++public enum ModelRotation implements ISprite, net.minecraftforge.common.model.IModelState, net.minecraftforge.common.model.ITransformation { X0_Y0(0, 0), X0_Y90(0, 90), X0_Y180(0, 180), -@@ -97,4 +97,9 @@ +@@ -102,4 +102,9 @@ public static ModelRotation func_177524_a(int p_177524_0_, int p_177524_1_) { return field_177546_q.get(func_177521_b(MathHelper.func_180184_b(p_177524_0_, 360), MathHelper.func_180184_b(p_177524_1_, 360))); } + + public java.util.Optional apply(java.util.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); } + public javax.vecmath.Matrix4f getMatrixVec() { return net.minecraftforge.common.model.TRSRTransformation.from(this).getMatrixVec(); } -+ public EnumFacing rotate(EnumFacing facing) { return func_177523_a(facing); } -+ public int rotate(EnumFacing facing, int vertexIndex) { return func_177520_a(facing, vertexIndex); } ++ public Direction rotate(Direction facing) { return func_177523_a(facing); } ++ public int rotate(Direction facing, int vertexIndex) { return func_177520_a(facing, vertexIndex); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/SimpleBakedModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/SimpleBakedModel.java.patch index 099695f08..2eeaa712e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/SimpleBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/SimpleBakedModel.java.patch @@ -3,9 +3,9 @@ @@ -75,7 +75,7 @@ } - public Builder(IBlockState p_i48189_1_, IBakedModel p_i48189_2_, TextureAtlasSprite p_i48189_3_, Random p_i48189_4_, long p_i48189_5_) { + public Builder(BlockState p_i48189_1_, IBakedModel p_i48189_2_, TextureAtlasSprite p_i48189_3_, Random p_i48189_4_, long p_i48189_5_) { - this(p_i48189_2_.func_177555_b(), p_i48189_2_.func_177556_c(), p_i48189_2_.func_177552_f(), p_i48189_2_.func_188617_f()); + this(p_i48189_2_.isAmbientOcclusion(p_i48189_1_), p_i48189_2_.func_177556_c(), p_i48189_2_.func_177552_f(), p_i48189_2_.func_188617_f()); this.field_177652_d = p_i48189_2_.func_177554_e(); - for(EnumFacing enumfacing : EnumFacing.values()) { + for(Direction direction : Direction.values()) { diff --git a/patches/minecraft/net/minecraft/client/renderer/model/Variant.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/Variant.java.patch index e1f38c60f..7a77bc38b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/Variant.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/Variant.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/renderer/model/Variant.java +++ b/net/minecraft/client/renderer/model/Variant.java -@@ -12,7 +12,7 @@ +@@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) --public class Variant { -+public class Variant implements net.minecraftforge.client.model.ISmartVariant { +-public class Variant implements ISprite { ++public class Variant implements ISprite, net.minecraftforge.client.model.ISmartVariant { private final ResourceLocation field_188050_a; private final ModelRotation field_188051_b; private final boolean field_188052_c; -@@ -29,10 +29,15 @@ +@@ -30,10 +30,16 @@ return this.field_188050_a; } @@ -18,6 +18,7 @@ return this.field_188051_b; } ++ @Override + public net.minecraftforge.common.model.IModelState getState() { + return this.field_188051_b; + } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/VariantList.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/VariantList.java.patch index 0f73a02cd..9bcf8f14a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/VariantList.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/VariantList.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/client/renderer/model/VariantList.java +++ b/net/minecraft/client/renderer/model/VariantList.java -@@ -56,14 +56,15 @@ +@@ -57,14 +57,15 @@ } @Nullable -- public IBakedModel func_209558_a(Function p_209558_1_, Function p_209558_2_, ModelRotation p_209558_3_, boolean p_209558_4_) { +- public IBakedModel func_217641_a(ModelBakery p_217641_1_, Function p_217641_2_, ISprite p_217641_3_) { + @Override -+ public IBakedModel bake(Function p_209558_1_, Function p_209558_2_, net.minecraftforge.common.model.IModelState p_209558_3_, boolean p_209558_4_, net.minecraft.client.renderer.vertex.VertexFormat format) { ++ public IBakedModel bake(Function p_217641_1_, Function p_217641_2_, ISprite p_217641_3_, net.minecraft.client.renderer.vertex.VertexFormat format) { if (this.func_188114_a().isEmpty()) { return null; } else { WeightedBakedModel.Builder weightedbakedmodel$builder = new WeightedBakedModel.Builder(); for(Variant variant : this.func_188114_a()) { -- IBakedModel ibakedmodel = p_209558_1_.apply(variant.func_188046_a()).func_209558_a(p_209558_1_, p_209558_2_, variant.func_188048_b(), variant.func_188049_c()); -+ IBakedModel ibakedmodel = p_209558_1_.apply(variant.func_188046_a()).bake(p_209558_1_, p_209558_2_, variant.getState(), variant.func_188049_c(), format); +- IBakedModel ibakedmodel = p_217641_1_.func_217845_a(variant.func_188046_a(), variant); ++ IBakedModel ibakedmodel = p_217641_1_.apply(variant.func_188046_a()).bake(p_217641_1_, p_217641_2_, variant, format); weightedbakedmodel$builder.func_177677_a(ibakedmodel, variant.func_188047_d()); } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/WeightedBakedModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/WeightedBakedModel.java.patch index eaba4450c..6b2e3d0ae 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/WeightedBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/WeightedBakedModel.java.patch @@ -6,7 +6,7 @@ } + + @Override -+ public boolean isAmbientOcclusion(IBlockState state) { return this.field_177566_c.isAmbientOcclusion(state); } ++ 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(); diff --git a/patches/minecraft/net/minecraft/client/renderer/model/multipart/Multipart.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/multipart/Multipart.java.patch index 4660f68d8..7f94ae840 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/multipart/Multipart.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/multipart/Multipart.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/client/renderer/model/multipart/Multipart.java +++ b/net/minecraft/client/renderer/model/multipart/Multipart.java -@@ -81,11 +81,12 @@ +@@ -82,11 +82,12 @@ } @Nullable -- public IBakedModel func_209558_a(Function p_209558_1_, Function p_209558_2_, ModelRotation p_209558_3_, boolean p_209558_4_) { +- public IBakedModel func_217641_a(ModelBakery p_217641_1_, Function p_217641_2_, ISprite p_217641_3_) { + @Override -+ public IBakedModel bake(Function p_209558_1_, Function p_209558_2_, net.minecraftforge.common.model.IModelState p_209558_3_, boolean p_209558_4_, net.minecraft.client.renderer.vertex.VertexFormat format) { ++ public IBakedModel bake(Function p_217641_1_, Function p_217641_2_, ISprite p_217641_3_, net.minecraft.client.renderer.vertex.VertexFormat format) { MultipartBakedModel.Builder multipartbakedmodel$builder = new MultipartBakedModel.Builder(); for(Selector selector : this.func_188136_a()) { -- IBakedModel ibakedmodel = selector.func_188165_a().func_209558_a(p_209558_1_, p_209558_2_, p_209558_3_, p_209558_4_); -+ IBakedModel ibakedmodel = selector.func_188165_a().bake(p_209558_1_, p_209558_2_, p_209558_3_, p_209558_4_, format); +- IBakedModel ibakedmodel = selector.func_188165_a().func_217641_a(p_217641_1_, p_217641_2_, p_217641_3_); ++ IBakedModel ibakedmodel = selector.func_188165_a().bake(p_217641_1_, p_217641_2_, p_217641_3_, format); if (ibakedmodel != null) { multipartbakedmodel$builder.func_188648_a(selector.func_188166_a(this.field_188140_b), ibakedmodel); } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch similarity index 54% rename from patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch rename to patches/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch index 978a10a73..feba121b8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch @@ -1,78 +1,27 @@ ---- a/net/minecraft/client/renderer/texture/TextureMap.java -+++ b/net/minecraft/client/renderer/texture/TextureMap.java -@@ -44,6 +44,7 @@ - - public void func_195426_a(IResourceManager p_195426_1_, Iterable p_195426_2_) { - this.field_195427_i.clear(); -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); - p_195426_2_.forEach((p_195423_2_) -> { - this.func_199362_a(p_195426_1_, p_195423_2_); - }); -@@ -57,8 +58,14 @@ - int j = Integer.MAX_VALUE; - int k = 1 << this.field_147636_j; - -- for(ResourceLocation resourcelocation : this.field_195427_i) { -+ field_147635_d.info("Max texture size: {}", i); -+ try (net.minecraftforge.fml.common.progress.ProgressBar textureLoadingBar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Texture loading", this.field_195427_i.size())) { -+ loadedSprites.clear(); -+ for(ResourceLocation resourcelocation : Sets.newHashSet(this.field_195427_i)) { -+ textureLoadingBar.step(this.func_195420_b(resourcelocation).toString()); - if (!this.field_94249_f.func_195668_m().equals(resourcelocation)) { -+ j = loadTexture(stitcher, p_195421_1_, resourcelocation, j, k); -+ if (true) continue; // Forge: skip the rest of this if statement, we're using loadTexture instead - ResourceLocation resourcelocation1 = this.func_195420_b(resourcelocation); - - TextureAtlasSprite textureatlassprite; -@@ -84,9 +91,11 @@ - stitcher.func_110934_a(textureatlassprite); - } - } -+ } // Forge: end progress bar - - int l = Math.min(j, k); - int i1 = MathHelper.func_151239_c(l); -+ if (false) // FORGE: do not lower the mipmap level - if (i1 < this.field_147636_j) { - field_147635_d.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", this.field_94254_c, this.field_147636_j, i1, l); - this.field_147636_j = i1; -@@ -94,18 +103,25 @@ - - this.field_94249_f.func_147963_d(this.field_147636_j); - stitcher.func_110934_a(this.field_94249_f); -+ try (net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Texture creation", 2)) { - - try { -+ bar.step("Stitching"); - stitcher.func_94305_f(); - } catch (StitcherException stitcherexception) { - throw stitcherexception; - } - - field_147635_d.info("Created: {}x{} {}-atlas", stitcher.func_110935_a(), stitcher.func_110936_b(), this.field_94254_c); -+ bar.step("Allocating GL texture"); - TextureUtil.func_180600_a(this.func_110552_b(), this.field_147636_j, stitcher.func_110935_a(), stitcher.func_110936_b()); - -+ }; // Forge: end progress bar -+ try (net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Texture mipmap and upload", stitcher.func_94309_g().size())) { - for(TextureAtlasSprite textureatlassprite1 : stitcher.func_94309_g()) { -- if (textureatlassprite1 == this.field_94249_f || this.func_195422_a(p_195421_1_, textureatlassprite1)) { -+ bar.step(textureatlassprite1.func_195668_m().toString()); -+ // FORGE: Sprite loading is now done during stitching, short-circuit this check -+ if (true || textureatlassprite1 == this.field_94249_f || this.func_195422_a(p_195421_1_, textureatlassprite1)) { - this.field_94252_e.put(textureatlassprite1.func_195668_m(), textureatlassprite1); - - try { -@@ -124,6 +140,8 @@ +--- a/net/minecraft/client/renderer/texture/AtlasTexture.java ++++ b/net/minecraft/client/renderer/texture/AtlasTexture.java +@@ -79,10 +79,12 @@ } } + net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); -+ }; // Forge: end progress bar } - private boolean func_195422_a(IResourceManager p_195422_1_, TextureAtlasSprite p_195422_2_) { -@@ -132,6 +150,7 @@ + public AtlasTexture.SheetData func_215254_a(IResourceManager p_215254_1_, Iterable p_215254_2_, IProfiler p_215254_3_) { + Set set = Sets.newHashSet(); ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); + p_215254_3_.func_76320_a("preparing"); + p_215254_2_.forEach((p_215253_1_) -> { + if (p_215253_1_ == null) { +@@ -110,6 +112,7 @@ + + int i1 = Math.min(j, k); + int j1 = MathHelper.func_151239_c(i1); ++ if (false) // FORGE: do not lower the mipmap level + if (j1 < this.field_147636_j) { + field_147635_d.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", this.field_94254_c, this.field_147636_j, j1, i1); + this.field_147636_j = j1; +@@ -191,6 +194,7 @@ label62: { boolean flag; @@ -80,7 +29,7 @@ try { iresource = p_195422_1_.func_199002_a(resourcelocation); p_195422_2_.func_195664_a(iresource, this.field_147636_j + 1); -@@ -216,4 +235,91 @@ +@@ -267,7 +271,94 @@ this.field_94252_e.clear(); this.field_94258_i.clear(); } @@ -88,7 +37,7 @@ + //=================================================================================================== + // Forge Start + //=================================================================================================== -+ + + private final java.util.Deque loadingSprites = new java.util.ArrayDeque<>(); + private final java.util.Set loadedSprites = new java.util.HashSet<>(); + @@ -121,7 +70,7 @@ + loadingSprites.addLast(resourcelocation1); + try (IResource iresource = manager.func_199002_a(resourcelocation1)) + { -+ PngSizeInfo pngsizeinfo = new PngSizeInfo(iresource); ++ PngSizeInfo pngsizeinfo = new PngSizeInfo(iresource.toString(), iresource.func_199027_b()); + AnimationMetadataSection animationmetadatasection = iresource.func_199028_a(AnimationMetadataSection.field_195817_a); + textureatlassprite = new TextureAtlasSprite(resourcelocation, pngsizeinfo, animationmetadatasection); + @@ -129,7 +78,7 @@ + { + if (!field_195427_i.contains(dependency)) + { -+ func_199362_a(manager, dependency); ++ this.field_195427_i.add(dependency); + } + j = loadTexture(stitcher, manager, dependency, j, k); + } @@ -171,4 +120,7 @@ + field_195427_i.add(resourcelocation1); + } + } - } ++ + @OnlyIn(Dist.CLIENT) + public static class SheetData { + final Set field_217805_a; diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/ISprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/ISprite.java.patch new file mode 100644 index 000000000..1a8ce73ab --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/ISprite.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/client/renderer/texture/ISprite.java ++++ b/net/minecraft/client/renderer/texture/ISprite.java +@@ -6,6 +6,10 @@ + + @OnlyIn(Dist.CLIENT) + public interface ISprite { ++ /** ++ * @deprecated Use {@link #getState()} instead. ++ */ ++ @Deprecated + default ModelRotation func_188048_b() { + return ModelRotation.X0_Y0; + } +@@ -13,4 +17,6 @@ + default boolean func_188049_c() { + return false; + } ++ ++ default net.minecraftforge.common.model.IModelState getState() { return func_188048_b(); } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java.patch index 26d61f7fb..66a437cc1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java +++ b/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java -@@ -38,8 +38,7 @@ +@@ -39,8 +39,7 @@ String s = this.field_174949_h.get(i); if (s != null) { try ( diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index a4e0a0487..fce2b918c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -1,28 +1,27 @@ --- a/net/minecraft/client/renderer/texture/Stitcher.java +++ b/net/minecraft/client/renderer/texture/Stitcher.java -@@ -12,6 +12,8 @@ +@@ -13,6 +13,8 @@ @OnlyIn(Dist.CLIENT) public class Stitcher { + private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); -+ - private final int field_147971_a; - private final Set field_94319_a = Sets.newHashSetWithExpectedSize(256); - private final List field_94317_b = Lists.newArrayListWithCapacity(256); -@@ -48,16 +50,22 @@ ++ + private static final Comparator field_217797_a = Comparator.comparing((p_217793_0_) -> { + return -p_217793_0_.field_94201_d; + }).thenComparing((p_217795_0_) -> { +@@ -50,15 +52,21 @@ public void func_94305_f() { - Stitcher.Holder[] astitcher$holder = this.field_94319_a.toArray(new Stitcher.Holder[this.field_94319_a.size()]); - Arrays.sort((Object[])astitcher$holder); -+ try(net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Texture stitching", astitcher$holder.length)) { + List list = Lists.newArrayList(this.field_94319_a); + list.sort(field_217797_a); ++ try(net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Texture stitching", list.size())) { - for(Stitcher.Holder stitcher$holder : astitcher$holder) { -+ bar.step(stitcher$holder.func_98150_a().func_195668_m().toString()); + for(Stitcher.Holder stitcher$holder : list) { ++ bar.step(stitcher$holder.field_98151_a.func_195668_m().toString()); if (!this.func_94310_b(stitcher$holder)) { - String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", stitcher$holder.func_98150_a().func_195668_m(), stitcher$holder.func_98150_a().func_94211_a(), stitcher$holder.func_98150_a().func_94216_b()); -+ LOGGER.info(s); -+ for (Stitcher.Holder h : astitcher$holder) ++ LOGGER.info(String.format("Unable to fit: %s - size: %dx%d - Maybe try a lower resolution resourcepack?", stitcher$holder.field_98151_a.func_195668_m(), stitcher$holder.field_98151_a.func_94211_a(), stitcher$holder.field_98151_a.func_94216_b())); ++ for (Stitcher.Holder h : list) + LOGGER.info(" {}", h); - throw new StitcherException(stitcher$holder, s); + throw new StitcherException(stitcher$holder.field_98151_a); } } @@ -32,21 +31,21 @@ } public List func_94309_g() { -@@ -121,7 +129,7 @@ - boolean flag4 = flag2 && l != j1; +@@ -104,7 +112,7 @@ + boolean flag4 = flag2 && j != l; boolean flag; if (flag3 ^ flag4) { - flag = flag3; + flag = !flag3 && flag1; // Forge: Fix stitcher not expanding entire height before growing width, and (potentially) growing larger then the max size. } else { - flag = flag1 && k <= l; + flag = flag1 && i <= j; } -@@ -195,7 +203,7 @@ +@@ -141,7 +149,7 @@ } public String toString() { - return "Holder{width=" + this.field_94204_c + ", height=" + this.field_94201_d + '}'; + return "Holder{width=" + this.field_94204_c + ", height=" + this.field_94201_d + ", name=" + this.field_98151_a.func_195668_m() + '}'; } + } - public int compareTo(Stitcher.Holder p_compareTo_1_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch index d2e9c1b81..e62151f06 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +++ b/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -17,7 +17,7 @@ +@@ -18,7 +18,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) @@ -9,7 +9,7 @@ private final ResourceLocation field_110984_i; protected final int field_130223_c; protected final int field_130224_d; -@@ -89,7 +89,10 @@ +@@ -104,7 +104,10 @@ anativeimage[k1] = this.field_195670_c[k1]; } else { NativeImage nativeimage1 = anativeimage[k1 - 1]; @@ -21,7 +21,7 @@ int k = nativeimage.func_195702_a(); int l = nativeimage.func_195714_b(); -@@ -98,8 +101,11 @@ +@@ -113,8 +116,11 @@ nativeimage.func_195700_a(i1, j1, func_195661_b(nativeimage1.func_195709_a(i1 * 2 + 0, j1 * 2 + 0), nativeimage1.func_195709_a(i1 * 2 + 1, j1 * 2 + 0), nativeimage1.func_195709_a(i1 * 2 + 0, j1 * 2 + 1), nativeimage1.func_195709_a(i1 * 2 + 1, j1 * 2 + 1), flag)); } } @@ -34,7 +34,7 @@ } } -@@ -181,6 +187,7 @@ +@@ -196,6 +202,7 @@ private void func_195667_a(int p_195667_1_, int p_195667_2_, NativeImage[] p_195667_3_) { for(int i = 0; i < this.field_195670_c.length; ++i) { @@ -42,24 +42,7 @@ p_195667_3_[i].func_195706_a(i, this.field_110975_c >> i, this.field_110974_d >> i, p_195667_1_ >> i, p_195667_2_ >> i, this.field_130223_c >> i, this.field_130224_d >> i, this.field_195670_c.length > 1); } -@@ -190,12 +197,10 @@ - this.field_110975_c = p_110971_3_; - this.field_110974_d = p_110971_4_; - this.field_130222_e = p_110971_5_; -- float f = (float)((double)0.01F / (double)p_110971_1_); -- float f1 = (float)((double)0.01F / (double)p_110971_2_); -- this.field_110979_l = (float)p_110971_3_ / (float)((double)p_110971_1_) + f; -- this.field_110980_m = (float)(p_110971_3_ + this.field_130223_c) / (float)((double)p_110971_1_) - f; -- this.field_110977_n = (float)p_110971_4_ / (float)p_110971_2_ + f1; -- this.field_110978_o = (float)(p_110971_4_ + this.field_130224_d) / (float)p_110971_2_ - f1; -+ this.field_110979_l = (float)p_110971_3_ / (float)((double)p_110971_1_); -+ this.field_110980_m = (float)(p_110971_3_ + this.field_130223_c) / (float)((double)p_110971_1_); -+ this.field_110977_n = (float)p_110971_4_ / (float)p_110971_2_; -+ this.field_110978_o = (float)(p_110971_4_ + this.field_130224_d) / (float)p_110971_2_; - } - - public int func_94211_a() { -@@ -439,4 +444,10 @@ +@@ -451,4 +458,10 @@ public void func_195663_q() { this.func_195659_d(0); } @@ -68,5 +51,5 @@ + + public int getPixelRGBA(int frameIndex, int x, int y) { + return this.field_195670_c[frameIndex].func_195709_a(x + this.field_195671_d[frameIndex] * this.field_130223_c, y + this.field_195672_e[frameIndex] * this.field_130224_d); ++ } } -+} diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch index e3a50ee0d..86c2242cc 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -1,36 +1,10 @@ --- a/net/minecraft/client/renderer/texture/TextureManager.java +++ b/net/minecraft/client/renderer/texture/TextureManager.java -@@ -106,6 +106,7 @@ +@@ -125,6 +125,7 @@ public void func_147645_c(ResourceLocation p_147645_1_) { ITextureObject itextureobject = this.func_110581_b(p_147645_1_); if (itextureobject != null) { + this.field_110585_a.remove(p_147645_1_); // Forge: fix MC-98707 - TextureUtil.func_147942_a(itextureobject.func_110552_b()); + TextureUtil.releaseTextureId(itextureobject.func_110552_b()); } -@@ -113,11 +114,13 @@ - - public void func_195410_a(IResourceManager p_195410_1_) { - MissingTextureSprite.func_195676_d(); -+ try (net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Reloading Texture Manager", this.field_110585_a.entrySet().size(), true)) { - Iterator> iterator = this.field_110585_a.entrySet().iterator(); - - while(iterator.hasNext()) { - Entry entry = iterator.next(); - ResourceLocation resourcelocation = entry.getKey(); -+ bar.step(resourcelocation.toString()); - ITextureObject itextureobject = entry.getValue(); - if (itextureobject == MissingTextureSprite.func_195676_d() && !resourcelocation.equals(MissingTextureSprite.func_195675_b())) { - iterator.remove(); -@@ -125,6 +128,11 @@ - this.func_110579_a(entry.getKey(), itextureobject); - } - } -+ }; // Forge: end progress bar -+ } - -+ @Override -+ public net.minecraftforge.resource.IResourceType getResourceType() { -+ return net.minecraftforge.resource.VanillaResourceType.TEXTURES; - } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch deleted file mode 100644 index cd78f2e72..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/client/renderer/texture/TextureUtil.java -+++ b/net/minecraft/client/renderer/texture/TextureUtil.java -@@ -43,7 +43,10 @@ - } - - public static void func_211682_a(NativeImage.PixelFormatGLCode p_211682_0_, int p_211682_1_, int p_211682_2_, int p_211682_3_, int p_211682_4_) { -+ synchronized (net.minecraftforge.fml.client.SplashProgress.class) -+ { - func_94277_a(p_211682_1_); -+ } - if (p_211682_2_ >= 0) { - GlStateManager.func_187421_b(3553, 33085, p_211682_2_); - GlStateManager.func_187421_b(3553, 33082, 0); diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch new file mode 100644 index 000000000..e3ac56bf2 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java ++++ b/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java +@@ -67,6 +67,7 @@ + } + + private boolean func_188186_a(BlockPos p_188186_1_, BlockState p_188186_2_, BufferBuilder p_188186_3_, World p_188186_4_, boolean p_188186_5_) { ++ if (field_178462_c == null) field_178462_c = Minecraft.func_71410_x().func_175602_ab(); + return this.field_178462_c.func_175019_b().func_217631_a(p_188186_4_, this.field_178462_c.func_184389_a(p_188186_2_), p_188186_2_, p_188186_1_, p_188186_3_, p_188186_5_, new Random(), p_188186_2_.func_209533_a(p_188186_1_)); + } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch deleted file mode 100644 index e250a74b7..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java -+++ b/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java -@@ -67,6 +67,7 @@ - } - - private boolean func_188186_a(BlockPos p_188186_1_, IBlockState p_188186_2_, BufferBuilder p_188186_3_, World p_188186_4_, boolean p_188186_5_) { -+ if (field_178462_c == null) field_178462_c = Minecraft.func_71410_x().func_175602_ab(); - return this.field_178462_c.func_175019_b().func_199324_a(p_188186_4_, this.field_178462_c.func_184389_a(p_188186_2_), p_188186_2_, p_188186_1_, p_188186_3_, p_188186_5_, new Random(), p_188186_2_.func_209533_a(p_188186_1_)); - } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRenderer.java.patch index 5c73db205..03807de7a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRenderer.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/renderer/tileentity/TileEntityRenderer.java +++ b/net/minecraft/client/renderer/tileentity/TileEntityRenderer.java -@@ -63,6 +63,8 @@ +@@ -66,6 +66,8 @@ return false; } + public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, net.minecraft.client.renderer.BufferBuilder buffer) {} + protected void func_190052_a(T p_190052_1_, String p_190052_2_, double p_190052_3_, double p_190052_5_, double p_190052_7_, int p_190052_9_) { - Entity entity = this.field_147501_a.field_147551_g; - double d0 = p_190052_1_.func_145835_a(entity.field_70165_t, entity.field_70163_u, entity.field_70161_v); + ActiveRenderInfo activerenderinfo = this.field_147501_a.field_217666_g; + double d0 = p_190052_1_.func_145835_a(activerenderinfo.func_216785_c().field_72450_a, activerenderinfo.func_216785_c().field_72448_b, activerenderinfo.func_216785_c().field_72449_c); diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch index ca15654de..4dbf8cfa1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java +++ b/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java -@@ -88,7 +88,7 @@ +@@ -89,7 +89,7 @@ @Nullable public TileEntityRenderer func_147547_b(@Nullable TileEntity p_147547_1_) { @@ -8,39 +8,34 @@ + return p_147547_1_ == null || p_147547_1_.func_145837_r() ? null : this.func_147546_a(p_147547_1_.getClass()); } - public void func_190056_a(World p_190056_1_, TextureManager p_190056_2_, FontRenderer p_190056_3_, Entity p_190056_4_, RayTraceResult p_190056_5_, float p_190056_6_) { -@@ -109,12 +109,15 @@ + public void func_217665_a(World p_217665_1_, TextureManager p_217665_2_, FontRenderer p_217665_3_, ActiveRenderInfo p_217665_4_, RayTraceResult p_217665_5_) { +@@ -105,12 +105,14 @@ public void func_180546_a(TileEntity p_180546_1_, float p_180546_2_, int p_180546_3_) { - if (p_180546_1_.func_145835_a(this.field_147560_j, this.field_147561_k, this.field_147558_l) < p_180546_1_.func_145833_n()) { -+ if(!drawingBatch || !p_180546_1_.hasFastRenderer()) -+ { + if (p_180546_1_.func_145835_a(this.field_217666_g.func_216785_c().field_72450_a, this.field_217666_g.func_216785_c().field_72448_b, this.field_217666_g.func_216785_c().field_72449_c) < p_180546_1_.func_145833_n()) { ++ if(!drawingBatch || !p_180546_1_.hasFastRenderer()) { RenderHelper.func_74519_b(); - int i = this.field_147550_f.func_175626_b(p_180546_1_.func_174877_v(), 0); + int i = this.field_147550_f.func_217338_b(p_180546_1_.func_174877_v(), 0); int j = i % 65536; int k = i / 65536; - OpenGlHelper.func_77475_a(OpenGlHelper.field_77476_b, (float)j, (float)k); - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, (float)j, (float)k); + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + } BlockPos blockpos = p_180546_1_.func_174877_v(); this.func_203602_a(p_180546_1_, (double)blockpos.func_177958_n() - field_147554_b, (double)blockpos.func_177956_o() - field_147555_c, (double)blockpos.func_177952_p() - field_147552_d, p_180546_2_, p_180546_3_, false); } -@@ -133,10 +136,13 @@ - TileEntityRenderer tileentityrenderer = this.func_147547_b(p_203602_1_); +@@ -130,6 +132,10 @@ if (tileentityrenderer != null) { try { -- if (!p_203602_10_ && (!p_203602_1_.func_145830_o() || !p_203602_1_.func_195044_w().func_177230_c().func_149716_u())) { -+ if (!p_203602_10_ && (!p_203602_1_.func_145830_o() || !p_203602_1_.func_195044_w().hasTileEntity())) { - return; + if (p_203602_10_ || p_203602_1_.func_145830_o() && p_203602_1_.func_200662_C().func_223045_a(p_203602_1_.func_195044_w().func_177230_c())) { ++ ++ if(drawingBatch && p_203602_1_.hasFastRenderer()) ++ tileentityrenderer.renderTileEntityFast(p_203602_1_, p_203602_2_, p_203602_4_, p_203602_6_, p_203602_8_, p_203602_9_, batchBuffer.func_178180_c()); ++ else + tileentityrenderer.func_199341_a(p_203602_1_, p_203602_2_, p_203602_4_, p_203602_6_, p_203602_8_, p_203602_9_); } - -+ if(drawingBatch && p_203602_1_.hasFastRenderer()) -+ tileentityrenderer.renderTileEntityFast(p_203602_1_, p_203602_2_, p_203602_4_, p_203602_6_, p_203602_8_, p_203602_9_, batchBuffer.func_178180_c()); -+ else - tileentityrenderer.func_199341_a(p_203602_1_, p_203602_2_, p_203602_4_, p_203602_6_, p_203602_8_, p_203602_9_); } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.func_85055_a(throwable, "Rendering Block Entity"); -@@ -159,4 +165,51 @@ +@@ -153,4 +159,46 @@ public FontRenderer func_147548_a() { return this.field_147557_n; } @@ -64,23 +59,18 @@ + * Render all TESRs batched so far. + * You probably shouldn't call this manually. + */ -+ public void drawBatch(int pass) { -+ field_147553_e.func_110577_a(net.minecraft.client.renderer.texture.TextureMap.field_110575_b); ++ public void drawBatch() { ++ field_147553_e.func_110577_a(net.minecraft.client.renderer.texture.AtlasTexture.field_110575_b); + net.minecraft.client.renderer.RenderHelper.func_74518_a(); -+ GlStateManager.func_179112_b(org.lwjgl.opengl.GL11.GL_SRC_ALPHA, org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA); -+ GlStateManager.func_179147_l(); -+ GlStateManager.func_179129_p(); ++ GlStateManager.blendFunc(org.lwjgl.opengl.GL11.GL_SRC_ALPHA, org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA); ++ GlStateManager.enableBlend(); ++ GlStateManager.disableCull(); + -+ if (net.minecraft.client.Minecraft.func_71379_u()) { -+ GlStateManager.func_179103_j(org.lwjgl.opengl.GL11.GL_SMOOTH); -+ } else { -+ GlStateManager.func_179103_j(org.lwjgl.opengl.GL11.GL_FLAT); -+ } ++ if (net.minecraft.client.Minecraft.func_71379_u()) ++ GlStateManager.shadeModel(org.lwjgl.opengl.GL11.GL_SMOOTH); ++ else ++ GlStateManager.shadeModel(org.lwjgl.opengl.GL11.GL_FLAT); + -+ if(pass > 0) { -+ net.minecraft.util.math.Vec3d cameraPos = net.minecraft.client.renderer.ActiveRenderInfo.getCameraPosition(); -+ batchBuffer.func_178180_c().func_181674_a((float)cameraPos.field_72450_a, (float)cameraPos.field_72448_b, (float)cameraPos.field_72449_c); -+ } + batchBuffer.func_78381_a(); + + net.minecraft.client.renderer.RenderHelper.func_74519_b(); diff --git a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch index 2f56bc005..42806e1d1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch @@ -18,4 +18,4 @@ + private final String field_177392_h; - private EnumUsage(String p_i46094_3_) { + private Usage(String p_i46094_3_) { diff --git a/patches/minecraft/net/minecraft/client/resources/ResourcePackInfoClient.java.patch b/patches/minecraft/net/minecraft/client/resources/ClientResourcePackInfo.java.patch similarity index 82% rename from patches/minecraft/net/minecraft/client/resources/ResourcePackInfoClient.java.patch rename to patches/minecraft/net/minecraft/client/resources/ClientResourcePackInfo.java.patch index 00f2b6fcb..7ff2c300b 100644 --- a/patches/minecraft/net/minecraft/client/resources/ResourcePackInfoClient.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/ClientResourcePackInfo.java.patch @@ -1,16 +1,16 @@ ---- a/net/minecraft/client/resources/ResourcePackInfoClient.java -+++ b/net/minecraft/client/resources/ResourcePackInfoClient.java +--- a/net/minecraft/client/resources/ClientResourcePackInfo.java ++++ b/net/minecraft/client/resources/ClientResourcePackInfo.java @@ -23,8 +23,13 @@ @Nullable private ResourceLocation field_195810_b; + @Deprecated - public ResourcePackInfoClient(String p_i48113_1_, boolean p_i48113_2_, Supplier p_i48113_3_, IResourcePack p_i48113_4_, PackMetadataSection p_i48113_5_, ResourcePackInfo.Priority p_i48113_6_) { + public ClientResourcePackInfo(String p_i48113_1_, boolean p_i48113_2_, Supplier p_i48113_3_, IResourcePack p_i48113_4_, PackMetadataSection p_i48113_5_, ResourcePackInfo.Priority p_i48113_6_) { - super(p_i48113_1_, p_i48113_2_, p_i48113_3_, p_i48113_4_, p_i48113_5_, p_i48113_6_); + this(p_i48113_1_, p_i48113_2_, p_i48113_3_, p_i48113_4_, p_i48113_5_, p_i48113_6_, false); + } + -+ public ResourcePackInfoClient(String p_i48113_1_, boolean p_i48113_2_, Supplier p_i48113_3_, IResourcePack p_i48113_4_, PackMetadataSection p_i48113_5_, ResourcePackInfo.Priority p_i48113_6_, boolean hidden) { ++ public ClientResourcePackInfo(String p_i48113_1_, boolean p_i48113_2_, Supplier p_i48113_3_, IResourcePack p_i48113_4_, PackMetadataSection p_i48113_5_, ResourcePackInfo.Priority p_i48113_6_, boolean hidden) { + super(p_i48113_1_, p_i48113_2_, p_i48113_3_, p_i48113_4_, p_i48113_5_, p_i48113_6_, hidden); NativeImage nativeimage = null; @@ -20,12 +20,12 @@ } + @Deprecated - public ResourcePackInfoClient(String p_i48114_1_, boolean p_i48114_2_, Supplier p_i48114_3_, ITextComponent p_i48114_4_, ITextComponent p_i48114_5_, PackCompatibility p_i48114_6_, ResourcePackInfo.Priority p_i48114_7_, boolean p_i48114_8_, @Nullable NativeImage p_i48114_9_) { + public ClientResourcePackInfo(String p_i48114_1_, boolean p_i48114_2_, Supplier p_i48114_3_, ITextComponent p_i48114_4_, ITextComponent p_i48114_5_, PackCompatibility p_i48114_6_, ResourcePackInfo.Priority p_i48114_7_, boolean p_i48114_8_, @Nullable NativeImage p_i48114_9_) { - super(p_i48114_1_, p_i48114_2_, p_i48114_3_, p_i48114_4_, p_i48114_5_, p_i48114_6_, p_i48114_7_, p_i48114_8_); + this(p_i48114_1_, p_i48114_2_, p_i48114_3_, p_i48114_4_, p_i48114_5_, p_i48114_6_, p_i48114_7_, p_i48114_8_, p_i48114_9_, false); + } + -+ public ResourcePackInfoClient(String p_i48114_1_, boolean p_i48114_2_, Supplier p_i48114_3_, ITextComponent p_i48114_4_, ITextComponent p_i48114_5_, PackCompatibility p_i48114_6_, ResourcePackInfo.Priority p_i48114_7_, boolean p_i48114_8_, @Nullable NativeImage p_i48114_9_, boolean hidden) { ++ public ClientResourcePackInfo(String p_i48114_1_, boolean p_i48114_2_, Supplier p_i48114_3_, ITextComponent p_i48114_4_, ITextComponent p_i48114_5_, PackCompatibility p_i48114_6_, ResourcePackInfo.Priority p_i48114_7_, boolean p_i48114_8_, @Nullable NativeImage p_i48114_9_, boolean hidden) { + super(p_i48114_1_, p_i48114_2_, p_i48114_3_, p_i48114_4_, p_i48114_5_, p_i48114_6_, p_i48114_7_, p_i48114_8_, hidden); this.field_195809_a = p_i48114_9_; } diff --git a/patches/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java.patch b/patches/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java.patch index 390f7570a..05653b3b1 100644 --- a/patches/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/resources/FoliageColorReloadListener.java +++ b/net/minecraft/client/resources/FoliageColorReloadListener.java -@@ -21,4 +21,9 @@ - } - +@@ -23,4 +23,9 @@ + protected void func_212853_a_(int[] p_212853_1_, IResourceManager p_212853_2_, IProfiler p_212853_3_) { + FoliageColors.func_77467_a(p_212853_1_); } + -+ @Override ++ //@Override //Forge: TODO: Filtered resource reloading + public net.minecraftforge.resource.IResourceType getResourceType() { + return net.minecraftforge.resource.VanillaResourceType.TEXTURES; + } diff --git a/patches/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java.patch b/patches/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java.patch index 1aae2996d..c6ec74d07 100644 --- a/patches/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/resources/GrassColorReloadListener.java +++ b/net/minecraft/client/resources/GrassColorReloadListener.java -@@ -21,4 +21,9 @@ - } - +@@ -23,4 +23,9 @@ + protected void func_212853_a_(int[] p_212853_1_, IResourceManager p_212853_2_, IProfiler p_212853_3_) { + GrassColors.func_77479_a(p_212853_1_); } + -+ @Override ++ //@Override //Forge: TODO: Filtered resource reloading + public net.minecraftforge.resource.IResourceType getResourceType() { + return net.minecraftforge.resource.VanillaResourceType.TEXTURES; + } diff --git a/patches/minecraft/net/minecraft/client/resources/Language.java.patch b/patches/minecraft/net/minecraft/client/resources/Language.java.patch index d30f022d5..fd7f9dc96 100644 --- a/patches/minecraft/net/minecraft/client/resources/Language.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/Language.java.patch @@ -12,8 +12,8 @@ + } } - public String func_135034_a() { -@@ -44,4 +50,8 @@ + public String getCode() { +@@ -52,4 +58,8 @@ public int compareTo(Language p_compareTo_1_) { return this.field_135039_a.compareTo(p_compareTo_1_.field_135039_a); } diff --git a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch index daf73f958..3dc3c4bc6 100644 --- a/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/KeyBinding.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/settings/KeyBinding.java +++ b/net/minecraft/client/settings/KeyBinding.java -@@ -12,9 +12,9 @@ +@@ -14,9 +14,9 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) @@ -12,7 +12,7 @@ private static final Set field_151473_c = Sets.newHashSet(); private static final Map field_193627_d = Util.func_200696_a(Maps.newHashMap(), (p_205215_0_) -> { p_205215_0_.put("key.categories.movement", 1); -@@ -33,7 +33,7 @@ +@@ -35,7 +35,7 @@ private int field_151474_i; public static void func_197981_a(InputMappings.Input p_197981_0_) { @@ -21,7 +21,7 @@ if (keybinding != null) { ++keybinding.field_151474_i; } -@@ -41,7 +41,7 @@ +@@ -43,7 +43,7 @@ } public static void func_197980_a(InputMappings.Input p_197980_0_, boolean p_197980_1_) { @@ -30,7 +30,7 @@ if (keybinding != null) { keybinding.field_74513_e = p_197980_1_; } -@@ -65,10 +65,10 @@ +@@ -67,10 +67,10 @@ } public static void func_74508_b() { @@ -43,7 +43,7 @@ } } -@@ -83,12 +83,12 @@ +@@ -85,12 +85,12 @@ this.field_151472_e = this.field_74512_d; this.field_151471_f = p_i47675_4_; field_74516_a.put(p_i47675_1_, this); @@ -58,7 +58,7 @@ } public String func_151466_e() { -@@ -122,7 +122,13 @@ +@@ -124,7 +124,13 @@ } public int compareTo(KeyBinding p_compareTo_1_) { @@ -73,7 +73,7 @@ } public static Supplier func_193626_b(String p_193626_0_) { -@@ -133,6 +139,20 @@ +@@ -135,6 +141,20 @@ } public boolean func_197983_b(KeyBinding p_197983_1_) { @@ -94,17 +94,24 @@ return this.field_74512_d.equals(p_197983_1_.field_74512_d); } -@@ -153,14 +173,110 @@ +@@ -155,6 +175,7 @@ } public String func_197978_k() { -- return this.field_74512_d.func_197936_a(); -+ return getKeyModifier().getLocalizedComboName(this.field_74512_d); ++ return getKeyModifier().getLocalizedComboName(this.field_74512_d, () -> { + String s = this.field_74512_d.func_197935_d(); + int i = this.field_74512_d.func_197937_c(); + String s1 = null; +@@ -171,13 +192,94 @@ + } + + return s1 == null ? I18n.func_135052_a(s) : s1; ++ }); } public boolean func_197985_l() { - return this.field_74512_d.equals(this.field_151472_e); -+ return getKey().equals(this.field_151472_e) && getKeyModifier() == getKeyModifierDefault(); ++ return this.field_74512_d.equals(this.field_151472_e) && getKeyModifier() == getKeyModifierDefault(); } public String func_197982_m() { @@ -112,7 +119,6 @@ } + + /****************** Forge Start *****************************/ -+ + private net.minecraftforge.client.settings.KeyModifier keyModifierDefault = net.minecraftforge.client.settings.KeyModifier.NONE; + private net.minecraftforge.client.settings.KeyModifier keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; + private net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext = net.minecraftforge.client.settings.KeyConflictContext.UNIVERSAL; @@ -120,32 +126,28 @@ + /** + * Convenience constructor for creating KeyBindings with keyConflictContext set. + */ -+ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputMappings.Type inputType, final int keyCode, String category) -+ { ++ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputMappings.Type inputType, final int keyCode, String category) { + this(description, keyConflictContext, inputType.func_197944_a(keyCode), category); + } + + /** + * Convenience constructor for creating KeyBindings with keyConflictContext set. + */ -+ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, InputMappings.Input keyCode, String category) -+ { -+ this(description, keyConflictContext, net.minecraftforge.client.settings.KeyModifier.NONE, keyCode, category); ++ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, InputMappings.Input keyCode, String category) { ++ this(description, keyConflictContext, net.minecraftforge.client.settings.KeyModifier.NONE, keyCode, category); + } + + /** + * 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, final InputMappings.Type inputType, final int keyCode, String category) -+ { ++ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputMappings.Type inputType, final int keyCode, String category) { + this(description, keyConflictContext, keyModifier, inputType.func_197944_a(keyCode), category); + } + + /** + * 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) -+ { ++ 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; @@ -154,56 +156,45 @@ + this.keyModifier = keyModifier; + this.keyModifierDefault = keyModifier; + if (this.keyModifier.matches(keyCode)) -+ { -+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; -+ } ++ 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 -+ public InputMappings.Input getKey() -+ { ++ public InputMappings.Input getKey() { + return this.field_74512_d; + } + + @Override -+ public void setKeyConflictContext(net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext) -+ { -+ this.keyConflictContext = keyConflictContext; ++ public void setKeyConflictContext(net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext) { ++ this.keyConflictContext = keyConflictContext; + } + + @Override -+ public net.minecraftforge.client.settings.IKeyConflictContext getKeyConflictContext() -+ { -+ return keyConflictContext; ++ public net.minecraftforge.client.settings.IKeyConflictContext getKeyConflictContext() { ++ return keyConflictContext; + } + + @Override -+ public net.minecraftforge.client.settings.KeyModifier getKeyModifierDefault() -+ { -+ return keyModifierDefault; ++ public net.minecraftforge.client.settings.KeyModifier getKeyModifierDefault() { ++ return keyModifierDefault; + } + + @Override -+ public net.minecraftforge.client.settings.KeyModifier getKeyModifier() -+ { -+ return keyModifier; ++ public net.minecraftforge.client.settings.KeyModifier getKeyModifier() { ++ return keyModifier; + } + + @Override -+ public void setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier keyModifier, InputMappings.Input keyCode) -+ { -+ this.field_74512_d = keyCode; -+ if (keyModifier.matches(keyCode)) -+ { -+ keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; -+ } -+ field_74514_b.removeKey(this); -+ this.keyModifier = keyModifier; -+ field_74514_b.addKey(keyCode, this); ++ public void setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier keyModifier, InputMappings.Input keyCode) { ++ this.field_74512_d = keyCode; ++ if (keyModifier.matches(keyCode)) ++ keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; ++ field_74514_b.removeKey(this); ++ this.keyModifier = keyModifier; ++ field_74514_b.addKey(keyCode, this); + } -+ + /****************** Forge End *****************************/ } diff --git a/patches/minecraft/net/minecraft/client/shader/ShaderGroup.java.patch b/patches/minecraft/net/minecraft/client/shader/ShaderGroup.java.patch index c2464f7ff..ff55bdb6e 100644 --- a/patches/minecraft/net/minecraft/client/shader/ShaderGroup.java.patch +++ b/patches/minecraft/net/minecraft/client/shader/ShaderGroup.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/shader/ShaderGroup.java +++ b/net/minecraft/client/shader/ShaderGroup.java -@@ -142,7 +142,8 @@ - String s3 = JsonUtils.func_151200_h(jsonobject1, "id"); +@@ -143,7 +143,8 @@ + String s3 = JSONUtils.func_151200_h(jsonobject1, "id"); Framebuffer framebuffer2 = this.func_148017_a(s3); if (framebuffer2 == null) { - ResourceLocation resourcelocation = new ResourceLocation("textures/effect/" + s3 + ".png"); diff --git a/patches/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch b/patches/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch new file mode 100644 index 000000000..464d7dd5e --- /dev/null +++ b/patches/minecraft/net/minecraft/client/shader/ShaderInstance.java.patch @@ -0,0 +1,22 @@ +--- a/net/minecraft/client/shader/ShaderInstance.java ++++ b/net/minecraft/client/shader/ShaderInstance.java +@@ -50,7 +50,8 @@ + private final ShaderLoader field_216563_s; + + public ShaderInstance(IResourceManager p_i50988_1_, String p_i50988_2_) throws IOException { +- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_i50988_2_ + ".json"); ++ ResourceLocation rl = ResourceLocation.func_208304_a(p_i50988_2_); ++ ResourceLocation resourcelocation = new ResourceLocation(rl.func_110624_b(), "shaders/program/" + rl.func_110623_a() + ".json"); + this.field_216556_l = p_i50988_2_; + IResource iresource = null; + +@@ -142,7 +143,8 @@ + public static ShaderLoader func_216542_a(IResourceManager p_216542_0_, ShaderLoader.ShaderType p_216542_1_, String p_216542_2_) throws IOException { + ShaderLoader shaderloader = p_216542_1_.func_148064_d().get(p_216542_2_); + if (shaderloader == null) { +- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_216542_2_ + p_216542_1_.func_148063_b()); ++ ResourceLocation rl = ResourceLocation.func_208304_a(p_216542_2_); ++ ResourceLocation resourcelocation = new ResourceLocation(rl.func_110624_b(), "shaders/program/" + rl.func_110623_a() + p_216542_1_.func_148063_b()); + IResource iresource = p_216542_0_.func_199002_a(resourcelocation); + + try { diff --git a/patches/minecraft/net/minecraft/client/shader/ShaderLoader.java.patch b/patches/minecraft/net/minecraft/client/shader/ShaderLoader.java.patch deleted file mode 100644 index 6ae6cbe1d..000000000 --- a/patches/minecraft/net/minecraft/client/shader/ShaderLoader.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/client/shader/ShaderLoader.java -+++ b/net/minecraft/client/shader/ShaderLoader.java -@@ -51,7 +51,8 @@ - public static ShaderLoader func_195655_a(IResourceManager p_195655_0_, ShaderLoader.ShaderType p_195655_1_, String p_195655_2_) throws IOException { - ShaderLoader shaderloader = p_195655_1_.func_148064_d().get(p_195655_2_); - if (shaderloader == null) { -- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_195655_2_ + p_195655_1_.func_148063_b()); -+ ResourceLocation rl = ResourceLocation.func_208304_a(p_195655_2_); -+ ResourceLocation resourcelocation = new ResourceLocation(rl.func_110624_b(), "shaders/program/" + rl.func_110623_a() + p_195655_1_.func_148063_b()); - IResource iresource = p_195655_0_.func_199002_a(resourcelocation); - ByteBuffer bytebuffer = null; - diff --git a/patches/minecraft/net/minecraft/client/shader/ShaderManager.java.patch b/patches/minecraft/net/minecraft/client/shader/ShaderManager.java.patch deleted file mode 100644 index 009b36505..000000000 --- a/patches/minecraft/net/minecraft/client/shader/ShaderManager.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/client/shader/ShaderManager.java -+++ b/net/minecraft/client/shader/ShaderManager.java -@@ -50,7 +50,8 @@ - private final ShaderLoader field_148012_t; - - public ShaderManager(IResourceManager p_i45087_1_, String p_i45087_2_) throws IOException { -- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_i45087_2_ + ".json"); -+ ResourceLocation rl = ResourceLocation.func_208304_a(p_i45087_2_); -+ ResourceLocation resourcelocation = new ResourceLocation(rl.func_110624_b(), "shaders/program/" + rl.func_110623_a() + ".json"); - this.field_148007_m = p_i45087_2_; - IResource iresource = null; - diff --git a/patches/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch b/patches/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch index 3afe592ac..e821230c2 100644 --- a/patches/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch +++ b/patches/minecraft/net/minecraft/client/util/SearchTreeManager.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/util/SearchTreeManager.java +++ b/net/minecraft/client/util/SearchTreeManager.java -@@ -30,6 +30,11 @@ - return (ISearchTree) this.field_194013_c.get(p_194010_1_); +@@ -31,6 +31,11 @@ + return (IMutableSearchTree) this.field_194013_c.get(p_215358_1_); } + @Override diff --git a/patches/minecraft/net/minecraft/client/world/ClientWorld.java.patch b/patches/minecraft/net/minecraft/client/world/ClientWorld.java.patch new file mode 100644 index 000000000..1e54c1571 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/world/ClientWorld.java.patch @@ -0,0 +1,67 @@ +--- a/net/minecraft/client/world/ClientWorld.java ++++ b/net/minecraft/client/world/ClientWorld.java +@@ -86,6 +86,8 @@ + this.func_175652_B(new BlockPos(8, 64, 8)); + this.func_72966_v(); + this.func_72947_a(); ++ this.gatherCapabilities(field_73011_w.initCapabilities()); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this)); + } + + public void func_72835_b(BooleanSupplier p_72835_1_) { +@@ -110,6 +112,7 @@ + Entity entity = this.field_217428_a.get(i); + this.func_217390_a((p_217415_0_) -> { + ++p_217415_0_.field_70173_aa; ++ if (p_217415_0_.canUpdate()) + p_217415_0_.func_70071_h_(); + }, entity); + if (entity.field_70128_L) { +@@ -157,6 +160,7 @@ + this.func_217381_Z().func_194340_a(() -> { + return Registry.field_212629_r.func_177774_c(p_217418_1_.func_200600_R()).toString(); + }); ++ if (p_217418_1_.canUpdate()) + p_217418_1_.func_70071_h_(); + this.func_217381_Z().func_76319_b(); + } +@@ -267,6 +271,7 @@ + this.func_217413_d(p_217424_1_); + this.field_217429_b.put(p_217424_1_, p_217424_2_); + this.func_72863_F().func_212849_a_(MathHelper.func_76128_c(p_217424_2_.field_70165_t / 16.0D), MathHelper.func_76128_c(p_217424_2_.field_70161_v / 16.0D), ChunkStatus.field_222617_m, true).func_76612_a(p_217424_2_); ++ p_217424_2_.onAddedToWorld(); + } + + public void func_217413_d(int p_217413_1_) { +@@ -285,6 +290,7 @@ + } + + this.field_217431_w.remove(p_217414_1_); ++ p_217414_1_.onRemovedFromWorld(); + } + + public void func_217417_b(Chunk p_217417_1_) { +@@ -410,6 +416,11 @@ + } + + 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(); + if (p_184148_1_ == this.field_73037_M.field_71439_g) { + this.func_184134_a(p_184148_2_, p_184148_4_, p_184148_6_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_, false); + } +@@ -417,6 +428,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(); + if (p_217384_1_ == this.field_73037_M.field_71439_g) { + this.field_73037_M.func_147118_V().func_147682_a(new EntityTickableSound(p_217384_3_, p_217384_4_, p_217384_2_)); + } diff --git a/patches/minecraft/net/minecraft/command/Commands.java.patch b/patches/minecraft/net/minecraft/command/Commands.java.patch index 1e3bb3b03..a86deb5cb 100644 --- a/patches/minecraft/net/minecraft/command/Commands.java.patch +++ b/patches/minecraft/net/minecraft/command/Commands.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/command/Commands.java +++ b/net/minecraft/command/Commands.java -@@ -193,7 +193,15 @@ +@@ -183,7 +183,15 @@ try { try { diff --git a/patches/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch b/patches/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch index 5d3a29e06..0daa24a42 100644 --- a/patches/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch +++ b/patches/minecraft/net/minecraft/command/arguments/EntitySelectorParser.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/command/arguments/EntitySelectorParser.java +++ b/net/minecraft/command/arguments/EntitySelectorParser.java -@@ -435,6 +435,10 @@ +@@ -448,6 +448,10 @@ } this.field_197417_j.skip(); @@ -11,10 +11,10 @@ this.func_197403_b(); } else { this.func_197382_c(); -@@ -450,6 +454,7 @@ - p_210326_0_.suggest("@r", new TextComponentTranslation("argument.entity.selector.randomPlayer")); - p_210326_0_.suggest("@s", new TextComponentTranslation("argument.entity.selector.self")); - p_210326_0_.suggest("@e", new TextComponentTranslation("argument.entity.selector.allEntities")); +@@ -463,6 +467,7 @@ + p_210326_0_.suggest("@r", new TranslationTextComponent("argument.entity.selector.randomPlayer")); + p_210326_0_.suggest("@s", new TranslationTextComponent("argument.entity.selector.self")); + p_210326_0_.suggest("@e", new TranslationTextComponent("argument.entity.selector.allEntities")); + net.minecraftforge.common.command.EntitySelectorManager.fillSelectorSuggestions(p_210326_0_); } diff --git a/patches/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch b/patches/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch index eb512d734..2b447db97 100644 --- a/patches/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch +++ b/patches/minecraft/net/minecraft/command/impl/TeleportCommand.java.patch @@ -1,32 +1,10 @@ --- a/net/minecraft/command/impl/TeleportCommand.java +++ b/net/minecraft/command/impl/TeleportCommand.java -@@ -54,7 +54,7 @@ - - private static int func_201126_a(CommandSource p_201126_0_, Collection p_201126_1_, Entity p_201126_2_) { - for(Entity entity : p_201126_1_) { -- func_201127_a(p_201126_0_, entity, p_201126_0_.func_197023_e(), p_201126_2_.field_70165_t, p_201126_2_.field_70163_u, p_201126_2_.field_70161_v, EnumSet.noneOf(SPacketPlayerPosLook.EnumFlags.class), p_201126_2_.field_70177_z, p_201126_2_.field_70125_A, (TeleportCommand.Facing)null); -+ func_201127_a(p_201126_0_, entity, (WorldServer) p_201126_2_.func_130014_f_(), p_201126_2_.field_70165_t, p_201126_2_.field_70163_u, p_201126_2_.field_70161_v, EnumSet.noneOf(SPacketPlayerPosLook.EnumFlags.class), p_201126_2_.field_70177_z, p_201126_2_.field_70125_A, (TeleportCommand.Facing)null); // Forge: Fix MC-128441 cross-dimension teleporting does not work - } - - if (p_201126_1_.size() == 1) { -@@ -135,9 +135,9 @@ - p_201127_1_.func_70034_d(f); - } else { - WorldServer worldserver = (WorldServer)p_201127_1_.field_70170_p; -- worldserver.func_72900_e(p_201127_1_); -+ worldserver.removeEntity(p_201127_1_, true); //Forge: Delay invalidating caps until we copy. - p_201127_1_.field_71093_bK = p_201127_2_.field_73011_w.func_186058_p(); -- p_201127_1_.field_70128_L = false; -+ p_201127_1_.revive(); - Entity entity = p_201127_1_; - p_201127_1_ = p_201127_1_.func_200600_R().func_200721_a(p_201127_2_); - if (p_201127_1_ == null) { -@@ -152,7 +152,7 @@ - p_201127_2_.func_72838_d(p_201127_1_); - p_201127_1_.field_98038_p = flag; - p_201127_2_.func_72866_a(p_201127_1_, false); +@@ -151,7 +151,6 @@ + p_201127_1_.func_70012_b(p_201127_3_, p_201127_5_, p_201127_7_, f1, f); + p_201127_1_.func_70034_d(f1); + p_201127_2_.func_217460_e(p_201127_1_); - entity.field_70128_L = true; -+ entity.remove(false); //Forge: now invalidate everything. } } diff --git a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch index b90b7c18e..97aa8f3e9 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch +++ b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/crash/CrashReport.java +++ b/net/minecraft/crash/CrashReport.java -@@ -63,6 +63,7 @@ +@@ -65,6 +65,7 @@ List list = Util.func_211565_f().collect(Collectors.toList()); return String.format("%d total; %s", list.size(), list.stream().collect(Collectors.joining(" "))); }); @@ -8,7 +8,7 @@ } public String func_71501_a() { -@@ -115,23 +116,13 @@ +@@ -117,23 +118,13 @@ throwable.setStackTrace(this.field_71511_b.getStackTrace()); } diff --git a/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch b/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch new file mode 100644 index 000000000..040f4f636 --- /dev/null +++ b/patches/minecraft/net/minecraft/dispenser/IDispenseItemBehavior.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/dispenser/IDispenseItemBehavior.java ++++ b/net/minecraft/dispenser/IDispenseItemBehavior.java +@@ -370,15 +370,23 @@ + } + + DispenserBlock.func_199774_a(Items.field_151097_aZ.func_199767_j(), new OptionalDispenseBehavior() { ++ @SuppressWarnings("deprecation") + protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) { + World world = p_82487_1_.func_197524_h(); + if (!world.func_201670_d()) { + this.field_218407_b = false; + BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(p_82487_1_.func_189992_e().func_177229_b(DispenserBlock.field_176441_a)); + +- for(SheepEntity sheepentity : world.func_217357_a(SheepEntity.class, new AxisAlignedBB(blockpos))) { +- if (sheepentity.func_70089_S() && !sheepentity.func_70892_o() && !sheepentity.func_70631_g_()) { +- sheepentity.func_213612_dV(); ++ for(net.minecraft.entity.Entity entity : world.func_175674_a(null, new AxisAlignedBB(blockpos), e -> !e.func_175149_v() && e instanceof net.minecraftforge.common.IShearable)) { ++ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; ++ if (target.isShearable(p_82487_2_, world, blockpos)) { ++ java.util.List drops = target.onSheared(p_82487_2_, entity.field_70170_p, blockpos, ++ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantments.field_185308_t, p_82487_2_)); ++ java.util.Random rand = new java.util.Random(); ++ drops.forEach(d -> { ++ net.minecraft.entity.item.ItemEntity ent = entity.func_70099_a(p_82487_2_, 1.0F); ++ ent.func_213317_d(ent.func_213322_ci().func_72441_c((double)((rand.nextFloat() - rand.nextFloat()) * 0.1F), (double)(rand.nextFloat() * 0.05F), (double)((rand.nextFloat() - rand.nextFloat()) * 0.1F))); ++ }); + if (p_82487_2_.func_96631_a(1, world.field_73012_v, (ServerPlayerEntity)null)) { + p_82487_2_.func_190920_e(0); + } diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index 7db706c8b..bee3bcbde 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/enchantment/Enchantment.java +++ b/net/minecraft/enchantment/Enchantment.java -@@ -18,7 +18,7 @@ +@@ -17,7 +17,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -public abstract class Enchantment { +public abstract class Enchantment extends net.minecraftforge.registries.ForgeRegistryEntry { - private final EntityEquipmentSlot[] field_185263_a; + private final EquipmentSlotType[] field_185263_a; private final Enchantment.Rarity field_77333_a; @Nullable -@@ -115,7 +115,7 @@ +@@ -110,7 +110,7 @@ } public boolean func_92089_a(ItemStack p_92089_1_) { @@ -17,8 +17,8 @@ + return canApplyAtEnchantingTable(p_92089_1_); } - public void func_151368_a(EntityLivingBase p_151368_1_, Entity p_151368_2_, int p_151368_3_) { -@@ -132,6 +132,24 @@ + public void func_151368_a(LivingEntity p_151368_1_, Entity p_151368_2_, int p_151368_3_) { +@@ -127,12 +127,31 @@ return false; } @@ -40,6 +40,13 @@ + return true; + } + - public static void func_185257_f() { - EntityEquipmentSlot[] aentityequipmentslot = new EntityEquipmentSlot[]{EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET}; - func_210770_a("protection", new EnchantmentProtection(Enchantment.Rarity.COMMON, EnchantmentProtection.Type.ALL, aentityequipmentslot)); + public static enum Rarity { + COMMON(30), + UNCOMMON(10), + RARE(3), + VERY_RARE(1); + ++ + private final int field_185275_e; + + private Rarity(int p_i47026_3_) { diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentFrostWalker.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentFrostWalker.java.patch deleted file mode 100644 index efdca145d..000000000 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentFrostWalker.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/enchantment/EnchantmentFrostWalker.java -+++ b/net/minecraft/enchantment/EnchantmentFrostWalker.java -@@ -44,7 +44,8 @@ - IBlockState iblockstate1 = p_185266_1_.func_180495_p(blockpos$mutableblockpos); - if (iblockstate1.func_196958_f()) { - IBlockState iblockstate2 = p_185266_1_.func_180495_p(blockpos$mutableblockpos1); -- if (iblockstate2.func_185904_a() == Material.field_151586_h && iblockstate2.func_177229_b(BlockFlowingFluid.field_176367_b) == 0 && iblockstate.func_196955_c(p_185266_1_, blockpos$mutableblockpos1) && p_185266_1_.func_195584_a(iblockstate, blockpos$mutableblockpos1)) { -+ boolean isFull = iblockstate2.func_177230_c() == Blocks.field_150355_j && iblockstate2.func_177229_b(BlockFlowingFluid.field_176367_b) == 0; //TODO: Forge, modded waters? -+ if (iblockstate2.func_185904_a() == Material.field_151586_h && isFull && iblockstate.func_196955_c(p_185266_1_, blockpos$mutableblockpos1) && p_185266_1_.func_195584_a(iblockstate, blockpos$mutableblockpos1) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(p_185266_0_, new net.minecraftforge.common.util.BlockSnapshot(p_185266_1_, blockpos$mutableblockpos1.func_185334_h(), iblockstate2), net.minecraft.util.EnumFacing.UP)) { - p_185266_1_.func_175656_a(blockpos$mutableblockpos1, iblockstate); - p_185266_1_.func_205220_G_().func_205360_a(blockpos$mutableblockpos1.func_185334_h(), Blocks.field_185778_de, MathHelper.func_76136_a(p_185266_0_.func_70681_au(), 60, 120)); - } diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 84c1132f5..8ecce0382 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/enchantment/EnchantmentHelper.java +++ b/net/minecraft/enchantment/EnchantmentHelper.java -@@ -258,7 +258,7 @@ +@@ -257,7 +257,7 @@ public static int func_77514_a(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) { Item item = p_77514_3_.func_77973_b(); @@ -9,7 +9,7 @@ if (i <= 0) { return 0; } else { -@@ -296,7 +296,7 @@ +@@ -295,7 +295,7 @@ public static List func_77513_b(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_, boolean p_77513_3_) { List list = Lists.newArrayList(); Item item = p_77513_1_.func_77973_b(); @@ -18,12 +18,12 @@ if (i <= 0) { return list; } else { -@@ -349,7 +349,7 @@ +@@ -354,7 +354,7 @@ boolean flag = p_185291_1_.func_77973_b() == Items.field_151122_aG; - for(Enchantment enchantment : IRegistry.field_212628_q) { + for(Enchantment enchantment : Registry.field_212628_q) { - if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.field_77351_y.func_77557_a(item) || flag)) { + if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.canApplyAtEnchantingTable(p_185291_1_) || (flag && enchantment.isAllowedOnBooks()))) { for(int i = enchantment.func_77325_b(); i > enchantment.func_77319_d() - 1; --i) { - if (p_185291_0_ >= enchantment.func_77321_a(i) && p_185291_0_ <= enchantment.func_77317_b(i)) { + if (p_185291_0_ >= enchantment.func_77321_a(i)) { list.add(new EnchantmentData(enchantment, i)); diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentType.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentType.java.patch new file mode 100644 index 000000000..050831318 --- /dev/null +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentType.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/enchantment/EnchantmentType.java ++++ b/net/minecraft/enchantment/EnchantmentType.java +@@ -14,7 +14,7 @@ + import net.minecraft.item.ToolItem; + import net.minecraft.item.TridentItem; + +-public enum EnchantmentType { ++public enum EnchantmentType implements net.minecraftforge.common.IExtensibleEnum { + ALL { + public boolean func_77557_a(Item p_77557_1_) { + for(EnchantmentType enchantmenttype : EnchantmentType.values()) { +@@ -96,5 +96,16 @@ + private EnchantmentType() { + } + +- public abstract boolean func_77557_a(Item p_77557_1_); ++ private java.util.function.Predicate delegate; ++ private EnchantmentType(java.util.function.Predicate delegate) { ++ this.delegate = delegate; ++ } ++ ++ public static EnchantmentType create(String name, java.util.function.Predicate delegate) { ++ throw new IllegalStateException("Enum not extended"); ++ } ++ ++ public boolean func_77557_a(Item p_77557_1_) { ++ return this.delegate == null ? false : this.delegate.test(p_77557_1_); ++ } + } diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantments.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantments.java.patch new file mode 100644 index 000000000..eb13c7017 --- /dev/null +++ b/patches/minecraft/net/minecraft/enchantment/Enchantments.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/enchantment/Enchantments.java ++++ b/net/minecraft/enchantment/Enchantments.java +@@ -3,6 +3,7 @@ + import net.minecraft.inventory.EquipmentSlotType; + import net.minecraft.util.registry.Registry; + ++@net.minecraftforge.registries.ObjectHolder("minecraft") + public class Enchantments { + private static final EquipmentSlotType[] field_222195_L = new EquipmentSlotType[]{EquipmentSlotType.HEAD, EquipmentSlotType.CHEST, EquipmentSlotType.LEGS, EquipmentSlotType.FEET}; + public static final Enchantment field_180310_c = func_222191_a("protection", new ProtectionEnchantment(Enchantment.Rarity.COMMON, ProtectionEnchantment.Type.ALL, field_222195_L)); diff --git a/patches/minecraft/net/minecraft/enchantment/EnumEnchantmentType.java.patch b/patches/minecraft/net/minecraft/enchantment/EnumEnchantmentType.java.patch deleted file mode 100644 index 0232f4292..000000000 --- a/patches/minecraft/net/minecraft/enchantment/EnumEnchantmentType.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/net/minecraft/enchantment/EnumEnchantmentType.java -+++ b/net/minecraft/enchantment/EnumEnchantmentType.java -@@ -13,7 +13,7 @@ - import net.minecraft.item.ItemTool; - import net.minecraft.item.ItemTrident; - --public enum EnumEnchantmentType { -+public enum EnumEnchantmentType implements net.minecraftforge.common.IExtensibleEnum { - ALL { - public boolean func_77557_a(Item p_77557_1_) { - for(EnumEnchantmentType enumenchantmenttype : EnumEnchantmentType.values()) { -@@ -90,5 +90,16 @@ - private EnumEnchantmentType() { - } - -- public abstract boolean func_77557_a(Item p_77557_1_); -+ private java.util.function.Predicate delegate; -+ private EnumEnchantmentType(java.util.function.Predicate delegate) { -+ this.delegate = delegate; -+ } -+ -+ public static EnumEnchantmentType create(String name, java.util.function.Predicate delegate) { -+ throw new IllegalStateException("Enum not extended"); -+ } -+ -+ public boolean func_77557_a(Item p_77557_1_) { -+ return this.delegate == null ? false : this.delegate.test(p_77557_1_); -+ } - } diff --git a/patches/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch new file mode 100644 index 000000000..aca17f7fd --- /dev/null +++ b/patches/minecraft/net/minecraft/enchantment/FrostWalkerEnchantment.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/enchantment/FrostWalkerEnchantment.java ++++ b/net/minecraft/enchantment/FrostWalkerEnchantment.java +@@ -38,9 +38,10 @@ + if (blockpos.func_218137_a(p_185266_0_.func_213303_ch(), (double)f)) { + blockpos$mutableblockpos.func_181079_c(blockpos.func_177958_n(), blockpos.func_177956_o() + 1, blockpos.func_177952_p()); + BlockState blockstate1 = p_185266_1_.func_180495_p(blockpos$mutableblockpos); +- if (blockstate1.func_196958_f()) { ++ if (blockstate1.isAir(p_185266_1_, blockpos$mutableblockpos)) { + BlockState blockstate2 = p_185266_1_.func_180495_p(blockpos); +- if (blockstate2.func_185904_a() == Material.field_151586_h && blockstate2.func_177229_b(FlowingFluidBlock.field_176367_b) == 0 && blockstate.func_196955_c(p_185266_1_, blockpos) && p_185266_1_.func_217350_a(blockstate, blockpos, ISelectionContext.func_216377_a())) { ++ boolean isFull = blockstate2.func_177230_c() == Blocks.field_150355_j && blockstate2.func_177229_b(FlowingFluidBlock.field_176367_b) == 0; //TODO: Forge, modded waters? ++ if (blockstate2.func_185904_a() == Material.field_151586_h && isFull && blockstate.func_196955_c(p_185266_1_, blockpos) && p_185266_1_.func_217350_a(blockstate, blockpos, ISelectionContext.func_216377_a()) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(p_185266_0_, new net.minecraftforge.common.util.BlockSnapshot(p_185266_1_, blockpos, blockstate2), net.minecraft.util.Direction.UP)) { + p_185266_1_.func_175656_a(blockpos, blockstate); + p_185266_1_.func_205220_G_().func_205360_a(blockpos, Blocks.field_185778_de, MathHelper.func_76136_a(p_185266_0_.func_70681_au(), 60, 120)); + } diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 65acef178..7e85ffbd4 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -1,46 +1,48 @@ --- a/net/minecraft/entity/Entity.java +++ b/net/minecraft/entity/Entity.java -@@ -97,12 +97,13 @@ +@@ -103,12 +103,13 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public abstract class Entity implements INameable, ICommandSource { +public abstract class Entity extends net.minecraftforge.common.capabilities.CapabilityProvider implements INameable, ICommandSource, net.minecraftforge.common.extensions.IForgeEntity { protected static final Logger field_184243_a = LogManager.getLogger(); + private static final AtomicInteger field_213331_b = new AtomicInteger(); private static final List field_190535_b = Collections.emptyList(); private static final AxisAlignedBB field_174836_a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); private static double field_70155_l = 1.0D; - private static int field_70152_a; + @Deprecated // Forge: Use the getter to allow overriding in mods private final EntityType field_200606_g; - private int field_145783_c; + private int field_145783_c = field_213331_b.incrementAndGet(); public boolean field_70156_m; -@@ -132,6 +133,7 @@ +@@ -135,6 +136,7 @@ + public boolean field_70132_H; public boolean field_70133_I; - protected boolean field_70134_J; - private boolean field_174835_g; + protected Vec3d field_213328_B = Vec3d.field_186680_a; + @Deprecated //Forge: Use isAlive, remove(boolean) and revive() instead of directly accessing this field. To allow the entity to react to and better control this information. public boolean field_70128_L; - public float field_70130_N; - public float field_70131_O; -@@ -192,6 +194,7 @@ - private long field_191506_aJ; + public float field_70141_P; + public float field_70140_Q; +@@ -196,6 +198,7 @@ + private float field_213326_aJ; public Entity(EntityType p_i48580_1_, World p_i48580_2_) { + super(Entity.class); - this.field_145783_c = field_70152_a++; - this.field_184244_h = Lists.newArrayList(); - this.field_70121_D = field_174836_a; -@@ -221,6 +224,8 @@ - this.field_70180_af.func_187214_a(field_184234_aB, false); + this.field_200606_g = p_i48580_1_; + this.field_70170_p = p_i48580_2_; + this.field_213325_aI = p_i48580_1_.func_220334_j(); +@@ -213,7 +216,9 @@ this.field_70180_af.func_187214_a(field_189655_aD, false); + this.field_70180_af.func_187214_a(field_213330_X, Pose.STANDING); this.func_70088_a(); +- this.field_213326_aJ = this.func_213316_a(Pose.STANDING, this.field_213325_aI); ++ this.field_213326_aJ = getEyeHeightForge(Pose.STANDING, this.field_213325_aI); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); + this.gatherCapabilities(); } - public EntityType func_200600_R() { -@@ -289,7 +294,13 @@ + public boolean func_175149_v() { +@@ -302,7 +307,13 @@ } public void func_70106_y() { @@ -53,131 +55,131 @@ + this.invalidateCaps(); } - public void func_184174_b(boolean p_184174_1_) { -@@ -324,6 +335,7 @@ + protected void func_213301_b(Pose p_213301_1_) { +@@ -322,6 +333,7 @@ this.field_70165_t = p_70107_1_; this.field_70163_u = p_70107_3_; this.field_70161_v = p_70107_5_; -+ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K) this.field_70170_p.func_72866_a(this, false); // Forge - Process chunk registration after moving. - float f = this.field_70130_N / 2.0F; - float f1 = this.field_70131_O; ++ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K && field_70170_p instanceof ServerWorld) ((ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. + float f = this.field_213325_aI.field_220315_a / 2.0F; + float f1 = this.field_213325_aI.field_220316_b; this.func_174826_a(new AxisAlignedBB(p_70107_1_ - (double)f, p_70107_3_, p_70107_5_ - (double)f, p_70107_1_ + (double)f, p_70107_3_ + (double)f1, p_70107_5_ + (double)f)); -@@ -697,7 +709,7 @@ - int k1 = MathHelper.func_76128_c(this.field_70161_v); - BlockPos blockpos = new BlockPos(j1, k, k1); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); -- if (iblockstate.func_196958_f()) { -+ if (iblockstate.isAir(this.field_70170_p, blockpos)) { +@@ -487,7 +499,7 @@ + int k = MathHelper.func_76128_c(this.field_70161_v); + BlockPos blockpos = new BlockPos(i, j, k); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(this.field_70170_p, blockpos)) { BlockPos blockpos1 = blockpos.func_177977_b(); - IBlockState iblockstate1 = this.field_70170_p.func_180495_p(blockpos1); - Block block1 = iblockstate1.func_177230_c(); -@@ -735,7 +747,7 @@ + BlockState blockstate1 = this.field_70170_p.func_180495_p(blockpos1); + Block block = blockstate1.func_177230_c(); +@@ -526,7 +538,7 @@ - this.field_70140_Q = (float)((double)this.field_70140_Q + (double)MathHelper.func_76133_a(d21 * d21 + d23 * d23) * 0.6D); - this.field_82151_R = (float)((double)this.field_82151_R + (double)MathHelper.func_76133_a(d21 * d21 + d22 * d22 + d23 * d23) * 0.6D); -- if (this.field_82151_R > this.field_70150_b && !iblockstate.func_196958_f()) { -+ if (this.field_82151_R > this.field_70150_b && !iblockstate.isAir(this.field_70170_p, blockpos)) { + this.field_70140_Q = (float)((double)this.field_70140_Q + (double)MathHelper.func_76133_a(func_213296_b(vec3d)) * 0.6D); + this.field_82151_R = (float)((double)this.field_82151_R + (double)MathHelper.func_76133_a(d2 * d2 + d0 * d0 + d1 * d1) * 0.6D); +- if (this.field_82151_R > this.field_70150_b && !blockstate.func_196958_f()) { ++ if (this.field_82151_R > this.field_70150_b && !blockstate.isAir(this.field_70170_p, blockpos)) { this.field_70150_b = this.func_203009_ad(); if (this.func_70090_H()) { Entity entity = this.func_184207_aI() && this.func_184179_bs() != null ? this.func_184179_bs() : this; -@@ -749,7 +761,7 @@ +@@ -541,7 +553,7 @@ } else { - this.func_180429_a(blockpos, iblockstate); + this.func_180429_a(blockpos, blockstate); } -- } else if (this.field_82151_R > this.field_191959_ay && this.func_191957_ae() && iblockstate.func_196958_f()) { -+ } else if (this.field_82151_R > this.field_191959_ay && this.func_191957_ae() && iblockstate.isAir(this.field_70170_p, blockpos)) { +- } else if (this.field_82151_R > this.field_191959_ay && this.func_191957_ae() && blockstate.func_196958_f()) { ++ } else if (this.field_82151_R > this.field_191959_ay && this.func_191957_ae() && blockstate.isAir(this.field_70170_p, blockpos)) { this.field_191959_ay = this.func_191954_d(this.field_82151_R); } } -@@ -795,6 +807,7 @@ +@@ -743,6 +755,7 @@ this.field_70165_t = (axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D; this.field_70163_u = axisalignedbb.field_72338_b; this.field_70161_v = (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D; -+ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K) this.field_70170_p.func_72866_a(this, false); // Forge - Process chunk registration after moving. ++ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K && field_70170_p instanceof ServerWorld) ((ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. } protected SoundEvent func_184184_Z() { -@@ -846,7 +859,7 @@ - - protected void func_180429_a(BlockPos p_180429_1_, IBlockState p_180429_2_) { +@@ -795,7 +808,7 @@ + protected void func_180429_a(BlockPos p_180429_1_, BlockState p_180429_2_) { if (!p_180429_2_.func_185904_a().func_76224_d()) { -- SoundType soundtype = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()).func_177230_c() == Blocks.field_150433_aE ? Blocks.field_150433_aE.func_185467_w() : p_180429_2_.func_177230_c().func_185467_w(); -+ SoundType soundtype = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()).func_177230_c() == Blocks.field_150433_aE ? Blocks.field_150433_aE.func_185467_w() : p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this); + BlockState blockstate = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()); +- SoundType soundtype = blockstate.func_177230_c() == Blocks.field_150433_aE ? blockstate.func_215695_r() : p_180429_2_.func_215695_r(); ++ SoundType soundtype = blockstate.func_177230_c() == Blocks.field_150433_aE ? blockstate.func_215695_r() : p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this); this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b()); } } -@@ -1041,6 +1054,7 @@ +@@ -991,6 +1004,7 @@ int k = MathHelper.func_76128_c(this.field_70161_v); BlockPos blockpos = new BlockPos(i, j, k); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); -+ if (!iblockstate.addRunningEffects(field_70170_p, blockpos, this)) - if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) { - this.field_70170_p.func_195594_a(new BlockParticleData(Particles.field_197611_d, iblockstate), this.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, this.func_174813_aQ().field_72338_b + 0.1D, this.field_70161_v + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, -this.field_70159_w * 4.0D, 1.5D, -this.field_70179_y * 4.0D); - } -@@ -1054,7 +1068,7 @@ - double d0 = this.field_70163_u + (double)this.func_70047_e(); - BlockPos blockpos = new BlockPos(this.field_70165_t, d0, this.field_70161_v); - IFluidState ifluidstate = this.field_70170_p.func_204610_c(blockpos); -- return ifluidstate.func_206884_a(p_208600_1_) && d0 < (double)((float)blockpos.func_177956_o() + ifluidstate.func_206885_f() + 0.11111111F); -+ return ifluidstate.isEntityInside(field_70170_p, blockpos, this, d0, p_208600_1_, true); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); ++ if (!blockstate.addRunningEffects(field_70170_p, blockpos, this)) + if (blockstate.func_185901_i() != BlockRenderType.INVISIBLE) { + Vec3d vec3d = this.func_213322_ci(); + this.field_70170_p.func_195594_a(new BlockParticleData(ParticleTypes.field_197611_d, blockstate), this.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, this.field_70163_u + 0.1D, this.field_70161_v + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_213325_aI.field_220315_a, vec3d.field_72450_a * -4.0D, 1.5D, vec3d.field_72449_c * -4.0D); +@@ -1012,7 +1026,7 @@ + return false; + } else { + IFluidState ifluidstate = this.field_70170_p.func_204610_c(blockpos); +- return ifluidstate.func_206884_a(p_213290_1_) && d0 < (double)((float)blockpos.func_177956_o() + ifluidstate.func_215679_a(this.field_70170_p, blockpos) + 0.11111111F); ++ return ifluidstate.isEntityInside(field_70170_p, blockpos, this, d0, p_213290_1_, true); + } } } - -@@ -1123,6 +1137,7 @@ +@@ -1083,6 +1097,7 @@ this.field_70126_B -= 360.0F; } -+ if (!this.field_70170_p.field_72995_K) this.field_70170_p.func_72964_e((int) Math.floor(this.field_70165_t) >> 4, (int) Math.floor(this.field_70161_v) >> 4); // Forge - ensure target chunk is loaded. ++ if (!this.field_70170_p.field_72995_K) this.field_70170_p.func_212866_a_((int) Math.floor(this.field_70165_t) >> 4, (int) Math.floor(this.field_70161_v) >> 4); // Forge - ensure target chunk is loaded. this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); this.func_70101_b(p_70080_7_, p_70080_8_); } -@@ -1371,6 +1386,7 @@ +@@ -1319,6 +1334,7 @@ if (this.field_184238_ar) { p_189511_1_.func_74757_a("Glowing", this.field_184238_ar); } + p_189511_1_.func_74757_a("CanUpdate", canUpdate); if (!this.field_184236_aF.isEmpty()) { - NBTTagList nbttaglist = new NBTTagList(); -@@ -1382,6 +1398,10 @@ - p_189511_1_.func_74782_a("Tags", nbttaglist); + ListNBT listnbt = new ListNBT(); +@@ -1330,6 +1346,10 @@ + p_189511_1_.func_218657_a("Tags", listnbt); } -+ NBTTagCompound caps = serializeCaps(); -+ if (caps != null) p_189511_1_.func_74782_a("ForgeCaps", caps); -+ if (entityData != null) p_189511_1_.func_74782_a("ForgeData", entityData); ++ CompoundNBT caps = serializeCaps(); ++ if (caps != null) p_189511_1_.func_218657_a("ForgeCaps", caps); ++ if (entityData != null) p_189511_1_.func_218657_a("ForgeData", entityData); + - this.func_70014_b(p_189511_1_); + this.func_213281_b(p_189511_1_); if (this.func_184207_aI()) { - NBTTagList nbttaglist1 = new NBTTagList(); -@@ -1467,6 +1487,9 @@ - this.func_174810_b(p_70020_1_.func_74767_n("Silent")); - this.func_189654_d(p_70020_1_.func_74767_n("NoGravity")); - this.func_184195_f(p_70020_1_.func_74767_n("Glowing")); -+ if (p_70020_1_.func_150297_b("ForgeData", 10)) entityData = p_70020_1_.func_74775_l("ForgeData"); -+ if (p_70020_1_.func_150297_b("CanUpdate", 99)) this.canUpdate(p_70020_1_.func_74767_n("CanUpdate")); -+ if (p_70020_1_.func_150297_b("ForgeCaps", 10)) deserializeCaps(p_70020_1_.func_74775_l("ForgeCaps")); - if (p_70020_1_.func_150297_b("Tags", 9)) { - this.field_184236_aF.clear(); - NBTTagList nbttaglist1 = p_70020_1_.func_150295_c("Tags", 8); -@@ -1547,6 +1570,8 @@ + ListNBT listnbt1 = new ListNBT(); +@@ -1406,6 +1426,9 @@ + this.func_174810_b(p_70020_1_.func_74767_n("Silent")); + this.func_189654_d(p_70020_1_.func_74767_n("NoGravity")); + this.func_184195_f(p_70020_1_.func_74767_n("Glowing")); ++ if (p_70020_1_.func_150297_b("ForgeData", 10)) entityData = p_70020_1_.func_74775_l("ForgeData"); ++ if (p_70020_1_.func_150297_b("CanUpdate", 99)) this.canUpdate(p_70020_1_.func_74767_n("CanUpdate")); ++ if (p_70020_1_.func_150297_b("ForgeCaps", 10)) deserializeCaps(p_70020_1_.func_74775_l("ForgeCaps")); + if (p_70020_1_.func_150297_b("Tags", 9)) { + this.field_184236_aF.clear(); + ListNBT listnbt1 = p_70020_1_.func_150295_c("Tags", 8); +@@ -1494,6 +1517,8 @@ } else { - EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_); - entityitem.func_174869_p(); -+ if (captureDrops() != null) captureDrops().add(entityitem); + ItemEntity itementity = new ItemEntity(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_); + itementity.func_174869_p(); ++ if (captureDrops() != null) captureDrops().add(itementity); + else - this.field_70170_p.func_72838_d(entityitem); - return entityitem; + this.field_70170_p.func_217376_c(itementity); + return itementity; } -@@ -1596,6 +1621,7 @@ - this.field_70159_w = 0.0D; - this.field_70181_x = 0.0D; - this.field_70179_y = 0.0D; -+ if (canUpdate()) - this.func_70071_h_(); - if (this.func_184218_aH()) { - entity.func_184232_k(this); -@@ -1637,6 +1663,7 @@ +@@ -1537,6 +1562,7 @@ + + public void func_70098_U() { + this.func_213317_d(Vec3d.field_186680_a); ++ if (canUpdate()) + this.func_70071_h_(); + if (this.func_184218_aH()) { + this.func_184187_bx().func_184232_k(this); +@@ -1577,6 +1603,7 @@ } } @@ -185,7 +187,7 @@ if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) { if (this.func_184218_aH()) { this.func_184210_p(); -@@ -1664,6 +1691,7 @@ +@@ -1608,6 +1635,7 @@ public void func_184210_p() { if (this.field_184239_as != null) { Entity entity = this.field_184239_as; @@ -193,7 +195,7 @@ this.field_184239_as = null; entity.func_184225_p(this); } -@@ -1790,6 +1818,7 @@ +@@ -1758,6 +1786,7 @@ return !this.func_184188_bt().isEmpty(); } @@ -201,7 +203,7 @@ public boolean func_205710_ba() { return true; } -@@ -1991,7 +2020,7 @@ +@@ -1956,7 +1985,7 @@ func_207712_c(itextcomponent1); return itextcomponent1; } else { @@ -210,88 +212,64 @@ } } -@@ -2054,6 +2083,14 @@ +@@ -2014,6 +2043,7 @@ @Nullable public Entity func_212321_a(DimensionType p_212321_1_) { -+ if (this.field_70170_p.field_72995_K || this.field_70128_L) return null; -+ return changeDimension(p_212321_1_, this.func_184102_h().func_71218_a(p_212321_1_).func_85176_s()); -+ } -+ -+ @Nullable -+ @Override -+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { + if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_212321_1_)) return null; if (!this.field_70170_p.field_72995_K && !this.field_70128_L) { - this.field_70170_p.field_72984_F.func_76320_a("changeDimension"); + this.field_70170_p.func_217381_Z().func_76320_a("changeDimension"); MinecraftServer minecraftserver = this.func_184102_h(); -@@ -2061,25 +2098,25 @@ - WorldServer worldserver = minecraftserver.func_71218_a(dimensiontype); - WorldServer worldserver1 = minecraftserver.func_71218_a(p_212321_1_); - this.field_71093_bK = p_212321_1_; -- if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END) { -+ if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END && teleporter.isVanilla()) { - worldserver1 = minecraftserver.func_71218_a(DimensionType.OVERWORLD); - this.field_71093_bK = DimensionType.OVERWORLD; - } - -- this.field_70170_p.func_72900_e(this); -- this.field_70128_L = false; -+ this.field_70170_p.removeEntity(this, true); //Forge: Keep data until we copy. -+ this.revive(); - this.field_70170_p.field_72984_F.func_76320_a("reposition"); - BlockPos blockpos; -- if (p_212321_1_ == DimensionType.THE_END) { -+ if (p_212321_1_ == DimensionType.THE_END && teleporter.isVanilla()) { - blockpos = worldserver1.func_180504_m(); +@@ -2031,17 +2061,9 @@ + } else if (p_212321_1_ == DimensionType.THE_END) { + blockpos = serverworld1.func_180504_m(); } else { - double d0 = this.field_70165_t; - double d1 = this.field_70161_v; - double d2 = 8.0D; -- if (p_212321_1_ == DimensionType.NETHER) { -+ double moveFactor = worldserver.field_73011_w.getMovementFactor() / worldserver1.field_73011_w.getMovementFactor(); -+ double d0 = MathHelper.func_151237_a(this.field_70165_t * moveFactor, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D); -+ double d1 = MathHelper.func_151237_a(this.field_70161_v * moveFactor, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D); -+ if (false && p_212321_1_ == DimensionType.NETHER) { - d0 = MathHelper.func_151237_a(d0 / 8.0D, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D); - d1 = MathHelper.func_151237_a(d1 / 8.0D, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D); -- } else if (p_212321_1_ == DimensionType.OVERWORLD) { -+ } else if (false && p_212321_1_ == DimensionType.OVERWORLD) { - d0 = MathHelper.func_151237_a(d0 * 8.0D, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D); - d1 = MathHelper.func_151237_a(d1 * 8.0D, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D); - } -@@ -2088,8 +2125,7 @@ - d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872); - float f = this.field_70177_z; - this.func_70012_b(d0, this.field_70163_u, d1, 90.0F, 0.0F); -- Teleporter teleporter = worldserver1.func_85176_s(); -- teleporter.func_180620_b(this, f); -+ teleporter.placeEntity(worldserver1, this, f); - blockpos = new BlockPos(this); - } - -@@ -2098,7 +2134,7 @@ - Entity entity = this.func_200600_R().func_200721_a(worldserver1); - if (entity != null) { - entity.func_180432_n(this); -- if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END) { -+ if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END && teleporter.isVanilla()) { - BlockPos blockpos1 = worldserver1.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.func_175694_M()); - entity.func_174828_a(blockpos1, entity.field_70177_z, entity.field_70125_A); - } else { -@@ -2112,7 +2148,7 @@ - worldserver1.func_72866_a(entity, false); +- if (dimensiontype == DimensionType.OVERWORLD && p_212321_1_ == DimensionType.NETHER) { +- d0 /= 8.0D; +- d1 /= 8.0D; +- } else if (dimensiontype == DimensionType.NETHER && p_212321_1_ == DimensionType.OVERWORLD) { +- d0 *= 8.0D; +- d1 *= 8.0D; +- } +- ++ double movementFactor = serverworld.func_201675_m().getMovementFactor() / serverworld1.func_201675_m().getMovementFactor(); ++ double d0 = this.field_70165_t * movementFactor; ++ double d1 = this.field_70161_v * movementFactor; + double d3 = Math.min(-2.9999872E7D, serverworld1.func_175723_af().func_177726_b() + 16.0D); + double d4 = Math.min(-2.9999872E7D, serverworld1.func_175723_af().func_177736_c() + 16.0D); + double d5 = Math.min(2.9999872E7D, serverworld1.func_175723_af().func_177728_d() - 16.0D); +@@ -2069,7 +2091,6 @@ + serverworld1.func_217460_e(entity); } - this.field_70128_L = true; -+ this.remove(false); //Forge: now invalidate old entity - this.field_70170_p.field_72984_F.func_76319_b(); - worldserver.func_82742_i(); - worldserver1.func_82742_i(); -@@ -2592,4 +2628,63 @@ - public double func_212107_bY() { + this.field_70170_p.func_217381_Z().func_76319_b(); + serverworld.func_82742_i(); + serverworld1.func_82742_i(); +@@ -2225,7 +2246,7 @@ + Pose pose = this.func_213283_Z(); + EntitySize entitysize1 = this.func_213305_a(pose); + this.field_213325_aI = entitysize1; +- this.field_213326_aJ = this.func_213316_a(pose, entitysize1); ++ this.field_213326_aJ = getEyeHeightForge(pose, entitysize1); + if (entitysize1.field_220315_a < entitysize.field_220315_a) { + double d0 = (double)entitysize1.field_220315_a / 2.0D; + this.func_174826_a(new AxisAlignedBB(this.field_70165_t - d0, this.field_70163_u, this.field_70161_v - d0, this.field_70165_t + d0, this.field_70163_u + (double)entitysize1.field_220316_b, this.field_70161_v + d0)); +@@ -2592,6 +2613,7 @@ return this.field_211517_W; } + ++ + public final float func_213311_cf() { + return this.field_213325_aI.field_220315_a; + } +@@ -2621,4 +2643,69 @@ + public void func_213293_j(double p_213293_1_, double p_213293_3_, double p_213293_5_) { + this.func_213317_d(new Vec3d(p_213293_1_, p_213293_3_, p_213293_5_)); + } + + /* ================================== Forge Start =====================================*/ + @@ -304,30 +282,30 @@ + public boolean canUpdate() { + return this.canUpdate; + } -+ private Collection captureDrops = null; ++ private Collection captureDrops = null; + @Override -+ public Collection captureDrops() { ++ public Collection captureDrops() { + return captureDrops; + } + @Override -+ public Collection captureDrops(Collection value) { -+ Collection ret = captureDrops; ++ public Collection captureDrops(Collection value) { ++ Collection ret = captureDrops; + this.captureDrops = value; + return ret; + } -+ private NBTTagCompound entityData; ++ private CompoundNBT entityData; + @Override -+ public NBTTagCompound getEntityData() { ++ public CompoundNBT getEntityData() { + if (entityData == null) -+ entityData = new NBTTagCompound(); ++ entityData = new CompoundNBT(); + return entityData; + } + @Override -+ public boolean canTrample(IBlockState state, BlockPos pos, float fallDistance) { ++ public boolean canTrample(BlockState state, BlockPos pos, float fallDistance) { + return field_70170_p.field_73012_v.nextFloat() < fallDistance - 0.5F -+ && this instanceof EntityLivingBase -+ && (this instanceof EntityPlayer || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(field_70170_p, this)) -+ && this.field_70130_N * this.field_70130_N * this.field_70131_O > 0.512F; ++ && this instanceof LivingEntity ++ && (this instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(field_70170_p, this)) ++ && this.func_213311_cf() * this.func_213311_cf() * this.func_213302_cg() > 0.512F; + } + + /** @@ -350,5 +328,11 @@ + public void revive() { + this.field_70128_L = false; + this.reviveCaps(); ++ } ++ ++ private float getEyeHeightForge(Pose pose, EntitySize size) { ++ net.minecraftforge.event.entity.EntityEvent.EyeHeight evt = new net.minecraftforge.event.entity.EntityEvent.EyeHeight(this, pose, size, this.func_213316_a(pose, size)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(evt); ++ return evt.getNewHeight(); + } } diff --git a/patches/minecraft/net/minecraft/entity/EntityClassification.java.patch b/patches/minecraft/net/minecraft/entity/EntityClassification.java.patch new file mode 100644 index 000000000..0e2aa4040 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityClassification.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/entity/EntityClassification.java ++++ b/net/minecraft/entity/EntityClassification.java +@@ -4,7 +4,7 @@ + import java.util.Map; + import java.util.stream.Collectors; + +-public enum EntityClassification { ++public enum EntityClassification implements net.minecraftforge.common.IExtensibleEnum { + MONSTER("monster", 70, false, false), + CREATURE("creature", 10, true, true), + AMBIENT("ambient", 15, true, false), +@@ -41,4 +41,8 @@ + public boolean func_82705_e() { + return this.field_82707_i; + } ++ ++ public static EntityClassification create(String name, String p_i50381_3_, int p_i50381_4_, boolean p_i50381_5_, boolean p_i50381_6_) { ++ throw new IllegalStateException("Enum not extended"); ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/EntityFlying.java.patch b/patches/minecraft/net/minecraft/entity/EntityFlying.java.patch deleted file mode 100644 index 16196da33..000000000 --- a/patches/minecraft/net/minecraft/entity/EntityFlying.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/entity/EntityFlying.java -+++ b/net/minecraft/entity/EntityFlying.java -@@ -32,14 +32,16 @@ - } else { - float f = 0.91F; - if (this.field_70122_E) { -- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().func_208618_m() * 0.91F; -+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v)); -+ f = this.field_70170_p.func_180495_p(underPos).getSlipperiness(field_70170_p, underPos, this) * 0.91F; - } - - float f1 = 0.16277137F / (f * f * f); - this.func_191958_b(p_191986_1_, p_191986_2_, p_191986_3_, this.field_70122_E ? 0.1F * f1 : 0.02F); - f = 0.91F; - if (this.field_70122_E) { -- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().func_208618_m() * 0.91F; -+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v)); -+ f = this.field_70170_p.func_180495_p(underPos).getSlipperiness(field_70170_p, underPos, this) * 0.91F; - } - - this.func_70091_d(MoverType.SELF, this.field_70159_w, this.field_70181_x, this.field_70179_y); diff --git a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch deleted file mode 100644 index 04869a756..000000000 --- a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/EntityHanging.java -+++ b/net/minecraft/entity/EntityHanging.java -@@ -117,6 +117,8 @@ - int j1 = (j - 1) / -2; - blockpos$mutableblockpos.func_189533_g(blockpos).func_189534_c(enumfacing, k + i1).func_189534_c(EnumFacing.UP, l + j1); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos$mutableblockpos); -+ if (iblockstate.func_193401_d(this.field_70170_p, blockpos$mutableblockpos, this.field_174860_b) == net.minecraft.block.state.BlockFaceShape.SOLID) -+ continue; - if (!iblockstate.func_185904_a().func_76220_a() && !BlockRedstoneDiode.func_185546_B(iblockstate)) { - return false; - } diff --git a/patches/minecraft/net/minecraft/entity/EntityLeashKnot.java.patch b/patches/minecraft/net/minecraft/entity/EntityLeashKnot.java.patch deleted file mode 100644 index bbfe697a2..000000000 --- a/patches/minecraft/net/minecraft/entity/EntityLeashKnot.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/entity/EntityLeashKnot.java -+++ b/net/minecraft/entity/EntityLeashKnot.java -@@ -38,6 +38,7 @@ - this.field_70165_t = (double)this.field_174861_a.func_177958_n() + 0.5D; - this.field_70163_u = (double)this.field_174861_a.func_177956_o() + 0.5D; - this.field_70161_v = (double)this.field_174861_a.func_177952_p() + 0.5D; -+ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K) this.field_70170_p.func_72866_a(this, false); // Forge - Process chunk registration after moving. - } - - public void func_174859_a(EnumFacing p_174859_1_) { diff --git a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch deleted file mode 100644 index 5a5a1321a..000000000 --- a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- a/net/minecraft/entity/EntityLiving.java -+++ b/net/minecraft/entity/EntityLiving.java -@@ -159,6 +159,7 @@ - - public void func_70624_b(@Nullable EntityLivingBase p_70624_1_) { - this.field_70696_bz = p_70624_1_; -+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); - } - - public boolean func_70686_a(Class p_70686_1_) { -@@ -472,7 +473,7 @@ - public void func_70636_d() { - super.func_70636_d(); - this.field_70170_p.field_72984_F.func_76320_a("looting"); -- if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && !this.field_70729_aU && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { -+ if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && !this.field_70729_aU && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { - for(EntityItem entityitem : this.field_70170_p.func_72872_a(EntityItem.class, this.func_174813_aQ().func_72314_b(1.0D, 0.0D, 1.0D))) { - if (!entityitem.field_70128_L && !entityitem.func_92059_d().func_190926_b() && !entityitem.func_174874_s()) { - this.func_175445_a(entityitem); -@@ -556,8 +557,14 @@ - } - - protected void func_70623_bb() { -+ net.minecraftforge.eventbus.api.Event.Result result = null; - if (this.field_82179_bU) { - this.field_70708_bq = 0; -+ } else if ((this.field_70708_bq & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.eventbus.api.Event.Result.DEFAULT) { -+ if (result == net.minecraftforge.eventbus.api.Event.Result.DENY) -+ this.field_70708_bq = 0; -+ else -+ this.func_70106_y(); - } else { - Entity entity = this.field_70170_p.func_72890_a(this, -1.0D); - if (entity != null) { -@@ -671,7 +678,6 @@ - return !p_205019_1_.func_72953_d(this.func_174813_aQ()) && p_205019_1_.func_195586_b(this, this.func_174813_aQ()) && p_205019_1_.func_195587_c(this, this.func_174813_aQ()); - } - -- @OnlyIn(Dist.CLIENT) - public float func_70603_bj() { - return 1.0F; - } -@@ -799,6 +805,8 @@ - } - - public static EntityEquipmentSlot func_184640_d(ItemStack p_184640_0_) { -+ final EntityEquipmentSlot slot = p_184640_0_.getEquipmentSlot(); -+ if (slot != null) return slot; // FORGE: Allow modders to set a non-default equipment slot for a stack; e.g. a non-armor chestplate-slot item - Item item = p_184640_0_.func_77973_b(); - if (item != Blocks.field_196625_cS.func_199767_j() && (!(item instanceof ItemBlock) || !(((ItemBlock)item).func_179223_d() instanceof BlockAbstractSkull))) { - if (item instanceof ItemArmor) { -@@ -806,7 +814,7 @@ - } else if (item == Items.field_185160_cR) { - return EntityEquipmentSlot.CHEST; - } else { -- return item == Items.field_185159_cQ ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND; -+ return p_184640_0_.isShield(null) ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND; - } - } else { - return EntityEquipmentSlot.HEAD; -@@ -1129,10 +1137,10 @@ - EntityPlayer entityplayer = (EntityPlayer)p_70652_1_; - ItemStack itemstack = this.func_184614_ca(); - ItemStack itemstack1 = entityplayer.func_184587_cr() ? entityplayer.func_184607_cu() : ItemStack.field_190927_a; -- if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.func_77973_b() instanceof ItemAxe && itemstack1.func_77973_b() == Items.field_185159_cQ) { -+ if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.canDisableShield(itemstack1, entityplayer, this) && itemstack1.isShield(entityplayer)) { - float f1 = 0.25F + (float)EnchantmentHelper.func_185293_e(this) * 0.05F; - if (this.field_70146_Z.nextFloat() < f1) { -- entityplayer.func_184811_cZ().func_185145_a(Items.field_185159_cQ, 100); -+ entityplayer.func_184811_cZ().func_185145_a(itemstack1.func_77973_b(), 100); - this.field_70170_p.func_72960_a(entityplayer, (byte)30); - } - } diff --git a/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch b/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch index 63c07636b..b154645b4 100644 --- a/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch @@ -1,34 +1,34 @@ --- a/net/minecraft/entity/EntitySpawnPlacementRegistry.java +++ b/net/minecraft/entity/EntitySpawnPlacementRegistry.java -@@ -17,6 +17,7 @@ +@@ -9,6 +9,7 @@ + private static final Map, EntitySpawnPlacementRegistry.Entry> field_209347_a = Maps.newHashMap(); + + private static void func_209343_a(EntityType p_209343_0_, EntitySpawnPlacementRegistry.PlacementType p_209343_1_, Heightmap.Type p_209343_2_) { ++ if (field_209347_a.containsKey(p_209343_0_)) throw new IllegalArgumentException("Invalid register call, " + p_209343_0_ + " already registered."); + field_209347_a.put(p_209343_0_, new EntitySpawnPlacementRegistry.Entry(p_209343_2_, p_209343_1_)); } - public static void func_209346_a(EntityType p_209346_0_, EntitySpawnPlacementRegistry.SpawnPlacementType p_209346_1_, Heightmap.Type p_209346_2_, @Nullable Tag p_209346_3_) { -+ if (field_209347_a.containsKey(p_209346_0_)) throw new IllegalArgumentException("Invalid register call, " + p_209346_0_ + " already registered."); - field_209347_a.put(p_209346_0_, new EntitySpawnPlacementRegistry.Entry(p_209346_2_, p_209346_1_, p_209346_3_)); - } - -@@ -106,8 +107,23 @@ +@@ -87,8 +88,23 @@ } } -- public static enum SpawnPlacementType { -+ public static enum SpawnPlacementType implements net.minecraftforge.common.IExtensibleEnum { +- public static enum PlacementType { ++ public static enum PlacementType implements net.minecraftforge.common.IExtensibleEnum { ON_GROUND, IN_WATER; + -+ public static SpawnPlacementType create(String name, net.minecraftforge.common.util.TriPredicate> predicate) { ++ public static PlacementType create(String name, net.minecraftforge.common.util.TriPredicate> predicate) { + throw new IllegalStateException("Enum not extended"); + } + -+ private net.minecraftforge.common.util.TriPredicate> predicate; -+ private SpawnPlacementType() { this(null); } -+ private SpawnPlacementType(net.minecraftforge.common.util.TriPredicate> predicate) { ++ private net.minecraftforge.common.util.TriPredicate> predicate; ++ private PlacementType() { this(null); } ++ private PlacementType(net.minecraftforge.common.util.TriPredicate> predicate) { + this.predicate = predicate; + } + -+ public boolean canSpawnAt(net.minecraft.world.IWorldReaderBase world, net.minecraft.util.math.BlockPos pos, EntityType type) { -+ if (predicate == null) return net.minecraft.world.WorldEntitySpawner.canSpawnAtBody(this, world, pos, type); ++ public boolean canSpawnAt(net.minecraft.world.IWorldReader world, net.minecraft.util.math.BlockPos pos, EntityType type) { ++ if (predicate == null) return net.minecraft.world.spawner.WorldEntitySpawner.canSpawnAtBody(this, world, pos, type); + return predicate.test(world, pos, type); + } } diff --git a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch deleted file mode 100644 index 863316af5..000000000 --- a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/net/minecraft/entity/EntityTracker.java -+++ b/net/minecraft/entity/EntityTracker.java -@@ -71,6 +71,10 @@ - } - - public void func_72786_a(Entity p_72786_1_) { -+ if (p_72786_1_.func_200600_R().hasCustomTracking()) { -+ this.func_72785_a(p_72786_1_, p_72786_1_.func_200600_R().getTrackingRange(), p_72786_1_.func_200600_R().getUpdateFrequency(), p_72786_1_.func_200600_R().shouldSendVelocityUpdates()); -+ return; -+ } - if (p_72786_1_ instanceof EntityPlayerMP) { - this.func_72791_a(p_72786_1_, 512, 2); - EntityPlayerMP entityplayermp = (EntityPlayerMP)p_72786_1_; -@@ -296,4 +300,18 @@ - } - - } -+ -+ // don't expose the EntityTrackerEntry directly so mods can't mess with the data in there as easily -+ /** -+ * Get all players tracking the given Entity. The Entity must be part of the World that this Tracker belongs to. -+ * @param entity the Entity -+ * @return all players tracking the Entity -+ */ -+ public Set getTrackingPlayers(Entity entity) { -+ EntityTrackerEntry entry = (EntityTrackerEntry)field_72794_c.func_76041_a(entity.func_145782_y()); -+ if (entry == null) -+ return java.util.Collections.emptySet(); -+ else -+ return java.util.Collections.unmodifiableSet(entry.field_73134_o); -+ } - } diff --git a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch deleted file mode 100644 index b85ce026a..000000000 --- a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/net/minecraft/entity/EntityTrackerEntry.java -+++ b/net/minecraft/entity/EntityTrackerEntry.java -@@ -142,9 +142,8 @@ - if (this.field_73132_a instanceof EntityItemFrame && this.field_73136_m % 10 == 0) { - EntityItemFrame entityitemframe = (EntityItemFrame)this.field_73132_a; - ItemStack itemstack = entityitemframe.func_82335_i(); -- if (itemstack.func_77973_b() instanceof ItemMap) { -- MapData mapdata = ItemMap.func_195950_a(itemstack, this.field_73132_a.field_70170_p); -- -+ MapData mapdata = ItemMap.func_195950_a(itemstack, this.field_73132_a.field_70170_p); -+ if (mapdata != null) { // FORGE: No need to instanceof check, getMapData handles this - for(EntityPlayer entityplayer : p_73122_1_) { - EntityPlayerMP entityplayermp = (EntityPlayerMP)entityplayer; - mapdata.func_76191_a(entityplayermp, itemstack); -@@ -376,11 +375,13 @@ - - this.field_73132_a.func_184178_b(p_73117_1_); - p_73117_1_.func_184848_d(this.field_73132_a); -+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(field_73132_a, p_73117_1_); - } - } else if (this.field_73134_o.contains(p_73117_1_)) { - this.field_73134_o.remove(p_73117_1_); - this.field_73132_a.func_184203_c(p_73117_1_); - p_73117_1_.func_152339_d(this.field_73132_a); -+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(field_73132_a, p_73117_1_); - } - - } -@@ -409,6 +410,9 @@ - field_151262_p.warn("Fetching addPacket for removed entity"); - } - -+ Packet pkt = net.minecraftforge.fml.network.NetworkHooks.getEntitySpawningPacket(this.field_73132_a); -+ if (pkt != null) return pkt; -+ - if (this.field_73132_a instanceof EntityPlayerMP) { - return new SPacketSpawnPlayer((EntityPlayer)this.field_73132_a); - } else if (this.field_73132_a instanceof IAnimal) { diff --git a/patches/minecraft/net/minecraft/entity/EntityType.java.patch b/patches/minecraft/net/minecraft/entity/EntityType.java.patch index 4dcb1260c..22071dc89 100644 --- a/patches/minecraft/net/minecraft/entity/EntityType.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityType.java.patch @@ -1,91 +1,128 @@ --- a/net/minecraft/entity/EntityType.java +++ b/net/minecraft/entity/EntityType.java -@@ -123,7 +123,7 @@ +@@ -135,7 +135,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public class EntityType { +public class EntityType extends net.minecraftforge.registries.ForgeRegistryEntry> { private static final Logger field_200731_aJ = LogManager.getLogger(); - public static final EntityType field_200788_b = func_200712_a("area_effect_cloud", EntityType.Builder.func_201757_a(EntityAreaEffectCloud.class, EntityAreaEffectCloud::new)); - public static final EntityType field_200789_c = func_200712_a("armor_stand", EntityType.Builder.func_201757_a(EntityArmorStand.class, EntityArmorStand::new)); -@@ -263,6 +263,7 @@ + public static final EntityType field_200788_b = func_200712_a("area_effect_cloud", EntityType.Builder.func_220322_a(AreaEffectCloudEntity::new, EntityClassification.MISC).func_220320_c().func_220321_a(6.0F, 0.5F)); + public static final EntityType field_200789_c = func_200712_a("armor_stand", EntityType.Builder.func_220322_a(ArmorStandEntity::new, EntityClassification.MISC).func_220321_a(0.5F, 1.975F)); +@@ -254,6 +254,11 @@ + private final Type field_206832_aX; + private final EntitySize field_220359_bi; + ++ private final java.util.function.Predicate> velocityUpdateSupplier; ++ private final java.util.function.ToIntFunction> trackingRangeSupplier; ++ private final java.util.function.ToIntFunction> updateIntervalSupplier; ++ private final java.util.function.BiFunction customClientFactory; ++ + private static EntityType func_200712_a(String p_200712_0_, EntityType.Builder p_200712_1_) { + return Registry.func_218325_a(Registry.field_212629_r, p_200712_0_, p_200712_1_.func_206830_a(p_200712_0_)); + } +@@ -266,7 +271,7 @@ + return Registry.field_212629_r.func_218349_b(ResourceLocation.func_208304_a(p_220327_0_)); + } + +- public EntityType(EntityType.IFactory p_i50385_1_, EntityClassification p_i50385_2_, boolean p_i50385_3_, boolean p_i50385_4_, boolean p_i50385_5_, @Nullable Type p_i50385_6_, EntitySize p_i50385_7_) { ++ public EntityType(IFactory p_i50385_1_, EntityClassification p_i50385_2_, boolean p_i50385_3_, boolean p_i50385_4_, boolean p_i50385_5_, @Nullable Type p_i50385_6_, EntitySize p_i50385_7_, final java.util.function.Predicate> velocityUpdateSupplier, final java.util.function.ToIntFunction> trackingRangeSupplier, final java.util.function.ToIntFunction> updateIntervalSupplier, final java.util.function.BiFunction customClientFactory) { + this.field_200732_aK = p_i50385_1_; + this.field_220355_ba = p_i50385_2_; + this.field_200733_aL = p_i50385_3_; +@@ -274,6 +279,10 @@ + this.field_220357_bd = p_i50385_5_; + this.field_206832_aX = p_i50385_6_; + this.field_220359_bi = p_i50385_7_; ++ this.velocityUpdateSupplier = velocityUpdateSupplier; ++ this.trackingRangeSupplier = trackingRangeSupplier; ++ this.updateIntervalSupplier = updateIntervalSupplier; ++ this.customClientFactory = customClientFactory; + } + @Nullable - public T func_208050_a(World p_208050_1_, @Nullable NBTTagCompound p_208050_2_, @Nullable ITextComponent p_208050_3_, @Nullable EntityPlayer p_208050_4_, BlockPos p_208050_5_, boolean p_208050_6_, boolean p_208050_7_) { - T t = this.func_210761_b(p_208050_1_, p_208050_2_, p_208050_3_, p_208050_4_, p_208050_5_, p_208050_6_, p_208050_7_); -+ if (t instanceof net.minecraft.entity.EntityLiving && net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn((EntityLiving) t, p_208050_1_, p_208050_5_.func_177958_n(), p_208050_5_.func_177956_o(), p_208050_5_.func_177952_p(), null)) return null; - p_208050_1_.func_72838_d(t); +@@ -284,6 +293,7 @@ + @Nullable + public T func_220342_a(World p_220342_1_, @Nullable CompoundNBT p_220342_2_, @Nullable ITextComponent p_220342_3_, @Nullable PlayerEntity p_220342_4_, BlockPos p_220342_5_, SpawnReason p_220342_6_, boolean p_220342_7_, boolean p_220342_8_) { + T t = this.func_220349_b(p_220342_1_, p_220342_2_, p_220342_3_, p_220342_4_, p_220342_5_, p_220342_6_, p_220342_7_, p_220342_8_); ++ if (t instanceof net.minecraft.entity.MobEntity && net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn((net.minecraft.entity.MobEntity) t, p_220342_1_, p_220342_5_.func_177958_n(), p_220342_5_.func_177956_o(), p_220342_5_.func_177952_p(), null)) return null; + p_220342_1_.func_217376_c(t); return t; } -@@ -386,15 +387,53 @@ - return p_200719_1_ == null ? null : p_200719_1_.func_200721_a(p_200719_0_); +@@ -462,6 +472,9 @@ } -+ /* Forge Start */ -+ private boolean useVanillaSpawning; -+ private Function customSpawnCallback; -+ private boolean hasCustomTracking; -+ private int customTrackingRange, customUpdateFrequency; -+ private boolean customSendVelocityUpdates; -+ -+ public boolean hasCustomTracking() { return hasCustomTracking; } -+ public int getTrackingRange() { return customTrackingRange; } -+ public int getUpdateFrequency() { return customUpdateFrequency; } -+ public boolean shouldSendVelocityUpdates() { return customSendVelocityUpdates; } -+ public boolean usesVanillaSpawning() { return useVanillaSpawning; } -+ -+ public EntityType(Class clazz, Function factory, boolean serializable, boolean summonable, @Nullable Type dataFixerType, -+ boolean useVanillaSpawning, Function customSpawnCallback, -+ boolean hasCustomTracking, int range, int updateFreq, boolean sendVelocityUpdates) { -+ this(clazz, factory, serializable, summonable, dataFixerType); -+ this.useVanillaSpawning = useVanillaSpawning; -+ this.customSpawnCallback = customSpawnCallback; -+ this.hasCustomTracking = hasCustomTracking; -+ this.customTrackingRange = range; -+ this.customUpdateFrequency = updateFreq; -+ this.customSendVelocityUpdates = sendVelocityUpdates; + public int func_220345_k() { ++ return trackingRangeSupplier.applyAsInt(this); + } -+ -+ @Nullable public Entity handleSpawnMessage(World world, net.minecraftforge.fml.network.FMLPlayMessages.SpawnEntity msg) -+ { -+ return customSpawnCallback == null ? func_200721_a(world) : customSpawnCallback.apply(msg); ++ private int defaultTrackingRangeSupplier() { + if (this == field_200729_aH) { + return 32; + } else if (this == field_200801_o) { +@@ -474,6 +487,9 @@ + } + + public int func_220332_l() { ++ return updateIntervalSupplier.applyAsInt(this); ++ } ++ private int defaultUpdateIntervalSupplier() { + if (this != field_200729_aH && this != field_200805_s) { + if (this == field_200808_v) { + return 4; +@@ -494,6 +510,9 @@ + } + + public boolean func_220340_m() { ++ return velocityUpdateSupplier.test(this); ++ } ++ private boolean defaultVelocitySupplier() { + return this != field_200729_aH && this != field_200770_J && this != field_200760_az && this != field_200791_e && this != field_200766_F && this != field_200768_H && this != field_200782_V && this != field_200801_o && this != field_200805_s; + } + +@@ -501,12 +520,22 @@ + return p_220341_1_.func_199685_a_(this); + } + ++ public T customClientSpawn(net.minecraftforge.fml.network.FMLPlayMessages.SpawnEntity packet, World world) { ++ if (customClientFactory == null) throw new RuntimeException("Missing custom spawn data for entity type "+this); ++ return customClientFactory.apply(packet, world); + } -+ /* Forge End */ + public static class Builder { - private final Class field_201759_a; - private final Function field_200709_a; + private final EntityType.IFactory field_200709_a; + private final EntityClassification field_220324_b; private boolean field_200710_b = true; private boolean field_200711_c = true; -+ private boolean useVanillaSpawning; -+ private Function customSpawnCallback = null; -+ private boolean hasCustomTracking = false; -+ private int trackingRange; -+ private int updateFrequency; -+ private boolean sendVelocityUpdates; + private boolean field_220325_e; ++ private java.util.function.Predicate> velocityUpdateSupplier = EntityType::defaultVelocitySupplier; ++ private java.util.function.ToIntFunction> trackingRangeSupplier = EntityType::defaultTrackingRangeSupplier; ++ private java.util.function.ToIntFunction> updateIntervalSupplier = EntityType::defaultUpdateIntervalSupplier; ++ private java.util.function.BiFunction customClientFactory; ++ + private EntitySize field_220326_f = EntitySize.func_220314_b(0.6F, 1.8F); - private Builder(Class p_i48756_1_, Function p_i48756_2_) { - this.field_201759_a = p_i48756_1_; - this.field_200709_a = p_i48756_2_; -+ this.useVanillaSpawning = field_201759_a.getName().startsWith("net.minecraft."); - } - - public static EntityType.Builder func_201757_a(Class p_201757_0_, Function p_201757_1_) { -@@ -417,12 +456,26 @@ + private Builder(EntityType.IFactory p_i50479_1_, EntityClassification p_i50479_2_) { +@@ -544,12 +573,32 @@ return this; } -+ public EntityType.Builder customSpawning(Function cb, boolean useVanillaSpawning) { -+ this.customSpawnCallback = cb; -+ this.useVanillaSpawning = useVanillaSpawning; ++ public EntityType.Builder setUpdateInterval(int interval) { ++ this.updateIntervalSupplier = t->interval; + return this; + } + -+ public final EntityType.Builder tracker(int range, int updateFrequency, boolean sendVelocityUpdates) { -+ this.hasCustomTracking = true; -+ this.trackingRange = range; -+ this.updateFrequency = updateFrequency; -+ this.sendVelocityUpdates = sendVelocityUpdates; ++ public EntityType.Builder setTrackingRange(int range) { ++ this.trackingRangeSupplier = t->range; ++ return this; ++ } ++ ++ public EntityType.Builder setShouldReceiveVelocityUpdates(boolean value) { ++ this.velocityUpdateSupplier = t->value; ++ return this; ++ } ++ ++ public EntityType.Builder setCustomClientFactory(java.util.function.BiFunction customClientFactory) { ++ this.customClientFactory = customClientFactory; + return this; + } + @@ -93,18 +130,18 @@ Type type = null; if (this.field_200710_b) { try { - type = DataFixesManager.func_210901_a().getSchema(DataFixUtils.makeKey(1631)).getChoiceType(TypeReferences.field_211298_n, p_206830_1_); + type = DataFixesManager.func_210901_a().getSchema(DataFixUtils.makeKey(SharedConstants.func_215069_a().getWorldVersion())).getChoiceType(TypeReferences.field_211298_n, p_206830_1_); - } catch (IllegalStateException illegalstateexception) { + } catch (IllegalArgumentException illegalstateexception) { if (SharedConstants.field_206244_b) { throw illegalstateexception; } -@@ -431,7 +484,7 @@ +@@ -558,7 +607,7 @@ } } -- return new EntityType<>(this.field_201759_a, this.field_200709_a, this.field_200710_b, this.field_200711_c, type); -+ return new EntityType<>(this.field_201759_a, this.field_200709_a, this.field_200710_b, this.field_200711_c, type, useVanillaSpawning, customSpawnCallback, hasCustomTracking, trackingRange, updateFrequency, sendVelocityUpdates); +- return new EntityType<>(this.field_200709_a, this.field_220324_b, this.field_200710_b, this.field_200711_c, this.field_220325_e, type, this.field_220326_f); ++ return new EntityType<>(this.field_200709_a, this.field_220324_b, this.field_200710_b, this.field_200711_c, this.field_220325_e, type, this.field_220326_f, velocityUpdateSupplier, trackingRangeSupplier, updateIntervalSupplier, customClientFactory); } } - } + diff --git a/patches/minecraft/net/minecraft/entity/EnumCreatureType.java.patch b/patches/minecraft/net/minecraft/entity/EnumCreatureType.java.patch deleted file mode 100644 index 695908b4c..000000000 --- a/patches/minecraft/net/minecraft/entity/EnumCreatureType.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/entity/EnumCreatureType.java -+++ b/net/minecraft/entity/EnumCreatureType.java -@@ -6,7 +6,7 @@ - import net.minecraft.entity.passive.EntityWaterMob; - import net.minecraft.entity.passive.IAnimal; - --public enum EnumCreatureType { -+public enum EnumCreatureType implements net.minecraftforge.common.IExtensibleEnum { - MONSTER(IMob.class, 70, false, false), - CREATURE(EntityAnimal.class, 10, true, true), - AMBIENT(EntityAmbientCreature.class, 15, true, false), -@@ -39,4 +39,8 @@ - public boolean func_82705_e() { - return this.field_82707_i; - } -+ -+ public static EnumCreatureType create(String name, Class p_i47849_3_, int p_i47849_4_, boolean p_i47849_5_, boolean p_i47849_6_) { -+ throw new IllegalStateException("Enum not extended"); -+ } - } diff --git a/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch b/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch new file mode 100644 index 000000000..35467dfd5 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/FlyingEntity.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/entity/FlyingEntity.java ++++ b/net/minecraft/entity/FlyingEntity.java +@@ -27,15 +27,16 @@ + this.func_213315_a(MoverType.SELF, this.func_213322_ci()); + this.func_213317_d(this.func_213322_ci().func_186678_a(0.5D)); + } else { ++ BlockPos ground = new BlockPos(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v); + float f = 0.91F; + if (this.field_70122_E) { +- f = this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().func_208618_m() * 0.91F; ++ f = this.field_70170_p.func_180495_p(ground).getSlipperiness(field_70170_p, ground, this) * 0.91F; + } + + float f1 = 0.16277137F / (f * f * f); + f = 0.91F; + if (this.field_70122_E) { +- f = this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().func_208618_m() * 0.91F; ++ f = this.field_70170_p.func_180495_p(ground).getSlipperiness(field_70170_p, ground, this) * 0.91F; + } + + this.func_213309_a(this.field_70122_E ? 0.1F * f1 : 0.02F, p_213352_1_); diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch similarity index 55% rename from patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch rename to patches/minecraft/net/minecraft/entity/LivingEntity.java.patch index 4f156f59a..a138f9e55 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/LivingEntity.java.patch @@ -1,15 +1,15 @@ ---- a/net/minecraft/entity/EntityLivingBase.java -+++ b/net/minecraft/entity/EntityLivingBase.java -@@ -92,6 +92,8 @@ - private static final Logger field_190632_a = LogManager.getLogger(); +--- a/net/minecraft/entity/LivingEntity.java ++++ b/net/minecraft/entity/LivingEntity.java +@@ -104,6 +104,8 @@ + public abstract class LivingEntity extends Entity { private static final UUID field_110156_b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); - private static final AttributeModifier field_110157_c = (new AttributeModifier(field_110156_b, "Sprinting speed boost", (double)0.3F, 2)).func_111168_a(false); + private static final AttributeModifier field_110157_c = (new AttributeModifier(field_110156_b, "Sprinting speed boost", (double)0.3F, AttributeModifier.Operation.MULTIPLY_TOTAL)).func_111168_a(false); + public static final net.minecraft.entity.ai.attributes.IAttribute SWIM_SPEED = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.swimSpeed", 1.0D, 0.0D, 1024.0D).func_111112_a(true); + public static final net.minecraft.entity.ai.attributes.IAttribute NAMETAG_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "forge.nameTagDistance", 64.0D, 0.0D, Float.MAX_VALUE).func_111112_a(true); - protected static final DataParameter field_184621_as = EntityDataManager.func_187226_a(EntityLivingBase.class, DataSerializers.field_187191_a); - private static final DataParameter field_184632_c = EntityDataManager.func_187226_a(EntityLivingBase.class, DataSerializers.field_187193_c); - private static final DataParameter field_184633_f = EntityDataManager.func_187226_a(EntityLivingBase.class, DataSerializers.field_187192_b); -@@ -199,6 +201,8 @@ + protected static final DataParameter field_184621_as = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187191_a); + private static final DataParameter field_184632_c = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187193_c); + private static final DataParameter field_184633_f = EntityDataManager.func_187226_a(LivingEntity.class, DataSerializers.field_187192_b); +@@ -227,6 +229,8 @@ this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_111263_d); this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188791_g); this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_189429_h); @@ -17,8 +17,8 @@ + this.func_110140_aT().func_111150_b(NAMETAG_DISTANCE); } - protected void func_184231_a(double p_184231_1_, boolean p_184231_3_, IBlockState p_184231_4_, BlockPos p_184231_5_) { -@@ -208,9 +212,10 @@ + protected void func_184231_a(double p_184231_1_, boolean p_184231_3_, BlockState p_184231_4_, BlockPos p_184231_5_) { +@@ -236,9 +240,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); @@ -26,11 +26,11 @@ + if (!p_184231_4_.isAir(field_70170_p, p_184231_5_)) { double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D); int i = (int)(150.0D * d0); -+ if (!p_184231_4_.addLandingEffects((WorldServer)this.field_70170_p, p_184231_5_, p_184231_4_, this, i)) - ((WorldServer)this.field_70170_p).func_195598_a(new BlockParticleData(Particles.field_197611_d, p_184231_4_), this.field_70165_t, this.field_70163_u, this.field_70161_v, i, 0.0D, 0.0D, 0.0D, (double)0.15F); ++ if (!p_184231_4_.addLandingEffects((ServerWorld)this.field_70170_p, p_184231_5_, p_184231_4_, this, i)) + ((ServerWorld)this.field_70170_p).func_195598_a(new BlockParticleData(ParticleTypes.field_197611_d, p_184231_4_), this.field_70165_t, this.field_70163_u, this.field_70161_v, i, 0.0D, 0.0D, 0.0D, (double)0.15F); } } -@@ -274,7 +279,7 @@ +@@ -302,7 +307,7 @@ } } @@ -39,103 +39,75 @@ this.func_184210_p(); } } else if (this.func_70086_ai() < this.func_205010_bg()) { -@@ -356,6 +361,7 @@ +@@ -387,6 +392,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_82766_b("doMobLoot"))) { int i = this.func_70693_a(this.field_70717_bb); + i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.field_70717_bb, i); while(i > 0) { - int j = EntityXPOrb.func_70527_a(i); + int j = ExperienceOrbEntity.func_70527_a(i); i -= j; -@@ -534,7 +540,7 @@ - Potion potion = iterator.next(); - PotionEffect potioneffect = this.field_70713_bf.get(potion); - if (!potioneffect.func_76455_a(this)) { +@@ -589,7 +595,7 @@ + Effect effect = iterator.next(); + EffectInstance effectinstance = this.field_70713_bf.get(effect); + if (!effectinstance.func_76455_a(this)) { - if (!this.field_70170_p.field_72995_K) { -+ if (!this.field_70170_p.field_72995_K && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionExpiryEvent(this, potioneffect))) { ++ if (!this.field_70170_p.field_72995_K && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionExpiryEvent(this, effectinstance))) { iterator.remove(); - this.func_70688_c(potioneffect); + this.func_70688_c(effectinstance); } -@@ -584,8 +590,10 @@ +@@ -639,8 +645,10 @@ this.func_82142_c(false); } else { - Collection collection = this.field_70713_bf.values(); + Collection collection = this.field_70713_bf.values(); - this.field_70180_af.func_187227_b(field_184634_g, func_184593_a(collection)); - this.field_70180_af.func_187227_b(field_184633_f, PotionUtils.func_185181_a(collection)); + net.minecraftforge.event.entity.living.PotionColorCalculationEvent event = new net.minecraftforge.event.entity.living.PotionColorCalculationEvent(this, PotionUtils.func_185181_a(collection), func_184593_a(collection), collection); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + this.field_70180_af.func_187227_b(field_184634_g, event.areParticlesHidden()); + this.field_70180_af.func_187227_b(field_184633_f, event.getColor()); - this.func_82142_c(this.func_70644_a(MobEffects.field_76441_p)); + this.func_82142_c(this.func_70644_a(Effects.field_76441_p)); } -@@ -614,7 +622,10 @@ +@@ -704,7 +712,10 @@ boolean flag; for(flag = false; iterator.hasNext(); flag = true) { - this.func_70688_c(iterator.next()); -+ PotionEffect effect = iterator.next(); ++ EffectInstance effect = iterator.next(); + if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, effect))) continue; + + this.func_70688_c(effect); iterator.remove(); } -@@ -622,6 +633,27 @@ - } - } - -+ /*** -+ * Removes all potion effects that have curativeItem as a curative item for its effect -+ * @param curativeItem The itemstack we are using to cure potion effects -+ */ -+ public boolean curePotionEffects(ItemStack curativeItem) { -+ if (this.field_70170_p.field_72995_K) -+ return false; -+ boolean ret = false; -+ Iterator itr = this.field_70713_bf.values().iterator(); -+ while (itr.hasNext()) { -+ PotionEffect effect = itr.next(); -+ if (effect.isCurativeItem(curativeItem) && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, effect))) { -+ this.func_70688_c(effect); -+ itr.remove(); -+ ret = true; -+ this.field_70752_e = true; -+ } -+ } -+ return ret; -+ } -+ - public Collection func_70651_bq() { - return this.field_70713_bf.values(); - } -@@ -644,6 +676,7 @@ +@@ -734,6 +745,7 @@ return false; } else { - PotionEffect potioneffect = this.field_70713_bf.get(p_195064_1_.func_188419_a()); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionAddedEvent(this, potioneffect, p_195064_1_)); - if (potioneffect == null) { + EffectInstance effectinstance = this.field_70713_bf.get(p_195064_1_.func_188419_a()); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionAddedEvent(this, effectinstance, p_195064_1_)); + if (effectinstance == null) { this.field_70713_bf.put(p_195064_1_.func_188419_a(), p_195064_1_); this.func_70670_a(p_195064_1_); -@@ -658,6 +691,9 @@ +@@ -748,6 +760,9 @@ } - public boolean func_70687_e(PotionEffect p_70687_1_) { + public boolean func_70687_e(EffectInstance p_70687_1_) { + net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent event = new net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent(this, p_70687_1_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() != net.minecraftforge.eventbus.api.Event.Result.DEFAULT) return event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW; if (this.func_70668_bt() == CreatureAttribute.UNDEAD) { - Potion potion = p_70687_1_.func_188419_a(); - if (potion == MobEffects.field_76428_l || potion == MobEffects.field_76436_u) { -@@ -678,6 +714,7 @@ + Effect effect = p_70687_1_.func_188419_a(); + if (effect == Effects.field_76428_l || effect == Effects.field_76436_u) { +@@ -768,6 +783,7 @@ } - public boolean func_195063_d(Potion p_195063_1_) { + public boolean func_195063_d(Effect p_195063_1_) { + if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, p_195063_1_))) return false; - PotionEffect potioneffect = this.func_184596_c(p_195063_1_); - if (potioneffect != null) { - this.func_70688_c(potioneffect); -@@ -714,6 +751,8 @@ + EffectInstance effectinstance = this.func_184596_c(p_195063_1_); + if (effectinstance != null) { + this.func_70688_c(effectinstance); +@@ -804,6 +820,8 @@ } public void func_70691_i(float p_70691_1_) { @@ -144,7 +116,7 @@ float f = this.func_110143_aJ(); if (f > 0.0F) { this.func_70606_j(f + p_70691_1_); -@@ -730,6 +769,7 @@ +@@ -820,6 +838,7 @@ } public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -152,53 +124,54 @@ if (this.func_180431_b(p_70097_1_)) { return false; } else if (this.field_70170_p.field_72995_K) { -@@ -790,8 +830,8 @@ - if (entity1 instanceof EntityPlayer) { +@@ -886,8 +905,8 @@ + if (entity1 instanceof PlayerEntity) { this.field_70718_bc = 100; - this.field_70717_bb = (EntityPlayer)entity1; -- } else if (entity1 instanceof EntityWolf) { -- EntityWolf entitywolf = (EntityWolf)entity1; -+ } else if (entity1 instanceof net.minecraft.entity.passive.EntityTameable) { -+ net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity1; - if (entitywolf.func_70909_n()) { + this.field_70717_bb = (PlayerEntity)entity1; +- } else if (entity1 instanceof WolfEntity) { +- WolfEntity wolfentity = (WolfEntity)entity1; ++ } else if (entity1 instanceof net.minecraft.entity.passive.TameableEntity) { ++ net.minecraft.entity.passive.TameableEntity wolfentity = (net.minecraft.entity.passive.TameableEntity)entity1; + if (wolfentity.func_70909_n()) { this.field_70718_bc = 100; - this.field_70717_bb = null; -@@ -941,11 +981,12 @@ - } - - public void func_70669_a(ItemStack p_70669_1_) { -- super.func_184185_a(SoundEvents.field_187635_cQ, 0.8F, 0.8F + this.field_70170_p.field_73012_v.nextFloat() * 0.4F); -+ this.field_70170_p.func_184148_a(null, this.field_70165_t, this.field_70163_u, this.field_70161_v, SoundEvents.field_187635_cQ, this.func_184176_by(), 0.8F, 0.8F + this.field_70170_p.field_73012_v.nextFloat() * 0.4F); //Forge: Fix MC-2518 Items are not damaged on the client so client needs packet as well. - this.func_195062_a(p_70669_1_, 5); + LivingEntity livingentity = wolfentity.func_70902_q(); +@@ -1069,6 +1088,7 @@ } public void func_70645_a(DamageSource p_70645_1_) { + if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; if (!this.field_70729_aU) { Entity entity = p_70645_1_.func_76346_g(); - EntityLivingBase entitylivingbase = this.func_94060_bK(); -@@ -960,15 +1001,16 @@ - this.field_70729_aU = true; - this.func_110142_aN().func_94549_h(); - if (!this.field_70170_p.field_72995_K) { -- int i = 0; -- if (entity instanceof EntityPlayer) { -- i = EnchantmentHelper.func_185283_h((EntityLivingBase)entity); -- } -+ int i = net.minecraftforge.common.ForgeHooks.getLootingLevel(this, entity, p_70645_1_); -+ this.captureDrops(new java.util.ArrayList<>()); + LivingEntity livingentity = this.func_94060_bK(); +@@ -1113,13 +1133,10 @@ - if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) { - boolean flag = this.field_70718_bc > 0; - this.func_184610_a(flag, i, p_70645_1_); - } -+ Collection drops = captureDrops(null); -+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_70645_1_, drops, i, field_70718_bc > 0)) -+ drops.forEach(e -> field_70170_p.func_72838_d(e)); - } + protected void func_213345_d(DamageSource p_213345_1_) { + Entity entity = p_213345_1_.func_76346_g(); +- int i; +- if (entity instanceof PlayerEntity) { +- i = EnchantmentHelper.func_185283_h((LivingEntity)entity); +- } else { +- i = 0; +- } - this.field_70170_p.func_72960_a(this, (byte)3); -@@ -984,6 +1026,9 @@ ++ int i = net.minecraftforge.common.ForgeHooks.getLootingLevel(this, entity, p_213345_1_); ++ this.captureDrops(new java.util.ArrayList<>()); ++ + boolean flag = this.field_70718_bc > 0; + if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) { + this.func_213354_a(p_213345_1_, flag); +@@ -1127,6 +1144,10 @@ + } + + this.func_213337_cE(); ++ ++ Collection drops = captureDrops(null); ++ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_213345_1_, drops, i, field_70718_bc > 0)) ++ drops.forEach(e -> field_70170_p.func_217376_c(e)); + } + + protected void func_213337_cE() { +@@ -1156,6 +1177,9 @@ } public void func_70653_a(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_) { @@ -207,22 +180,22 @@ + p_70653_2_ = event.getStrength(); p_70653_3_ = event.getRatioX(); p_70653_5_ = event.getRatioZ(); if (!(this.field_70146_Z.nextDouble() < this.func_110148_a(SharedMonsterAttributes.field_111266_c).func_111126_e())) { this.field_70160_al = true; - float f = MathHelper.func_76133_a(p_70653_3_ * p_70653_3_ + p_70653_5_ * p_70653_5_); -@@ -1028,12 +1073,7 @@ + Vec3d vec3d = this.func_213322_ci(); +@@ -1191,12 +1215,7 @@ + return false; } else { - BlockPos blockpos = new BlockPos(i, j, k); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); -- Block block = iblockstate.func_177230_c(); -- if (block != Blocks.field_150468_ap && block != Blocks.field_150395_bd) { -- return block instanceof BlockTrapDoor && this.func_184604_a(blockpos, iblockstate); + BlockState blockstate = this.func_213339_cH(); +- Block block = blockstate.func_177230_c(); +- if (block != Blocks.field_150468_ap && block != Blocks.field_150395_bd && block != Blocks.field_222420_lI) { +- return block instanceof TrapDoorBlock && this.func_184604_a(new BlockPos(this), blockstate); - } else { - return true; - } -+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(iblockstate, field_70170_p, blockpos, this); ++ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(blockstate, field_70170_p, new BlockPos(this), this); } } -@@ -1053,6 +1093,9 @@ +@@ -1220,6 +1239,9 @@ } public void func_180430_e(float p_180430_1_, float p_180430_2_) { @@ -230,18 +203,18 @@ + if (ret == null) return; + p_180430_1_ = ret[0]; p_180430_2_ = ret[1]; super.func_180430_e(p_180430_1_, p_180430_2_); - PotionEffect potioneffect = this.func_70660_b(MobEffects.field_76430_j); - float f = potioneffect == null ? 0.0F : (float)(potioneffect.func_76458_c() + 1); -@@ -1065,7 +1108,7 @@ + EffectInstance effectinstance = this.func_70660_b(Effects.field_76430_j); + float f = effectinstance == null ? 0.0F : (float)(effectinstance.func_76458_c() + 1); +@@ -1232,7 +1254,7 @@ int l = MathHelper.func_76128_c(this.field_70161_v); - IBlockState iblockstate = this.field_70170_p.func_180495_p(new BlockPos(j, k, l)); - if (!iblockstate.func_196958_f()) { -- SoundType soundtype = iblockstate.func_177230_c().func_185467_w(); -+ SoundType soundtype = iblockstate.getSoundType(field_70170_p, new BlockPos(j, k, l), this); + BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(j, k, l)); + if (!blockstate.func_196958_f()) { +- SoundType soundtype = blockstate.func_215695_r(); ++ SoundType soundtype = blockstate.getSoundType(field_70170_p, new BlockPos(j, k, l), this); this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F); } } -@@ -1134,6 +1177,8 @@ +@@ -1301,6 +1323,8 @@ protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) { if (!this.func_180431_b(p_70665_1_)) { @@ -250,8 +223,8 @@ 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 f = p_70665_2_; -@@ -1144,10 +1189,11 @@ - ((EntityPlayerMP)p_70665_1_.func_76346_g()).func_195067_a(StatList.field_212735_F, Math.round(f1 * 10.0F)); +@@ -1311,10 +1335,11 @@ + ((ServerPlayerEntity)p_70665_1_.func_76346_g()).func_195067_a(Stats.field_212735_F, Math.round(f1 * 10.0F)); } + p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, p_70665_2_); @@ -263,38 +236,16 @@ this.func_110149_m(this.func_110139_bj() - p_70665_2_); } } -@@ -1189,6 +1235,8 @@ +@@ -1356,6 +1381,8 @@ } - public void func_184609_a(EnumHand p_184609_1_) { + public void func_184609_a(Hand p_184609_1_) { + ItemStack stack = this.func_184586_b(p_184609_1_); + if (!stack.func_190926_b() && stack.onEntitySwing(this)) return; if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) { this.field_110158_av = -1; this.field_82175_bq = true; -@@ -1373,18 +1421,18 @@ - double d12 = d6 + d10; - AxisAlignedBB axisalignedbb1 = axisalignedbb.func_72317_d(d9, 0.0D, d10); - if (this.field_70170_p.func_195586_b(this, axisalignedbb1)) { -- if (this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u, d12)).func_185896_q()) { -+ if (this.field_70170_p.func_195595_w(new BlockPos(d11, this.field_70163_u, d12))) { - this.func_70634_a(d11, this.field_70163_u + 1.0D, d12); - return; - } - - BlockPos blockpos = new BlockPos(d11, this.field_70163_u - 1.0D, d12); -- if (this.field_70170_p.func_180495_p(blockpos).func_185896_q() || this.field_70170_p.func_204610_c(blockpos).func_206884_a(FluidTags.field_206959_a)) { -+ if (this.field_70170_p.func_195595_w(blockpos) || this.field_70170_p.func_204610_c(blockpos).func_206884_a(FluidTags.field_206959_a)) { - d1 = d11; - d13 = this.field_70163_u + 1.0D; - d14 = d12; - } -- } else if (this.field_70170_p.func_195586_b(this, axisalignedbb1.func_72317_d(0.0D, 1.0D, 0.0D)) && this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u + 1.0D, d12)).func_185896_q()) { -+ } else if (this.field_70170_p.func_195586_b(this, axisalignedbb1.func_72317_d(0.0D, 1.0D, 0.0D)) && this.field_70170_p.func_195595_w(new BlockPos(d11, this.field_70163_u + 1.0D, d12))) { - d1 = d11; - d13 = this.field_70163_u + 2.0D; - d14 = d12; -@@ -1439,15 +1487,16 @@ +@@ -1714,15 +1741,16 @@ } this.field_70160_al = true; @@ -303,35 +254,34 @@ @OnlyIn(Dist.CLIENT) protected void func_203010_cG() { -- this.field_70181_x -= (double)0.04F; -+ this.field_70181_x -= (double)0.04F * this.func_110148_a(SWIM_SPEED).func_111126_e(); +- this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)-0.04F, 0.0D)); ++ this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)-0.04F * this.func_110148_a(SWIM_SPEED).func_111126_e(), 0.0D)); } protected void func_180466_bG(Tag p_180466_1_) { -- this.field_70181_x += (double)0.04F; -+ this.field_70181_x += (double)0.04F * this.func_110148_a(SWIM_SPEED).func_111126_e(); +- this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F, 0.0D)); ++ this.func_213317_d(this.func_213322_ci().func_72441_c(0.0D, (double)0.04F * this.func_110148_a(SWIM_SPEED).func_111126_e(), 0.0D)); } protected float func_189749_co() { -@@ -1518,7 +1567,7 @@ +@@ -1785,7 +1813,7 @@ + } + } else { + BlockPos blockpos = new BlockPos(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v); +- float f5 = this.field_70170_p.func_180495_p(blockpos).func_177230_c().func_208618_m(); ++ float f5 = this.field_70170_p.func_180495_p(blockpos).getSlipperiness(field_70170_p, blockpos, this); + float f7 = this.field_70122_E ? f5 * 0.91F : 0.91F; + this.func_213309_a(this.func_213335_r(f5), p_213352_1_); + this.func_213317_d(this.func_213362_f(this.func_213322_ci())); +@@ -1847,6 +1875,7 @@ + f = 0.96F; + } - try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.func_185345_c(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)) { - if (this.field_70122_E) { -- f7 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos).func_177230_c().func_208618_m() * 0.91F; -+ f7 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos).getSlipperiness(field_70170_p, blockpos$pooledmutableblockpos, this) * 0.91F; - } - - float f8 = 0.16277137F / (f7 * f7 * f7); -@@ -1532,7 +1581,7 @@ - this.func_191958_b(p_191986_1_, p_191986_2_, p_191986_3_, f9); - f7 = 0.91F; - if (this.field_70122_E) { -- f7 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos.func_189532_c(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().func_208618_m() * 0.91F; -+ f7 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos.func_189532_c(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).getSlipperiness(field_70170_p, blockpos$pooledmutableblockpos, this) * 0.91F; - } - - if (this.func_70617_f_()) { -@@ -1663,6 +1712,7 @@ ++ f1 *= (float)this.func_110148_a(SWIM_SPEED).func_111126_e(); + this.func_213309_a(f1, p_213352_1_); + this.func_213315_a(MoverType.SELF, this.func_213322_ci()); + Vec3d vec3d1 = this.func_213322_ci(); +@@ -1922,6 +1951,7 @@ } public void func_70071_h_() { @@ -339,17 +289,17 @@ super.func_70071_h_(); this.func_184608_ct(); this.func_205014_p(); -@@ -1694,7 +1744,9 @@ +@@ -1953,7 +1983,9 @@ - ItemStack itemstack1 = this.func_184582_a(entityequipmentslot); + ItemStack itemstack1 = this.func_184582_a(equipmentslottype); if (!ItemStack.func_77989_b(itemstack1, itemstack)) { + if (!itemstack1.equals(itemstack, true)) - ((WorldServer)this.field_70170_p).func_73039_n().func_151247_a(this, new SPacketEntityEquipment(this.func_145782_y(), entityequipmentslot, itemstack1)); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent(this, entityequipmentslot, itemstack, itemstack1)); + ((ServerWorld)this.field_70170_p).func_72863_F().func_217218_b(this, new SEntityEquipmentPacket(this.func_145782_y(), equipmentslottype, itemstack1)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent(this, equipmentslottype, itemstack, itemstack1)); if (!itemstack.func_190926_b()) { - this.func_110140_aT().func_111148_a(itemstack.func_111283_C(entityequipmentslot)); + this.func_110140_aT().func_111148_a(itemstack.func_111283_C(equipmentslottype)); } -@@ -2133,12 +2185,21 @@ +@@ -2402,13 +2434,22 @@ protected void func_184608_ct() { if (this.func_184587_cr()) { @@ -364,17 +314,18 @@ + field_184627_bm.onUsingTick(this, field_184628_bn); + } + + this.field_184627_bm.func_222121_b(this.field_70170_p, this, this.func_184605_cv()); if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0) { this.func_184584_a(this.field_184627_bm, 5); } -- if (--this.field_184628_bn == 0 && !this.field_70170_p.field_72995_K) { -+ if (--this.field_184628_bn <= 0 && !this.field_70170_p.field_72995_K) { +- if (--this.field_184628_bn == 0 && !this.field_70170_p.field_72995_K && !this.field_184627_bm.func_222122_m()) { ++ if (--this.field_184628_bn <= 0 && !this.field_70170_p.field_72995_K && !this.field_184627_bm.func_222122_m()) { this.func_71036_o(); } } else { -@@ -2172,8 +2233,10 @@ - public void func_184598_c(EnumHand p_184598_1_) { +@@ -2442,8 +2483,10 @@ + public void func_184598_c(Hand p_184598_1_) { ItemStack itemstack = this.func_184586_b(p_184598_1_); if (!itemstack.func_190926_b() && !this.func_184587_cr()) { + int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.func_77988_m()); @@ -384,18 +335,18 @@ + this.field_184628_bn = duration; if (!this.field_70170_p.field_72995_K) { this.func_204802_c(1, true); - this.func_204802_c(2, p_184598_1_ == EnumHand.OFF_HAND); -@@ -2229,6 +2292,9 @@ + this.func_204802_c(2, p_184598_1_ == Hand.OFF_HAND); +@@ -2503,6 +2546,9 @@ vec3d1 = vec3d1.func_178789_a(-this.field_70125_A * ((float)Math.PI / 180F)); vec3d1 = vec3d1.func_178785_b(-this.field_70177_z * ((float)Math.PI / 180F)); vec3d1 = vec3d1.func_72441_c(this.field_70165_t, this.field_70163_u + (double)this.func_70047_e(), this.field_70161_v); -+ if (this.field_70170_p instanceof WorldServer) //Forge: Fix MC-2518 spawnParticle is nooped on server, need to use server specific variant -+ ((WorldServer)this.field_70170_p).func_195598_a(new ItemParticleData(Particles.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, 1, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c, 0.0D); ++ if (this.field_70170_p instanceof ServerWorld) //Forge: Fix MC-2518 spawnParticle is nooped on server, need to use server specific variant ++ ((ServerWorld)this.field_70170_p).func_195598_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, 1, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c, 0.0D); + else - this.field_70170_p.func_195594_a(new ItemParticleData(Particles.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c); + this.field_70170_p.func_195594_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c); } -@@ -2237,7 +2303,9 @@ +@@ -2511,7 +2557,9 @@ protected void func_71036_o() { if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) { this.func_184584_a(this.field_184627_bm, 16); @@ -406,18 +357,76 @@ this.func_184602_cy(); } -@@ -2257,6 +2325,7 @@ +@@ -2531,6 +2579,7 @@ public void func_184597_cx() { if (!this.field_184627_bm.func_190926_b()) { + if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv())) this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv()); - } + if (this.field_184627_bm.func_222122_m()) { + this.func_184608_ct(); +@@ -2686,16 +2735,16 @@ -@@ -2363,4 +2432,62 @@ - @OnlyIn(Dist.CLIENT) - public void func_191987_a(BlockPos p_191987_1_, boolean p_191987_2_) { + private boolean func_213359_p() { + return this.func_213374_dv().map((p_213347_1_) -> { +- return this.field_70170_p.func_180495_p(p_213347_1_).func_177230_c() instanceof BedBlock; ++ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, p_213347_1_); + }).orElse(false); } + + public void func_213366_dy() { + this.func_213374_dv().filter(this.field_70170_p::func_175667_e).ifPresent((p_213368_1_) -> { + BlockState blockstate = this.field_70170_p.func_180495_p(p_213368_1_); +- if (blockstate.func_177230_c() instanceof BedBlock) { +- this.field_70170_p.func_180501_a(p_213368_1_, blockstate.func_206870_a(BedBlock.field_176471_b, Boolean.valueOf(false)), 3); +- Vec3d vec3d = BedBlock.func_220172_a(this.func_200600_R(), this.field_70170_p, p_213368_1_, 0).orElseGet(() -> { ++ if (blockstate.isBed(this.field_70170_p, p_213368_1_, this)) { ++ blockstate.setBedOccupied(field_70170_p, p_213368_1_, this, false); ++ Vec3d vec3d = blockstate.getBedSpawnPosition(this.func_200600_R(), field_70170_p, p_213368_1_, this).orElseGet(()-> { + BlockPos blockpos = p_213368_1_.func_177984_a(); + return new Vec3d((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.1D, (double)blockpos.func_177952_p() + 0.5D); + }); +@@ -2710,8 +2759,13 @@ + @Nullable + @OnlyIn(Dist.CLIENT) + public Direction func_213376_dz() { ++// this.func_213374_dv().map(pos->{ // This is apparently an "optimization" by Mojang, so we'll copy their lead here for now ++// BlockState state = this.world.getBlockState(pos); ++// return !state.isBed(world, pos, this) ? Direction.UP : state.getBedDirection(world, pos); ++// }); + BlockPos blockpos = this.func_213374_dv().orElse((BlockPos)null); +- return blockpos != null ? BedBlock.func_220174_a(this.field_70170_p, blockpos) : null; ++ BlockState state = this.field_70170_p.func_180495_p(blockpos); ++ return !state.isBed(field_70170_p, blockpos, this) ? Direction.UP : state.getBedDirection(field_70170_p, blockpos); + } + + public boolean func_70094_T() { +@@ -2778,4 +2832,58 @@ + public void func_213334_d(Hand p_213334_1_) { + this.func_213361_c(p_213334_1_ == Hand.MAIN_HAND ? EquipmentSlotType.MAINHAND : EquipmentSlotType.OFFHAND); + } ++ ++ /* ==== FORGE START ==== */ ++ /*** ++ * Removes all potion effects that have curativeItem as a curative item for its effect ++ * @param curativeItem The itemstack we are using to cure potion effects ++ */ ++ public boolean curePotionEffects(ItemStack curativeItem) { ++ if (this.field_70170_p.field_72995_K) ++ return false; ++ boolean ret = false; ++ Iterator itr = this.field_70713_bf.values().iterator(); ++ while (itr.hasNext()) { ++ EffectInstance effect = itr.next(); ++ if (effect.isCurativeItem(curativeItem) && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionRemoveEvent(this, effect))) { ++ this.func_70688_c(effect); ++ itr.remove(); ++ ret = true; ++ this.field_70752_e = true; ++ } ++ } ++ return ret; ++ } + + /** + * Returns true if the entity's rider (EntityPlayer) should face forward when mounted. @@ -426,40 +435,14 @@ + * @param player The player who is riding the entity. + * @return If the player should orient the same direction as this entity. + */ -+ public boolean shouldRiderFaceForward(EntityPlayer player) { -+ return this instanceof net.minecraft.entity.passive.EntityPig; -+ } -+ -+ @Override -+ public void func_191958_b(float strafe, float up, float forward, float friction) { -+ float f = strafe * strafe + up * up + forward * forward; -+ if (f >= 1.0E-4F) { -+ f = MathHelper.func_76129_c(f); -+ if (f < 1.0F) f = 1.0F; -+ f = friction / f; -+ strafe *= f; -+ up *= f; -+ forward *= f; -+ -+ if (this.func_70090_H() || this.func_180799_ab()) { -+ float speed = (float)this.func_110148_a(SWIM_SPEED).func_111126_e(); -+ strafe *= speed; -+ up *= speed; -+ forward *= speed; -+ } -+ -+ float f1 = MathHelper.func_76126_a(this.field_70177_z * ((float)Math.PI / 180F)); -+ float f2 = MathHelper.func_76134_b(this.field_70177_z * ((float)Math.PI / 180F)); -+ this.field_70159_w += (double)(strafe * f2 - forward * f1); -+ this.field_70181_x += (double)up; -+ this.field_70179_y += (double)(forward * f2 + strafe * f1); -+ } ++ public boolean shouldRiderFaceForward(PlayerEntity player) { ++ return this instanceof net.minecraft.entity.passive.PigEntity; + } + + private final net.minecraftforge.common.util.LazyOptional[] handlers = net.minecraftforge.items.wrapper.EntityEquipmentInvWrapper.create(this); + + @Override -+ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable EnumFacing facing) { ++ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable Direction facing) { + if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (facing == null) return handlers[2].cast(); + else if (facing.func_176740_k().func_200128_b()) return handlers[0].cast(); diff --git a/patches/minecraft/net/minecraft/entity/MobEntity.java.patch b/patches/minecraft/net/minecraft/entity/MobEntity.java.patch new file mode 100644 index 000000000..305d8aca8 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/MobEntity.java.patch @@ -0,0 +1,73 @@ +--- a/net/minecraft/entity/MobEntity.java ++++ b/net/minecraft/entity/MobEntity.java +@@ -174,6 +174,7 @@ + + public void func_70624_b(@Nullable LivingEntity p_70624_1_) { + this.field_70696_bz = p_70624_1_; ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); + } + + public boolean func_213358_a(EntityType p_213358_1_) { +@@ -257,7 +258,6 @@ + + } + +- @OnlyIn(Dist.CLIENT) + public void func_70103_a(byte p_70103_1_) { + if (p_70103_1_ == 20) { + this.func_70656_aK(); +@@ -456,7 +456,7 @@ + public void func_70636_d() { + super.func_70636_d(); + this.field_70170_p.func_217381_Z().func_76320_a("looting"); +- if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && this.func_70089_S() && !this.field_70729_aU && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { ++ if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && this.func_70089_S() && !this.field_70729_aU && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { + for(ItemEntity itementity : this.field_70170_p.func_217357_a(ItemEntity.class, this.func_174813_aQ().func_72314_b(1.0D, 0.0D, 1.0D))) { + if (!itementity.field_70128_L && !itementity.func_92059_d().func_190926_b() && !itementity.func_174874_s()) { + this.func_175445_a(itementity); +@@ -546,6 +546,14 @@ + protected void func_70623_bb() { + if (!this.func_104002_bU() && !this.func_213392_I()) { + Entity entity = this.field_70170_p.func_217362_a(this, -1.0D); ++ net.minecraftforge.eventbus.api.Event.Result result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this); ++ if (result == net.minecraftforge.eventbus.api.Event.Result.DENY) { ++ field_70708_bq = 0; ++ entity = null; ++ } else if (result == net.minecraftforge.eventbus.api.Event.Result.ALLOW) { ++ this.func_70106_y(); ++ entity = null; ++ } + if (entity != null) { + double d0 = entity.func_70068_e(this); + if (d0 > 16384.0D && this.func_213397_c(d0)) { +@@ -784,6 +792,8 @@ + } + + public static EquipmentSlotType func_184640_d(ItemStack p_184640_0_) { ++ final EquipmentSlotType slot = p_184640_0_.getEquipmentSlot(); ++ if (slot != null) return slot; // FORGE: Allow modders to set a non-default equipment slot for a stack; e.g. a non-armor chestplate-slot item + Item item = p_184640_0_.func_77973_b(); + if (item != Blocks.field_196625_cS.func_199767_j() && (!(item instanceof BlockItem) || !(((BlockItem)item).func_179223_d() instanceof AbstractSkullBlock))) { + if (item instanceof ArmorItem) { +@@ -791,7 +801,7 @@ + } else if (item == Items.field_185160_cR) { + return EquipmentSlotType.CHEST; + } else { +- return item == Items.field_185159_cQ ? EquipmentSlotType.OFFHAND : EquipmentSlotType.MAINHAND; ++ return p_184640_0_.isShield(null) ? EquipmentSlotType.OFFHAND : EquipmentSlotType.MAINHAND; + } + } else { + return EquipmentSlotType.HEAD; +@@ -1171,10 +1181,10 @@ + PlayerEntity playerentity = (PlayerEntity)p_70652_1_; + ItemStack itemstack = this.func_184614_ca(); + ItemStack itemstack1 = playerentity.func_184587_cr() ? playerentity.func_184607_cu() : ItemStack.field_190927_a; +- if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.func_77973_b() instanceof AxeItem && itemstack1.func_77973_b() == Items.field_185159_cQ) { ++ if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.canDisableShield(itemstack1, playerentity, this) && itemstack1.isShield(playerentity)) { + float f2 = 0.25F + (float)EnchantmentHelper.func_185293_e(this) * 0.05F; + if (this.field_70146_Z.nextFloat() < f2) { +- playerentity.func_184811_cZ().func_185145_a(Items.field_185159_cQ, 100); ++ playerentity.func_184811_cZ().func_185145_a(itemstack.func_77973_b(), 100); + this.field_70170_p.func_72960_a(playerentity, (byte)30); + } + } diff --git a/patches/minecraft/net/minecraft/entity/NpcMerchant.java.patch b/patches/minecraft/net/minecraft/entity/NpcMerchant.java.patch deleted file mode 100644 index 2b48c073d..000000000 --- a/patches/minecraft/net/minecraft/entity/NpcMerchant.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/NpcMerchant.java -+++ b/net/minecraft/entity/NpcMerchant.java -@@ -36,7 +36,7 @@ - - @Nullable - public MerchantRecipeList func_70934_b(EntityPlayer p_70934_1_) { -- return this.field_70936_c; -+ return net.minecraftforge.event.ForgeEventFactory.listTradeOffers(this, p_70934_1_, this.field_70936_c); - } - - public void func_70930_a(@Nullable MerchantRecipeList p_70930_1_) { diff --git a/patches/minecraft/net/minecraft/entity/SharedMonsterAttributes.java.patch b/patches/minecraft/net/minecraft/entity/SharedMonsterAttributes.java.patch index e2a6ad755..770229d21 100644 --- a/patches/minecraft/net/minecraft/entity/SharedMonsterAttributes.java.patch +++ b/patches/minecraft/net/minecraft/entity/SharedMonsterAttributes.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/entity/SharedMonsterAttributes.java +++ b/net/minecraft/entity/SharedMonsterAttributes.java -@@ -16,7 +16,7 @@ +@@ -15,7 +15,7 @@ public class SharedMonsterAttributes { private static final Logger field_151476_f = LogManager.getLogger(); diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch deleted file mode 100644 index 5ad634870..000000000 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackMelee.java.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- a/net/minecraft/entity/ai/EntityAIAttackMelee.java -+++ b/net/minecraft/entity/ai/EntityAIAttackMelee.java -@@ -18,6 +18,8 @@ - private double field_151495_j; - private double field_151496_k; - protected final int field_188493_g = 20; -+ private int failedPathFindingPenalty = 0; -+ private boolean canPenalize = false; - - public EntityAIAttackMelee(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) { - this.field_75441_b = p_i1636_1_; -@@ -33,6 +35,15 @@ - } else if (!entitylivingbase.func_70089_S()) { - return false; - } else { -+ if (canPenalize) { -+ if (--this.field_75445_i <= 0) { -+ this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); -+ this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); -+ return this.field_75438_g != null; -+ } else { -+ return true; -+ } -+ } - this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); - if (this.field_75438_g != null) { - return true; -@@ -81,6 +92,18 @@ - this.field_151495_j = entitylivingbase.func_174813_aQ().field_72338_b; - this.field_151496_k = entitylivingbase.field_70161_v; - this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); -+ if (this.canPenalize) { -+ this.field_75445_i += failedPathFindingPenalty; -+ if (this.field_75441_b.func_70661_as().func_75505_d() != null) { -+ net.minecraft.pathfinding.PathPoint finalPathPoint = this.field_75441_b.func_70661_as().func_75505_d().func_75870_c(); -+ if (finalPathPoint != null && entitylivingbase.func_70092_e(finalPathPoint.field_75839_a, finalPathPoint.field_75837_b, finalPathPoint.field_75838_c) < 1) -+ failedPathFindingPenalty = 0; -+ else -+ failedPathFindingPenalty += 10; -+ } else { -+ failedPathFindingPenalty += 10; -+ } -+ } - if (d0 > 1024.0D) { - this.field_75445_i += 10; - } else if (d0 > 256.0D) { diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackRangedBow.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackRangedBow.java.patch deleted file mode 100644 index 4e5bf60bc..000000000 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackRangedBow.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/ai/EntityAIAttackRangedBow.java -+++ b/net/minecraft/entity/ai/EntityAIAttackRangedBow.java -@@ -35,7 +35,7 @@ - } - - protected boolean func_188498_f() { -- return !this.field_188499_a.func_184614_ca().func_190926_b() && this.field_188499_a.func_184614_ca().func_77973_b() == Items.field_151031_f; -+ return !this.field_188499_a.func_184614_ca().func_190926_b() && this.field_188499_a.func_184614_ca().func_77973_b() instanceof net.minecraft.item.ItemBow; - } - - public boolean func_75253_b() { diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java.patch deleted file mode 100644 index d4e68a703..000000000 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/net/minecraft/entity/ai/EntityAIHarvestFarmland.java -+++ b/net/minecraft/entity/ai/EntityAIHarvestFarmland.java -@@ -25,7 +25,7 @@ - - public boolean func_75250_a() { - if (this.field_179496_a <= 0) { -- if (!this.field_179504_c.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179504_c.field_70170_p, this.field_179504_c)) { - return false; - } - -@@ -70,6 +70,11 @@ - } else if (itemstack.func_77973_b() == Items.field_185163_cU) { - iworld.func_180501_a(blockpos, Blocks.field_185773_cZ.func_176223_P(), 3); - flag = true; -+ } else if (itemstack.func_77973_b() instanceof net.minecraftforge.common.IPlantable) { -+ if (((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlantType(iworld, blockpos) == net.minecraftforge.common.EnumPlantType.Crop) { -+ iworld.func_180501_a(blockpos, ((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlant(iworld, blockpos),3); -+ flag = true; -+ } - } - } - diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIVillagerMate.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIVillagerMate.java.patch deleted file mode 100644 index ab8093b4c..000000000 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIVillagerMate.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/net/minecraft/entity/ai/EntityAIVillagerMate.java -+++ b/net/minecraft/entity/ai/EntityAIVillagerMate.java -@@ -82,11 +82,14 @@ - } - - private void func_75447_i() { -- EntityVillager entityvillager = this.field_75450_b.func_90011_a(this.field_75451_c); -+ net.minecraft.entity.EntityAgeable entityvillager = this.field_75450_b.func_90011_a(this.field_75451_c); - this.field_75451_c.func_70873_a(6000); - this.field_75450_b.func_70873_a(6000); - this.field_75451_c.func_175549_o(false); - this.field_75450_b.func_175549_o(false); -+ final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(field_75450_b, field_75451_c, entityvillager); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event) || event.getChild() == null) return; -+ entityvillager = event.getChild(); - entityvillager.func_70873_a(-24000); - entityvillager.func_70012_b(this.field_75450_b.field_70165_t, this.field_75450_b.field_70163_u, this.field_75450_b.field_70161_v, 0.0F, 0.0F); - this.field_75448_d.func_72838_d(entityvillager); diff --git a/patches/minecraft/net/minecraft/entity/ai/brain/task/FarmTask.java.patch b/patches/minecraft/net/minecraft/entity/ai/brain/task/FarmTask.java.patch new file mode 100644 index 000000000..9d9577658 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/ai/brain/task/FarmTask.java.patch @@ -0,0 +1,23 @@ +--- a/net/minecraft/entity/ai/brain/task/FarmTask.java ++++ b/net/minecraft/entity/ai/brain/task/FarmTask.java +@@ -39,7 +39,7 @@ + } + + protected boolean func_212832_a_(ServerWorld p_212832_1_, VillagerEntity p_212832_2_) { +- if (!p_212832_1_.func_82736_K().func_82766_b("mobGriefing")) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_212832_1_, p_212832_2_)) { + return false; + } else if (p_212832_2_.func_213700_eh().func_221130_b() != VillagerProfession.field_221156_f) { + return false; +@@ -106,6 +106,11 @@ + } else if (itemstack.func_77973_b() == Items.field_185163_cU) { + p_212833_1_.func_180501_a(this.field_220422_a, Blocks.field_185773_cZ.func_176223_P(), 3); + flag = true; ++ } else if (itemstack.func_77973_b() instanceof net.minecraftforge.common.IPlantable) { ++ if (((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlantType(p_212833_1_, field_220422_a) == net.minecraftforge.common.PlantType.Crop) { ++ p_212833_1_.func_180501_a(field_220422_a, ((net.minecraftforge.common.IPlantable)itemstack.func_77973_b()).getPlant(p_212833_1_, field_220422_a),3); ++ flag = true; ++ } + } + } + diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIBreakBlock.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/BreakBlockGoal.java.patch similarity index 72% rename from patches/minecraft/net/minecraft/entity/ai/EntityAIBreakBlock.java.patch rename to patches/minecraft/net/minecraft/entity/ai/goal/BreakBlockGoal.java.patch index 5299554b0..f4f8c242d 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIBreakBlock.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/BreakBlockGoal.java.patch @@ -1,11 +1,11 @@ ---- a/net/minecraft/entity/ai/EntityAIBreakBlock.java -+++ b/net/minecraft/entity/ai/EntityAIBreakBlock.java -@@ -28,7 +28,7 @@ +--- a/net/minecraft/entity/ai/goal/BreakBlockGoal.java ++++ b/net/minecraft/entity/ai/goal/BreakBlockGoal.java +@@ -29,7 +29,7 @@ } public boolean func_75250_a() { - if (!this.field_203118_g.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { + if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_203118_g.field_70170_p, this.field_203118_g) || !this.field_203118_g.field_70170_p.func_180495_p(this.field_179494_b).canEntityDestroy(this.field_203118_g.field_70170_p, this.field_179494_b, this.field_203118_g) || !net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this.field_203118_g, this.field_179494_b, this.field_203118_g.field_70170_p.func_180495_p(this.field_179494_b))) { return false; - } else { - return this.field_203118_g.func_70681_au().nextInt(20) != 0 ? false : super.func_75250_a(); + } else if (this.field_179496_a > 0) { + --this.field_179496_a; diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIBreakDoor.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/BreakDoorGoal.java.patch similarity index 74% rename from patches/minecraft/net/minecraft/entity/ai/EntityAIBreakDoor.java.patch rename to patches/minecraft/net/minecraft/entity/ai/goal/BreakDoorGoal.java.patch index 503f8dd5c..5fdec51de 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIBreakDoor.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/BreakDoorGoal.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/entity/ai/EntityAIBreakDoor.java -+++ b/net/minecraft/entity/ai/EntityAIBreakDoor.java -@@ -15,7 +15,7 @@ +--- a/net/minecraft/entity/ai/goal/BreakDoorGoal.java ++++ b/net/minecraft/entity/ai/goal/BreakDoorGoal.java +@@ -28,7 +28,7 @@ public boolean func_75250_a() { if (!super.func_75250_a()) { return false; @@ -8,4 +8,4 @@ + } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_75356_a.field_70170_p, this.field_75356_a) || !this.field_75356_a.field_70170_p.func_180495_p(this.field_179507_b).canEntityDestroy(this.field_75356_a.field_70170_p, this.field_179507_b, this.field_75356_a) || !net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this.field_75356_a, this.field_179507_b, this.field_75356_a.field_70170_p.func_180495_p(this.field_179507_b))) { return false; } else { - return !this.func_195922_f(); + return this.func_220696_a(this.field_75356_a.field_70170_p.func_175659_aa()) && !this.func_195922_f(); diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIMate.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/BreedGoal.java.patch similarity index 53% rename from patches/minecraft/net/minecraft/entity/ai/EntityAIMate.java.patch rename to patches/minecraft/net/minecraft/entity/ai/goal/BreedGoal.java.patch index 0fdc57982..51b300bee 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIMate.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/BreedGoal.java.patch @@ -1,12 +1,12 @@ ---- a/net/minecraft/entity/ai/EntityAIMate.java -+++ b/net/minecraft/entity/ai/EntityAIMate.java -@@ -76,6 +76,17 @@ +--- a/net/minecraft/entity/ai/goal/BreedGoal.java ++++ b/net/minecraft/entity/ai/goal/BreedGoal.java +@@ -79,6 +79,17 @@ protected void func_75388_i() { - EntityAgeable entityageable = this.field_75390_d.func_90011_a(this.field_75391_e); -+ final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(field_75390_d, field_75391_e, entityageable); + AgeableEntity ageableentity = this.field_75390_d.func_90011_a(this.field_75391_e); ++ final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(field_75390_d, field_75391_e, ageableentity); + final boolean cancelled = net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ entityageable = event.getChild(); ++ ageableentity = event.getChild(); + if (cancelled) { + //Reset the "inLove" state for the animals + this.field_75390_d.func_70873_a(6000); @@ -15,6 +15,6 @@ + this.field_75391_e.func_70875_t(); + return; + } - if (entityageable != null) { - EntityPlayerMP entityplayermp = this.field_75390_d.func_191993_do(); - if (entityplayermp == null && this.field_75391_e.func_191993_do() != null) { + if (ageableentity != null) { + ServerPlayerEntity serverplayerentity = this.field_75390_d.func_191993_do(); + if (serverplayerentity == null && this.field_75391_e.func_191993_do() != null) { diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIEatGrass.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch similarity index 74% rename from patches/minecraft/net/minecraft/entity/ai/EntityAIEatGrass.java.patch rename to patches/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch index a612e0948..fe35a4d11 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIEatGrass.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/EatGrassGoal.java.patch @@ -1,20 +1,20 @@ ---- a/net/minecraft/entity/ai/EntityAIEatGrass.java -+++ b/net/minecraft/entity/ai/EntityAIEatGrass.java -@@ -57,7 +57,7 @@ +--- a/net/minecraft/entity/ai/goal/EatGrassGoal.java ++++ b/net/minecraft/entity/ai/goal/EatGrassGoal.java +@@ -58,7 +58,7 @@ if (this.field_151502_a == 4) { - BlockPos blockpos = new BlockPos(this.field_151500_b.field_70165_t, this.field_151500_b.field_70163_u, this.field_151500_b.field_70161_v); + BlockPos blockpos = new BlockPos(this.field_151500_b); if (field_179505_b.test(this.field_151501_c.func_180495_p(blockpos))) { - if (this.field_151501_c.func_82736_K().func_82766_b("mobGriefing")) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_151501_c, this.field_151500_b)) { this.field_151501_c.func_175655_b(blockpos, false); } -@@ -65,7 +65,7 @@ +@@ -66,7 +66,7 @@ } else { BlockPos blockpos1 = blockpos.func_177977_b(); if (this.field_151501_c.func_180495_p(blockpos1).func_177230_c() == Blocks.field_196658_i) { - if (this.field_151501_c.func_82736_K().func_82766_b("mobGriefing")) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_151501_c, this.field_151500_b)) { - this.field_151501_c.func_175718_b(2001, blockpos1, Block.func_196246_j(Blocks.field_196658_i.func_176223_P())); + this.field_151501_c.func_217379_c(2001, blockpos1, Block.func_196246_j(Blocks.field_196658_i.func_176223_P())); this.field_151501_c.func_180501_a(blockpos1, Blocks.field_150346_d.func_176223_P(), 2); } diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch new file mode 100644 index 000000000..18f4590a8 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/ai/goal/MeleeAttackGoal.java.patch @@ -0,0 +1,46 @@ +--- a/net/minecraft/entity/ai/goal/MeleeAttackGoal.java ++++ b/net/minecraft/entity/ai/goal/MeleeAttackGoal.java +@@ -21,6 +21,8 @@ + private double field_151496_k; + protected final int field_188493_g = 20; + private long field_220720_k; ++ private int failedPathFindingPenalty = 0; ++ private boolean canPenalize = false; + + public MeleeAttackGoal(CreatureEntity p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) { + this.field_75441_b = p_i1636_1_; +@@ -41,6 +43,15 @@ + } else if (!livingentity.func_70089_S()) { + return false; + } else { ++ if (canPenalize) { ++ if (--this.field_75445_i <= 0) { ++ this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(livingentity); ++ this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); ++ return this.field_75438_g != null; ++ } else { ++ return true; ++ } ++ } + this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(livingentity); + if (this.field_75438_g != null) { + return true; +@@ -92,6 +103,18 @@ + this.field_151495_j = livingentity.func_174813_aQ().field_72338_b; + this.field_151496_k = livingentity.field_70161_v; + this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); ++ if (this.canPenalize) { ++ this.field_75445_i += failedPathFindingPenalty; ++ if (this.field_75441_b.func_70661_as().func_75505_d() != null) { ++ net.minecraft.pathfinding.PathPoint finalPathPoint = this.field_75441_b.func_70661_as().func_75505_d().func_75870_c(); ++ if (finalPathPoint != null && livingentity.func_70092_e(finalPathPoint.field_75839_a, finalPathPoint.field_75837_b, finalPathPoint.field_75838_c) < 1) ++ failedPathFindingPenalty = 0; ++ else ++ failedPathFindingPenalty += 10; ++ } else { ++ failedPathFindingPenalty += 10; ++ } ++ } + if (d0 > 1024.0D) { + this.field_75445_i += 10; + } else if (d0 > 256.0D) { diff --git a/patches/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch new file mode 100644 index 000000000..e961b5c56 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java ++++ b/net/minecraft/entity/ai/goal/RangedBowAttackGoal.java +@@ -36,7 +36,9 @@ + } + + protected boolean func_188498_f() { +- return this.field_188499_a.func_213382_a(Items.field_151031_f); ++ net.minecraft.item.ItemStack main = this.field_188499_a.func_184614_ca(); ++ net.minecraft.item.ItemStack off = this.field_188499_a.func_184592_cb(); ++ return main.func_77973_b() instanceof BowItem || off.func_77973_b() instanceof BowItem; + } + + public boolean func_75253_b() { diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java.patch b/patches/minecraft/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch similarity index 55% rename from patches/minecraft/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java.patch rename to patches/minecraft/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch index ee2ff581d..07266933d 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java.patch @@ -1,11 +1,11 @@ ---- a/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java -+++ b/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java -@@ -52,7 +52,7 @@ - if (entity instanceof EntityPlayer) { +--- a/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java ++++ b/net/minecraft/entity/ai/goal/RunAroundLikeCrazyGoal.java +@@ -54,7 +54,7 @@ + if (entity instanceof PlayerEntity) { int i = this.field_111180_a.func_110252_cg(); int j = this.field_111180_a.func_190676_dC(); - if (j > 0 && this.field_111180_a.func_70681_au().nextInt(j) < i) { -+ if (j > 0 && this.field_111180_a.func_70681_au().nextInt(j) < i && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(field_111180_a, (EntityPlayer)entity)) { - this.field_111180_a.func_110263_g((EntityPlayer)entity); ++ if (j > 0 && this.field_111180_a.func_70681_au().nextInt(j) < i && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(field_111180_a, (PlayerEntity)entity)) { + this.field_111180_a.func_110263_g((PlayerEntity)entity); return; } diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch deleted file mode 100644 index 703b05250..000000000 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/net/minecraft/entity/boss/EntityDragon.java -+++ b/net/minecraft/entity/boss/EntityDragon.java -@@ -423,10 +423,10 @@ - BlockPos blockpos = new BlockPos(k1, l1, i2); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); - Block block = iblockstate.func_177230_c(); -- if (!iblockstate.func_196958_f() && iblockstate.func_185904_a() != Material.field_151581_o) { -- if (!this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { -+ if (!iblockstate.isAir(field_70170_p, blockpos) && iblockstate.func_185904_a() != Material.field_151581_o) { -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { - flag = true; -- } else if (block != Blocks.field_180401_cv && block != Blocks.field_150343_Z && block != Blocks.field_150377_bs && block != Blocks.field_150357_h && block != Blocks.field_150384_bq && block != Blocks.field_150378_br) { -+ } else if (iblockstate.canEntityDestroy(this.field_70170_p, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, iblockstate)) { - if (block != Blocks.field_150483_bI && block != Blocks.field_185776_dc && block != Blocks.field_185777_dd && block != Blocks.field_150411_aY && block != Blocks.field_185775_db) { - flag1 = this.field_70170_p.func_175698_g(blockpos) || flag1; - } else { diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch deleted file mode 100644 index f817dbc2e..000000000 --- a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/net/minecraft/entity/boss/EntityWither.java -+++ b/net/minecraft/entity/boss/EntityWither.java -@@ -208,7 +208,7 @@ - if (this.func_82212_n() > 0) { - int j1 = this.func_82212_n() - 1; - if (j1 <= 0) { -- this.field_70170_p.func_72885_a(this, this.field_70165_t, this.field_70163_u + (double)this.func_70047_e(), this.field_70161_v, 7.0F, false, this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")); -+ this.field_70170_p.func_72885_a(this, this.field_70165_t, this.field_70163_u + (double)this.func_70047_e(), this.field_70161_v, 7.0F, false, net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)); - this.field_70170_p.func_175669_a(1023, new BlockPos(this), 0); - } - -@@ -282,7 +282,7 @@ - - if (this.field_82222_j > 0) { - --this.field_82222_j; -- if (this.field_82222_j == 0 && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { -+ if (this.field_82222_j == 0 && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { - int i1 = MathHelper.func_76128_c(this.field_70163_u); - int l1 = MathHelper.func_76128_c(this.field_70165_t); - int i2 = MathHelper.func_76128_c(this.field_70161_v); -@@ -297,7 +297,7 @@ - BlockPos blockpos = new BlockPos(i3, k, l); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); - Block block = iblockstate.func_177230_c(); -- if (!iblockstate.func_196958_f() && func_181033_a(block)) { -+ if (!iblockstate.isAir(field_70170_p, blockpos) && block.canEntityDestroy(iblockstate, field_70170_p, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, iblockstate)) { - flag = this.field_70170_p.func_175655_b(blockpos, true) || flag; - } - } diff --git a/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch b/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch new file mode 100644 index 000000000..7ec55ead1 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/boss/WitherEntity.java.patch @@ -0,0 +1,37 @@ +--- a/net/minecraft/entity/boss/WitherEntity.java ++++ b/net/minecraft/entity/boss/WitherEntity.java +@@ -206,7 +206,7 @@ + if (this.func_82212_n() > 0) { + int j1 = this.func_82212_n() - 1; + if (j1 <= 0) { +- Explosion.Mode explosion$mode = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing") ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; ++ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; + this.field_70170_p.func_217398_a(this, this.field_70165_t, this.field_70163_u + (double)this.func_70047_e(), this.field_70161_v, 7.0F, false, explosion$mode); + this.field_70170_p.func_175669_a(1023, new BlockPos(this), 0); + } +@@ -281,7 +281,7 @@ + + if (this.field_82222_j > 0) { + --this.field_82222_j; +- if (this.field_82222_j == 0 && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { ++ if (this.field_82222_j == 0 && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { + int i1 = MathHelper.func_76128_c(this.field_70163_u); + int l1 = MathHelper.func_76128_c(this.field_70165_t); + int i2 = MathHelper.func_76128_c(this.field_70161_v); +@@ -295,7 +295,7 @@ + int l = i2 + l2; + BlockPos blockpos = new BlockPos(i3, k, l); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); +- if (func_181033_a(blockstate)) { ++ if (blockstate.canEntityDestroy(this.field_70170_p, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, blockstate)) { + flag = this.field_70170_p.func_175655_b(blockpos, true) || flag; + } + } +@@ -316,6 +316,7 @@ + } + } + ++ @Deprecated //Forge: DO NOT USE use BlockState.canEntityDestroy + public static boolean func_181033_a(BlockState p_181033_0_) { + return !p_181033_0_.func_196958_f() && !BlockTags.field_219755_X.func_199685_a_(p_181033_0_.func_177230_c()); + } diff --git a/patches/minecraft/net/minecraft/entity/boss/dragon/EnderDragonEntity.java.patch b/patches/minecraft/net/minecraft/entity/boss/dragon/EnderDragonEntity.java.patch new file mode 100644 index 000000000..290a9e475 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/boss/dragon/EnderDragonEntity.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/entity/boss/dragon/EnderDragonEntity.java ++++ b/net/minecraft/entity/boss/dragon/EnderDragonEntity.java +@@ -407,8 +407,10 @@ + BlockPos blockpos = new BlockPos(k1, l1, i2); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); + Block block = blockstate.func_177230_c(); +- if (!blockstate.func_196958_f() && blockstate.func_185904_a() != Material.field_151581_o) { +- if (this.field_70170_p.func_82736_K().func_82766_b("mobGriefing") && !BlockTags.field_219754_W.func_199685_a_(block)) { ++ if (!blockstate.isAir(this.field_70170_p, blockpos) && blockstate.func_185904_a() != Material.field_151581_o) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this) && ++ blockstate.canEntityDestroy(this.field_70170_p, blockpos, this) && ++ net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, blockstate)) { + flag1 = this.field_70170_p.func_217377_a(blockpos, false) || flag1; + } else { + flag = true; diff --git a/patches/minecraft/net/minecraft/entity/boss/dragon/phase/FlamingSittingPhase.java.patch b/patches/minecraft/net/minecraft/entity/boss/dragon/phase/FlamingSittingPhase.java.patch new file mode 100644 index 000000000..45902066d --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/boss/dragon/phase/FlamingSittingPhase.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/boss/dragon/phase/FlamingSittingPhase.java ++++ b/net/minecraft/entity/boss/dragon/phase/FlamingSittingPhase.java +@@ -58,7 +58,7 @@ + double d2 = this.field_188661_a.field_70986_h.field_70163_u + (double)(this.field_188661_a.field_70986_h.func_213302_cg() / 2.0F); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(d0, d2, d1); + +- while(this.field_188661_a.field_70170_p.func_175623_d(blockpos$mutableblockpos)) { ++ while(this.field_188661_a.field_70170_p.func_175623_d(blockpos$mutableblockpos) && d2 >= 0) { //Forge: Fix infinite loop if ground is missing. + --d2; + blockpos$mutableblockpos.func_189532_c(d0, d2, d1); + } diff --git a/patches/minecraft/net/minecraft/entity/boss/dragon/phase/PhaseSittingFlaming.java.patch b/patches/minecraft/net/minecraft/entity/boss/dragon/phase/PhaseSittingFlaming.java.patch deleted file mode 100644 index c7d2b71fd..000000000 --- a/patches/minecraft/net/minecraft/entity/boss/dragon/phase/PhaseSittingFlaming.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/boss/dragon/phase/PhaseSittingFlaming.java -+++ b/net/minecraft/entity/boss/dragon/phase/PhaseSittingFlaming.java -@@ -58,7 +58,7 @@ - double d2 = this.field_188661_a.field_70986_h.field_70163_u + (double)(this.field_188661_a.field_70986_h.field_70131_O / 2.0F); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d2), MathHelper.func_76128_c(d1)); - -- while(this.field_188661_a.field_70170_p.func_175623_d(blockpos$mutableblockpos)) { -+ while(this.field_188661_a.field_70170_p.func_175623_d(blockpos$mutableblockpos) && d2 >= 0) { //Forge: Fix infinite loop if ground is missing. - --d2; - blockpos$mutableblockpos.func_181079_c(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d2), MathHelper.func_76128_c(d1)); - } diff --git a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch deleted file mode 100644 index d14c85e82..000000000 --- a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/entity/effect/EntityLightningBolt.java -+++ b/net/minecraft/entity/effect/EntityLightningBolt.java -@@ -75,6 +75,7 @@ - - for(int i = 0; i < list.size(); ++i) { - Entity entity = list.get(i); -+ if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) - entity.func_70077_a(this); - } - diff --git a/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch b/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch new file mode 100644 index 000000000..2aa8fc8c0 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/effect/LightningBoltEntity.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/entity/effect/LightningBoltEntity.java ++++ b/net/minecraft/entity/effect/LightningBoltEntity.java +@@ -79,6 +79,7 @@ + List list = this.field_70170_p.func_175674_a(this, new AxisAlignedBB(this.field_70165_t - 3.0D, this.field_70163_u - 3.0D, this.field_70161_v - 3.0D, this.field_70165_t + 3.0D, this.field_70163_u + 6.0D + 3.0D, this.field_70161_v + 3.0D), Entity::func_70089_S); + + for(Entity entity : list) { ++ if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) + entity.func_70077_a(this); + } + diff --git a/patches/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch new file mode 100644 index 000000000..e63ad54f5 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/ArmorStandEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/item/ArmorStandEntity.java ++++ b/net/minecraft/entity/item/ArmorStandEntity.java +@@ -56,7 +56,7 @@ + public static final DataParameter field_184806_f = EntityDataManager.func_187226_a(ArmorStandEntity.class, DataSerializers.field_187199_i); + public static final DataParameter field_184807_g = EntityDataManager.func_187226_a(ArmorStandEntity.class, DataSerializers.field_187199_i); + private static final Predicate field_184798_bv = (p_200617_0_) -> { +- return p_200617_0_ instanceof AbstractMinecartEntity && ((AbstractMinecartEntity)p_200617_0_).func_184264_v() == AbstractMinecartEntity.Type.RIDEABLE; ++ return p_200617_0_ instanceof AbstractMinecartEntity && ((AbstractMinecartEntity)p_200617_0_).canBeRidden(); + }; + private final NonNullList field_184799_bw = NonNullList.func_191197_a(2, ItemStack.field_190927_a); + private final NonNullList field_184800_bx = NonNullList.func_191197_a(4, ItemStack.field_190927_a); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityBoat.java.patch b/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch similarity index 51% rename from patches/minecraft/net/minecraft/entity/item/EntityBoat.java.patch rename to patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch index 5b7c8b510..54acc1923 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityBoat.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/BoatEntity.java.patch @@ -1,16 +1,16 @@ ---- a/net/minecraft/entity/item/EntityBoat.java -+++ b/net/minecraft/entity/item/EntityBoat.java -@@ -460,7 +460,7 @@ +--- a/net/minecraft/entity/item/BoatEntity.java ++++ b/net/minecraft/entity/item/BoatEntity.java +@@ -458,7 +458,7 @@ blockpos$pooledmutableblockpos.func_181079_c(l1, k2, i2); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos); - if (!(iblockstate.func_177230_c() instanceof BlockLilyPad) && VoxelShapes.func_197879_c(iblockstate.func_196952_d(this.field_70170_p, blockpos$pooledmutableblockpos).func_197751_a((double)l1, (double)k2, (double)i2), voxelshape, IBooleanFunction.AND)) { -- f += iblockstate.func_177230_c().func_208618_m(); -+ f += iblockstate.getSlipperiness(field_70170_p, blockpos$pooledmutableblockpos, this); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos); + if (!(blockstate.func_177230_c() instanceof LilyPadBlock) && VoxelShapes.func_197879_c(blockstate.func_196952_d(this.field_70170_p, blockpos$pooledmutableblockpos).func_197751_a((double)l1, (double)k2, (double)i2), voxelshape, IBooleanFunction.AND)) { +- f += blockstate.func_177230_c().func_208618_m(); ++ f += blockstate.getSlipperiness(this.field_70170_p, blockpos$pooledmutableblockpos, this); ++k1; } } -@@ -779,6 +779,20 @@ - this.field_184463_aC = p_184442_4_; +@@ -777,6 +777,20 @@ + return new SSpawnObjectPacket(this); } + // Forge: Fix MC-119811 by instantly completing lerp on board diff --git a/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch new file mode 100644 index 000000000..208691a6a --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch @@ -0,0 +1,24 @@ +--- a/net/minecraft/entity/item/EnderPearlEntity.java ++++ b/net/minecraft/entity/item/EnderPearlEntity.java +@@ -84,6 +84,8 @@ + if (livingentity instanceof ServerPlayerEntity) { + ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)livingentity; + if (serverplayerentity.field_71135_a.func_147362_b().func_150724_d() && serverplayerentity.field_70170_p == this.field_70170_p && !serverplayerentity.func_70608_bn()) { ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(serverplayerentity, this.field_70165_t, this.field_70163_u, this.field_70161_v, 5.0F); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { // Don't indent to lower patch size + if (this.field_70146_Z.nextFloat() < 0.05F && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) { + EndermiteEntity endermiteentity = EntityType.field_200804_r.func_200721_a(this.field_70170_p); + endermiteentity.func_175496_a(true); +@@ -95,9 +97,10 @@ + livingentity.func_184210_p(); + } + +- livingentity.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v); ++ livingentity.func_70634_a(event.getTargetX(), event.getTargetY(), event.getTargetZ()); + livingentity.field_70143_R = 0.0F; +- livingentity.func_70097_a(DamageSource.field_76379_h, 5.0F); ++ livingentity.func_70097_a(DamageSource.field_76379_h, event.getAttackDamage()); ++ }//Forge: End + } + } else if (livingentity != null) { + livingentity.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityArmorStand.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityArmorStand.java.patch deleted file mode 100644 index aed24238d..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityArmorStand.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/item/EntityArmorStand.java -+++ b/net/minecraft/entity/item/EntityArmorStand.java -@@ -54,7 +54,7 @@ - public static final DataParameter field_184806_f = EntityDataManager.func_187226_a(EntityArmorStand.class, DataSerializers.field_187199_i); - public static final DataParameter field_184807_g = EntityDataManager.func_187226_a(EntityArmorStand.class, DataSerializers.field_187199_i); - private static final Predicate field_184798_bv = (p_200617_0_) -> { -- return p_200617_0_ instanceof EntityMinecart && ((EntityMinecart)p_200617_0_).func_184264_v() == EntityMinecart.Type.RIDEABLE; -+ return p_200617_0_ instanceof EntityMinecart && ((EntityMinecart)p_200617_0_).canBeRidden(); - }; - private final NonNullList field_184799_bw = NonNullList.func_191197_a(2, ItemStack.field_190927_a); - private final NonNullList field_184800_bx = NonNullList.func_191197_a(4, ItemStack.field_190927_a); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch deleted file mode 100644 index 6c80456e3..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- a/net/minecraft/entity/item/EntityEnderPearl.java -+++ b/net/minecraft/entity/item/EntityEnderPearl.java -@@ -75,6 +75,9 @@ - if (entitylivingbase instanceof EntityPlayerMP) { - EntityPlayerMP entityplayermp = (EntityPlayerMP)entitylivingbase; - if (entityplayermp.field_71135_a.func_147362_b().func_150724_d() && entityplayermp.field_70170_p == this.field_70170_p && !entityplayermp.func_70608_bn()) { -+ -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.field_70165_t, this.field_70163_u, this.field_70161_v, 5.0F); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { // Don't indent to lower patch size - if (this.field_70146_Z.nextFloat() < 0.05F && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) { - EntityEndermite entityendermite = new EntityEndermite(this.field_70170_p); - entityendermite.func_175496_a(true); -@@ -86,9 +89,10 @@ - entitylivingbase.func_184210_p(); - } - -- entitylivingbase.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v); -+ entitylivingbase.func_70634_a(event.getTargetX(), event.getTargetY(), event.getTargetZ()); - entitylivingbase.field_70143_R = 0.0F; -- entitylivingbase.func_70097_a(DamageSource.field_76379_h, 5.0F); -+ entitylivingbase.func_70097_a(DamageSource.field_76379_h, event.getAttackDamage()); -+ } - } - } else if (entitylivingbase != null) { - entitylivingbase.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v); -@@ -110,12 +114,13 @@ - - } - -+ @Override - @Nullable -- public Entity func_212321_a(DimensionType p_212321_1_) { -+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { - if (this.field_70192_c.field_71093_bK != p_212321_1_) { - this.field_70192_c = null; - } - -- return super.func_212321_a(p_212321_1_); -+ return super.changeDimension(p_212321_1_, teleporter); - } - } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch deleted file mode 100644 index a98b6a7c8..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityFallingBlock.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/net/minecraft/entity/item/EntityFallingBlock.java -+++ b/net/minecraft/entity/item/EntityFallingBlock.java -@@ -133,6 +133,7 @@ - } - } else { - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos1); -+ if (this.field_70170_p.func_175623_d(new BlockPos(this.field_70165_t, this.field_70163_u - (double)0.01F, this.field_70161_v))) //Forge: Don't indent below. - if (!flag1 && BlockFalling.func_185759_i(this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.field_70163_u - (double)0.01F, this.field_70161_v)))) { - this.field_70122_E = false; - return; -@@ -144,12 +145,12 @@ - if (iblockstate.func_177230_c() != Blocks.field_196603_bb) { - this.func_70106_y(); - if (!this.field_145808_f) { -- if (iblockstate.func_185904_a().func_76222_j() && (flag1 || !BlockFalling.func_185759_i(this.field_70170_p.func_180495_p(blockpos1.func_177977_b()))) && this.field_70170_p.func_180501_a(blockpos1, this.field_175132_d, 3)) { -+ if (iblockstate.func_185904_a().func_76222_j() && (flag1 || !BlockFalling.func_185759_i(this.field_70170_p.func_180495_p(blockpos1.func_177977_b()))) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(this, new net.minecraftforge.common.util.BlockSnapshot(func_130014_f_(), func_180425_c(), iblockstate), net.minecraft.util.EnumFacing.UP) && this.field_70170_p.func_180501_a(blockpos1, this.field_175132_d, 3)) { - if (block instanceof BlockFalling) { - ((BlockFalling)block).func_176502_a_(this.field_70170_p, blockpos1, this.field_175132_d, iblockstate); - } - -- if (this.field_145810_d != null && block instanceof ITileEntityProvider) { -+ if (this.field_145810_d != null && this.field_175132_d.hasTileEntity()) { - TileEntity tileentity = this.field_70170_p.func_175625_s(blockpos1); - if (tileentity != null) { - NBTTagCompound nbttagcompound = tileentity.func_189515_b(new NBTTagCompound()); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch deleted file mode 100644 index c3699dfb8..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/entity/item/EntityItemFrame.java -+++ b/net/minecraft/entity/item/EntityItemFrame.java -@@ -175,12 +175,13 @@ - } - - private void func_110131_b(ItemStack p_110131_1_) { -- if (p_110131_1_.func_77973_b() == Items.field_151098_aY) { -+ if (p_110131_1_.func_77973_b() instanceof net.minecraft.item.ItemMap) { - MapData mapdata = ItemMap.func_195950_a(p_110131_1_, this.field_70170_p); - mapdata.func_212441_a(this.field_174861_a, this.func_145782_y()); - } - - p_110131_1_.func_82842_a((EntityItemFrame)null); -+ this.func_82334_a(ItemStack.field_190927_a); //Forge: Fix MC-124833 Pistons duplicating Items. - } - - public ItemStack func_82335_i() { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch deleted file mode 100644 index ad4486b5f..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ /dev/null @@ -1,258 +0,0 @@ ---- a/net/minecraft/entity/item/EntityMinecart.java -+++ b/net/minecraft/entity/item/EntityMinecart.java -@@ -38,7 +38,7 @@ - import net.minecraftforge.api.distmarker.Dist; - import net.minecraftforge.api.distmarker.OnlyIn; - --public abstract class EntityMinecart extends Entity implements INameable { -+public abstract class EntityMinecart extends Entity implements INameable, net.minecraftforge.common.extensions.IForgeEntityMinecart { - private static final DataParameter field_184265_a = EntityDataManager.func_187226_a(EntityMinecart.class, DataSerializers.field_187192_b); - private static final DataParameter field_184266_b = EntityDataManager.func_187226_a(EntityMinecart.class, DataSerializers.field_187192_b); - private static final DataParameter field_184267_c = EntityDataManager.func_187226_a(EntityMinecart.class, DataSerializers.field_187193_c); -@@ -59,6 +59,7 @@ - private double field_70507_ar; - @OnlyIn(Dist.CLIENT) - private double field_70506_as; -+ private boolean canBePushed = true; - - protected EntityMinecart(EntityType p_i48538_1_, World p_i48538_2_) { - super(p_i48538_1_, p_i48538_2_); -@@ -111,11 +112,12 @@ - - @Nullable - public AxisAlignedBB func_70114_g(Entity p_70114_1_) { -+ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, p_70114_1_); - return p_70114_1_.func_70104_M() ? p_70114_1_.func_174813_aQ() : null; - } - - public boolean func_70104_M() { -- return true; -+ return canBePushed; - } - - public double func_70042_X() { -@@ -260,7 +262,7 @@ - - BlockPos blockpos = new BlockPos(j, k, l); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); -- if (iblockstate.func_203425_a(BlockTags.field_203437_y)) { -+ if (canUseRail() && iblockstate.func_203425_a(BlockTags.field_203437_y)) { - this.func_180460_a(blockpos, iblockstate); - if (iblockstate.func_177230_c() == Blocks.field_150408_cc) { - this.func_96095_a(j, k, l, iblockstate.func_177229_b(BlockRailPowered.field_176569_M)); -@@ -287,8 +289,11 @@ - } - - this.func_70101_b(this.field_70177_z, this.field_70125_A); -- if (this.func_184264_v() == EntityMinecart.Type.RIDEABLE && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D) { -- List list = this.field_70170_p.func_175674_a(this, this.func_174813_aQ().func_72314_b((double)0.2F, 0.0D, (double)0.2F), EntitySelectors.func_200823_a(this)); -+ AxisAlignedBB box; -+ if (getCollisionHandler() != null) box = getCollisionHandler().getMinecartCollisionBox(this); -+ else box = this.func_174813_aQ().func_72314_b(0.2F, 0.0D, 0.2F); -+ if (canBeRidden() && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D) { -+ List list = this.field_70170_p.func_175674_a(this, box, EntitySelectors.func_200823_a(this)); - if (!list.isEmpty()) { - for(int i1 = 0; i1 < list.size(); ++i1) { - Entity entity1 = list.get(i1); -@@ -300,7 +305,7 @@ - } - } - } else { -- for(Entity entity : this.field_70170_p.func_72839_b(this, this.func_174813_aQ().func_72314_b((double)0.2F, 0.0D, (double)0.2F))) { -+ for(Entity entity : this.field_70170_p.func_72839_b(this, box)) { - if (!this.func_184196_w(entity) && entity.func_70104_M() && entity instanceof EntityMinecart) { - entity.func_70108_f(this); - } -@@ -308,6 +313,7 @@ - } - - this.func_70072_I(); -+ //net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); - } - } - -@@ -319,20 +325,30 @@ - } - - protected void func_180459_n() { -- double d0 = this.func_174898_m(); -+ double d0 = field_70122_E ? this.func_174898_m() : getMaxSpeedAirLateral(); - this.field_70159_w = MathHelper.func_151237_a(this.field_70159_w, -d0, d0); - this.field_70179_y = MathHelper.func_151237_a(this.field_70179_y, -d0, d0); -+ -+ double moveY = field_70181_x; -+ if(getMaxSpeedAirVertical() > 0 && field_70181_x > getMaxSpeedAirVertical()) { -+ moveY = getMaxSpeedAirVertical(); -+ if(Math.abs(field_70159_w) < 0.3f && Math.abs(field_70179_y) < 0.3f) { -+ moveY = 0.15f; -+ field_70181_x = moveY; -+ } -+ } -+ - if (this.field_70122_E) { - this.field_70159_w *= 0.5D; - this.field_70181_x *= 0.5D; - this.field_70179_y *= 0.5D; - } - -- this.func_70091_d(MoverType.SELF, this.field_70159_w, this.field_70181_x, this.field_70179_y); -+ this.func_70091_d(MoverType.SELF, this.field_70159_w, moveY, this.field_70179_y); - if (!this.field_70122_E) { -- this.field_70159_w *= (double)0.95F; -- this.field_70181_x *= (double)0.95F; -- this.field_70179_y *= (double)0.95F; -+ this.field_70159_w *= getDragAir(); -+ this.field_70181_x *= getDragAir(); -+ this.field_70179_y *= getDragAir(); - } - - } -@@ -349,23 +365,23 @@ - flag1 = !flag; - } - -- double d0 = 0.0078125D; -- RailShape railshape = p_180460_2_.func_177229_b(blockrailbase.func_176560_l()); -+ double slopeAdjustment = getSlopeAdjustment(); -+ RailShape railshape = ((BlockRailBase)p_180460_2_.func_177230_c()).getRailDirection(p_180460_2_, field_70170_p, p_180460_1_, this); - switch(railshape) { - case ASCENDING_EAST: -- this.field_70159_w -= 0.0078125D; -+ this.field_70159_w -= slopeAdjustment; - ++this.field_70163_u; - break; - case ASCENDING_WEST: -- this.field_70159_w += 0.0078125D; -+ this.field_70159_w += slopeAdjustment; - ++this.field_70163_u; - break; - case ASCENDING_NORTH: -- this.field_70179_y += 0.0078125D; -+ this.field_70179_y += slopeAdjustment; - ++this.field_70163_u; - break; - case ASCENDING_SOUTH: -- this.field_70179_y -= 0.0078125D; -+ this.field_70179_y -= slopeAdjustment; - ++this.field_70163_u; - } - -@@ -401,7 +417,7 @@ - } - } - -- if (flag1) { -+ if (flag1 && shouldDoRailFunctions()) { - double d17 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); - if (d17 < 0.03D) { - this.field_70159_w *= 0.0D; -@@ -436,17 +452,7 @@ - this.field_70165_t = d18 + d1 * d10; - this.field_70161_v = d19 + d2 * d10; - this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); -- double d22 = this.field_70159_w; -- double d23 = this.field_70179_y; -- if (this.func_184207_aI()) { -- d22 *= 0.75D; -- d23 *= 0.75D; -- } -- -- double d13 = this.func_174898_m(); -- d22 = MathHelper.func_151237_a(d22, -d13, d13); -- d23 = MathHelper.func_151237_a(d23, -d13, d13); -- this.func_70091_d(MoverType.SELF, d22, 0.0D, d23); -+ this.moveMinecartOnRail(p_180460_1_); - if (aint[0][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[0][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[0][2]) { - this.func_70107_b(this.field_70165_t, this.field_70163_u + (double)aint[0][1], this.field_70161_v); - } else if (aint[1][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[1][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[1][2]) { -@@ -474,7 +480,10 @@ - this.field_70179_y = d5 * (double)(i - p_180460_1_.func_177952_p()); - } - -- if (flag) { -+ if (shouldDoRailFunctions()) -+ ((BlockRailBase)p_180460_2_.func_177230_c()).onMinecartPass(p_180460_2_, field_70170_p, p_180460_1_, this); -+ -+ if (flag && shouldDoRailFunctions()) { - double d15 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); - if (d15 > 0.01D) { - double d16 = 0.06D; -@@ -531,7 +540,7 @@ - - IBlockState iblockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)); - if (iblockstate.func_203425_a(BlockTags.field_203437_y)) { -- RailShape railshape = iblockstate.func_177229_b(((BlockRailBase)iblockstate.func_177230_c()).func_176560_l()); -+ RailShape railshape = ((BlockRailBase)iblockstate.func_177230_c()).getRailDirection(iblockstate, field_70170_p, new BlockPos(i, j, k), this); - p_70495_3_ = (double)j; - if (railshape.func_208092_c()) { - p_70495_3_ = (double)(j + 1); -@@ -568,7 +577,7 @@ - - IBlockState iblockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)); - if (iblockstate.func_203425_a(BlockTags.field_203437_y)) { -- RailShape railshape = iblockstate.func_177229_b(((BlockRailBase)iblockstate.func_177230_c()).func_176560_l()); -+ RailShape railshape = ((BlockRailBase)iblockstate.func_177230_c()).getRailDirection(iblockstate, field_70170_p, new BlockPos(i, j, k), this); - int[][] aint = field_70500_g[railshape.func_208091_a()]; - double d0 = (double)i + 0.5D + (double)aint[0][0] * 0.5D; - double d1 = (double)j + 0.0625D + (double)aint[0][1] * 0.5D; -@@ -631,6 +640,11 @@ - } - - public void func_70108_f(Entity p_70108_1_) { -+ //net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); -+ if (getCollisionHandler() != null) { -+ getCollisionHandler().onEntityCollision(this, p_70108_1_); -+ return; -+ } - if (!this.field_70170_p.field_72995_K) { - if (!p_70108_1_.field_70145_X && !this.field_70145_X) { - if (!this.func_184196_w(p_70108_1_)) { -@@ -666,13 +680,13 @@ - - double d7 = p_70108_1_.field_70159_w + this.field_70159_w; - double d8 = p_70108_1_.field_70179_y + this.field_70179_y; -- if (((EntityMinecart)p_70108_1_).func_184264_v() == EntityMinecart.Type.FURNACE && this.func_184264_v() != EntityMinecart.Type.FURNACE) { -+ if (((EntityMinecart)p_70108_1_).isPoweredCart() && !isPoweredCart()) { - this.field_70159_w *= (double)0.2F; - this.field_70179_y *= (double)0.2F; - this.func_70024_g(p_70108_1_.field_70159_w - d0, 0.0D, p_70108_1_.field_70179_y - d1); - p_70108_1_.field_70159_w *= (double)0.95F; - p_70108_1_.field_70179_y *= (double)0.95F; -- } else if (((EntityMinecart)p_70108_1_).func_184264_v() != EntityMinecart.Type.FURNACE && this.func_184264_v() == EntityMinecart.Type.FURNACE) { -+ } else if (!((EntityMinecart)p_70108_1_).isPoweredCart() && isPoweredCart()) { - p_70108_1_.field_70159_w *= (double)0.2F; - p_70108_1_.field_70179_y *= (double)0.2F; - p_70108_1_.func_70024_g(this.field_70159_w + d0, 0.0D, this.field_70179_y + d1); -@@ -782,6 +796,32 @@ - this.func_184212_Q().func_187227_b(field_184270_f, p_94096_1_); - } - -+ private boolean canUseRail = true; -+ @Override public boolean canUseRail() { return canUseRail; } -+ @Override public void setCanUseRail(boolean value) { this.canUseRail = value; } -+ private float currentSpeedOnRail; -+ @Override public float getCurrentCartSpeedCapOnRail() { return currentSpeedOnRail; } -+ @Override public void setCurrentCartSpeedCapOnRail(float value) { currentSpeedOnRail = Math.min(value, getMaxCartSpeedOnRail()); } -+ private float maxSpeedAirLateral = DEFAULT_MAX_SPEED_AIR_LATERAL; -+ @Override public float getMaxSpeedAirLateral() { return maxSpeedAirLateral; } -+ @Override public void setMaxSpeedAirLateral(float value) { maxSpeedAirLateral = value; } -+ private float maxSpeedAirVertical = DEFAULT_MAX_SPEED_AIR_VERTICAL; -+ @Override public float getMaxSpeedAirVertical() { return maxSpeedAirVertical; } -+ @Override public void setMaxSpeedAirVertical(float value) { maxSpeedAirVertical = value; } -+ private double dragAir = DEFAULT_AIR_DRAG; -+ @Override public double getDragAir() { return dragAir; } -+ @Override public void setDragAir(double value) { dragAir = value; } -+ @Override -+ public double getMaxSpeed() { //Non-default because getMaximumSpeed is protected -+ if (!canUseRail()) return func_174898_m(); -+ BlockPos pos = this.getCurrentRailPosition(); -+ IBlockState state = getMinecart().field_70170_p.func_180495_p(pos); -+ if (!state.func_203425_a(BlockTags.field_203437_y)) return func_174898_m(); -+ -+ float railMaxSpeed = ((BlockRailBase)state.func_177230_c()).getRailMaxSpeed(state, getMinecart().field_70170_p, pos, getMinecart()); -+ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); -+ } -+ - public static enum Type { - RIDEABLE(0), - CHEST(1), diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch deleted file mode 100644 index 26122a455..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartCommandBlock.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/entity/item/EntityMinecartCommandBlock.java -+++ b/net/minecraft/entity/item/EntityMinecartCommandBlock.java -@@ -72,6 +72,7 @@ - } - - public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_) { -+ if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true; - this.field_145824_a.func_175574_a(p_184230_1_); - return true; - } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch deleted file mode 100644 index aa5a4a55e..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- a/net/minecraft/entity/item/EntityMinecartContainer.java -+++ b/net/minecraft/entity/item/EntityMinecartContainer.java -@@ -120,18 +120,26 @@ - return 64; - } - -+ @Override - @Nullable -- public Entity func_212321_a(DimensionType p_212321_1_) { -+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { - this.field_94112_b = false; -- return super.func_212321_a(p_212321_1_); -+ return super.changeDimension(p_212321_1_, teleporter); - } - - public void func_70106_y() { -+ super.func_70106_y(); -+ } -+ -+ @Override -+ public void remove(boolean keepData) { - if (this.field_94112_b) { - InventoryHelper.func_180176_a(this.field_70170_p, this, this); - } - -- super.func_70106_y(); -+ super.remove(keepData); -+ if (!keepData) -+ itemHandler.invalidate(); - } - - public void func_184174_b(boolean p_184174_1_) { -@@ -164,6 +172,7 @@ - } - - public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_) { -+ if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true; - if (!this.field_70170_p.field_72995_K) { - p_184230_1_.func_71007_a(this); - } -@@ -216,9 +225,9 @@ - random = new Random(this.field_184291_d); - } - -- LootContext.Builder lootcontext$builder = (new LootContext.Builder((WorldServer)this.field_70170_p)).func_204313_a(new BlockPos(this)); -+ LootContext.Builder lootcontext$builder = (new LootContext.Builder((WorldServer)this.field_70170_p)).func_204313_a(new BlockPos(this)).func_186472_a(this); // Forge: add looted entity to LootContext - if (p_184288_1_ != null) { -- lootcontext$builder.func_186469_a(p_184288_1_.func_184817_da()); -+ lootcontext$builder.func_186469_a(p_184288_1_.func_184817_da()).func_186470_a(p_184288_1_); // Forge: add player to LootContext - } - - loottable.func_186460_a(this, random, lootcontext$builder.func_186471_a()); -@@ -239,4 +248,13 @@ - public ResourceLocation func_184276_b() { - return this.field_184290_c; - } -+ -+ private net.minecraftforge.common.util.LazyOptional itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this)); -+ -+ @Override -+ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.EnumFacing facing) { -+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ return itemHandler.cast(); -+ return super.getCapability(capability, facing); -+ } - } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch deleted file mode 100644 index 78d47872a..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/entity/item/EntityMinecartHopper.java -+++ b/net/minecraft/entity/item/EntityMinecartHopper.java -@@ -47,6 +47,7 @@ - } - - public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_) { -+ if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true; - if (!this.field_70170_p.field_72995_K) { - p_184230_1_.func_71007_a(this); - } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartMobSpawner.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartMobSpawner.java.patch deleted file mode 100644 index 073a57aa1..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartMobSpawner.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/net/minecraft/entity/item/EntityMinecartMobSpawner.java -+++ b/net/minecraft/entity/item/EntityMinecartMobSpawner.java -@@ -23,6 +23,12 @@ - public BlockPos func_177221_b() { - return new BlockPos(EntityMinecartMobSpawner.this); - } -+ -+ @Override -+ @javax.annotation.Nullable -+ public net.minecraft.entity.Entity getSpawnerEntity() { -+ return EntityMinecartMobSpawner.this; -+ } - }; - - public EntityMinecartMobSpawner(World p_i46752_1_) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch deleted file mode 100644 index f7ee5277c..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/net/minecraft/entity/item/EntityXPOrb.java -+++ b/net/minecraft/entity/item/EntityXPOrb.java -@@ -117,7 +117,8 @@ - this.func_70091_d(MoverType.SELF, this.field_70159_w, this.field_70181_x, this.field_70179_y); - float f = 0.98F; - if (this.field_70122_E) { -- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().func_208618_m() * 0.98F; -+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v)); -+ f = this.field_70170_p.func_180495_p(underPos).getSlipperiness(field_70170_p, underPos, this) * 0.98F; - } - - this.field_70159_w *= (double)f; -@@ -150,6 +151,7 @@ - } - - public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { -+ if (this.field_70170_p.field_72995_K || this.field_70128_L) return false; //Forge: Fixes MC-53850 - if (this.func_180431_b(p_70097_1_)) { - return false; - } else { -@@ -178,12 +180,14 @@ - public void func_70100_b_(EntityPlayer p_70100_1_) { - if (!this.field_70170_p.field_72995_K) { - if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(p_70100_1_, this))) return; - p_70100_1_.field_71090_bL = 2; - p_70100_1_.func_71001_a(this, 1); - ItemStack itemstack = EnchantmentHelper.func_92099_a(Enchantments.field_185296_A, p_70100_1_); - if (!itemstack.func_190926_b() && itemstack.func_77951_h()) { -- int i = Math.min(this.func_184514_c(this.field_70530_e), itemstack.func_77952_i()); -- this.field_70530_e -= this.func_184515_b(i); -+ float ratio = itemstack.func_77973_b().getXpRepairRatio(itemstack); -+ int i = Math.min(roundAverage(this.field_70530_e * ratio), itemstack.func_77952_i()); -+ this.field_70530_e -= roundAverage(i / ratio); - itemstack.func_196085_b(itemstack.func_77952_i() - i); - } - -@@ -261,4 +265,9 @@ - public boolean func_70075_an() { - return false; - } -+ -+ private static int roundAverage(float value) { -+ double floor = Math.floor(value); -+ return (int) floor + (Math.random() < value - floor ? 1 : 0); -+ } - } diff --git a/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch new file mode 100644 index 000000000..f5cbc6795 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/ExperienceOrbEntity.java.patch @@ -0,0 +1,48 @@ +--- a/net/minecraft/entity/item/ExperienceOrbEntity.java ++++ b/net/minecraft/entity/item/ExperienceOrbEntity.java +@@ -114,7 +114,8 @@ + this.func_213315_a(MoverType.SELF, this.func_213322_ci()); + float f = 0.98F; + if (this.field_70122_E) { +- f = this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().func_208618_m() * 0.98F; ++ BlockPos underPos = new BlockPos(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v); ++ f = this.field_70170_p.func_180495_p(underPos).getSlipperiness(this.field_70170_p, underPos, this) * 0.98F; + } + + this.func_213317_d(this.func_213322_ci().func_216372_d((double)f, 0.98D, (double)f)); +@@ -143,6 +144,7 @@ + } + + public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { ++ if (this.field_70170_p.field_72995_K || this.field_70128_L) return false; //Forge: Fixes MC-53850 + if (this.func_180431_b(p_70097_1_)) { + return false; + } else { +@@ -171,13 +173,14 @@ + public void func_70100_b_(PlayerEntity p_70100_1_) { + if (!this.field_70170_p.field_72995_K) { + if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(p_70100_1_, this))) return; + p_70100_1_.field_71090_bL = 2; + p_70100_1_.func_71001_a(this, 1); + Entry entry = EnchantmentHelper.func_222189_b(Enchantments.field_185296_A, p_70100_1_); + if (entry != null) { + ItemStack itemstack = entry.getValue(); + if (!itemstack.func_190926_b() && itemstack.func_77951_h()) { +- int i = Math.min(this.func_184514_c(this.field_70530_e), itemstack.func_77952_i()); ++ int i = Math.min((int)(this.field_70530_e * itemstack.getXpRepairRatio()), itemstack.func_77952_i()); + this.field_70530_e -= this.func_184515_b(i); + itemstack.func_196085_b(itemstack.func_77952_i() - i); + } +@@ -258,6 +261,11 @@ + return false; + } + ++ private static int roundAverage(float value) { ++ double floor = Math.floor(value); ++ return (int) floor + (Math.random() < value - floor ? 1 : 0); ++ } ++ + public IPacket func_213297_N() { + return new SSpawnExperienceOrbPacket(this); + } diff --git a/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch new file mode 100644 index 000000000..29c838232 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/FallingBlockEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/item/FallingBlockEntity.java ++++ b/net/minecraft/entity/item/FallingBlockEntity.java +@@ -152,7 +152,7 @@ + ((FallingBlock)block).func_176502_a_(this.field_70170_p, blockpos1, this.field_175132_d, blockstate); + } + +- if (this.field_145810_d != null && block instanceof ITileEntityProvider) { ++ if (this.field_145810_d != null && this.field_175132_d.hasTileEntity()) { + TileEntity tileentity = this.field_70170_p.func_175625_s(blockpos1); + if (tileentity != null) { + CompoundNBT compoundnbt = tileentity.func_189515_b(new CompoundNBT()); diff --git a/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch new file mode 100644 index 000000000..68c3398cb --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/HangingEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/item/HangingEntity.java ++++ b/net/minecraft/entity/item/HangingEntity.java +@@ -119,6 +119,8 @@ + int j1 = (j - 1) / -2; + blockpos$mutableblockpos.func_189533_g(blockpos).func_189534_c(direction, k + i1).func_189534_c(Direction.UP, l + j1); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos$mutableblockpos); ++ if (net.minecraft.block.Block.func_220055_a(this.field_70170_p, blockpos$mutableblockpos, this.field_174860_b)) ++ continue; + if (!blockstate.func_185904_a().func_76220_a() && !RedstoneDiodeBlock.func_185546_B(blockstate)) { + return false; + } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch rename to patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch index a993fc934..4caca1ece 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/ItemEntity.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/entity/item/EntityItem.java -+++ b/net/minecraft/entity/item/EntityItem.java -@@ -34,6 +34,10 @@ +--- a/net/minecraft/entity/item/ItemEntity.java ++++ b/net/minecraft/entity/item/ItemEntity.java +@@ -38,6 +38,10 @@ private int field_70291_e = 5; private UUID field_145801_f; private UUID field_145802_g; @@ -8,18 +8,18 @@ + * The maximum age of this EntityItem. The item is expired once this is reached. + */ + public int lifespan = 6000; - public float field_70290_d = (float)(Math.random() * Math.PI * 2.0D); + public final float field_70290_d = (float)(Math.random() * Math.PI * 2.0D); - public EntityItem(World p_i1711_1_) { -@@ -53,6 +57,7 @@ - public EntityItem(World p_i1710_1_, double p_i1710_2_, double p_i1710_4_, double p_i1710_6_, ItemStack p_i1710_8_) { + public ItemEntity(EntityType p_i50217_1_, World p_i50217_2_) { +@@ -54,6 +58,7 @@ + public ItemEntity(World p_i1710_1_, double p_i1710_2_, double p_i1710_4_, double p_i1710_6_, ItemStack p_i1710_8_) { this(p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_); this.func_92058_a(p_i1710_8_); + this.lifespan = (p_i1710_8_.func_77973_b() == null ? 6000 : p_i1710_8_.getEntityLifespan(p_i1710_1_)); } protected boolean func_70041_e_() { -@@ -64,6 +69,7 @@ +@@ -65,6 +70,7 @@ } public void func_70071_h_() { @@ -27,17 +27,17 @@ if (this.func_92059_d().func_190926_b()) { this.func_70106_y(); } else { -@@ -107,7 +113,8 @@ +@@ -96,7 +102,8 @@ + this.func_213315_a(MoverType.SELF, this.func_213322_ci()); + float f = 0.98F; + if (this.field_70122_E) { +- f = this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().func_208618_m() * 0.98F; ++ BlockPos pos = new BlockPos(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v); ++ f = this.field_70170_p.func_180495_p(pos).getSlipperiness(this.field_70170_p, pos, this) * 0.98F; + } - float f = 0.98F; - if (this.field_70122_E) { -- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().func_208618_m() * 0.98F; -+ BlockPos pos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v)); -+ f = this.field_70170_p.func_180495_p(pos).getSlipperiness(this.field_70170_p, pos, this) * 0.98F; - } - - this.field_70159_w *= (double)f; -@@ -132,7 +139,14 @@ + this.func_213317_d(this.func_213322_ci().func_216372_d((double)f, 0.98D, (double)f)); +@@ -130,7 +137,14 @@ } } @@ -53,16 +53,15 @@ this.func_70106_y(); } -@@ -175,6 +189,8 @@ - return p_70289_1_.func_70289_a(this); - } else if (itemstack1.func_190916_E() + itemstack.func_190916_E() > itemstack1.func_77976_d()) { - return false; -+ } else if (!itemstack.areCapsCompatible(itemstack1)) { -+ return false; - } else { - itemstack1.func_190917_f(itemstack.func_190916_E()); - p_70289_1_.field_145804_b = Math.max(p_70289_1_.field_145804_b, this.field_145804_b); -@@ -203,6 +219,7 @@ +@@ -183,6 +197,7 @@ + } + + private static void func_213858_a(ItemEntity p_213858_0_, ItemStack p_213858_1_, ItemEntity p_213858_2_, ItemStack p_213858_3_) { ++ if (!p_213858_1_.areCapsCompatible(p_213858_3_)) return; + int i = Math.min(p_213858_1_.func_77976_d() - p_213858_1_.func_190916_E(), p_213858_3_.func_190916_E()); + ItemStack itemstack = p_213858_1_.func_77946_l(); + itemstack.func_190917_f(i); +@@ -206,6 +221,7 @@ } public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -70,15 +69,15 @@ if (this.func_180431_b(p_70097_1_)) { return false; } else if (!this.func_92059_d().func_190926_b() && this.func_92059_d().func_77973_b() == Items.field_151156_bN && p_70097_1_.func_94541_c()) { -@@ -222,6 +239,7 @@ - p_70014_1_.func_74777_a("Health", (short)this.field_70291_e); - p_70014_1_.func_74777_a("Age", (short)this.field_70292_b); - p_70014_1_.func_74777_a("PickupDelay", (short)this.field_145804_b); -+ p_70014_1_.func_74768_a("Lifespan", lifespan); +@@ -225,6 +241,7 @@ + p_213281_1_.func_74777_a("Health", (short)this.field_70291_e); + p_213281_1_.func_74777_a("Age", (short)this.field_70292_b); + p_213281_1_.func_74777_a("PickupDelay", (short)this.field_145804_b); ++ p_213281_1_.func_74768_a("Lifespan", lifespan); if (this.func_200214_m() != null) { - p_70014_1_.func_74782_a("Thrower", NBTUtil.func_186862_a(this.func_200214_m())); + p_213281_1_.func_218657_a("Thrower", NBTUtil.func_186862_a(this.func_200214_m())); } -@@ -242,6 +260,7 @@ +@@ -245,6 +262,7 @@ if (p_70037_1_.func_74764_b("PickupDelay")) { this.field_145804_b = p_70037_1_.func_74765_d("PickupDelay"); } @@ -86,9 +85,9 @@ if (p_70037_1_.func_150297_b("Owner", 10)) { this.field_145802_g = NBTUtil.func_186860_b(p_70037_1_.func_74775_l("Owner")); -@@ -261,12 +280,20 @@ +@@ -264,12 +282,20 @@ - public void func_70100_b_(EntityPlayer p_70100_1_) { + public void func_70100_b_(PlayerEntity p_70100_1_) { if (!this.field_70170_p.field_72995_K) { + if (this.field_145804_b > 0) return; ItemStack itemstack = this.func_92059_d(); @@ -109,24 +108,12 @@ this.func_70106_y(); itemstack.func_190920_e(i); } -@@ -286,9 +313,10 @@ - return false; - } - -+ @Override - @Nullable -- public Entity func_212321_a(DimensionType p_212321_1_) { -- Entity entity = super.func_212321_a(p_212321_1_); -+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { -+ Entity entity = super.changeDimension(p_212321_1_, teleporter); - if (!this.field_70170_p.field_72995_K && entity instanceof EntityItem) { - ((EntityItem)entity).func_85054_d(); - } -@@ -353,6 +381,6 @@ +@@ -356,7 +382,7 @@ public void func_174870_v() { this.func_174871_r(); - this.field_70292_b = 5999; + this.field_70292_b = func_92059_d().getEntityLifespan(field_70170_p) - 1; } - } + + public IPacket func_213297_N() { diff --git a/patches/minecraft/net/minecraft/entity/item/ItemFrameEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/ItemFrameEntity.java.patch new file mode 100644 index 000000000..ee981f553 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/ItemFrameEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/item/ItemFrameEntity.java ++++ b/net/minecraft/entity/item/ItemFrameEntity.java +@@ -190,7 +190,7 @@ + } + + private void func_110131_b(ItemStack p_110131_1_) { +- if (p_110131_1_.func_77973_b() == Items.field_151098_aY) { ++ if (p_110131_1_.func_77973_b() instanceof net.minecraft.item.FilledMapItem) { + MapData mapdata = FilledMapItem.func_195950_a(p_110131_1_, this.field_70170_p); + mapdata.func_212441_a(this.field_174861_a, this.func_145782_y()); + mapdata.func_76186_a(true); diff --git a/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch new file mode 100644 index 000000000..a145687fe --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/LeashKnotEntity.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/entity/item/LeashKnotEntity.java ++++ b/net/minecraft/entity/item/LeashKnotEntity.java +@@ -45,6 +45,7 @@ + this.field_70165_t = (double)this.field_174861_a.func_177958_n() + 0.5D; + this.field_70163_u = (double)this.field_174861_a.func_177956_o() + 0.5D; + this.field_70161_v = (double)this.field_174861_a.func_177952_p() + 0.5D; ++ if (this.isAddedToWorld() && this.field_70170_p instanceof net.minecraft.world.ServerWorld) ((net.minecraft.world.ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. + } + + public void func_174859_a(Direction p_174859_1_) { diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch new file mode 100644 index 000000000..d3f2cc146 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java.patch @@ -0,0 +1,249 @@ +--- a/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java ++++ b/net/minecraft/entity/item/minecart/AbstractMinecartEntity.java +@@ -34,7 +34,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public abstract class AbstractMinecartEntity extends Entity { ++public abstract class AbstractMinecartEntity extends Entity implements net.minecraftforge.common.extensions.IForgeEntityMinecart { + private static final DataParameter field_184265_a = EntityDataManager.func_187226_a(AbstractMinecartEntity.class, DataSerializers.field_187192_b); + private static final DataParameter field_184266_b = EntityDataManager.func_187226_a(AbstractMinecartEntity.class, DataSerializers.field_187192_b); + private static final DataParameter field_184267_c = EntityDataManager.func_187226_a(AbstractMinecartEntity.class, DataSerializers.field_187193_c); +@@ -55,6 +55,7 @@ + private double field_70507_ar; + @OnlyIn(Dist.CLIENT) + private double field_70506_as; ++ private boolean canBePushed = true; + + protected AbstractMinecartEntity(EntityType p_i48538_1_, World p_i48538_2_) { + super(p_i48538_1_, p_i48538_2_); +@@ -101,11 +102,12 @@ + + @Nullable + public AxisAlignedBB func_70114_g(Entity p_70114_1_) { ++ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, p_70114_1_); + return p_70114_1_.func_70104_M() ? p_70114_1_.func_174813_aQ() : null; + } + + public boolean func_70104_M() { +- return true; ++ return canBePushed; + } + + public double func_70042_X() { +@@ -213,7 +215,7 @@ + + BlockPos blockpos = new BlockPos(i, j, k); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); +- if (blockstate.func_203425_a(BlockTags.field_203437_y)) { ++ if (canUseRail() && blockstate.func_203425_a(BlockTags.field_203437_y)) { + this.func_180460_a(blockpos, blockstate); + if (blockstate.func_177230_c() == Blocks.field_150408_cc) { + this.func_96095_a(i, j, k, blockstate.func_177229_b(PoweredRailBlock.field_176569_M)); +@@ -240,8 +242,11 @@ + } + + this.func_70101_b(this.field_70177_z, this.field_70125_A); +- if (this.func_184264_v() == AbstractMinecartEntity.Type.RIDEABLE && func_213296_b(this.func_213322_ci()) > 0.01D) { +- List list = this.field_70170_p.func_175674_a(this, this.func_174813_aQ().func_72314_b((double)0.2F, 0.0D, (double)0.2F), EntityPredicates.func_200823_a(this)); ++ AxisAlignedBB box; ++ if (getCollisionHandler() != null) box = getCollisionHandler().getMinecartCollisionBox(this); ++ else box = this.func_174813_aQ().func_72314_b(0.2F, 0.0D, 0.2F); ++ if (canBeRidden() && func_213296_b(this.func_213322_ci()) > 0.01D) { ++ List list = this.field_70170_p.func_175674_a(this, box, EntityPredicates.func_200823_a(this)); + if (!list.isEmpty()) { + for(int l = 0; l < list.size(); ++l) { + Entity entity1 = list.get(l); +@@ -253,7 +258,7 @@ + } + } + } else { +- for(Entity entity : this.field_70170_p.func_72839_b(this, this.func_174813_aQ().func_72314_b((double)0.2F, 0.0D, (double)0.2F))) { ++ for(Entity entity : this.field_70170_p.func_72839_b(this, box)) { + if (!this.func_184196_w(entity) && entity.func_70104_M() && entity instanceof AbstractMinecartEntity) { + entity.func_70108_f(this); + } +@@ -261,6 +266,7 @@ + } + + this.func_70072_I(); ++ //net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); + } + } + +@@ -272,16 +278,24 @@ + } + + protected void func_180459_n() { +- double d0 = this.func_174898_m(); ++ double d0 = field_70122_E ? this.func_174898_m() : getMaxSpeedAirLateral(); + Vec3d vec3d = this.func_213322_ci(); + this.func_213293_j(MathHelper.func_151237_a(vec3d.field_72450_a, -d0, d0), vec3d.field_72448_b, MathHelper.func_151237_a(vec3d.field_72449_c, -d0, d0)); ++ ++ if(getMaxSpeedAirVertical() > 0 && func_213322_ci().field_72448_b > getMaxSpeedAirVertical()) { ++ if(Math.abs(func_213322_ci().field_72450_a) < 0.3f && Math.abs(func_213322_ci().field_72449_c) < 0.3f) ++ func_213317_d(new Vec3d(func_213322_ci().field_72450_a, 0.15f, func_213322_ci().field_72449_c)); ++ else ++ func_213317_d(new Vec3d(func_213322_ci().field_72450_a, getMaxSpeedAirVertical(), func_213322_ci().field_72449_c)); ++ } ++ + if (this.field_70122_E) { + this.func_213317_d(this.func_213322_ci().func_186678_a(0.5D)); + } + + this.func_213315_a(MoverType.SELF, this.func_213322_ci()); + if (!this.field_70122_E) { +- this.func_213317_d(this.func_213322_ci().func_186678_a(0.95D)); ++ this.func_213317_d(this.func_213322_ci().func_186678_a(getDragAir())); + } + + } +@@ -298,24 +312,24 @@ + flag1 = !flag; + } + +- double d0 = 0.0078125D; ++ double d0 = getSlopeAdjustment(); + Vec3d vec3d1 = this.func_213322_ci(); +- RailShape railshape = p_180460_2_.func_177229_b(abstractrailblock.func_176560_l()); ++ RailShape railshape = ((AbstractRailBlock)p_180460_2_.func_177230_c()).getRailDirection(p_180460_2_, this.field_70170_p, p_180460_1_, this); + switch(railshape) { + case ASCENDING_EAST: +- this.func_213317_d(vec3d1.func_72441_c(-0.0078125D, 0.0D, 0.0D)); ++ this.func_213317_d(vec3d1.func_72441_c(-1*d0, 0.0D, 0.0D)); + ++this.field_70163_u; + break; + case ASCENDING_WEST: +- this.func_213317_d(vec3d1.func_72441_c(0.0078125D, 0.0D, 0.0D)); ++ this.func_213317_d(vec3d1.func_72441_c(d0, 0.0D, 0.0D)); + ++this.field_70163_u; + break; + case ASCENDING_NORTH: +- this.func_213317_d(vec3d1.func_72441_c(0.0D, 0.0D, 0.0078125D)); ++ this.func_213317_d(vec3d1.func_72441_c(0.0D, 0.0D, d0)); + ++this.field_70163_u; + break; + case ASCENDING_SOUTH: +- this.func_213317_d(vec3d1.func_72441_c(0.0D, 0.0D, -0.0078125D)); ++ this.func_213317_d(vec3d1.func_72441_c(0.0D, 0.0D, -1*d0)); + ++this.field_70163_u; + } + +@@ -344,7 +358,7 @@ + } + } + +- if (flag1) { ++ if (flag1 && shouldDoRailFunctions()) { + double d19 = Math.sqrt(func_213296_b(this.func_213322_ci())); + if (d19 < 0.03D) { + this.func_213317_d(Vec3d.field_186680_a); +@@ -375,10 +389,7 @@ + this.field_70165_t = d20 + d1 * d11; + this.field_70161_v = d7 + d2 * d11; + this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); +- double d21 = this.func_184207_aI() ? 0.75D : 1.0D; +- double d22 = this.func_174898_m(); +- vec3d1 = this.func_213322_ci(); +- this.func_213315_a(MoverType.SELF, new Vec3d(MathHelper.func_151237_a(d21 * vec3d1.field_72450_a, -d22, d22), 0.0D, MathHelper.func_151237_a(d21 * vec3d1.field_72449_c, -d22, d22))); ++ this.moveMinecartOnRail(p_180460_1_); + if (aint[0][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[0][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[0][2]) { + this.func_70107_b(this.field_70165_t, this.field_70163_u + (double)aint[0][1], this.field_70161_v); + } else if (aint[1][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[1][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[1][2]) { +@@ -406,7 +417,10 @@ + this.func_213293_j(d23 * (double)(j - p_180460_1_.func_177958_n()), vec3d5.field_72448_b, d23 * (double)(i - p_180460_1_.func_177952_p())); + } + +- if (flag) { ++ if (shouldDoRailFunctions()) ++ ((AbstractRailBlock)p_180460_2_.func_177230_c()).onMinecartPass(p_180460_2_, field_70170_p, p_180460_1_, this); ++ ++ if (flag && shouldDoRailFunctions()) { + Vec3d vec3d6 = this.func_213322_ci(); + double d24 = Math.sqrt(func_213296_b(vec3d6)); + if (d24 > 0.01D) { +@@ -461,7 +475,7 @@ + + BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)); + if (blockstate.func_203425_a(BlockTags.field_203437_y)) { +- RailShape railshape = blockstate.func_177229_b(((AbstractRailBlock)blockstate.func_177230_c()).func_176560_l()); ++ RailShape railshape = ((AbstractRailBlock)blockstate.func_177230_c()).getRailDirection(blockstate, this.field_70170_p, new BlockPos(i, j, k), this); + p_70495_3_ = (double)j; + if (railshape.func_208092_c()) { + p_70495_3_ = (double)(j + 1); +@@ -498,7 +512,7 @@ + + BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)); + if (blockstate.func_203425_a(BlockTags.field_203437_y)) { +- RailShape railshape = blockstate.func_177229_b(((AbstractRailBlock)blockstate.func_177230_c()).func_176560_l()); ++ RailShape railshape = ((AbstractRailBlock)blockstate.func_177230_c()).getRailDirection(blockstate, this.field_70170_p, new BlockPos(i, j, k), this); + int[][] aint = field_70500_g[railshape.func_208091_a()]; + double d0 = (double)i + 0.5D + (double)aint[0][0] * 0.5D; + double d1 = (double)j + 0.0625D + (double)aint[0][1] * 0.5D; +@@ -561,6 +575,11 @@ + } + + public void func_70108_f(Entity p_70108_1_) { ++ //net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); ++ if (getCollisionHandler() != null) { ++ getCollisionHandler().onEntityCollision(this, p_70108_1_); ++ return; ++ } + if (!this.field_70170_p.field_72995_K) { + if (!p_70108_1_.field_70145_X && !this.field_70145_X) { + if (!this.func_184196_w(p_70108_1_)) { +@@ -596,11 +615,11 @@ + + Vec3d vec3d2 = this.func_213322_ci(); + Vec3d vec3d3 = p_70108_1_.func_213322_ci(); +- if (((AbstractMinecartEntity)p_70108_1_).func_184264_v() == AbstractMinecartEntity.Type.FURNACE && this.func_184264_v() != AbstractMinecartEntity.Type.FURNACE) { ++ if (((AbstractMinecartEntity)p_70108_1_).isPoweredCart() && !this.isPoweredCart()) { + this.func_213317_d(vec3d2.func_216372_d(0.2D, 1.0D, 0.2D)); + this.func_70024_g(vec3d3.field_72450_a - d0, 0.0D, vec3d3.field_72449_c - d1); + p_70108_1_.func_213317_d(vec3d3.func_216372_d(0.95D, 1.0D, 0.95D)); +- } else if (((AbstractMinecartEntity)p_70108_1_).func_184264_v() != AbstractMinecartEntity.Type.FURNACE && this.func_184264_v() == AbstractMinecartEntity.Type.FURNACE) { ++ } else if (!((AbstractMinecartEntity)p_70108_1_).isPoweredCart() && this.isPoweredCart()) { + p_70108_1_.func_213317_d(vec3d3.func_216372_d(0.2D, 1.0D, 0.2D)); + p_70108_1_.func_70024_g(vec3d2.field_72450_a + d0, 0.0D, vec3d2.field_72449_c + d1); + this.func_213317_d(vec3d2.func_216372_d(0.95D, 1.0D, 0.95D)); +@@ -706,6 +725,40 @@ + return new SSpawnObjectPacket(this); + } + ++ private boolean canUseRail = true; ++ @Override public boolean canUseRail() { return canUseRail; } ++ @Override public void setCanUseRail(boolean value) { this.canUseRail = value; } ++ private float currentSpeedOnRail; ++ @Override public float getCurrentCartSpeedCapOnRail() { return currentSpeedOnRail; } ++ @Override public void setCurrentCartSpeedCapOnRail(float value) { currentSpeedOnRail = Math.min(value, getMaxCartSpeedOnRail()); } ++ private float maxSpeedAirLateral = DEFAULT_MAX_SPEED_AIR_LATERAL; ++ @Override public float getMaxSpeedAirLateral() { return maxSpeedAirLateral; } ++ @Override public void setMaxSpeedAirLateral(float value) { maxSpeedAirLateral = value; } ++ private float maxSpeedAirVertical = DEFAULT_MAX_SPEED_AIR_VERTICAL; ++ @Override public float getMaxSpeedAirVertical() { return maxSpeedAirVertical; } ++ @Override public void setMaxSpeedAirVertical(float value) { maxSpeedAirVertical = value; } ++ private double dragAir = DEFAULT_AIR_DRAG; ++ @Override public double getDragAir() { return dragAir; } ++ @Override public void setDragAir(double value) { dragAir = value; } ++ @Override ++ public double getMaxSpeed() { //Non-default because getMaximumSpeed is protected ++ if (!canUseRail()) return func_174898_m(); ++ BlockPos pos = this.getCurrentRailPosition(); ++ BlockState state = getMinecart().field_70170_p.func_180495_p(pos); ++ if (!state.func_203425_a(BlockTags.field_203437_y)) return func_174898_m(); ++ ++ float railMaxSpeed = ((AbstractRailBlock)state.func_177230_c()).getRailMaxSpeed(state, getMinecart().field_70170_p, pos, getMinecart()); ++ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); ++ } ++ @Override ++ public void moveMinecartOnRail(BlockPos pos) { //Non-default because getMaximumSpeed is protected ++ AbstractMinecartEntity mc = getMinecart(); ++ double d21 = mc.func_184207_aI() ? 0.75D : 1.0D; ++ double d22 = mc.func_174898_m(); ++ Vec3d vec3d1 = mc.func_213322_ci(); ++ mc.func_213315_a(MoverType.SELF, new Vec3d(MathHelper.func_151237_a(d21 * vec3d1.field_72450_a, -d22, d22), 0.0D, MathHelper.func_151237_a(d21 * vec3d1.field_72449_c, -d22, d22))); ++ } ++ + public static enum Type { + RIDEABLE, + CHEST, diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch new file mode 100644 index 000000000..fe0666389 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java.patch @@ -0,0 +1,55 @@ +--- a/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java ++++ b/net/minecraft/entity/item/minecart/ContainerMinecartEntity.java +@@ -115,11 +115,17 @@ + } + + public void func_70106_y() { ++ super.func_70106_y(); ++ } ++ ++ @Override ++ public void remove(boolean keepData) { + if (!this.field_70170_p.field_72995_K && this.field_94112_b) { + InventoryHelper.func_180176_a(this.field_70170_p, this, this); + } + +- super.func_70106_y(); ++ super.remove(keepData); ++ if (!keepData) itemHandler.invalidate(); + } + + protected void func_213281_b(CompoundNBT p_213281_1_) { +@@ -148,6 +154,7 @@ + } + + public boolean func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { ++ if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true; + p_184230_1_.func_213829_a(this); + return true; + } +@@ -167,6 +174,7 @@ + LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(this.field_184290_c); + this.field_184290_c = null; + LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, new BlockPos(this)).func_216016_a(this.field_184291_d); ++ lootcontext$builder.func_216015_a(LootParameters.field_216281_a, this); // Forge: add looted entity to LootContext + if (p_184288_1_ != null) { + lootcontext$builder.func_186469_a(p_184288_1_.func_184817_da()).func_216015_a(LootParameters.field_216281_a, p_184288_1_); + } +@@ -197,4 +205,17 @@ + } + + protected abstract Container func_213968_a(int p_213968_1_, PlayerInventory p_213968_2_); ++ ++ private net.minecraftforge.common.util.LazyOptional itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> new net.minecraftforge.items.wrapper.InvWrapper(this)); ++ ++ @Override ++ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.Direction facing) { ++ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) ++ return itemHandler.cast(); ++ return super.getCapability(capability, facing); ++ } ++ ++ public void dropContentsWhenDead(boolean value) { ++ this.field_94112_b = value; ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch similarity index 55% rename from patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch rename to patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch index ea217deeb..3cfb77768 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java.patch @@ -1,9 +1,9 @@ ---- a/net/minecraft/entity/item/EntityMinecartFurnace.java -+++ b/net/minecraft/entity/item/EntityMinecartFurnace.java -@@ -115,6 +115,7 @@ +--- a/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java ++++ b/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java +@@ -110,6 +110,7 @@ } - public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_) { + public boolean func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { + if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true; ItemStack itemstack = p_184230_1_.func_184586_b(p_184230_2_); if (field_195407_e.test(itemstack) && this.field_94110_c + 3600 <= 32000) { diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/MinecartCommandBlockEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/MinecartCommandBlockEntity.java.patch new file mode 100644 index 000000000..0811fd700 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/minecart/MinecartCommandBlockEntity.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/entity/item/minecart/MinecartCommandBlockEntity.java ++++ b/net/minecraft/entity/item/minecart/MinecartCommandBlockEntity.java +@@ -72,6 +72,7 @@ + } + + public boolean func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { ++ if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true; + this.field_145824_a.func_175574_a(p_184230_1_); + return true; + } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch rename to patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch index 7b1781d5e..f5f6136be 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/minecart/MinecartEntity.java.patch @@ -1,9 +1,9 @@ ---- a/net/minecraft/entity/item/EntityMinecartEmpty.java -+++ b/net/minecraft/entity/item/EntityMinecartEmpty.java +--- a/net/minecraft/entity/item/minecart/MinecartEntity.java ++++ b/net/minecraft/entity/item/minecart/MinecartEntity.java @@ -15,6 +15,7 @@ } - public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_) { + public boolean func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { + if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true; if (p_184230_1_.func_70093_af()) { return false; diff --git a/patches/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch b/patches/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch new file mode 100644 index 000000000..02d08e37b --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java ++++ b/net/minecraft/entity/item/minecart/SpawnerMinecartEntity.java +@@ -23,6 +23,12 @@ + public BlockPos func_177221_b() { + return new BlockPos(SpawnerMinecartEntity.this); + } ++ ++ @Override ++ @javax.annotation.Nullable ++ public net.minecraft.entity.Entity getSpawnerEntity() { ++ return SpawnerMinecartEntity.this; ++ } + }; + + public SpawnerMinecartEntity(EntityType p_i50114_1_, World p_i50114_2_) { diff --git a/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch b/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch new file mode 100644 index 000000000..f610b86d8 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/merchant/villager/VillagerEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/merchant/villager/VillagerEntity.java ++++ b/net/minecraft/entity/merchant/villager/VillagerEntity.java +@@ -229,7 +229,7 @@ + if (flag) { + itemstack.func_111282_a(p_184645_1_, this, p_184645_2_); + return true; +- } else if (itemstack.func_77973_b() != Items.field_196172_da && this.func_70089_S() && !this.func_213716_dX() && !this.func_70608_bn()) { ++ } else if (itemstack.func_77973_b() != Items.field_196172_da && this.func_70089_S() && !this.func_213716_dX() && !this.func_70608_bn() && !p_184645_1_.func_70093_af()) { + if (this.func_70631_g_()) { + this.func_213756_es(); + return super.func_184645_a(p_184645_1_, p_184645_2_); diff --git a/patches/minecraft/net/minecraft/entity/monster/AbstractSkeleton.java.patch b/patches/minecraft/net/minecraft/entity/monster/AbstractSkeleton.java.patch deleted file mode 100644 index 312c83234..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/AbstractSkeleton.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/entity/monster/AbstractSkeleton.java -+++ b/net/minecraft/entity/monster/AbstractSkeleton.java -@@ -161,7 +161,7 @@ - this.field_70714_bg.func_85156_a(this.field_85038_e); - this.field_70714_bg.func_85156_a(this.field_85037_d); - ItemStack itemstack = this.func_184614_ca(); -- if (itemstack.func_77973_b() == Items.field_151031_f) { -+ if (itemstack.func_77973_b() instanceof net.minecraft.item.ItemBow) { - int i = 20; - if (this.field_70170_p.func_175659_aa() != EnumDifficulty.HARD) { - i = 40; -@@ -178,6 +178,8 @@ - - public void func_82196_d(EntityLivingBase p_82196_1_, float p_82196_2_) { - EntityArrow entityarrow = this.func_190726_a(p_82196_2_); -+ if (this.func_184614_ca().func_77973_b() instanceof net.minecraft.item.ItemBow) -+ entityarrow = ((net.minecraft.item.ItemBow) this.func_184614_ca().func_77973_b()).customizeArrow(entityarrow); - double d0 = p_82196_1_.field_70165_t - this.field_70165_t; - double d1 = p_82196_1_.func_174813_aQ().field_72338_b + (double)(p_82196_1_.field_70131_O / 3.0F) - entityarrow.field_70163_u; - double d2 = p_82196_1_.field_70161_v - this.field_70161_v; diff --git a/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch new file mode 100644 index 000000000..90ac61ca1 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/AbstractSkeletonEntity.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/entity/monster/AbstractSkeletonEntity.java ++++ b/net/minecraft/entity/monster/AbstractSkeletonEntity.java +@@ -154,7 +154,7 @@ + this.field_70714_bg.func_85156_a(this.field_85038_e); + this.field_70714_bg.func_85156_a(this.field_85037_d); + ItemStack itemstack = this.func_184586_b(ProjectileHelper.func_221274_a(this, Items.field_151031_f)); +- if (itemstack.func_77973_b() == Items.field_151031_f) { ++ if (itemstack.func_77973_b() instanceof net.minecraft.item.BowItem) { + int i = 20; + if (this.field_70170_p.func_175659_aa() != Difficulty.HARD) { + i = 40; +@@ -172,6 +172,8 @@ + public void func_82196_d(LivingEntity p_82196_1_, float p_82196_2_) { + ItemStack itemstack = this.func_213356_f(this.func_184586_b(ProjectileHelper.func_221274_a(this, Items.field_151031_f))); + AbstractArrowEntity abstractarrowentity = this.func_213624_b(itemstack, p_82196_2_); ++ if (this.func_184614_ca().func_77973_b() instanceof net.minecraft.item.BowItem) ++ abstractarrowentity = ((net.minecraft.item.BowItem)this.func_184614_ca().func_77973_b()).customeArrow(abstractarrowentity); + double d0 = p_82196_1_.field_70165_t - this.field_70165_t; + double d1 = p_82196_1_.func_174813_aQ().field_72338_b + (double)(p_82196_1_.func_213302_cg() / 3.0F) - abstractarrowentity.field_70163_u; + double d2 = p_82196_1_.field_70161_v - this.field_70161_v; diff --git a/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch new file mode 100644 index 000000000..ae840961c --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/CreeperEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/monster/CreeperEntity.java ++++ b/net/minecraft/entity/monster/CreeperEntity.java +@@ -207,7 +207,7 @@ + + private void func_146077_cc() { + if (!this.field_70170_p.field_72995_K) { +- Explosion.Mode explosion$mode = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing") ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; ++ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; + float f = this.func_70830_n() ? 2.0F : 1.0F; + this.field_70729_aU = true; + this.field_70170_p.func_217385_a(this, this.field_70165_t, this.field_70163_u, this.field_70161_v, (float)this.field_82226_g * f, explosion$mode); diff --git a/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch new file mode 100644 index 000000000..bae4cb09e --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/EndermanEntity.java.patch @@ -0,0 +1,40 @@ +--- a/net/minecraft/entity/monster/EndermanEntity.java ++++ b/net/minecraft/entity/monster/EndermanEntity.java +@@ -225,7 +225,9 @@ + if (!this.field_70170_p.func_180495_p(blockpos$mutableblockpos).func_185904_a().func_76230_c()) { + return false; + } else { +- boolean flag = this.func_213373_a(p_70825_1_, p_70825_3_, p_70825_5_, true); ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; ++ boolean flag = this.func_213373_a(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true); + if (flag) { + this.field_70170_p.func_184148_a((PlayerEntity)null, this.field_70169_q, this.field_70167_r, this.field_70166_s, SoundEvents.field_187534_aX, this.func_184176_by(), 1.0F, 1.0F); + this.func_184185_a(SoundEvents.field_187534_aX, 1.0F, 1.0F); +@@ -370,7 +372,7 @@ + public boolean func_75250_a() { + if (this.field_179475_a.func_195405_dq() == null) { + return false; +- } else if (!this.field_179475_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { ++ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179475_a.field_70170_p, this.field_179475_a)) { + return false; + } else { + return this.field_179475_a.func_70681_au().nextInt(2000) == 0; +@@ -388,7 +390,7 @@ + BlockPos blockpos1 = blockpos.func_177977_b(); + BlockState blockstate1 = iworld.func_180495_p(blockpos1); + BlockState blockstate2 = this.field_179475_a.func_195405_dq(); +- if (blockstate2 != null && this.func_220836_a(iworld, blockpos, blockstate2, blockstate, blockstate1, blockpos1)) { ++ if (blockstate2 != null && this.func_220836_a(iworld, blockpos, blockstate2, blockstate, blockstate1, blockpos1) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(field_179475_a, new net.minecraftforge.common.util.BlockSnapshot(iworld, blockpos, blockstate1), net.minecraft.util.Direction.UP)) { + iworld.func_180501_a(blockpos, blockstate2, 3); + this.field_179475_a.func_195406_b((BlockState)null); + } +@@ -433,7 +435,7 @@ + public boolean func_75250_a() { + if (this.field_179473_a.func_195405_dq() != null) { + return false; +- } else if (!this.field_179473_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { ++ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179473_a.field_70170_p, this.field_179473_a)) { + return false; + } else { + return this.field_179473_a.func_70681_au().nextInt(20) == 0; diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityCreeper.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityCreeper.java.patch deleted file mode 100644 index c60a84aaa..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntityCreeper.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/monster/EntityCreeper.java -+++ b/net/minecraft/entity/monster/EntityCreeper.java -@@ -211,7 +211,7 @@ - - private void func_146077_cc() { - if (!this.field_70170_p.field_72995_K) { -- boolean flag = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"); -+ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this); - float f = this.func_70830_n() ? 2.0F : 1.0F; - this.field_70729_aU = true; - this.field_70170_p.func_72876_a(this, this.field_70165_t, this.field_70163_u, this.field_70161_v, (float)this.field_82226_g * f, flag); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch deleted file mode 100644 index e1c4e246a..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/net/minecraft/entity/monster/EntityEnderman.java -+++ b/net/minecraft/entity/monster/EntityEnderman.java -@@ -209,7 +209,9 @@ - } - - private boolean func_70825_j(double p_70825_1_, double p_70825_3_, double p_70825_5_) { -- boolean flag = this.func_184595_k(p_70825_1_, p_70825_3_, p_70825_5_); -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; -+ boolean flag = this.func_184595_k(event.getTargetX(), event.getTargetY(), event.getTargetZ()); - if (flag) { - this.field_70170_p.func_184148_a((EntityPlayer)null, this.field_70169_q, this.field_70167_r, this.field_70166_s, SoundEvents.field_187534_aX, this.func_184176_by(), 1.0F, 1.0F); - this.func_184185_a(SoundEvents.field_187534_aX, 1.0F, 1.0F); -@@ -356,7 +358,7 @@ - public boolean func_75250_a() { - if (this.field_179475_a.func_195405_dq() == null) { - return false; -- } else if (!this.field_179475_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { -+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179475_a.field_70170_p, this.field_179475_a)) { - return false; - } else { - return this.field_179475_a.func_70681_au().nextInt(2000) == 0; -@@ -373,7 +375,7 @@ - IBlockState iblockstate = iworld.func_180495_p(blockpos); - IBlockState iblockstate1 = iworld.func_180495_p(blockpos.func_177977_b()); - IBlockState iblockstate2 = this.field_179475_a.func_195405_dq(); -- if (iblockstate2 != null && this.func_195924_a(iworld, blockpos, iblockstate2, iblockstate, iblockstate1)) { -+ if (iblockstate2 != null && this.func_195924_a(iworld, blockpos, iblockstate2, iblockstate, iblockstate1) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(field_179475_a, new net.minecraftforge.common.util.BlockSnapshot(field_179475_a.field_70170_p, blockpos, iblockstate), net.minecraft.util.EnumFacing.UP)) { - iworld.func_180501_a(blockpos, iblockstate2, 3); - this.field_179475_a.func_195406_b((IBlockState)null); - } -@@ -395,7 +397,7 @@ - public boolean func_75250_a() { - if (this.field_179473_a.func_195405_dq() != null) { - return false; -- } else if (!this.field_179473_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { -+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179473_a.field_70170_p, this.field_179473_a)) { - return false; - } else { - return this.field_179473_a.func_70681_au().nextInt(20) == 0; diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEvoker.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEvoker.java.patch deleted file mode 100644 index 51abe22d7..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEvoker.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/monster/EntityEvoker.java -+++ b/net/minecraft/entity/monster/EntityEvoker.java -@@ -287,7 +287,7 @@ - return false; - } else if (EntityEvoker.this.field_70173_aa < this.field_193322_d) { - return false; -- } else if (!EntityEvoker.this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { -+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(EntityEvoker.this.field_70170_p, EntityEvoker.this)) { - return false; - } else { - List list = EntityEvoker.this.field_70170_p.func_175647_a(EntitySheep.class, EntityEvoker.this.func_174813_aQ().func_72314_b(16.0D, 4.0D, 16.0D), this.field_190879_a); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityIllusionIllager.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityIllusionIllager.java.patch deleted file mode 100644 index c4ac565d7..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntityIllusionIllager.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/monster/EntityIllusionIllager.java -+++ b/net/minecraft/entity/monster/EntityIllusionIllager.java -@@ -181,6 +181,8 @@ - - public void func_82196_d(EntityLivingBase p_82196_1_, float p_82196_2_) { - EntityArrow entityarrow = this.func_193097_t(p_82196_2_); -+ if (this.func_184614_ca().func_77973_b() instanceof net.minecraft.item.ItemBow) -+ entityarrow = ((net.minecraft.item.ItemBow) this.func_184614_ca().func_77973_b()).customizeArrow(entityarrow); - double d0 = p_82196_1_.field_70165_t - this.field_70165_t; - double d1 = p_82196_1_.func_174813_aQ().field_72338_b + (double)(p_82196_1_.field_70131_O / 3.0F) - entityarrow.field_70163_u; - double d2 = p_82196_1_.field_70161_v - this.field_70161_v; diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityIronGolem.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityIronGolem.java.patch deleted file mode 100644 index 27d1a7f59..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntityIronGolem.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/monster/EntityIronGolem.java -+++ b/net/minecraft/entity/monster/EntityIronGolem.java -@@ -233,7 +233,7 @@ - - public void func_70645_a(DamageSource p_70645_1_) { - if (!this.func_70850_q() && this.field_70717_bb != null && this.field_70857_d != null) { -- this.field_70857_d.func_82688_a(this.field_70717_bb.func_146103_bH().getName(), -5); -+ this.field_70857_d.modifyPlayerReputation(this.field_70717_bb.func_146103_bH().getId(), -5); - } - - super.func_70645_a(p_70645_1_); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch deleted file mode 100644 index e5789ae28..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/entity/monster/EntityMagmaCube.java -+++ b/net/minecraft/entity/monster/EntityMagmaCube.java -@@ -77,6 +77,7 @@ - protected void func_70664_aZ() { - this.field_70181_x = (double)(0.42F + (float)this.func_70809_q() * 0.1F); - this.field_70160_al = true; -+ net.minecraftforge.common.ForgeHooks.onLivingJump(this); - } - - protected void func_180466_bG(Tag p_180466_1_) { diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityShulker.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityShulker.java.patch deleted file mode 100644 index 5fe493ec5..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntityShulker.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/net/minecraft/entity/monster/EntityShulker.java -+++ b/net/minecraft/entity/monster/EntityShulker.java -@@ -245,6 +245,7 @@ - this.field_70165_t = (double)blockpos.func_177958_n() + 0.5D; - this.field_70163_u = (double)blockpos.func_177956_o(); - this.field_70161_v = (double)blockpos.func_177952_p() + 0.5D; -+ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K) this.field_70170_p.func_72866_a(this, false); // Forge - Process chunk registration after moving. - this.field_70169_q = this.field_70165_t; - this.field_70167_r = this.field_70163_u; - this.field_70166_s = this.field_70161_v; -@@ -338,6 +339,13 @@ - } - } - -+ if (flag) -+ { -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, blockpos1.func_177958_n(), blockpos1.func_177956_o(), blockpos1.func_177952_p(), 0); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) flag = false; -+ blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ()); -+ } -+ - if (flag) { - this.func_184185_a(SoundEvents.field_187791_eX, 1.0F, 1.0F); - this.field_70180_af.func_187227_b(field_184701_b, Optional.of(blockpos1)); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntitySnowman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntitySnowman.java.patch deleted file mode 100644 index 6827b5aa6..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntitySnowman.java.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- a/net/minecraft/entity/monster/EntitySnowman.java -+++ b/net/minecraft/entity/monster/EntitySnowman.java -@@ -31,7 +31,7 @@ - import net.minecraft.world.World; - import net.minecraft.world.storage.loot.LootTableList; - --public class EntitySnowman extends EntityGolem implements IRangedAttackMob { -+public class EntitySnowman extends EntityGolem implements IRangedAttackMob, net.minecraftforge.common.IShearable { - private static final DataParameter field_184749_a = EntityDataManager.func_187226_a(EntitySnowman.class, DataSerializers.field_187191_a); - - public EntitySnowman(World p_i1692_1_) { -@@ -85,7 +85,7 @@ - this.func_70097_a(DamageSource.field_76370_b, 1.0F); - } - -- if (!this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { - return; - } - -@@ -127,7 +127,7 @@ - - protected boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_) { - ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_); -- if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o() && !this.field_70170_p.field_72995_K) { -+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o() && !this.field_70170_p.field_72995_K) { //Forge: Moved to onSheared - this.func_184747_a(false); - itemstack.func_77972_a(1, p_184645_1_); - } -@@ -166,4 +166,15 @@ - - public void func_184724_a(boolean p_184724_1_) { - } -+ -+ @Override -+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) { -+ return this.func_184748_o(); -+ } -+ -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) { -+ this.func_184747_a(false); -+ return new java.util.ArrayList<>(); -+ } - } diff --git a/patches/minecraft/net/minecraft/entity/monster/EntitySpider.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntitySpider.java.patch deleted file mode 100644 index 1db8c20b9..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntitySpider.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/net/minecraft/entity/monster/EntitySpider.java -+++ b/net/minecraft/entity/monster/EntitySpider.java -@@ -120,7 +120,12 @@ - } - - public boolean func_70687_e(PotionEffect p_70687_1_) { -- return p_70687_1_.func_188419_a() == MobEffects.field_76436_u ? false : super.func_70687_e(p_70687_1_); -+ if (p_70687_1_.func_188419_a() == MobEffects.field_76436_u) { -+ net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent event = new net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent(this, p_70687_1_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ return event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW; -+ } -+ return super.func_70687_e(p_70687_1_); - } - - public boolean func_70841_p() { diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch deleted file mode 100644 index b950752fe..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/net/minecraft/entity/monster/EntityZombie.java -+++ b/net/minecraft/entity/monster/EntityZombie.java -@@ -107,7 +107,7 @@ - this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a((double)0.23F); - this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(3.0D); - this.func_110148_a(SharedMonsterAttributes.field_188791_g).func_111128_a(2.0D); -- this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * (double)0.1F); -+ this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * net.minecraftforge.common.ForgeConfig.SERVER.zombieBaseSummonChance.get()); - } - - protected void func_70088_a() { -@@ -284,20 +284,25 @@ - entitylivingbase = (EntityLivingBase)p_70097_1_.func_76346_g(); - } - -- if (entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) { - int i = MathHelper.func_76128_c(this.field_70165_t); - int j = MathHelper.func_76128_c(this.field_70163_u); - int k = MathHelper.func_76128_c(this.field_70161_v); -- EntityZombie entityzombie = new EntityZombie(this.field_70170_p); -+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, entitylivingbase, this.func_110148_a(field_110186_bp).func_111126_e()); -+ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; - -+ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || -+ entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) { -+ EntityZombie entityzombie = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : new EntityZombie(this.field_70170_p); -+ - for(int l = 0; l < 50; ++l) { - int i1 = i + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); - int j1 = j + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); - int k1 = k + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); -- if (this.field_70170_p.func_180495_p(new BlockPos(i1, j1 - 1, k1)).func_185896_q() && this.field_70170_p.func_201696_r(new BlockPos(i1, j1, k1)) < 10) { -+ if (this.field_70170_p.func_195595_w(new BlockPos(i1, j1 - 1, k1)) && this.field_70170_p.func_201696_r(new BlockPos(i1, j1, k1)) < 10) { - entityzombie.func_70107_b((double)i1, (double)j1, (double)k1); - if (!this.field_70170_p.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_195587_c(entityzombie, entityzombie.func_174813_aQ()) && this.field_70170_p.func_195586_b(entityzombie, entityzombie.func_174813_aQ()) && !this.field_70170_p.func_72953_d(entityzombie.func_174813_aQ())) { - this.field_70170_p.func_72838_d(entityzombie); -+ if (entitylivingbase != null) - entityzombie.func_70624_b(entitylivingbase); - entityzombie.func_204210_a(this.field_70170_p.func_175649_E(new BlockPos(entityzombie)), (IEntityLivingData)null, (NBTTagCompound)null); - this.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement caller charge", (double)-0.05F, 0)); -@@ -405,7 +410,7 @@ - entityzombievillager.func_82149_j(entityvillager); - this.field_70170_p.func_72900_e(entityvillager); - entityzombievillager.func_204210_a(this.field_70170_p.func_175649_E(new BlockPos(entityzombievillager)), new EntityZombie.GroupData(false), (NBTTagCompound)null); -- entityzombievillager.func_190733_a(entityvillager.func_70946_n()); -+ entityzombievillager.setProfession(entityvillager.getProfessionForge()); - entityzombievillager.func_82227_f(entityvillager.func_70631_g_()); - entityzombievillager.func_94061_f(entityvillager.func_175446_cd()); - if (entityvillager.func_145818_k_()) { -@@ -438,7 +443,7 @@ - float f = p_204210_1_.func_180170_c(); - this.func_98053_h(this.field_70146_Z.nextFloat() < 0.55F * f); - if (p_204210_2_ == null) { -- p_204210_2_ = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < 0.05F); -+ p_204210_2_ = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < net.minecraftforge.common.ForgeConfig.SERVER.zombieBabyChance.get()); - } - - if (p_204210_2_ instanceof EntityZombie.GroupData) { diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java.patch deleted file mode 100644 index 5459e2826..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombieVillager.java.patch +++ /dev/null @@ -1,81 +0,0 @@ ---- a/net/minecraft/entity/monster/EntityZombieVillager.java -+++ b/net/minecraft/entity/monster/EntityZombieVillager.java -@@ -49,15 +49,18 @@ - - public void func_190733_a(int p_190733_1_) { - this.field_70180_af.func_187227_b(field_190739_c, p_190733_1_); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, p_190733_1_); - } - -+ @Deprecated // Use Forge Variant below - public int func_190736_dl() { -- return Math.max(this.field_70180_af.func_187225_a(field_190739_c) % 6, 0); -+ return Math.max(this.field_70180_af.func_187225_a(field_190739_c), 0); - } - - public void func_70014_b(NBTTagCompound p_70014_1_) { - super.func_70014_b(p_70014_1_); - p_70014_1_.func_74768_a("Profession", this.func_190736_dl()); -+ p_70014_1_.func_74778_a("ProfessionName", this.getProfessionForge().getRegistryName().toString()); - p_70014_1_.func_74768_a("ConversionTime", this.func_82230_o() ? this.field_82234_d : -1); - if (this.field_191992_by != null) { - p_70014_1_.func_186854_a("ConversionPlayer", this.field_191992_by); -@@ -68,6 +71,11 @@ - public void func_70037_a(NBTTagCompound p_70037_1_) { - super.func_70037_a(p_70037_1_); - this.func_190733_a(p_70037_1_.func_74762_e("Profession")); -+ if (p_70037_1_.func_74764_b("ProfessionName")) { -+ net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p = net.minecraftforge.registries.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation(p_70037_1_.func_74779_i("ProfessionName"))); -+ if (p == null) p = net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER.orElseThrow(() -> new IllegalStateException("Farmer profession not initialized?")); -+ this.setProfession(p); -+ } - if (p_70037_1_.func_150297_b("ConversionTime", 99) && p_70037_1_.func_74762_e("ConversionTime") > -1) { - this.func_191991_a(p_70037_1_.func_186855_b("ConversionPlayer") ? p_70037_1_.func_186857_a("ConversionPlayer") : null, p_70037_1_.func_74762_e("ConversionTime")); - } -@@ -76,7 +84,7 @@ - - @Nullable - public IEntityLivingData func_204210_a(DifficultyInstance p_204210_1_, @Nullable IEntityLivingData p_204210_2_, @Nullable NBTTagCompound p_204210_3_) { -- this.func_190733_a(this.field_70170_p.field_73012_v.nextInt(6)); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.field_70170_p.field_73012_v); - return super.func_204210_a(p_204210_1_, p_204210_2_, p_204210_3_); - } - -@@ -145,7 +153,7 @@ - protected void func_190738_dp() { - EntityVillager entityvillager = new EntityVillager(this.field_70170_p); - entityvillager.func_82149_j(this); -- entityvillager.func_70938_b(this.func_190736_dl()); -+ entityvillager.setProfession(this.getProfessionForge()); - entityvillager.func_190672_a(this.field_70170_p.func_175649_E(new BlockPos(entityvillager)), (IEntityLivingData)null, (NBTTagCompound)null, false); - entityvillager.func_82187_q(); - if (this.func_70631_g_()) { -@@ -224,4 +232,28 @@ - protected ItemStack func_190732_dj() { - return ItemStack.field_190927_a; - } -+ -+ @Nullable -+ private net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof; -+ public void setProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof) { -+ this.prof = prof; -+ this.func_190733_a(net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof)); -+ } -+ -+ public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getProfessionForge() { -+ if (this.prof == null) { -+ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.getById(this.func_190736_dl()); -+ if (this.prof == null) -+ return net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER.orElseThrow(() -> new IllegalStateException("Farmer profession not initialized?")); -+ } -+ return this.prof; -+ } -+ -+ @Override -+ public void func_184206_a(DataParameter key) { -+ super.func_184206_a(key); -+ if (key.equals(field_190739_c)) { -+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, this.field_70180_af.func_187225_a(field_190739_c)); -+ } -+ } - } diff --git a/patches/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch new file mode 100644 index 000000000..bcfbba48c --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/EvokerEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/monster/EvokerEntity.java ++++ b/net/minecraft/entity/monster/EvokerEntity.java +@@ -286,7 +286,7 @@ + return false; + } else if (EvokerEntity.this.field_70173_aa < this.field_193322_d) { + return false; +- } else if (!EvokerEntity.this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { ++ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(EvokerEntity.this.field_70170_p, EvokerEntity.this)) { + return false; + } else { + List list = EvokerEntity.this.field_70170_p.func_217374_a(SheepEntity.class, this.field_220845_e, EvokerEntity.this, EvokerEntity.this.func_174813_aQ().func_72314_b(16.0D, 4.0D, 16.0D)); diff --git a/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch new file mode 100644 index 000000000..4dcc0d40f --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/IllusionerEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/monster/IllusionerEntity.java ++++ b/net/minecraft/entity/monster/IllusionerEntity.java +@@ -185,6 +185,8 @@ + public void func_82196_d(LivingEntity p_82196_1_, float p_82196_2_) { + ItemStack itemstack = this.func_213356_f(this.func_184586_b(ProjectileHelper.func_221274_a(this, Items.field_151031_f))); + AbstractArrowEntity abstractarrowentity = ProjectileHelper.func_221272_a(this, itemstack, p_82196_2_); ++ if (this.func_184614_ca().func_77973_b() instanceof net.minecraft.item.BowItem) ++ abstractarrowentity = ((net.minecraft.item.BowItem)this.func_184614_ca().func_77973_b()).customeArrow(abstractarrowentity); + double d0 = p_82196_1_.field_70165_t - this.field_70165_t; + double d1 = p_82196_1_.func_174813_aQ().field_72338_b + (double)(p_82196_1_.func_213302_cg() / 3.0F) - abstractarrowentity.field_70163_u; + double d2 = p_82196_1_.field_70161_v - this.field_70161_v; diff --git a/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch new file mode 100644 index 000000000..61a7bddcd --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/MagmaCubeEntity.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/entity/monster/MagmaCubeEntity.java ++++ b/net/minecraft/entity/monster/MagmaCubeEntity.java +@@ -77,6 +77,7 @@ + Vec3d vec3d = this.func_213322_ci(); + this.func_213293_j(vec3d.field_72450_a, (double)(0.42F + (float)this.func_70809_q() * 0.1F), vec3d.field_72449_c); + this.field_70160_al = true; ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); + } + + protected void func_180466_bG(Tag p_180466_1_) { diff --git a/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch new file mode 100644 index 000000000..0871eb186 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/ShulkerEntity.java.patch @@ -0,0 +1,23 @@ +--- a/net/minecraft/entity/monster/ShulkerEntity.java ++++ b/net/minecraft/entity/monster/ShulkerEntity.java +@@ -249,6 +249,7 @@ + this.field_70165_t = (double)blockpos.func_177958_n() + 0.5D; + this.field_70163_u = (double)blockpos.func_177956_o(); + this.field_70161_v = (double)blockpos.func_177952_p() + 0.5D; ++ if (this.isAddedToWorld() && this.field_70170_p instanceof net.minecraft.world.ServerWorld) ((net.minecraft.world.ServerWorld)this.field_70170_p).func_217464_b(this); // Forge - Process chunk registration after moving. + this.field_70169_q = this.field_70165_t; + this.field_70167_r = this.field_70163_u; + this.field_70166_s = this.field_70161_v; +@@ -315,6 +316,12 @@ + } + + if (flag) { ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, blockpos1.func_177958_n(), blockpos1.func_177956_o(), blockpos1.func_177952_p(), 0); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) flag = false; ++ blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ()); ++ } ++ ++ if (flag) { + this.func_184185_a(SoundEvents.field_187791_eX, 1.0F, 1.0F); + this.field_70180_af.func_187227_b(field_184701_b, Optional.of(blockpos1)); + this.field_70180_af.func_187227_b(field_184702_c, (byte)0); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntitySilverfish.java.patch b/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/entity/monster/EntitySilverfish.java.patch rename to patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch index 3ead23290..8f7bc618d 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntitySilverfish.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/SilverfishEntity.java.patch @@ -1,20 +1,20 @@ ---- a/net/minecraft/entity/monster/EntitySilverfish.java -+++ b/net/minecraft/entity/monster/EntitySilverfish.java -@@ -144,7 +144,7 @@ +--- a/net/minecraft/entity/monster/SilverfishEntity.java ++++ b/net/minecraft/entity/monster/SilverfishEntity.java +@@ -141,7 +141,7 @@ return false; } else { Random random = this.field_75457_a.func_70681_au(); - if (this.field_75457_a.field_70170_p.func_82736_K().func_82766_b("mobGriefing") && random.nextInt(10) == 0) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_75457_a.field_70170_p, this.field_75457_a) && random.nextInt(10) == 0) { - this.field_179483_b = EnumFacing.func_176741_a(random); + this.field_179483_b = Direction.func_176741_a(random); BlockPos blockpos = (new BlockPos(this.field_75457_a.field_70165_t, this.field_75457_a.field_70163_u + 0.5D, this.field_75457_a.field_70161_v)).func_177972_a(this.field_179483_b); - IBlockState iblockstate = this.field_75457_a.field_70170_p.func_180495_p(blockpos); -@@ -213,7 +213,7 @@ - IBlockState iblockstate = world.func_180495_p(blockpos1); - Block block = iblockstate.func_177230_c(); - if (block instanceof BlockSilverfish) { + BlockState blockstate = this.field_75457_a.field_70170_p.func_180495_p(blockpos); +@@ -210,7 +210,7 @@ + BlockState blockstate = world.func_180495_p(blockpos1); + Block block = blockstate.func_177230_c(); + if (block instanceof SilverfishBlock) { - if (world.func_82736_K().func_82766_b("mobGriefing")) { + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(world, field_179464_a)) { world.func_175655_b(blockpos1, true); } else { - world.func_180501_a(blockpos1, ((BlockSilverfish)block).func_196468_d().func_176223_P(), 3); + world.func_180501_a(blockpos1, ((SilverfishBlock)block).func_196468_d().func_176223_P(), 3); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch rename to patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch index 9ea4e6470..6931a5bf8 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/SlimeEntity.java.patch @@ -1,9 +1,9 @@ ---- a/net/minecraft/entity/monster/EntitySlime.java -+++ b/net/minecraft/entity/monster/EntitySlime.java +--- a/net/minecraft/entity/monster/SlimeEntity.java ++++ b/net/minecraft/entity/monster/SlimeEntity.java @@ -113,7 +113,7 @@ public void func_70071_h_() { - if (!this.field_70170_p.field_72995_K && this.field_70170_p.func_175659_aa() == EnumDifficulty.PEACEFUL && this.func_70809_q() > 0) { + if (!this.field_70170_p.field_72995_K && this.field_70170_p.func_175659_aa() == Difficulty.PEACEFUL && this.func_70809_q() > 0) { - this.field_70128_L = true; + this.func_70106_y(); //Forge: Kill entity with notification to caps/subclasses. } @@ -17,17 +17,17 @@ for(int j = 0; j < i * 8; ++j) { float f = this.field_70146_Z.nextFloat() * ((float)Math.PI * 2F); float f1 = this.field_70146_Z.nextFloat() * 0.5F + 0.5F; -@@ -255,7 +256,7 @@ +@@ -251,7 +252,7 @@ - public boolean func_205020_a(IWorld p_205020_1_, boolean p_205020_2_) { - BlockPos blockpos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), 0, MathHelper.func_76128_c(this.field_70161_v)); -- if (p_205020_1_.func_72912_H().func_76067_t() == WorldType.field_77138_c && this.field_70146_Z.nextInt(4) != 1) { -+ if (p_205020_1_.func_72912_H().func_76067_t().handleSlimeSpawnReduction(field_70146_Z, field_70170_p)) { + public boolean func_213380_a(IWorld p_213380_1_, SpawnReason p_213380_2_) { + BlockPos blockpos = new BlockPos(this.field_70165_t, 0.0D, this.field_70161_v); +- if (p_213380_1_.func_72912_H().func_76067_t() == WorldType.field_77138_c && this.field_70146_Z.nextInt(4) != 1) { ++ if (p_213380_1_.func_72912_H().func_76067_t().handleSlimeSpawnReduction(field_70146_Z, field_70170_p)) { return false; } else { - if (p_205020_1_.func_175659_aa() != EnumDifficulty.PEACEFUL) { -@@ -308,6 +309,12 @@ - return this.func_189101_db() ? SoundEvents.field_189110_fE : SoundEvents.field_187882_fq; + if (p_213380_1_.func_175659_aa() != Difficulty.PEACEFUL) { +@@ -309,6 +310,12 @@ + return super.func_213305_a(p_213305_1_).func_220313_a(0.255F * (float)this.func_70809_q()); } + /** @@ -36,6 +36,6 @@ + */ + protected boolean spawnCustomParticles() { return false; } + - static class AISlimeAttack extends EntityAIBase { - private final EntitySlime field_179466_a; + static class AttackGoal extends Goal { + private final SlimeEntity field_179466_a; private int field_179465_b; diff --git a/patches/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch new file mode 100644 index 000000000..1215b5b94 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/SpiderEntity.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/entity/monster/SpiderEntity.java ++++ b/net/minecraft/entity/monster/SpiderEntity.java +@@ -119,7 +119,12 @@ + } + + public boolean func_70687_e(EffectInstance p_70687_1_) { +- return p_70687_1_.func_188419_a() == Effects.field_76436_u ? false : super.func_70687_e(p_70687_1_); ++ if (p_70687_1_.func_188419_a() == Effects.field_76436_u) { ++ net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent event = new net.minecraftforge.event.entity.living.PotionEvent.PotionApplicableEvent(this, p_70687_1_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW; ++ } ++ return super.func_70687_e(p_70687_1_); + } + + public boolean func_70841_p() { diff --git a/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch b/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch new file mode 100644 index 000000000..3d324879c --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/ZombieEntity.java.patch @@ -0,0 +1,47 @@ +--- a/net/minecraft/entity/monster/ZombieEntity.java ++++ b/net/minecraft/entity/monster/ZombieEntity.java +@@ -105,7 +105,7 @@ + this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a((double)0.23F); + this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(3.0D); + this.func_110148_a(SharedMonsterAttributes.field_188791_g).func_111128_a(2.0D); +- this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * (double)0.1F); ++ this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * net.minecraftforge.common.ForgeConfig.SERVER.zombieBaseSummonChance.get()); + } + + protected void func_70088_a() { +@@ -278,12 +278,16 @@ + livingentity = (LivingEntity)p_70097_1_.func_76346_g(); + } + +- if (livingentity != null && this.field_70170_p.func_175659_aa() == Difficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) { + int i = MathHelper.func_76128_c(this.field_70165_t); + int j = MathHelper.func_76128_c(this.field_70163_u); + int k = MathHelper.func_76128_c(this.field_70161_v); +- ZombieEntity zombieentity = new ZombieEntity(this.field_70170_p); + ++ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, livingentity, this.func_110148_a(field_110186_bp).func_111126_e()); ++ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; ++ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || ++ livingentity != null && this.field_70170_p.func_175659_aa() == Difficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) { ++ ZombieEntity zombieentity = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : new ZombieEntity(this.field_70170_p); ++ + for(int l = 0; l < 50; ++l) { + int i1 = i + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); + int j1 = j + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1); +@@ -293,6 +297,7 @@ + zombieentity.func_70107_b((double)i1, (double)j1, (double)k1); + if (!this.field_70170_p.func_217358_a((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_217346_i(zombieentity) && this.field_70170_p.func_217345_j(zombieentity) && !this.field_70170_p.func_72953_d(zombieentity.func_174813_aQ())) { + this.field_70170_p.func_217376_c(zombieentity); ++ if (livingentity != null) + zombieentity.func_70624_b(livingentity); + zombieentity.func_213386_a(this.field_70170_p, this.field_70170_p.func_175649_E(new BlockPos(zombieentity)), SpawnReason.REINFORCEMENT, (ILivingEntityData)null, (CompoundNBT)null); + this.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement caller charge", (double)-0.05F, AttributeModifier.Operation.ADDITION)); +@@ -425,7 +430,7 @@ + float f = p_213386_2_.func_180170_c(); + this.func_98053_h(this.field_70146_Z.nextFloat() < 0.55F * f); + if (p_213386_4_ == null) { +- p_213386_4_ = new ZombieEntity.GroupData(p_213386_1_.func_201674_k().nextFloat() < 0.05F); ++ p_213386_4_ = new ZombieEntity.GroupData(p_213386_1_.func_201674_k().nextFloat() < net.minecraftforge.common.ForgeConfig.SERVER.zombieBabyChance.get()); + } + + if (p_213386_4_ instanceof ZombieEntity.GroupData) { diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch deleted file mode 100644 index 42818fd27..000000000 --- a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/net/minecraft/entity/passive/EntityHorse.java -+++ b/net/minecraft/entity/passive/EntityHorse.java -@@ -32,6 +32,7 @@ - private static final UUID field_184786_bD = UUID.fromString("556E1665-8B10-40C8-8F9D-CF9B1667F295"); - private static final DataParameter field_184789_bG = EntityDataManager.func_187226_a(EntityHorse.class, DataSerializers.field_187192_b); - private static final DataParameter field_184791_bI = EntityDataManager.func_187226_a(EntityHorse.class, DataSerializers.field_187192_b); -+ private static final DataParameter HORSE_ARMOR_STACK = EntityDataManager.func_187226_a(EntityHorse.class, DataSerializers.field_187196_f); - private static final String[] field_110268_bz = new String[]{"textures/entity/horse/horse_white.png", "textures/entity/horse/horse_creamy.png", "textures/entity/horse/horse_chestnut.png", "textures/entity/horse/horse_brown.png", "textures/entity/horse/horse_black.png", "textures/entity/horse/horse_gray.png", "textures/entity/horse/horse_darkbrown.png"}; - private static final String[] field_110269_bA = new String[]{"hwh", "hcr", "hch", "hbr", "hbl", "hgr", "hdb"}; - private static final String[] field_110291_bB = new String[]{null, "textures/entity/horse/horse_markings_white.png", "textures/entity/horse/horse_markings_whitefield.png", "textures/entity/horse/horse_markings_whitedots.png", "textures/entity/horse/horse_markings_blackdots.png"}; -@@ -47,6 +48,7 @@ - super.func_70088_a(); - this.field_70180_af.func_187214_a(field_184789_bG, 0); - this.field_70180_af.func_187214_a(field_184791_bI, HorseArmorType.NONE.func_188579_a()); -+ this.field_70180_af.func_187214_a(HORSE_ARMOR_STACK, ItemStack.field_190927_a); - } - - public void func_70014_b(NBTTagCompound p_70014_1_) { -@@ -63,7 +65,7 @@ - this.func_110235_q(p_70037_1_.func_74762_e("Variant")); - if (p_70037_1_.func_150297_b("ArmorItem", 10)) { - ItemStack itemstack = ItemStack.func_199557_a(p_70037_1_.func_74775_l("ArmorItem")); -- if (!itemstack.func_190926_b() && HorseArmorType.func_188577_b(itemstack.func_77973_b())) { -+ if (!itemstack.func_190926_b() && func_190682_f(itemstack)) { - this.field_110296_bG.func_70299_a(1, itemstack); - } - } -@@ -122,6 +124,7 @@ - public void func_146086_d(ItemStack p_146086_1_) { - HorseArmorType horsearmortype = HorseArmorType.func_188580_a(p_146086_1_); - this.field_70180_af.func_187227_b(field_184791_bI, horsearmortype.func_188579_a()); -+ this.field_70180_af.func_187227_b(HORSE_ARMOR_STACK, p_146086_1_); - this.func_110230_cF(); - if (!this.field_70170_p.field_72995_K) { - this.func_110148_a(SharedMonsterAttributes.field_188791_g).func_188479_b(field_184786_bD); -@@ -134,6 +137,8 @@ - } - - public HorseArmorType func_184783_dl() { -+ ItemStack stack = this.field_70180_af.func_187225_a(HORSE_ARMOR_STACK); -+ if (!stack.func_190926_b()) return stack.getHorseArmorType(); - return HorseArmorType.func_188575_a(this.field_70180_af.func_187225_a(field_184791_bI)); - } - -@@ -168,7 +173,8 @@ - this.field_70180_af.func_187230_e(); - this.func_110230_cF(); - } -- -+ ItemStack stack = this.field_110296_bG.func_70301_a(1); -+ if (func_190682_f(stack)) stack.onHorseArmorTick(field_70170_p, this); - } - - protected SoundEvent func_184639_G() { -@@ -295,7 +301,7 @@ - } - - public boolean func_190682_f(ItemStack p_190682_1_) { -- return HorseArmorType.func_188577_b(p_190682_1_.func_77973_b()); -+ return HorseArmorType.isHorseArmor(p_190682_1_); - } - - @Nullable diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch deleted file mode 100644 index 2a529e6ca..000000000 --- a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/passive/EntityOcelot.java -+++ b/net/minecraft/entity/passive/EntityOcelot.java -@@ -181,7 +181,7 @@ - } - - if (!this.field_70170_p.field_72995_K) { -- if (this.field_70146_Z.nextInt(3) == 0) { -+ if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_184645_1_)) { - this.func_193101_c(p_184645_1_); - this.func_70912_b(1 + this.field_70170_p.field_73012_v.nextInt(3)); - this.func_70908_e(true); diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityParrot.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityParrot.java.patch deleted file mode 100644 index f383ede54..000000000 --- a/patches/minecraft/net/minecraft/entity/passive/EntityParrot.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/entity/passive/EntityParrot.java -+++ b/net/minecraft/entity/passive/EntityParrot.java -@@ -219,7 +219,7 @@ - } - - if (!this.field_70170_p.field_72995_K) { -- if (this.field_70146_Z.nextInt(10) == 0) { -+ if (this.field_70146_Z.nextInt(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_184645_1_)) { - this.func_193101_c(p_184645_1_); - this.func_70908_e(true); - this.field_70170_p.func_72960_a(this, (byte)7); -@@ -260,7 +260,7 @@ - int k = MathHelper.func_76128_c(this.field_70161_v); - BlockPos blockpos = new BlockPos(i, j, k); - Block block = p_205020_1_.func_180495_p(blockpos.func_177977_b()).func_177230_c(); -- return block instanceof BlockLeaves || block == Blocks.field_150349_c || block instanceof BlockLog || block == Blocks.field_150350_a && super.func_205020_a(p_205020_1_, p_205020_2_); -+ return block instanceof BlockLeaves || block == Blocks.field_196658_i || block instanceof BlockLog || block == Blocks.field_150350_a && super.func_205020_a(p_205020_1_, p_205020_2_); - } - - public void func_180430_e(float p_180430_1_, float p_180430_2_) { diff --git a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch deleted file mode 100644 index 7df6732c0..000000000 --- a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- a/net/minecraft/entity/passive/EntitySheep.java -+++ b/net/minecraft/entity/passive/EntitySheep.java -@@ -50,7 +50,7 @@ - import net.minecraftforge.api.distmarker.Dist; - import net.minecraftforge.api.distmarker.OnlyIn; - --public class EntitySheep extends EntityAnimal { -+public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable { - private static final DataParameter field_184774_bv = EntityDataManager.func_187226_a(EntitySheep.class, DataSerializers.field_187191_a); - private final InventoryCrafting field_90016_e = new InventoryCrafting(new Container() { - public boolean func_75145_c(EntityPlayer p_75145_1_) { -@@ -214,7 +214,7 @@ - - public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_) { - ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_); -- if (itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) { -+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) { //Forge: Moved to onSheared - if (!this.field_70170_p.field_72995_K) { - this.func_70893_e(true); - int i = 1 + this.field_70146_Z.nextInt(3); -@@ -329,7 +329,7 @@ - EnumDyeColor enumdyecolor1 = ((EntitySheep)p_175511_2_).func_175509_cj(); - this.field_90016_e.func_70299_a(0, new ItemStack(ItemDye.func_195961_a(enumdyecolor))); - this.field_90016_e.func_70299_a(1, new ItemStack(ItemDye.func_195961_a(enumdyecolor1))); -- ItemStack itemstack = p_175511_1_.field_70170_p.func_199532_z().func_199514_a(this.field_90016_e, ((EntitySheep)p_175511_1_).field_70170_p); -+ ItemStack itemstack = p_175511_1_.field_70170_p.func_199532_z().getResult(this.field_90016_e, ((EntitySheep)p_175511_1_).field_70170_p, net.minecraftforge.common.crafting.VanillaRecipeTypes.CRAFTING); - Item item = itemstack.func_77973_b(); - EnumDyeColor enumdyecolor2; - if (item instanceof ItemDye) { -@@ -344,4 +344,23 @@ - public float func_70047_e() { - return 0.95F * this.field_70131_O; - } -+ -+ @Override -+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) { -+ return !this.func_70892_o() && !this.func_70631_g_(); -+ } -+ -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) { -+ java.util.List ret = new java.util.ArrayList<>(); -+ if (!this.field_70170_p.field_72995_K) { -+ this.func_70893_e(true); -+ int i = 1 + this.field_70146_Z.nextInt(3); -+ -+ for(int j = 0; j < i; ++j) { -+ ret.add(new ItemStack(field_200206_bz.get(this.func_175509_cj()))); -+ } -+ } -+ return ret; -+ } - } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch deleted file mode 100644 index e19504b5e..000000000 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ /dev/null @@ -1,201 +0,0 @@ ---- a/net/minecraft/entity/passive/EntityVillager.java -+++ b/net/minecraft/entity/passive/EntityVillager.java -@@ -106,7 +106,7 @@ - private boolean field_70959_by; - private boolean field_175565_bs; - private int field_70956_bz; -- private String field_82189_bL; -+ private java.util.UUID field_82189_bL; - private int field_175563_bv; - private int field_175562_bw; - private boolean field_82190_bM; -@@ -203,7 +203,7 @@ - this.field_70959_by = false; - if (this.field_70954_d != null && this.field_82189_bL != null) { - this.field_70170_p.func_72960_a(this, (byte)14); -- this.field_70954_d.func_82688_a(this.field_82189_bL, 1); -+ this.field_70954_d.modifyPlayerReputation(this.field_82189_bL, 1); - } - } - -@@ -220,7 +220,7 @@ - if (flag) { - itemstack.func_111282_a(p_184645_1_, this, p_184645_2_); - return true; -- } else if (itemstack.func_77973_b() != Items.field_196172_da && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_()) { -+ } else if (itemstack.func_77973_b() != Items.field_196172_da && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_() && !p_184645_1_.func_70093_af()) { - if (this.field_70963_i == null) { - this.func_175554_cu(); - } -@@ -250,6 +250,7 @@ - public void func_70014_b(NBTTagCompound p_70014_1_) { - super.func_70014_b(p_70014_1_); - p_70014_1_.func_74768_a("Profession", this.func_70946_n()); -+ p_70014_1_.func_74778_a("ProfessionName", this.getProfessionForge().getRegistryName().toString()); - p_70014_1_.func_74768_a("Riches", this.field_70956_bz); - p_70014_1_.func_74768_a("Career", this.field_175563_bv); - p_70014_1_.func_74768_a("CareerLevel", this.field_175562_bw); -@@ -273,6 +274,14 @@ - public void func_70037_a(NBTTagCompound p_70037_1_) { - super.func_70037_a(p_70037_1_); - this.func_70938_b(p_70037_1_.func_74762_e("Profession")); -+ if (p_70037_1_.func_74764_b("ProfessionName")) -+ { -+ net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p = -+ net.minecraftforge.registries.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation(p_70037_1_.func_74779_i("ProfessionName"))); -+ if (p == null) -+ p = net.minecraftforge.registries.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation("minecraft:farmer")); -+ this.setProfession(p); -+ } - this.field_70956_bz = p_70037_1_.func_74762_e("Riches"); - this.field_175563_bv = p_70037_1_.func_74762_e("Career"); - this.field_175562_bw = p_70037_1_.func_74762_e("CareerLevel"); -@@ -318,12 +327,42 @@ - - public void func_70938_b(int p_70938_1_) { - this.field_70180_af.func_187227_b(field_184752_bw, p_70938_1_); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, p_70938_1_); - } - -+ @Deprecated // Use Forge Variant below - public int func_70946_n() { -- return Math.max(this.field_70180_af.func_187225_a(field_184752_bw) % 6, 0); -+ return Math.max(this.field_70180_af.func_187225_a(field_184752_bw), 0); - } - -+ private net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof; -+ public void setProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof) -+ { -+ this.prof = prof; -+ this.func_70938_b(net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof)); -+ } -+ -+ public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getProfessionForge() -+ { -+ if (this.prof == null) -+ { -+ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.getById(this.func_70946_n()); -+ if (this.prof == null) -+ return net.minecraftforge.fml.common.registry.VillagerRegistry.getById(0); //Farmer -+ } -+ return this.prof; -+ } -+ -+ @Override -+ public void func_184206_a(DataParameter key) -+ { -+ super.func_184206_a(key); -+ if (key.equals(field_184752_bw)) -+ { -+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, this.field_70180_af.func_187225_a(field_184752_bw)); -+ } -+ } -+ - public boolean func_70941_o() { - return this.field_70952_f; - } -@@ -350,7 +389,7 @@ - i = -3; - } - -- this.field_70954_d.func_82688_a(((EntityPlayer)p_70604_1_).func_146103_bH().getName(), i); -+ this.field_70954_d.modifyPlayerReputation(((EntityPlayer)p_70604_1_).func_146103_bH().getId(), i); - if (this.func_70089_S()) { - this.field_70170_p.func_72960_a(this, (byte)13); - } -@@ -364,7 +403,7 @@ - Entity entity = p_70645_1_.func_76346_g(); - if (entity != null) { - if (entity instanceof EntityPlayer) { -- this.field_70954_d.func_82688_a(((EntityPlayer)entity).func_146103_bH().getName(), -2); -+ this.field_70954_d.modifyPlayerReputation(((EntityPlayer)entity).func_146103_bH().getId(), -2); - } else if (entity instanceof IMob) { - this.field_70954_d.func_82692_h(); - } -@@ -433,7 +472,7 @@ - this.field_70959_by = true; - this.field_175565_bs = true; - if (this.field_70962_h != null) { -- this.field_82189_bL = this.field_70962_h.func_146103_bH().getName(); -+ this.field_82189_bL = this.field_70962_h.func_110124_au(); - } else { - this.field_82189_bL = null; - } -@@ -469,15 +508,14 @@ - this.func_175554_cu(); - } - -- return this.field_70963_i; -+ return net.minecraftforge.event.ForgeEventFactory.listTradeOffers(this, p_70934_1_, field_70963_i); - } - - private void func_175554_cu() { -- EntityVillager.ITradeList[][][] aentityvillager$itradelist = field_175561_bA[this.func_70946_n()]; - if (this.field_175563_bv != 0 && this.field_175562_bw != 0) { - ++this.field_175562_bw; - } else { -- this.field_175563_bv = this.field_70146_Z.nextInt(aentityvillager$itradelist.length) + 1; -+ this.field_175563_bv = this.getProfessionForge().getRandomCareer(this.field_70146_Z) + 1; - this.field_175562_bw = 1; - } - -@@ -487,16 +525,11 @@ - - int i = this.field_175563_bv - 1; - int j = this.field_175562_bw - 1; -- if (i >= 0 && i < aentityvillager$itradelist.length) { -- EntityVillager.ITradeList[][] aentityvillager$itradelist1 = aentityvillager$itradelist[i]; -- if (j >= 0 && j < aentityvillager$itradelist1.length) { -- EntityVillager.ITradeList[] aentityvillager$itradelist2 = aentityvillager$itradelist1[j]; -- -- for(EntityVillager.ITradeList entityvillager$itradelist : aentityvillager$itradelist2) { -- entityvillager$itradelist.func_190888_a(this, this.field_70963_i, this.field_70146_Z); -- } -+ java.util.List trades = this.getProfessionForge().getCareer(i).getTrades(j); -+ if (i >= 0 && trades != null) { -+ for (EntityVillager.ITradeList entityvillager$itradelist : trades) { -+ entityvillager$itradelist.func_190888_a(this, this.field_70963_i, this.field_70146_Z); - } -- - } - } - -@@ -567,7 +600,7 @@ - s = "nitwit"; - } - -- if (s != null) { -+ s = this.getProfessionForge().getCareer(this.field_175563_bv-1).getName(); - ITextComponent itextcomponent1 = (new TextComponentTranslation(this.func_200600_R().func_210760_d() + '.' + s)).func_211710_a((p_211520_1_) -> { - p_211520_1_.func_150209_a(this.func_174823_aP()).func_179989_a(this.func_189512_bd()); - }); -@@ -576,9 +609,6 @@ - } - - return itextcomponent1; -- } else { -- return super.func_145748_c_(); -- } - } - } - -@@ -619,7 +649,7 @@ - public IEntityLivingData func_190672_a(DifficultyInstance p_190672_1_, @Nullable IEntityLivingData p_190672_2_, @Nullable NBTTagCompound p_190672_3_, boolean p_190672_4_) { - p_190672_2_ = super.func_204210_a(p_190672_1_, p_190672_2_, p_190672_3_); - if (p_190672_4_) { -- this.func_70938_b(this.field_70170_p.field_73012_v.nextInt(6)); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.field_70170_p.field_73012_v); - } - - this.func_175552_ct(); -@@ -818,6 +848,10 @@ - } - } - -+ //MODDERS DO NOT USE OR EDIT THIS IN ANY WAY IT WILL HAVE NO EFFECT, THIS IS JUST IN HERE TO ALLOW FORGE TO ACCESS IT -+ @Deprecated -+ public static ITradeList[][][][] GET_TRADES_DONT_USE(){ return field_175561_bA; } -+ - public static class ListItemForEmeralds implements EntityVillager.ITradeList { - public ItemStack field_179403_a; - public EntityVillager.PriceInfo field_179402_b; diff --git a/patches/minecraft/net/minecraft/entity/passive/HorseArmorType.java.patch b/patches/minecraft/net/minecraft/entity/passive/HorseArmorType.java.patch deleted file mode 100644 index 3577537f8..000000000 --- a/patches/minecraft/net/minecraft/entity/passive/HorseArmorType.java.patch +++ /dev/null @@ -1,78 +0,0 @@ ---- a/net/minecraft/entity/passive/HorseArmorType.java -+++ b/net/minecraft/entity/passive/HorseArmorType.java -@@ -7,7 +7,7 @@ - import net.minecraftforge.api.distmarker.Dist; - import net.minecraftforge.api.distmarker.OnlyIn; - --public enum HorseArmorType { -+public enum HorseArmorType implements net.minecraftforge.common.IExtensibleEnum { - NONE(0), - IRON(5, "iron", "meo"), - GOLD(7, "gold", "goo"), -@@ -16,6 +16,7 @@ - private final String field_188586_e; - private final String field_188587_f; - private final int field_188588_g; -+ private Item item; - - private HorseArmorType(int p_i46799_3_) { - this.field_188588_g = p_i46799_3_; -@@ -29,6 +30,17 @@ - this.field_188587_f = p_i46800_5_; - } - -+ private HorseArmorType(int strength, String texture, String hash, Item item) { -+ this.field_188588_g = strength; -+ this.field_188586_e = texture; -+ this.field_188587_f = hash; -+ this.item = item; -+ } -+ -+ public static HorseArmorType create(String name, int strength, String texture, String hash, Item item) { -+ throw new IllegalStateException("Enum not extended"); -+ } -+ - public int func_188579_a() { - return this.ordinal(); - } -@@ -48,25 +60,38 @@ - return this.field_188586_e; - } - -+ @Deprecated //Forge: Use by name, or ItemStack, ordinals for modded ones are not guaranteed to be in the same order each run. - public static HorseArmorType func_188575_a(int p_188575_0_) { - return values()[p_188575_0_]; - } - - public static HorseArmorType func_188580_a(ItemStack p_188580_0_) { -- return p_188580_0_.func_190926_b() ? NONE : func_188576_a(p_188580_0_.func_77973_b()); -+ return p_188580_0_.func_190926_b() ? NONE : p_188580_0_.getHorseArmorType(); - } - -+ @Deprecated //Forge: Use ItemStack.getHorseArmorType - public static HorseArmorType func_188576_a(Item p_188576_0_) { - if (p_188576_0_ == Items.field_151138_bX) { - return IRON; - } else if (p_188576_0_ == Items.field_151136_bY) { - return GOLD; -+ } else if (p_188576_0_ == Items.field_151125_bZ) { -+ return DIAMOND; - } else { -- return p_188576_0_ == Items.field_151125_bZ ? DIAMOND : NONE; -+ for (HorseArmorType type : values()) { -+ if (type.item != null && type.item.delegate.get() == p_188576_0_.delegate.get()) -+ return type; -+ } -+ return NONE; - } - } - -+ @Deprecated //Forge: Use ItemStack version - public static boolean func_188577_b(Item p_188577_0_) { - return func_188576_a(p_188577_0_) != NONE; - } -+ -+ public static boolean isHorseArmor(ItemStack stack) { -+ return stack.getHorseArmorType() != NONE; -+ } - } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch similarity index 51% rename from patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch rename to patches/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch index 047ab67dd..17807b4cf 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/MooshroomEntity.java.patch @@ -1,28 +1,27 @@ ---- a/net/minecraft/entity/passive/EntityMooshroom.java -+++ b/net/minecraft/entity/passive/EntityMooshroom.java -@@ -15,7 +15,7 @@ - import net.minecraft.world.World; - import net.minecraft.world.storage.loot.LootTableList; +--- a/net/minecraft/entity/passive/MooshroomEntity.java ++++ b/net/minecraft/entity/passive/MooshroomEntity.java +@@ -28,7 +28,7 @@ + import net.minecraftforge.api.distmarker.OnlyIn; + import org.apache.commons.lang3.tuple.Pair; --public class EntityMooshroom extends EntityCow { -+public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable { - public EntityMooshroom(World p_i1687_1_) { - super(EntityType.field_200780_T, p_i1687_1_); - this.func_70105_a(0.9F, 1.4F); -@@ -33,7 +33,7 @@ - } +-public class MooshroomEntity extends CowEntity { ++public class MooshroomEntity extends CowEntity implements net.minecraftforge.common.IShearable { + private static final DataParameter field_213449_bz = EntityDataManager.func_187226_a(MooshroomEntity.class, DataSerializers.field_187194_d); + private Effect field_213450_bA; + private int field_213447_bB; +@@ -85,7 +85,7 @@ + this.func_184185_a(soundevent, 1.0F, 1.0F); return true; - } else if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) { + } else if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) { //Forge: Moved to onSheared - this.field_70170_p.func_195594_a(Particles.field_197627_t, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D); + this.field_70170_p.func_195594_a(ParticleTypes.field_197627_t, this.field_70165_t, this.field_70163_u + (double)(this.func_213302_cg() / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D); if (!this.field_70170_p.field_72995_K) { this.func_70106_y(); -@@ -69,4 +69,31 @@ - protected ResourceLocation func_184647_J() { - return LootTableList.field_186400_H; +@@ -191,6 +191,33 @@ + return mooshroomentity$type2; } -+ + + @Override + public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, net.minecraft.util.math.BlockPos pos) { + return this.func_70874_b() >= 0; @@ -31,17 +30,17 @@ + @Override + public java.util.List onSheared(ItemStack item, net.minecraft.world.IWorld world, net.minecraft.util.math.BlockPos pos, int fortune) { + java.util.List ret = new java.util.ArrayList<>(); -+ this.field_70170_p.func_195594_a(Particles.field_197627_t, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D); ++ this.field_70170_p.func_195594_a(ParticleTypes.field_197627_t, this.field_70165_t, this.field_70163_u + (double)(this.func_213302_cg() / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D); + if (!this.field_70170_p.field_72995_K) { + this.func_70106_y(); -+ EntityCow entitycow = new EntityCow(this.field_70170_p); ++ CowEntity entitycow = EntityType.field_200796_j.func_200721_a(this.field_70170_p); + entitycow.func_70012_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, this.field_70177_z, this.field_70125_A); + entitycow.func_70606_j(this.func_110143_aJ()); + entitycow.field_70761_aq = this.field_70761_aq; + if (this.func_145818_k_()) { + entitycow.func_200203_b(this.func_200201_e()); + } -+ this.field_70170_p.func_72838_d(entitycow); ++ this.field_70170_p.func_217376_c(entitycow); + for(int i = 0; i < 5; ++i) { + ret.add(new ItemStack(Blocks.field_150337_Q)); + } @@ -49,4 +48,7 @@ + } + return ret; + } - } ++ + public static enum Type { + RED("red", Blocks.field_150337_Q.func_176223_P()), + BROWN("brown", Blocks.field_150338_P.func_176223_P()); diff --git a/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch new file mode 100644 index 000000000..46a18fa25 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/OcelotEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/passive/OcelotEntity.java ++++ b/net/minecraft/entity/passive/OcelotEntity.java +@@ -153,7 +153,7 @@ + if ((this.field_70914_e == null || this.field_70914_e.func_75277_f()) && !this.func_213530_dX() && this.func_70877_b(itemstack) && p_184645_1_.func_70068_e(this) < 9.0D) { + this.func_175505_a(p_184645_1_, itemstack); + if (!this.field_70170_p.field_72995_K) { +- if (this.field_70146_Z.nextInt(3) == 0) { ++ if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_184645_1_)) { + this.func_213528_r(true); + this.func_213527_s(true); + this.field_70170_p.func_72960_a(this, (byte)41); diff --git a/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch new file mode 100644 index 000000000..e1c154eef --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/ParrotEntity.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/entity/passive/ParrotEntity.java ++++ b/net/minecraft/entity/passive/ParrotEntity.java +@@ -225,7 +225,7 @@ + } + + if (!this.field_70170_p.field_72995_K) { +- if (this.field_70146_Z.nextInt(10) == 0) { ++ if (this.field_70146_Z.nextInt(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_184645_1_)) { + this.func_193101_c(p_184645_1_); + this.func_70908_e(true); + this.field_70170_p.func_72960_a(this, (byte)7); +@@ -266,7 +266,7 @@ + int k = MathHelper.func_76128_c(this.field_70161_v); + BlockPos blockpos = new BlockPos(i, j, k); + Block block = p_213380_1_.func_180495_p(blockpos.func_177977_b()).func_177230_c(); +- return block.func_203417_a(BlockTags.field_206952_E) || block == Blocks.field_196658_i || block instanceof LogBlock || block == Blocks.field_150350_a && super.func_213380_a(p_213380_1_, p_213380_2_); ++ return block.func_203417_a(BlockTags.field_206952_E) || block == Blocks.field_196658_i || block instanceof LogBlock || block == Blocks.field_150350_a && super.func_213380_a(p_213380_1_, p_213380_2_); //Forge: GRASS -> GRASS_BLOCK + } + + public void func_180430_e(float p_180430_1_, float p_180430_2_) { diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityRabbit.java.patch b/patches/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch similarity index 71% rename from patches/minecraft/net/minecraft/entity/passive/EntityRabbit.java.patch rename to patches/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch index e4c796f65..ba9711c97 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityRabbit.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/RabbitEntity.java.patch @@ -1,15 +1,15 @@ ---- a/net/minecraft/entity/passive/EntityRabbit.java -+++ b/net/minecraft/entity/passive/EntityRabbit.java -@@ -370,7 +370,7 @@ +--- a/net/minecraft/entity/passive/RabbitEntity.java ++++ b/net/minecraft/entity/passive/RabbitEntity.java +@@ -362,7 +362,7 @@ int k = MathHelper.func_76128_c(this.field_70161_v); BlockPos blockpos = new BlockPos(i, j, k); - Block block = p_205020_1_.func_180495_p(blockpos.func_177977_b()).func_177230_c(); -- return block != Blocks.field_150349_c && block != Blocks.field_150433_aE && block != Blocks.field_150354_m ? super.func_205020_a(p_205020_1_, p_205020_2_) : true; -+ return block != Blocks.field_196658_i && block != Blocks.field_150433_aE && block != Blocks.field_150354_m ? super.func_205020_a(p_205020_1_, p_205020_2_) : true; + Block block = p_213380_1_.func_180495_p(blockpos.func_177977_b()).func_177230_c(); +- return block != Blocks.field_150349_c && block != Blocks.field_150433_aE && block != Blocks.field_150354_m ? super.func_213380_a(p_213380_1_, p_213380_2_) : true; ++ return block != Blocks.field_196658_i && block != Blocks.field_150433_aE && block != Blocks.field_150354_m ? super.func_213380_a(p_213380_1_, p_213380_2_) : true; //Forge: GRASS -> GRASS_BLOCk } private boolean func_175534_cv() { -@@ -438,7 +438,7 @@ +@@ -500,7 +500,7 @@ public boolean func_75250_a() { if (this.field_179496_a <= 0) { diff --git a/patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch new file mode 100644 index 000000000..0e456fe93 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/SheepEntity.java.patch @@ -0,0 +1,52 @@ +--- a/net/minecraft/entity/passive/SheepEntity.java ++++ b/net/minecraft/entity/passive/SheepEntity.java +@@ -55,7 +55,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public class SheepEntity extends AnimalEntity { ++public class SheepEntity extends AnimalEntity implements net.minecraftforge.common.IShearable { + private static final DataParameter field_184774_bv = EntityDataManager.func_187226_a(SheepEntity.class, DataSerializers.field_187191_a); + private static final Map field_200206_bz = Util.func_200696_a(Maps.newEnumMap(DyeColor.class), (p_203402_0_) -> { + p_203402_0_.put(DyeColor.WHITE, Blocks.field_196556_aL); +@@ -212,7 +212,7 @@ + + public boolean func_184645_a(PlayerEntity p_184645_1_, Hand p_184645_2_) { + ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_); +- if (itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) { ++ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) { //Forge: Moved to onSheared + this.func_213612_dV(); + if (!this.field_70170_p.field_72995_K) { + itemstack.func_222118_a(1, p_184645_1_, (p_213613_1_) -> { +@@ -224,6 +224,7 @@ + return super.func_184645_a(p_184645_1_, p_184645_2_); + } + ++ @Deprecated //Forge: Use Shearable interface + public void func_213612_dV() { + if (!this.field_70170_p.field_72995_K) { + this.func_70893_e(true); +@@ -353,4 +354,23 @@ + protected float func_213348_b(Pose p_213348_1_, EntitySize p_213348_2_) { + return 0.95F * p_213348_2_.field_220316_b; + } ++ ++ @Override ++ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) { ++ return !this.func_70892_o() && !this.func_70631_g_(); ++ } ++ ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) { ++ java.util.List ret = new java.util.ArrayList<>(); ++ if (!this.field_70170_p.field_72995_K) { ++ this.func_70893_e(true); ++ int i = 1 + this.field_70146_Z.nextInt(3); ++ ++ for(int j = 0; j < i; ++j) { ++ ret.add(new ItemStack(field_200206_bz.get(this.func_175509_cj()))); ++ } ++ } ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch new file mode 100644 index 000000000..c74d226cd --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/SnowGolemEntity.java.patch @@ -0,0 +1,54 @@ +--- a/net/minecraft/entity/passive/SnowGolemEntity.java ++++ b/net/minecraft/entity/passive/SnowGolemEntity.java +@@ -32,7 +32,7 @@ + import net.minecraft.util.math.MathHelper; + import net.minecraft.world.World; + +-public class SnowGolemEntity extends GolemEntity implements IRangedAttackMob { ++public class SnowGolemEntity extends GolemEntity implements IRangedAttackMob, net.minecraftforge.common.IShearable { + private static final DataParameter field_184749_a = EntityDataManager.func_187226_a(SnowGolemEntity.class, DataSerializers.field_187191_a); + + public SnowGolemEntity(EntityType p_i50244_1_, World p_i50244_2_) { +@@ -87,7 +87,7 @@ + this.func_70097_a(DamageSource.field_76370_b, 1.0F); + } + +- if (!this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this)) { + return; + } + +@@ -98,7 +98,7 @@ + j = MathHelper.func_76128_c(this.field_70163_u); + k = MathHelper.func_76128_c(this.field_70161_v + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F)); + BlockPos blockpos = new BlockPos(i, j, k); +- if (this.field_70170_p.func_180495_p(blockpos).func_196958_f() && this.field_70170_p.func_180494_b(blockpos).func_180626_a(blockpos) < 0.8F && blockstate.func_196955_c(this.field_70170_p, blockpos)) { ++ if (this.field_70170_p.func_175623_d(blockpos) && this.field_70170_p.func_180494_b(blockpos).func_180626_a(blockpos) < 0.8F && blockstate.func_196955_c(this.field_70170_p, blockpos)) { + this.field_70170_p.func_175656_a(blockpos, blockstate); + } + } +@@ -124,7 +124,7 @@ + + protected boolean func_184645_a(PlayerEntity p_184645_1_, Hand p_184645_2_) { + ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_); +- if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o() && !this.field_70170_p.field_72995_K) { ++ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_184748_o() && !this.field_70170_p.field_72995_K) { //Forge: Moved to onSheared + this.func_184747_a(false); + itemstack.func_222118_a(1, p_184645_1_, (p_213622_1_) -> { + p_213622_1_.func_213334_d(p_184645_2_); +@@ -162,4 +162,15 @@ + protected SoundEvent func_184615_bR() { + return SoundEvents.field_187801_fC; + } ++ ++ @Override ++ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) { ++ return this.func_184748_o(); ++ } ++ ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) { ++ this.func_184747_a(false); ++ return new java.util.ArrayList<>(); ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityWolf.java.patch b/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch similarity index 66% rename from patches/minecraft/net/minecraft/entity/passive/EntityWolf.java.patch rename to patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch index 9cd5ed8e3..fb008f5ff 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityWolf.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/WolfEntity.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/entity/passive/EntityWolf.java -+++ b/net/minecraft/entity/passive/EntityWolf.java -@@ -340,7 +340,7 @@ +--- a/net/minecraft/entity/passive/WolfEntity.java ++++ b/net/minecraft/entity/passive/WolfEntity.java +@@ -348,7 +348,7 @@ } if (!this.field_70170_p.field_72995_K) { @@ -8,4 +8,4 @@ + if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_184645_1_)) { this.func_193101_c(p_184645_1_); this.field_70699_by.func_75499_g(); - this.func_70624_b((EntityLivingBase)null); + this.func_70624_b((LivingEntity)null); diff --git a/patches/minecraft/net/minecraft/entity/passive/AbstractHorse.java.patch b/patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch similarity index 78% rename from patches/minecraft/net/minecraft/entity/passive/AbstractHorse.java.patch rename to patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch index 2733a1252..e99cc7d24 100644 --- a/patches/minecraft/net/minecraft/entity/passive/AbstractHorse.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/horse/AbstractHorseEntity.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/entity/passive/AbstractHorse.java -+++ b/net/minecraft/entity/passive/AbstractHorse.java -@@ -264,6 +264,7 @@ +--- a/net/minecraft/entity/passive/horse/AbstractHorseEntity.java ++++ b/net/minecraft/entity/passive/horse/AbstractHorseEntity.java +@@ -260,6 +260,7 @@ this.field_110296_bG.func_110134_a(this); this.func_110232_cE(); @@ -8,15 +8,15 @@ } protected void func_110232_cE() { -@@ -960,4 +961,22 @@ +@@ -944,4 +945,22 @@ - return p_204210_2_; + return p_213386_4_; } + + private net.minecraftforge.common.util.LazyOptional itemHandler = null; + + @Override -+ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.EnumFacing facing) { ++ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.Direction facing) { + if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && itemHandler != null) + return itemHandler.cast(); + return super.getCapability(capability, facing); diff --git a/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch b/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch new file mode 100644 index 000000000..4e949352e --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/horse/HorseEntity.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/entity/passive/horse/HorseEntity.java ++++ b/net/minecraft/entity/passive/horse/HorseEntity.java +@@ -172,7 +172,8 @@ + this.field_70180_af.func_187230_e(); + this.func_110230_cF(); + } +- ++ ItemStack stack = this.field_110296_bG.func_70301_a(1); ++ if (func_190682_f(stack)) stack.onHorseArmorTick(field_70170_p, this); + } + + protected SoundEvent func_184639_G() { diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch deleted file mode 100644 index 9bad95a0c..000000000 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ /dev/null @@ -1,147 +0,0 @@ ---- a/net/minecraft/entity/player/EntityPlayerMP.java -+++ b/net/minecraft/entity/player/EntityPlayerMP.java -@@ -420,6 +420,7 @@ - } - - public void func_70645_a(DamageSource p_70645_1_) { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; - boolean flag = this.field_70170_p.func_82736_K().func_82766_b("showDeathMessages"); - if (flag) { - ITextComponent itextcomponent = this.func_110142_aN().func_151521_b(); -@@ -451,8 +452,10 @@ - - this.func_192030_dh(); - if (!this.field_70170_p.func_82736_K().func_82766_b("keepInventory") && !this.func_175149_v()) { -+ this.captureDrops(new java.util.ArrayList<>()); - this.func_190776_cN(); - this.field_71071_by.func_70436_m(); -+ if (!field_70170_p.field_72995_K) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, p_70645_1_, captureDrops(null), field_70718_bc > 0); - } - - this.func_96123_co().func_197893_a(ScoreCriteria.field_96642_c, this.func_195047_I_(), Score::func_96648_a); -@@ -537,8 +540,10 @@ - return this.field_71133_b.func_71219_W(); - } - -+ @Override - @Nullable -- public Entity func_212321_a(DimensionType p_212321_1_) { -+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_212321_1_)) return null; - this.field_184851_cj = true; - if (this.field_71093_bK == DimensionType.OVERWORLD && p_212321_1_ == DimensionType.NETHER) { - this.field_193110_cw = new Vec3d(this.field_70165_t, this.field_70163_u, this.field_70161_v); -@@ -546,7 +551,7 @@ - this.field_193110_cw = null; - } - -- if (this.field_71093_bK == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END) { -+ if (this.field_71093_bK == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END && teleporter.isVanilla()) { - this.field_70170_p.func_72900_e(this); - if (!this.field_71136_j) { - this.field_71136_j = true; -@@ -560,7 +565,7 @@ - p_212321_1_ = DimensionType.THE_END; - } - -- this.field_71133_b.func_184103_al().func_187242_a(this, p_212321_1_); -+ this.field_71133_b.func_184103_al().changePlayerDimension(this, p_212321_1_, teleporter); - this.field_71135_a.func_147359_a(new SPacketEffect(1032, BlockPos.field_177992_a, 0, false)); - this.field_71144_ck = -1; - this.field_71149_ch = -1.0F; -@@ -662,7 +667,7 @@ - int k = MathHelper.func_76128_c(this.field_70161_v); - BlockPos blockpos = new BlockPos(i, j, k); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); -- if (iblockstate.func_196958_f()) { -+ if (iblockstate.isAir(field_70170_p, blockpos)) { - BlockPos blockpos1 = blockpos.func_177977_b(); - IBlockState iblockstate1 = this.field_70170_p.func_180495_p(blockpos1); - Block block = iblockstate1.func_177230_c(); -@@ -693,6 +698,7 @@ - this.field_71070_bA = p_180468_1_.func_174876_a(this.field_71071_by, this); - this.field_71070_bA.field_75152_c = this.field_71139_cq; - this.field_71070_bA.func_75132_a(this); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); - } - } - -@@ -724,6 +730,7 @@ - - this.field_71070_bA.field_75152_c = this.field_71139_cq; - this.field_71070_bA.func_75132_a(this); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); - } - } - -@@ -732,6 +739,7 @@ - this.field_71070_bA = new ContainerMerchant(this.field_71071_by, p_180472_1_, this.field_70170_p); - this.field_71070_bA.field_75152_c = this.field_71139_cq; - this.field_71070_bA.func_75132_a(this); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); - IInventory iinventory = ((ContainerMerchant)this.field_71070_bA).func_75174_d(); - ITextComponent itextcomponent = p_180472_1_.func_145748_c_(); - this.field_71135_a.func_147359_a(new SPacketOpenWindow(this.field_71139_cq, "minecraft:villager", itextcomponent, iinventory.func_70302_i_())); -@@ -755,6 +763,7 @@ - this.field_71070_bA = new ContainerHorseInventory(this.field_71071_by, p_184826_2_, p_184826_1_, this); - this.field_71070_bA.field_75152_c = this.field_71139_cq; - this.field_71070_bA.func_75132_a(this); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); - } - - public void func_184814_a(ItemStack p_184814_1_, EnumHand p_184814_2_) { -@@ -817,6 +826,7 @@ - - public void func_71128_l() { - this.field_71070_bA.func_75134_a(this); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Close(this, this.field_71070_bA)); - this.field_71070_bA = this.field_71069_bz; - } - -@@ -946,6 +956,20 @@ - this.field_193110_cw = p_193104_1_.field_193110_cw; - this.func_192029_h(p_193104_1_.func_192023_dk()); - this.func_192031_i(p_193104_1_.func_192025_dl()); -+ -+ this.spawnPosMap = p_193104_1_.spawnPosMap; -+ this.spawnForcedMap = p_193104_1_.spawnForcedMap; -+ if(p_193104_1_.field_71093_bK != net.minecraft.world.dimension.DimensionType.OVERWORLD) { -+ this.field_71077_c = p_193104_1_.field_71077_c; -+ this.field_82248_d = p_193104_1_.field_82248_d; -+ } -+ -+ //Copy over a section of the Entity Data from the old player. -+ //Allows mods to specify data that persists after players respawn. -+ NBTTagCompound old = p_193104_1_.getEntityData(); -+ if (old.func_74764_b(PERSISTED_NBT_TAG)) -+ getEntityData().func_74782_a(PERSISTED_NBT_TAG, old.func_74781_a(PERSISTED_NBT_TAG)); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, p_193104_1_, !p_193104_2_); - } - - protected void func_70670_a(PotionEffect p_70670_1_) { -@@ -1174,13 +1198,13 @@ - this.func_184210_p(); - if (p_200619_1_ == this.field_70170_p) { - this.field_71135_a.func_147364_a(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_); -- } else { -+ } else if (net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_200619_1_.field_73011_w.func_186058_p())) { - WorldServer worldserver = this.func_71121_q(); - this.field_71093_bK = p_200619_1_.field_73011_w.func_186058_p(); -- this.field_71135_a.func_147359_a(new SPacketRespawn(this.field_71093_bK, worldserver.func_175659_aa(), worldserver.func_72912_H().func_76067_t(), this.field_71134_c.func_73081_b())); -+ this.field_71135_a.func_147359_a(new SPacketRespawn(this.field_71093_bK, p_200619_1_.func_175659_aa(), p_200619_1_.func_72912_H().func_76067_t(), this.field_71134_c.func_73081_b())); // Forge: Use new dimensions information - this.field_71133_b.func_184103_al().func_187243_f(this); -- worldserver.func_72973_f(this); -- this.field_70128_L = false; -+ worldserver.removeEntityDangerously(this, true); //Forge: The player entity itself is moved, and not cloned. So we need to keep the data alive with no matching invalidate call later. -+ this.revive(); - this.func_70012_b(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_); - if (this.func_70089_S()) { - worldserver.func_72866_a(this, false); -@@ -1194,6 +1218,7 @@ - this.field_71134_c.func_73080_a(p_200619_1_); - this.field_71133_b.func_184103_al().func_72354_b(this, p_200619_1_); - this.field_71133_b.func_184103_al().func_72385_f(this); -+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(this, p_200619_1_.field_73011_w.func_186058_p(), this.field_71093_bK); - } - - } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch similarity index 63% rename from patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch rename to patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch index d5ee225ee..062b45dcb 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/PlayerEntity.java.patch @@ -1,28 +1,27 @@ ---- a/net/minecraft/entity/player/EntityPlayer.java -+++ b/net/minecraft/entity/player/EntityPlayer.java -@@ -98,6 +98,10 @@ +--- a/net/minecraft/entity/player/PlayerEntity.java ++++ b/net/minecraft/entity/player/PlayerEntity.java +@@ -107,6 +107,10 @@ import net.minecraftforge.api.distmarker.OnlyIn; - public abstract class EntityPlayer extends EntityLivingBase { + public abstract class PlayerEntity extends LivingEntity { + public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; + protected java.util.HashMap spawnPosMap = new java.util.HashMap<>(); + protected java.util.HashMap spawnForcedMap = new java.util.HashMap<>(); + public static final net.minecraft.entity.ai.attributes.IAttribute REACH_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "generic.reachDistance", 5.0D, 0.0D, 1024.0D).func_111112_a(true); - private static final DataParameter field_184829_a = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187193_c); - private static final DataParameter field_184830_b = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187192_b); - protected static final DataParameter field_184827_bp = EntityDataManager.func_187226_a(EntityPlayer.class, DataSerializers.field_187191_a); -@@ -144,6 +148,10 @@ + public static final EntitySize field_213835_bs = EntitySize.func_220314_b(0.6F, 1.8F); + private static final Map field_213836_b = ImmutableMap.builder().put(Pose.STANDING, field_213835_bs).put(Pose.SLEEPING, field_213377_as).put(Pose.FALL_FLYING, EntitySize.func_220314_b(0.6F, 0.6F)).put(Pose.SWIMMING, EntitySize.func_220314_b(0.6F, 0.6F)).put(Pose.SPIN_ATTACK, EntitySize.func_220314_b(0.6F, 0.6F)).put(Pose.SNEAKING, EntitySize.func_220314_b(0.6F, 1.5F)).put(Pose.DYING, EntitySize.func_220311_c(0.2F, 0.2F)).build(); + private static final DataParameter field_184829_a = EntityDataManager.func_187226_a(PlayerEntity.class, DataSerializers.field_187193_c); +@@ -148,6 +152,9 @@ private final CooldownTracker field_184832_bU = this.func_184815_l(); @Nullable - public EntityFishHook field_71104_cf; -+ private float eyeHeight = this.getDefaultEyeHeight(); + public FishingBobberEntity field_71104_cf; + private net.minecraft.world.dimension.DimensionType spawnDimension = net.minecraft.world.dimension.DimensionType.OVERWORLD; + private final java.util.Collection prefixes = new java.util.LinkedList(); + private final java.util.Collection suffixes = new java.util.LinkedList(); - public EntityPlayer(World p_i45324_1_, GameProfile p_i45324_2_) { + public PlayerEntity(World p_i45324_1_, GameProfile p_i45324_2_) { super(EntityType.field_200729_aH, p_i45324_1_); -@@ -162,6 +170,7 @@ +@@ -166,6 +173,7 @@ this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a((double)0.1F); this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188790_f); this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188792_h); @@ -30,7 +29,7 @@ } protected void func_70088_a() { -@@ -175,6 +184,7 @@ +@@ -179,6 +187,7 @@ } public void func_70071_h_() { @@ -38,62 +37,56 @@ this.field_70145_X = this.func_175149_v(); if (this.func_175149_v()) { this.field_70122_E = false; -@@ -193,7 +203,7 @@ - if (!this.field_70170_p.field_72995_K) { - if (!this.func_175143_p()) { - this.func_70999_a(true, true, false); -- } else if (this.field_70170_p.func_72935_r()) { -+ } else if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, this.field_71081_bT)) { - this.func_70999_a(false, true, true); - } +@@ -194,7 +203,7 @@ + this.field_71076_b = 100; } -@@ -253,6 +263,7 @@ + +- if (!this.field_70170_p.field_72995_K && this.field_70170_p.func_72935_r()) { ++ if (!this.field_70170_p.field_72995_K && !net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, func_213374_dv())) { + this.func_70999_a(false, true, true); + } + } else if (this.field_71076_b > 0) { +@@ -252,6 +261,7 @@ this.func_203041_m(); this.field_184832_bU.func_185144_a(); - this.func_184808_cD(); + this.func_213832_dB(); + net.minecraftforge.fml.hooks.BasicEventHooks.onPlayerPostTick(this); } protected boolean func_204229_de() { -@@ -434,10 +445,10 @@ +@@ -260,6 +270,7 @@ + } + + private void func_203041_m() { ++ net.minecraftforge.fml.hooks.BasicEventHooks.onPlayerPostTick(this); + ItemStack itemstack = this.func_184582_a(EquipmentSlotType.HEAD); + if (itemstack.func_77973_b() == Items.field_203179_ao && !this.func_208600_a(FluidTags.field_206959_a)) { + this.func_195064_c(new EffectInstance(Effects.field_76427_o, 200, 0, false, false, true)); +@@ -426,10 +437,10 @@ this.field_71107_bF = this.field_71109_bG; this.field_71109_bG = 0.0F; this.func_71015_k(this.field_70165_t - d0, this.field_70163_u - d1, this.field_70161_v - d2); -- if (this.func_184187_bx() instanceof EntityPig) { -+ if (this.func_184187_bx() instanceof EntityLivingBase && ((EntityLivingBase)this.func_184187_bx()).shouldRiderFaceForward(this)) { +- if (this.func_184187_bx() instanceof PigEntity) { ++ if (this.func_184187_bx() instanceof LivingEntity && ((LivingEntity)this.func_184187_bx()).shouldRiderFaceForward(this)) { this.field_70125_A = f1; this.field_70177_z = f; -- this.field_70761_aq = ((EntityPig)this.func_184187_bx()).field_70761_aq; -+ this.field_70761_aq = ((EntityLivingBase)this.func_184187_bx()).field_70761_aq; +- this.field_70761_aq = ((PigEntity)this.func_184187_bx()).field_70761_aq; ++ this.field_70761_aq = ((LivingEntity)this.func_184187_bx()).field_70761_aq; } } -@@ -556,10 +567,12 @@ +@@ -542,6 +553,7 @@ } public void func_70645_a(DamageSource p_70645_1_) { + if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; super.func_70645_a(p_70645_1_); - this.func_70105_a(0.2F, 0.2F); this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); - this.field_70181_x = (double)0.1F; -+ captureDrops(new java.util.ArrayList<>()); - if ("Notch".equals(this.func_200200_C_().getString())) { - this.func_146097_a(new ItemStack(Items.field_151034_e), true, false); - } -@@ -569,6 +582,8 @@ - this.field_71071_by.func_70436_m(); - } - -+ if (!field_70170_p.field_72995_K) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, p_70645_1_, captureDrops(null), field_70718_bc > 0); -+ - if (p_70645_1_ != null) { - this.field_70159_w = (double)(-MathHelper.func_76134_b((this.field_70739_aP + this.field_70177_z) * ((float)Math.PI / 180F)) * 0.1F); - this.field_70179_y = (double)(-MathHelper.func_76126_a((this.field_70739_aP + this.field_70177_z) * ((float)Math.PI / 180F)) * 0.1F); -@@ -608,12 +623,14 @@ + if (!this.func_175149_v()) { +@@ -596,12 +608,14 @@ @Nullable - public EntityItem func_71040_bB(boolean p_71040_1_) { + public ItemEntity func_71040_bB(boolean p_71040_1_) { - return this.func_146097_a(this.field_71071_by.func_70298_a(this.field_71071_by.field_70461_c, p_71040_1_ && !this.field_71071_by.func_70448_g().func_190926_b() ? this.field_71071_by.func_70448_g().func_190916_E() : 1), false, true); + ItemStack stack = field_71071_by.func_70448_g(); + if (stack.func_190926_b() || !stack.onDroppedByPlayer(this)) return null; @@ -101,32 +94,26 @@ } @Nullable - public EntityItem func_71019_a(ItemStack p_71019_1_, boolean p_71019_2_) { + public ItemEntity func_71019_a(ItemStack p_71019_1_, boolean p_71019_2_) { - return this.func_146097_a(p_71019_1_, false, p_71019_2_); + return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, p_71019_1_, false); } @Nullable -@@ -660,11 +677,18 @@ - } - - public ItemStack func_184816_a(EntityItem p_184816_1_) { -+ if (captureDrops() != null) captureDrops().add(p_184816_1_); -+ else - this.field_70170_p.func_72838_d(p_184816_1_); - return p_184816_1_.func_92059_d(); +@@ -635,7 +649,12 @@ + } } + @Deprecated //Use location sensitive version below - public float func_184813_a(IBlockState p_184813_1_) { + public float func_184813_a(BlockState p_184813_1_) { + return getDigSpeed(p_184813_1_, null); + } + -+ public float getDigSpeed(IBlockState p_184813_1_, @Nullable BlockPos pos) { ++ public float getDigSpeed(BlockState p_184813_1_, @Nullable BlockPos pos) { float f = this.field_71071_by.func_184438_a(p_184813_1_); if (f > 1.0F) { int i = EnchantmentHelper.func_185293_e(this); -@@ -706,11 +730,12 @@ +@@ -677,11 +696,12 @@ f /= 5.0F; } @@ -134,18 +121,18 @@ return f; } - public boolean func_184823_b(IBlockState p_184823_1_) { + public boolean func_184823_b(BlockState p_184823_1_) { - return p_184823_1_.func_185904_a().func_76229_l() || this.field_71071_by.func_184432_b(p_184823_1_); + return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_184823_1_, p_184823_1_.func_185904_a().func_76229_l() || this.field_71071_by.func_184432_b(p_184823_1_)); } - public void func_70037_a(NBTTagCompound p_70037_1_) { -@@ -740,6 +765,17 @@ + public void func_70037_a(CompoundNBT p_70037_1_) { +@@ -705,6 +725,17 @@ this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced"); } + p_70037_1_.func_150295_c("Spawns", 10).forEach(e -> { -+ NBTTagCompound data = (NBTTagCompound)e; ++ CompoundNBT data = (CompoundNBT)e; + ResourceLocation dim = new ResourceLocation(data.func_74779_i("Dim")); + this.spawnPosMap.put(dim, new BlockPos(data.func_74762_e("SpawnX"), data.func_74762_e("SpawnY"), data.func_74762_e("SpawnZ"))); + this.spawnForcedMap.put(dim, data.func_74767_n("SpawnForced")); @@ -158,14 +145,14 @@ this.field_71100_bB.func_75112_a(p_70037_1_); this.field_71075_bZ.func_75095_b(p_70037_1_); if (p_70037_1_.func_150297_b("EnderItems", 9)) { -@@ -786,9 +822,26 @@ - p_70014_1_.func_74782_a("ShoulderEntityRight", this.func_192025_dl()); +@@ -750,9 +781,26 @@ + p_213281_1_.func_218657_a("ShoulderEntityRight", this.func_192025_dl()); } -+ NBTTagList spawnlist = new NBTTagList(); ++ ListNBT spawnlist = new ListNBT(); + spawnPosMap.forEach((dim, pos) -> { + if (pos != null) { -+ NBTTagCompound data = new NBTTagCompound(); ++ CompoundNBT data = new CompoundNBT(); + data.func_74778_a("Dim", dim.toString()); + data.func_74768_a("SpawnX", pos.func_177958_n()); + data.func_74768_a("SpawnY", pos.func_177956_o()); @@ -174,9 +161,9 @@ + spawnlist.add(data); + } + }); -+ p_70014_1_.func_74782_a("Spawns", spawnlist); ++ p_213281_1_.func_218657_a("Spawns", spawnlist); + if (spawnDimension != net.minecraft.world.dimension.DimensionType.OVERWORLD) { -+ p_70014_1_.func_74778_a("SpawnDimension", spawnDimension.getRegistryName().toString()); ++ p_213281_1_.func_74778_a("SpawnDimension", spawnDimension.getRegistryName().toString()); + } } @@ -185,16 +172,16 @@ if (this.func_180431_b(p_70097_1_)) { return false; } else if (this.field_71075_bZ.field_75102_a && !p_70097_1_.func_76357_e()) { -@@ -824,7 +877,7 @@ +@@ -784,7 +832,7 @@ - protected void func_190629_c(EntityLivingBase p_190629_1_) { + protected void func_190629_c(LivingEntity p_190629_1_) { super.func_190629_c(p_190629_1_); -- if (p_190629_1_.func_184614_ca().func_77973_b() instanceof ItemAxe) { +- if (p_190629_1_.func_184614_ca().func_77973_b() instanceof AxeItem) { + if (p_190629_1_.func_184614_ca().canDisableShield(this.field_184627_bm, this, p_190629_1_)) { this.func_190777_m(true); } -@@ -845,11 +898,13 @@ +@@ -805,13 +853,15 @@ } protected void func_184590_k(float p_184590_1_) { @@ -202,14 +189,16 @@ + if (p_184590_1_ >= 3.0F && this.field_184627_bm.isShield(this)) { + ItemStack copy = this.field_184627_bm.func_77946_l(); int i = 1 + MathHelper.func_76141_d(p_184590_1_); - this.field_184627_bm.func_77972_a(i, this); + Hand hand = this.func_184600_cs(); + this.field_184627_bm.func_222118_a(i, this, (p_213833_1_) -> { + p_213833_1_.func_213334_d(hand); + }); if (this.field_184627_bm.func_190926_b()) { - EnumHand enumhand = this.func_184600_cs(); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, copy, enumhand); - if (enumhand == EnumHand.MAIN_HAND) { - this.func_184201_a(EntityEquipmentSlot.MAINHAND, ItemStack.field_190927_a); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, copy, hand); + if (hand == Hand.MAIN_HAND) { + this.func_184201_a(EquipmentSlotType.MAINHAND, ItemStack.field_190927_a); } else { -@@ -877,11 +932,14 @@ +@@ -827,11 +877,14 @@ protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) { if (!this.func_180431_b(p_70665_1_)) { @@ -223,36 +212,35 @@ + p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, p_70665_2_); float f1 = f - p_70665_2_; if (f1 > 0.0F && f1 < 3.4028235E37F) { - this.func_195067_a(StatList.field_212738_J, Math.round(f1 * 10.0F)); -@@ -935,6 +993,8 @@ + this.func_195067_a(Stats.field_212738_J, Math.round(f1 * 10.0F)); +@@ -886,6 +939,8 @@ - return EnumActionResult.PASS; + return ActionResultType.PASS; } else { -+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntity(this, p_190775_1_, p_190775_2_); ++ ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntity(this, p_190775_1_, p_190775_2_); + if (cancelResult != null) return cancelResult; ItemStack itemstack = this.func_184586_b(p_190775_2_); ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l(); if (p_190775_1_.func_184230_a(this, p_190775_2_)) { -@@ -942,6 +1002,10 @@ +@@ -893,6 +948,9 @@ itemstack.func_190920_e(itemstack1.func_190916_E()); } + if (!this.field_71075_bZ.field_75098_d && itemstack.func_190926_b()) { + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, p_190775_2_); + } -+ - return EnumActionResult.SUCCESS; + return ActionResultType.SUCCESS; } else { - if (!itemstack.func_190926_b() && p_190775_1_ instanceof EntityLivingBase) { -@@ -951,6 +1015,7 @@ + if (!itemstack.func_190926_b() && p_190775_1_ instanceof LivingEntity) { +@@ -902,6 +960,7 @@ - if (itemstack.func_111282_a(this, (EntityLivingBase)p_190775_1_, p_190775_2_)) { + if (itemstack.func_111282_a(this, (LivingEntity)p_190775_1_, p_190775_2_)) { if (itemstack.func_190926_b() && !this.field_71075_bZ.field_75098_d) { + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, p_190775_2_); this.func_184611_a(p_190775_2_, ItemStack.field_190927_a); } -@@ -973,6 +1038,7 @@ +@@ -928,6 +987,7 @@ } public void func_71059_n(Entity p_71059_1_) { @@ -260,11 +248,10 @@ if (p_71059_1_.func_70075_an()) { if (!p_71059_1_.func_85031_j(this)) { float f = (float)this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111126_e(); -@@ -1000,8 +1066,11 @@ +@@ -955,8 +1015,10 @@ - boolean flag2 = flag && this.field_70143_R > 0.0F && !this.field_70122_E && !this.func_70617_f_() && !this.func_70090_H() && !this.func_70644_a(MobEffects.field_76440_q) && !this.func_184218_aH() && p_71059_1_ instanceof EntityLivingBase; + boolean flag2 = flag && this.field_70143_R > 0.0F && !this.field_70122_E && !this.func_70617_f_() && !this.func_70090_H() && !this.func_70644_a(Effects.field_76440_q) && !this.func_184218_aH() && p_71059_1_ instanceof LivingEntity; flag2 = flag2 && !this.func_70051_ag(); -+ + net.minecraftforge.event.entity.player.CriticalHitEvent hitResult = net.minecraftforge.common.ForgeHooks.getCriticalHit(this, p_71059_1_, flag2, flag2 ? 1.5F : 1.0F); + flag2 = hitResult != null; if (flag2) { @@ -273,18 +260,18 @@ } f = f + f1; -@@ -1097,8 +1166,10 @@ +@@ -1044,8 +1106,10 @@ } - if (!itemstack1.func_190926_b() && entity instanceof EntityLivingBase) { + if (!this.field_70170_p.field_72995_K && !itemstack1.func_190926_b() && entity instanceof LivingEntity) { + ItemStack copy = itemstack1.func_77946_l(); - itemstack1.func_77961_a((EntityLivingBase)entity, this); + itemstack1.func_77961_a((LivingEntity)entity, this); if (itemstack1.func_190926_b()) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, copy, EnumHand.MAIN_HAND); - this.func_184611_a(EnumHand.MAIN_HAND, ItemStack.field_190927_a); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, copy, Hand.MAIN_HAND); + this.func_184611_a(Hand.MAIN_HAND, ItemStack.field_190927_a); } } -@@ -1140,7 +1211,7 @@ +@@ -1087,7 +1151,7 @@ } if (this.field_70146_Z.nextFloat() < f) { @@ -293,39 +280,26 @@ this.func_184602_cy(); this.field_70170_p.func_72960_a(this, (byte)30); } -@@ -1188,7 +1259,11 @@ +@@ -1131,6 +1195,8 @@ } - public EntityPlayer.SleepResult func_180469_a(BlockPos p_180469_1_) { -- EnumFacing enumfacing = this.field_70170_p.func_180495_p(p_180469_1_).func_177229_b(BlockHorizontal.field_185512_D); -+ EntityPlayer.SleepResult ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, p_180469_1_); -+ if (ret != null) return ret; -+ final IBlockState state = this.field_70170_p.func_175667_e(p_180469_1_) ? this.field_70170_p.func_180495_p(p_180469_1_) : null; -+ final boolean isBed = state != null && state.isBed(this.field_70170_p, p_180469_1_, this); -+ final EnumFacing enumfacing = isBed && state.func_177230_c() instanceof BlockHorizontal ? (EnumFacing)state.func_177229_b(BlockHorizontal.field_185512_D) : null; + public Either func_213819_a(BlockPos p_213819_1_) { ++ PlayerEntity.SleepResult ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, func_213374_dv()); ++ if (ret != null) return Either.left(ret); + Direction direction = this.field_70170_p.func_180495_p(p_213819_1_).func_177229_b(HorizontalBlock.field_185512_D); if (!this.field_70170_p.field_72995_K) { if (this.func_70608_bn() || !this.func_70089_S()) { - return EntityPlayer.SleepResult.OTHER_PROBLEM; -@@ -1198,7 +1273,7 @@ - return EntityPlayer.SleepResult.NOT_POSSIBLE_HERE; +@@ -1141,7 +1207,7 @@ + return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_HERE); } - if (this.field_70170_p.func_72935_r()) { -+ if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, p_180469_1_)) { - return EntityPlayer.SleepResult.NOT_POSSIBLE_NOW; ++ if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, func_213374_dv())) { + return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_NOW); } -@@ -1223,7 +1298,7 @@ - this.func_192030_dh(); - this.func_175145_a(StatList.field_199092_j.func_199076_b(StatList.field_203284_n)); - this.func_70105_a(0.2F, 0.2F); -- if (this.field_70170_p.func_175667_e(p_180469_1_)) { -+ if (enumfacing != null) { - float f1 = 0.5F + (float)enumfacing.func_82601_c() * 0.4F; - float f = 0.5F + (float)enumfacing.func_82599_e() * 0.4F; - this.func_175139_a(enumfacing); -@@ -1248,6 +1323,8 @@ - private boolean func_190774_a(BlockPos p_190774_1_, EnumFacing p_190774_2_) { +@@ -1183,6 +1249,8 @@ + private boolean func_190774_a(BlockPos p_190774_1_, Direction p_190774_2_) { if (Math.abs(this.field_70165_t - (double)p_190774_1_.func_177958_n()) <= 3.0D && Math.abs(this.field_70163_u - (double)p_190774_1_.func_177956_o()) <= 2.0D && Math.abs(this.field_70161_v - (double)p_190774_1_.func_177952_p()) <= 3.0D) { return true; + } else if (p_190774_2_ == null) { @@ -333,68 +307,37 @@ } else { BlockPos blockpos = p_190774_1_.func_177972_a(p_190774_2_.func_176734_d()); return Math.abs(this.field_70165_t - (double)blockpos.func_177958_n()) <= 3.0D && Math.abs(this.field_70163_u - (double)blockpos.func_177956_o()) <= 2.0D && Math.abs(this.field_70161_v - (double)blockpos.func_177952_p()) <= 3.0D; -@@ -1260,16 +1337,19 @@ +@@ -1195,6 +1263,7 @@ } public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { + net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, p_70999_2_, p_70999_3_); - this.func_70105_a(0.6F, 1.8F); -- IBlockState iblockstate = this.field_70170_p.func_180495_p(this.field_71081_bT); -- if (this.field_71081_bT != null && iblockstate.func_177230_c() instanceof BlockBed) { -- this.field_70170_p.func_180501_a(this.field_71081_bT, iblockstate.func_206870_a(BlockBed.field_176471_b, Boolean.valueOf(false)), 4); -- BlockPos blockpos = BlockBed.func_176468_a(this.field_70170_p, this.field_71081_bT, 0); -+ IBlockState iblockstate = field_71081_bT == null ? null : this.field_70170_p.func_180495_p(this.field_71081_bT); -+ if (this.field_71081_bT != null && iblockstate.isBed(field_70170_p, field_71081_bT, this)) { -+ iblockstate.setBedOccupied(field_70170_p, field_71081_bT, this, false); -+ BlockPos blockpos = iblockstate.getBedSpawnPosition(field_70170_p, field_71081_bT, this); - if (blockpos == null) { - blockpos = this.field_71081_bT.func_177984_a(); - } - - this.func_70107_b((double)((float)blockpos.func_177958_n() + 0.5F), (double)((float)blockpos.func_177956_o() + 0.1F), (double)((float)blockpos.func_177952_p() + 0.5F)); -+ } else { -+ p_70999_3_ = false; - } - - this.field_71083_bS = false; -@@ -1285,29 +1365,30 @@ + Optional optional = this.func_213374_dv(); + super.func_213366_dy(); + if (this.field_70170_p instanceof ServerWorld && p_70999_2_) { +@@ -1215,17 +1284,17 @@ } - private boolean func_175143_p() { -- return this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c() instanceof BlockBed; -+ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, this.field_71081_bT); - } - - @Nullable - public static BlockPos func_180467_a(IBlockReader p_180467_0_, BlockPos p_180467_1_, boolean p_180467_2_) { -- Block block = p_180467_0_.func_180495_p(p_180467_1_).func_177230_c(); -- if (!(block instanceof BlockBed)) { -+ IBlockState state = p_180467_0_.func_180495_p(p_180467_1_); -+ if (!state.isBed(p_180467_0_, p_180467_1_, null)) { - if (!p_180467_2_) { - return null; + public static Optional func_213822_a(IWorldReader p_213822_0_, BlockPos p_213822_1_, boolean p_213822_2_) { +- Block block = p_213822_0_.func_180495_p(p_213822_1_).func_177230_c(); +- if (!(block instanceof BedBlock)) { ++ BlockState blockState = p_213822_0_.func_180495_p(p_213822_1_); ++ if (!(blockState.isBed(p_213822_0_, p_213822_1_, null))) { + if (!p_213822_2_) { + return Optional.empty(); } else { - boolean flag = block.func_181623_g(); -+ boolean flag = state.func_177230_c().func_181623_g(); - boolean flag1 = p_180467_0_.func_180495_p(p_180467_1_.func_177984_a()).func_177230_c().func_181623_g(); - return flag && flag1 ? p_180467_1_ : null; ++ boolean flag = blockState.func_177230_c().func_181623_g(); + boolean flag1 = p_213822_0_.func_180495_p(p_213822_1_.func_177984_a()).func_177230_c().func_181623_g(); + return flag && flag1 ? Optional.of(new Vec3d((double)p_213822_1_.func_177958_n() + 0.5D, (double)p_213822_1_.func_177956_o() + 0.1D, (double)p_213822_1_.func_177952_p() + 0.5D)) : Optional.empty(); } } else { -- return BlockBed.func_176468_a(p_180467_0_, p_180467_1_, 0); -+ return state.getBedSpawnPosition(p_180467_0_, p_180467_1_, null); +- return BedBlock.func_220172_a(EntityType.field_200729_aH, p_213822_0_, p_213822_1_, 0); ++ return blockState.getBedSpawnPosition(EntityType.field_200729_aH, p_213822_0_, p_213822_1_, null); } } - @OnlyIn(Dist.CLIENT) - public float func_71051_bG() { - if (this.field_71081_bT != null) { -- EnumFacing enumfacing = this.field_70170_p.func_180495_p(this.field_71081_bT).func_177229_b(BlockHorizontal.field_185512_D); -+ IBlockState state = this.field_70170_p.func_180495_p(this.field_71081_bT); -+ EnumFacing enumfacing = !state.isBed(field_70170_p, field_71081_bT, this) ? EnumFacing.UP : state.getBedDirection(field_70170_p, field_71081_bT); - switch(enumfacing) { - case SOUTH: - return 90.0F; -@@ -1339,23 +1420,67 @@ +@@ -1240,23 +1309,67 @@ public void func_146105_b(ITextComponent p_146105_1_, boolean p_146105_2_) { } @@ -410,7 +353,7 @@ + * @return The player specific spawn location for the dimension. May be null. + */ + public BlockPos getBedLocation(net.minecraft.world.dimension.DimensionType dim) { -+ return dim == net.minecraft.world.dimension.DimensionType.OVERWORLD ? field_71081_bT : spawnPosMap.get(dim.getRegistryName()); ++ return dim == net.minecraft.world.dimension.DimensionType.OVERWORLD ? field_71077_c : spawnPosMap.get(dim.getRegistryName()); + } + + @Deprecated //Forge: Use Dimension sensitive version @@ -471,7 +414,7 @@ } public void func_195066_a(ResourceLocation p_195066_1_) { -@@ -1525,6 +1650,8 @@ +@@ -1422,6 +1535,8 @@ } super.func_180430_e(p_180430_1_, p_180430_2_); @@ -480,39 +423,23 @@ } } -@@ -1786,7 +1913,10 @@ +@@ -1684,7 +1799,10 @@ } public ITextComponent func_145748_c_() { - ITextComponent itextcomponent = ScorePlayerTeam.func_200541_a(this.func_96124_cp(), this.func_200200_C_()); -+ ITextComponent itextcomponent = new TextComponentString(""); ++ ITextComponent itextcomponent = new StringTextComponent(""); + prefixes.forEach(e -> itextcomponent.func_150257_a(e)); + itextcomponent.func_150257_a(ScorePlayerTeam.func_200541_a(this.func_96124_cp(), this.func_200200_C_())); + suffixes.forEach(e -> itextcomponent.func_150257_a(e)); return this.func_208016_c(itextcomponent); } -@@ -1806,7 +1936,7 @@ +@@ -1920,4 +2038,44 @@ + return this.field_221260_g; + } } - - public float func_70047_e() { -- float f = 1.62F; -+ float f = eyeHeight; - if (this.func_70608_bn()) { - f = 0.2F; - } else if (!this.func_203007_ba() && !this.func_184613_cA() && this.field_70131_O != 0.6F) { -@@ -1973,6 +2103,54 @@ - return this.field_71075_bZ.field_75098_d && this.func_184840_I() >= 2; - } - -+ /** -+ * Returns the default eye height of the player -+ * @return player default eye height -+ */ -+ public float getDefaultEyeHeight() { -+ return 1.62F; -+ } -+ ++ // =========== FORGE START ==============// + public net.minecraft.world.dimension.DimensionType getSpawnDimension() { + return this.spawnDimension; + } @@ -528,23 +455,23 @@ + public Collection getSuffixes() { + return this.suffixes; + } -+ ++ + private final net.minecraftforge.common.util.LazyOptional + playerMainHandler = net.minecraftforge.common.util.LazyOptional.of( + () -> new net.minecraftforge.items.wrapper.PlayerMainInvWrapper(field_71071_by)); -+ ++ + private final net.minecraftforge.common.util.LazyOptional + playerEquipmentHandler = net.minecraftforge.common.util.LazyOptional.of( + () -> new net.minecraftforge.items.wrapper.CombinedInvWrapper( + new net.minecraftforge.items.wrapper.PlayerArmorInvWrapper(field_71071_by), + new net.minecraftforge.items.wrapper.PlayerOffhandInvWrapper(field_71071_by))); -+ ++ + private final net.minecraftforge.common.util.LazyOptional + playerJoinedHandler = net.minecraftforge.common.util.LazyOptional.of( + () -> new net.minecraftforge.items.wrapper.PlayerInvWrapper(field_71071_by)); -+ ++ + @Override -+ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable EnumFacing facing) { ++ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable Direction facing) { + if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (facing == null) return playerJoinedHandler.cast(); + else if (facing.func_176740_k().func_200128_b()) return playerMainHandler.cast(); @@ -552,7 +479,4 @@ + } + return super.getCapability(capability, facing); + } -+ - public static enum EnumChatVisibility { - FULL(0, "options.chat.visibility.full"), - SYSTEM(1, "options.chat.visibility.system"), + } diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch similarity index 93% rename from patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch rename to patches/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch index 109aa69f4..d27a05c5e 100644 --- a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/PlayerInventory.java.patch @@ -1,5 +1,5 @@ ---- a/net/minecraft/entity/player/InventoryPlayer.java -+++ b/net/minecraft/entity/player/InventoryPlayer.java +--- a/net/minecraft/entity/player/PlayerInventory.java ++++ b/net/minecraft/entity/player/PlayerInventory.java @@ -214,7 +214,8 @@ int i = p_191973_2_.func_190916_E(); ItemStack itemstack = this.func_70301_a(p_191973_1_); diff --git a/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch b/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch new file mode 100644 index 000000000..d9ff37a11 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch @@ -0,0 +1,147 @@ +--- a/net/minecraft/entity/player/ServerPlayerEntity.java ++++ b/net/minecraft/entity/player/ServerPlayerEntity.java +@@ -433,6 +433,7 @@ + } + + public void func_70645_a(DamageSource p_70645_1_) { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; + boolean flag = this.field_70170_p.func_82736_K().func_82766_b("showDeathMessages"); + if (flag) { + ITextComponent itextcomponent = this.func_110142_aN().func_151521_b(); +@@ -565,8 +566,10 @@ + return this.field_71133_b.func_71219_W(); + } + ++ @Override + @Nullable + public Entity func_212321_a(DimensionType p_212321_1_) { ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_212321_1_)) return null; + this.field_184851_cj = true; + DimensionType dimensiontype = this.field_71093_bK; + if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.OVERWORLD) { +@@ -588,8 +591,8 @@ + this.field_71135_a.func_147359_a(new SServerDifficultyPacket(worldinfo.func_176130_y(), worldinfo.func_176123_z())); + PlayerList playerlist = this.field_71133_b.func_184103_al(); + playerlist.func_187243_f(this); +- serverworld.func_217434_e(this); +- this.field_70128_L = false; ++ serverworld.removeEntity(this, true); //Forge: the player entity is moved to the new world, NOT cloned. So keep the data alive with no matching invalidate call. ++ this.revive(); + double d0 = this.field_70165_t; + double d1 = this.field_70163_u; + double d2 = this.field_70161_v; +@@ -598,13 +601,11 @@ + double d3 = 8.0D; + float f2 = f1; + serverworld.func_217381_Z().func_76320_a("moving"); ++ double moveFactor = serverworld.func_201675_m().getMovementFactor() / serverworld1.func_201675_m().getMovementFactor(); ++ d0 *= moveFactor; ++ d2 *= moveFactor; + if (dimensiontype == DimensionType.OVERWORLD && p_212321_1_ == DimensionType.NETHER) { + this.field_193110_cw = new Vec3d(this.field_70165_t, this.field_70163_u, this.field_70161_v); +- d0 /= 8.0D; +- d2 /= 8.0D; +- } else if (dimensiontype == DimensionType.NETHER && p_212321_1_ == DimensionType.OVERWORLD) { +- d0 *= 8.0D; +- d2 *= 8.0D; + } else if (dimensiontype == DimensionType.OVERWORLD && p_212321_1_ == DimensionType.THE_END) { + BlockPos blockpos = serverworld1.func_180504_m(); + d0 = (double)blockpos.func_177958_n(); +@@ -668,6 +669,7 @@ + this.field_71144_ck = -1; + this.field_71149_ch = -1.0F; + this.field_71146_ci = -1; ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(this, dimensiontype, p_212321_1_); + return this; + } + } +@@ -773,7 +775,7 @@ + BlockPos blockpos = new BlockPos(i, j, k); + if (this.field_70170_p.func_175667_e(blockpos)) { + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(field_70170_p, blockpos)) { + BlockPos blockpos1 = blockpos.func_177977_b(); + BlockState blockstate1 = this.field_70170_p.func_180495_p(blockpos1); + Block block = blockstate1.func_177230_c(); +@@ -816,6 +818,7 @@ + this.field_71135_a.func_147359_a(new SOpenWindowPacket(container.field_75152_c, container.func_216957_a(), p_213829_1_.func_145748_c_())); + container.func_75132_a(this); + this.field_71070_bA = container; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); + return OptionalInt.of(this.field_71139_cq); + } + } +@@ -834,6 +837,7 @@ + this.field_71135_a.func_147359_a(new SOpenHorseWindowPacket(this.field_71139_cq, p_184826_2_.func_70302_i_(), p_184826_1_.func_145782_y())); + this.field_71070_bA = new HorseInventoryContainer(this.field_71139_cq, this.field_71071_by, p_184826_2_, p_184826_1_); + this.field_71070_bA.func_75132_a(this); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); + } + + public void func_184814_a(ItemStack p_184814_1_, Hand p_184814_2_) { +@@ -891,6 +895,7 @@ + + public void func_71128_l() { + this.field_71070_bA.func_75134_a(this); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Close(this, this.field_71070_bA)); + this.field_71070_bA = this.field_71069_bz; + } + +@@ -1017,6 +1022,20 @@ + this.field_193110_cw = p_193104_1_.field_193110_cw; + this.func_192029_h(p_193104_1_.func_192023_dk()); + this.func_192031_i(p_193104_1_.func_192025_dl()); ++ ++ this.spawnPosMap = p_193104_1_.spawnPosMap; ++ this.spawnForcedMap = p_193104_1_.spawnForcedMap; ++ if(p_193104_1_.field_71093_bK != net.minecraft.world.dimension.DimensionType.OVERWORLD) { ++ this.field_71077_c = p_193104_1_.field_71077_c; ++ this.field_82248_d = p_193104_1_.field_82248_d; ++ } ++ ++ //Copy over a section of the Entity Data from the old player. ++ //Allows mods to specify data that persists after players respawn. ++ CompoundNBT old = p_193104_1_.getEntityData(); ++ if (old.func_74764_b(PERSISTED_NBT_TAG)) ++ getEntityData().func_218657_a(PERSISTED_NBT_TAG, old.func_74781_a(PERSISTED_NBT_TAG)); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, p_193104_1_, !p_193104_2_); + } + + protected void func_70670_a(EffectInstance p_70670_1_) { +@@ -1239,15 +1258,15 @@ + this.func_184210_p(); + if (p_200619_1_ == this.field_70170_p) { + this.field_71135_a.func_147364_a(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_); +- } else { ++ } else if (net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_200619_1_.field_73011_w.func_186058_p())) { + ServerWorld serverworld = this.func_71121_q(); + this.field_71093_bK = p_200619_1_.field_73011_w.func_186058_p(); + WorldInfo worldinfo = p_200619_1_.func_72912_H(); + this.field_71135_a.func_147359_a(new SRespawnPacket(this.field_71093_bK, worldinfo.func_76067_t(), this.field_71134_c.func_73081_b())); + this.field_71135_a.func_147359_a(new SServerDifficultyPacket(worldinfo.func_176130_y(), worldinfo.func_176123_z())); + this.field_71133_b.func_184103_al().func_187243_f(this); +- serverworld.func_217434_e(this); +- this.field_70128_L = false; ++ serverworld.removePlayer(this, true); //Forge: The player entity itself is moved, and not cloned. So we need to keep the data alive with no matching invalidate call later. ++ this.revive(); + this.func_70012_b(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_); + this.func_70029_a(p_200619_1_); + p_200619_1_.func_217446_a(this); +@@ -1256,6 +1275,7 @@ + this.field_71134_c.func_73080_a(p_200619_1_); + this.field_71133_b.func_184103_al().func_72354_b(this, p_200619_1_); + this.field_71133_b.func_184103_al().func_72385_f(this); ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(this, p_200619_1_.field_73011_w.func_186058_p(), this.field_71093_bK); + } + + } +@@ -1290,6 +1310,8 @@ + if (itementity == null) { + return null; + } else { ++ if (captureDrops() != null) captureDrops().add(itementity); ++ else + this.field_70170_p.func_217376_c(itementity); + ItemStack itemstack = itementity.func_92059_d(); + if (p_146097_3_) { diff --git a/patches/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch new file mode 100644 index 000000000..437ce2903 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/projectile/AbstractArrowEntity.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/entity/projectile/AbstractArrowEntity.java ++++ b/net/minecraft/entity/projectile/AbstractArrowEntity.java +@@ -161,7 +161,7 @@ + + BlockPos blockpos = new BlockPos(this.field_70165_t, this.field_70163_u, this.field_70161_v); + BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); +- if (!blockstate.func_196958_f() && !flag) { ++ if (!blockstate.isAir(this.field_70170_p, blockpos) && !flag) { + VoxelShape voxelshape = blockstate.func_196952_d(this.field_70170_p, blockpos); + if (!voxelshape.func_197766_b()) { + for(AxisAlignedBB axisalignedbb : voxelshape.func_197756_d()) { +@@ -217,7 +217,7 @@ + } + } + +- if (raytraceresult != null && !flag) { ++ if (raytraceresult != null && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.func_184549_a(raytraceresult); + this.field_70160_al = true; + } diff --git a/patches/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch new file mode 100644 index 000000000..a219051b4 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/projectile/DamagingProjectileEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/projectile/DamagingProjectileEntity.java ++++ b/net/minecraft/entity/projectile/DamagingProjectileEntity.java +@@ -79,7 +79,7 @@ + + ++this.field_70234_an; + RayTraceResult raytraceresult = ProjectileHelper.func_221266_a(this, true, this.field_70234_an >= 25, this.field_70235_a, RayTraceContext.BlockMode.COLLIDER); +- if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) { ++ if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.func_70227_a(raytraceresult); + } + diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityArrow.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityArrow.java.patch deleted file mode 100644 index 98db4111e..000000000 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityArrow.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/net/minecraft/entity/projectile/EntityArrow.java -+++ b/net/minecraft/entity/projectile/EntityArrow.java -@@ -165,7 +165,7 @@ - - BlockPos blockpos = new BlockPos(this.field_145791_d, this.field_145792_e, this.field_145789_f); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); -- if (!iblockstate.func_196958_f() && !flag) { -+ if (!iblockstate.isAir(this.field_70170_p, blockpos) && !flag) { - VoxelShape voxelshape = iblockstate.func_196952_d(this.field_70170_p, blockpos); - if (!voxelshape.func_197766_b()) { - for(AxisAlignedBB axisalignedbb : voxelshape.func_197756_d()) { -@@ -223,7 +223,7 @@ - } - } - -- if (raytraceresult != null && !flag) { -+ if (raytraceresult != null && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.func_184549_a(raytraceresult); - this.field_70160_al = true; - } -@@ -314,7 +314,7 @@ - this.field_70254_i = true; - this.field_70249_b = 7; - this.func_70243_d(false); -- if (!iblockstate.func_196958_f()) { -+ if (!iblockstate.isAir(field_70170_p, blockpos)) { - this.field_195056_av.func_196950_a(this.field_70170_p, blockpos, this); - } - } diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityFireball.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityFireball.java.patch deleted file mode 100644 index 8a68b0dd2..000000000 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityFireball.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/projectile/EntityFireball.java -+++ b/net/minecraft/entity/projectile/EntityFireball.java -@@ -79,7 +79,7 @@ - - ++this.field_70234_an; - RayTraceResult raytraceresult = ProjectileHelper.func_188802_a(this, true, this.field_70234_an >= 25, this.field_70235_a); -- if (raytraceresult != null) { -+ if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.func_70227_a(raytraceresult); - } - diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch deleted file mode 100644 index 42d47fb48..000000000 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- a/net/minecraft/entity/projectile/EntityFishHook.java -+++ b/net/minecraft/entity/projectile/EntityFishHook.java -@@ -234,8 +234,8 @@ - private boolean func_190625_o() { - ItemStack itemstack = this.field_146042_b.func_184614_ca(); - ItemStack itemstack1 = this.field_146042_b.func_184592_cb(); -- boolean flag = itemstack.func_77973_b() == Items.field_151112_aM; -- boolean flag1 = itemstack1.func_77973_b() == Items.field_151112_aM; -+ boolean flag = itemstack.func_77973_b() instanceof net.minecraft.item.ItemFishingRod; -+ boolean flag1 = itemstack1.func_77973_b() instanceof net.minecraft.item.ItemFishingRod; - if (!this.field_146042_b.field_70128_L && this.field_146042_b.func_70089_S() && (flag || flag1) && !(this.func_70068_e(this.field_146042_b) > 1024.0D)) { - return false; - } else { -@@ -345,8 +345,7 @@ - double d0 = this.field_70165_t + (double)(f1 * (float)this.field_146038_az * 0.1F); - double d1 = (double)((float)MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) + 1.0F); - double d2 = this.field_70161_v + (double)(f2 * (float)this.field_146038_az * 0.1F); -- Block block = worldserver.func_180495_p(new BlockPos(d0, d1 - 1.0D, d2)).func_177230_c(); -- if (block == Blocks.field_150355_j) { -+ if (worldserver.func_180495_p(new BlockPos(d0, d1 - 1.0D, d2)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) { - if (this.field_70146_Z.nextFloat() < 0.15F) { - worldserver.func_195598_a(Particles.field_197612_e, d0, d1 - (double)0.1F, d2, 1, (double)f1, 0.1D, (double)f2, 0.0D); - } -@@ -381,8 +380,7 @@ - double d4 = this.field_70165_t + (double)(MathHelper.func_76126_a(f6) * f7 * 0.1F); - double d5 = (double)((float)MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) + 1.0F); - double d6 = this.field_70161_v + (double)(MathHelper.func_76134_b(f6) * f7 * 0.1F); -- Block block1 = worldserver.func_180495_p(new BlockPos((int)d4, (int)d5 - 1, (int)d6)).func_177230_c(); -- if (block1 == Blocks.field_150355_j) { -+ if (worldserver.func_180495_p(new BlockPos((int)d4, (int)d5 - 1, (int)d6)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) { - worldserver.func_195598_a(Particles.field_197606_Q, d4, d5, d6, 2 + this.field_70146_Z.nextInt(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D); - } - } -@@ -411,6 +409,7 @@ - public int func_146034_e(ItemStack p_146034_1_) { - if (!this.field_70170_p.field_72995_K && this.field_146042_b != null) { - int i = 0; -+ net.minecraftforge.event.entity.player.ItemFishedEvent event = null; - if (this.field_146043_c != null) { - this.func_184527_k(); - CriteriaTriggers.field_204811_D.func_204820_a((EntityPlayerMP)this.field_146042_b, p_146034_1_, this, Collections.emptyList()); -@@ -419,7 +418,14 @@ - } else if (this.field_146045_ax > 0) { - LootContext.Builder lootcontext$builder = (new LootContext.Builder((WorldServer)this.field_70170_p)).func_204313_a(new BlockPos(this)); - lootcontext$builder.func_186469_a((float)this.field_191518_aw + this.field_146042_b.func_184817_da()); -+ lootcontext$builder.func_186470_a(this.field_146042_b).func_186472_a(this); - List list = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(LootTableList.field_186387_al).func_186462_a(this.field_70146_Z, lootcontext$builder.func_186471_a()); -+ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.field_146051_au ? 2 : 1, this); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.isCanceled()) { -+ this.func_70106_y(); -+ return event.getRodDamage(); -+ } - CriteriaTriggers.field_204811_D.func_204820_a((EntityPlayerMP)this.field_146042_b, p_146034_1_, this, list); - - for(ItemStack itemstack : list) { -@@ -447,7 +453,7 @@ - } - - this.func_70106_y(); -- return i; -+ return event == null ? i : event.getRodDamage(); - } else { - return 0; - } diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityLargeFireball.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityLargeFireball.java.patch deleted file mode 100644 index f1fbdf8ea..000000000 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityLargeFireball.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/projectile/EntityLargeFireball.java -+++ b/net/minecraft/entity/projectile/EntityLargeFireball.java -@@ -33,7 +33,7 @@ - this.func_174815_a(this.field_70235_a, p_70227_1_.field_72308_g); - } - -- boolean flag = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"); -+ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a); - this.field_70170_p.func_72885_a((Entity)null, this.field_70165_t, this.field_70163_u, this.field_70161_v, (float)this.field_92057_e, flag, flag); - this.func_70106_y(); - } diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityLlamaSpit.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityLlamaSpit.java.patch deleted file mode 100644 index 29db6fcf9..000000000 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityLlamaSpit.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/projectile/EntityLlamaSpit.java -+++ b/net/minecraft/entity/projectile/EntityLlamaSpit.java -@@ -69,7 +69,7 @@ - raytraceresult = new RayTraceResult(entity); - } - -- if (raytraceresult != null) { -+ if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.func_190536_a(raytraceresult); - } - diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityShulkerBullet.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityShulkerBullet.java.patch deleted file mode 100644 index 222448230..000000000 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityShulkerBullet.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/projectile/EntityShulkerBullet.java -+++ b/net/minecraft/entity/projectile/EntityShulkerBullet.java -@@ -250,7 +250,7 @@ - } - - RayTraceResult raytraceresult = ProjectileHelper.func_188802_a(this, true, false, this.field_184570_a); -- if (raytraceresult != null) { -+ if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { - this.func_184567_a(raytraceresult); - } - } diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntitySmallFireball.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntitySmallFireball.java.patch deleted file mode 100644 index 47052bc8b..000000000 --- a/patches/minecraft/net/minecraft/entity/projectile/EntitySmallFireball.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/projectile/EntitySmallFireball.java -+++ b/net/minecraft/entity/projectile/EntitySmallFireball.java -@@ -35,7 +35,7 @@ - } else { - boolean flag1 = true; - if (this.field_70235_a != null && this.field_70235_a instanceof EntityLiving) { -- flag1 = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"); -+ flag1 = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a); - } - - if (flag1) { diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityThrowable.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityThrowable.java.patch deleted file mode 100644 index 68a2726ff..000000000 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityThrowable.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/entity/projectile/EntityThrowable.java -+++ b/net/minecraft/entity/projectile/EntityThrowable.java -@@ -178,7 +178,7 @@ - if (raytraceresult != null) { - if (raytraceresult.field_72313_a == RayTraceResult.Type.BLOCK && this.field_70170_p.func_180495_p(raytraceresult.func_178782_a()).func_177230_c() == Blocks.field_150427_aO) { - this.func_181015_d(raytraceresult.func_178782_a()); -- } else { -+ } else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)){ - this.func_70184_a(raytraceresult); - } - } diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java.patch deleted file mode 100644 index 850cb9449..000000000 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/entity/projectile/EntityWitherSkull.java -+++ b/net/minecraft/entity/projectile/EntityWitherSkull.java -@@ -45,7 +45,7 @@ - } - - public float func_180428_a(Explosion p_180428_1_, IBlockReader p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_, IFluidState p_180428_5_, float p_180428_6_) { -- return this.func_82342_d() && EntityWither.func_181033_a(p_180428_4_.func_177230_c()) ? Math.min(0.8F, p_180428_6_) : p_180428_6_; -+ return this.func_82342_d() && p_180428_4_.canEntityDestroy(p_180428_2_, p_180428_3_, this) ? Math.min(0.8F, p_180428_6_) : p_180428_6_; - } - - protected void func_70227_a(RayTraceResult p_70227_1_) { -@@ -77,7 +77,7 @@ - } - } - -- this.field_70170_p.func_72885_a(this, this.field_70165_t, this.field_70163_u, this.field_70161_v, 1.0F, false, this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")); -+ this.field_70170_p.func_72885_a(this, this.field_70165_t, this.field_70163_u, this.field_70161_v, 1.0F, false, net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a)); - this.func_70106_y(); - } - diff --git a/patches/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch new file mode 100644 index 000000000..7001981df --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/projectile/FireballEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/projectile/FireballEntity.java ++++ b/net/minecraft/entity/projectile/FireballEntity.java +@@ -36,7 +36,7 @@ + this.func_174815_a(this.field_70235_a, entity); + } + +- boolean flag = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"); ++ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a); + this.field_70170_p.func_217398_a((Entity)null, this.field_70165_t, this.field_70163_u, this.field_70161_v, (float)this.field_92057_e, flag, flag ? Explosion.Mode.DESTROY : Explosion.Mode.NONE); + this.func_70106_y(); + } diff --git a/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch new file mode 100644 index 000000000..aec4a82d9 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/projectile/FishingBobberEntity.java.patch @@ -0,0 +1,68 @@ +--- a/net/minecraft/entity/projectile/FishingBobberEntity.java ++++ b/net/minecraft/entity/projectile/FishingBobberEntity.java +@@ -210,8 +210,8 @@ + private boolean func_190625_o() { + ItemStack itemstack = this.field_146042_b.func_184614_ca(); + ItemStack itemstack1 = this.field_146042_b.func_184592_cb(); +- boolean flag = itemstack.func_77973_b() == Items.field_151112_aM; +- boolean flag1 = itemstack1.func_77973_b() == Items.field_151112_aM; ++ boolean flag = itemstack.func_77973_b() instanceof net.minecraft.item.FishingRodItem; ++ boolean flag1 = itemstack1.func_77973_b() instanceof net.minecraft.item.FishingRodItem; + if (!this.field_146042_b.field_70128_L && this.field_146042_b.func_70089_S() && (flag || flag1) && !(this.func_70068_e(this.field_146042_b) > 1024.0D)) { + return false; + } else { +@@ -295,7 +295,7 @@ + double d1 = (double)((float)MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) + 1.0F); + double d2 = this.field_70161_v + (double)(f2 * (float)this.field_146038_az * 0.1F); + Block block = serverworld.func_180495_p(new BlockPos(d0, d1 - 1.0D, d2)).func_177230_c(); +- if (block == Blocks.field_150355_j) { ++ if (serverworld.func_180495_p(new BlockPos((int)d0, (int)d1 - 1, (int)d2)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) { + if (this.field_70146_Z.nextFloat() < 0.15F) { + serverworld.func_195598_a(ParticleTypes.field_197612_e, d0, d1 - (double)0.1F, d2, 1, (double)f1, 0.1D, (double)f2, 0.0D); + } +@@ -332,7 +332,7 @@ + double d5 = (double)((float)MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) + 1.0F); + double d6 = this.field_70161_v + (double)(MathHelper.func_76134_b(f6) * f7 * 0.1F); + Block block1 = serverworld.func_180495_p(new BlockPos(d4, d5 - 1.0D, d6)).func_177230_c(); +- if (block1 == Blocks.field_150355_j) { ++ if (serverworld.func_180495_p(new BlockPos(d4, d5 - 1.0D, d6)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) { + serverworld.func_195598_a(ParticleTypes.field_218422_X, d4, d5, d6, 2 + this.field_70146_Z.nextInt(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D); + } + } +@@ -357,15 +357,26 @@ + public int func_146034_e(ItemStack p_146034_1_) { + if (!this.field_70170_p.field_72995_K && this.field_146042_b != null) { + int i = 0; ++ net.minecraftforge.event.entity.player.ItemFishedEvent event = null; + if (this.field_146043_c != null) { + this.func_184527_k(); + CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)this.field_146042_b, p_146034_1_, this, Collections.emptyList()); + this.field_70170_p.func_72960_a(this, (byte)31); + i = this.field_146043_c instanceof ItemEntity ? 3 : 5; + } else if (this.field_146045_ax > 0) { +- LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, new BlockPos(this)).func_216015_a(LootParameters.field_216289_i, p_146034_1_).func_216023_a(this.field_70146_Z).func_186469_a((float)this.field_191518_aw + this.field_146042_b.func_184817_da()); ++ LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, new BlockPos(this)). ++ func_216015_a(LootParameters.field_216289_i, p_146034_1_). ++ func_216023_a(this.field_70146_Z).func_186469_a((float)this.field_191518_aw + this.field_146042_b.func_184817_da()); ++ lootcontext$builder.func_216015_a(LootParameters.field_216284_d, this.field_146042_b). ++ func_216015_a(LootParameters.field_216281_a,this); + LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(LootTables.field_186387_al); + List list = loottable.func_216113_a(lootcontext$builder.func_216022_a(LootParameterSets.field_216262_c)); ++ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.field_146051_au ? 2 : 1, this); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.isCanceled()) { ++ this.func_70106_y(); ++ return event.getRodDamage(); ++ } + CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)this.field_146042_b, p_146034_1_, this, list); + + for(ItemStack itemstack : list) { +@@ -390,7 +401,7 @@ + } + + this.func_70106_y(); +- return i; ++ return event == null ? i : event.getRodDamage(); + } else { + return 0; + } diff --git a/patches/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch new file mode 100644 index 000000000..a1b33787b --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/projectile/LlamaSpitEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/projectile/LlamaSpitEntity.java ++++ b/net/minecraft/entity/projectile/LlamaSpitEntity.java +@@ -57,7 +57,7 @@ + RayTraceResult raytraceresult = ProjectileHelper.func_221267_a(this, this.func_174813_aQ().func_216361_a(vec3d).func_186662_g(1.0D), (p_213879_1_) -> { + return !p_213879_1_.func_175149_v() && p_213879_1_ != this.field_190539_a; + }, RayTraceContext.BlockMode.OUTLINE, true); +- if (raytraceresult != null) { ++ if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.func_190536_a(raytraceresult); + } + diff --git a/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch new file mode 100644 index 000000000..2b5d6a4e8 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/projectile/ShulkerBulletEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/projectile/ShulkerBulletEntity.java ++++ b/net/minecraft/entity/projectile/ShulkerBulletEntity.java +@@ -251,7 +251,7 @@ + } + + RayTraceResult raytraceresult = ProjectileHelper.func_221266_a(this, true, false, this.field_184570_a, RayTraceContext.BlockMode.COLLIDER); +- if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) { ++ if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { + this.func_184567_a(raytraceresult); + } + } diff --git a/patches/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch new file mode 100644 index 000000000..f58984384 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/projectile/SmallFireballEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/projectile/SmallFireballEntity.java ++++ b/net/minecraft/entity/projectile/SmallFireballEntity.java +@@ -36,7 +36,7 @@ + this.func_174815_a(this.field_70235_a, entity); + } + } +- } else if (this.field_70235_a == null || !(this.field_70235_a instanceof MobEntity) || this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { ++ } else if (this.field_70235_a == null || !(this.field_70235_a instanceof MobEntity) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a)) { + BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)p_70227_1_; + BlockPos blockpos = blockraytraceresult.func_216350_a().func_177972_a(blockraytraceresult.func_216354_b()); + if (this.field_70170_p.func_175623_d(blockpos)) { diff --git a/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch new file mode 100644 index 000000000..00ff984b1 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/projectile/ThrowableEntity.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/entity/projectile/ThrowableEntity.java ++++ b/net/minecraft/entity/projectile/ThrowableEntity.java +@@ -133,7 +133,7 @@ + if (raytraceresult.func_216346_c() != RayTraceResult.Type.MISS) { + if (raytraceresult.func_216346_c() == RayTraceResult.Type.BLOCK && this.field_70170_p.func_180495_p(((BlockRayTraceResult)raytraceresult).func_216350_a()).func_177230_c() == Blocks.field_150427_aO) { + this.func_181015_d(((BlockRayTraceResult)raytraceresult).func_216350_a()); +- } else { ++ } else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)){ + this.func_70184_a(raytraceresult); + } + } diff --git a/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch b/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch new file mode 100644 index 000000000..475b89cca --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/projectile/WitherSkullEntity.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/entity/projectile/WitherSkullEntity.java ++++ b/net/minecraft/entity/projectile/WitherSkullEntity.java +@@ -47,7 +47,7 @@ + } + + public float func_180428_a(Explosion p_180428_1_, IBlockReader p_180428_2_, BlockPos p_180428_3_, BlockState p_180428_4_, IFluidState p_180428_5_, float p_180428_6_) { +- return this.func_82342_d() && WitherEntity.func_181033_a(p_180428_4_) ? Math.min(0.8F, p_180428_6_) : p_180428_6_; ++ return this.func_82342_d() && p_180428_4_.canEntityDestroy(p_180428_2_, p_180428_3_, this) ? Math.min(0.8F, p_180428_6_) : p_180428_6_; + } + + protected void func_70227_a(RayTraceResult p_70227_1_) { +@@ -80,7 +80,7 @@ + } + } + +- Explosion.Mode explosion$mode = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing") ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; ++ Explosion.Mode explosion$mode = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE; + this.field_70170_p.func_217398_a(this, this.field_70165_t, this.field_70163_u, this.field_70161_v, 1.0F, false, explosion$mode); + this.func_70106_y(); + } diff --git a/patches/minecraft/net/minecraft/fluid/IFluidState.java.patch b/patches/minecraft/net/minecraft/fluid/IFluidState.java.patch index 05846306c..464c131e6 100644 --- a/patches/minecraft/net/minecraft/fluid/IFluidState.java.patch +++ b/patches/minecraft/net/minecraft/fluid/IFluidState.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/fluid/IFluidState.java +++ b/net/minecraft/fluid/IFluidState.java -@@ -16,7 +16,7 @@ +@@ -29,7 +29,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -9,3 +9,11 @@ Fluid func_206886_c(); default boolean func_206889_d() { +@@ -103,6 +103,7 @@ + return this.func_206886_c().func_207185_a(p_206884_1_); + } + ++ @Deprecated //Forge: Use more sensitive version. + default float func_210200_l() { + return this.func_206886_c().func_210195_d(); + } diff --git a/patches/minecraft/net/minecraft/init/Biomes.java.patch b/patches/minecraft/net/minecraft/init/Biomes.java.patch deleted file mode 100644 index 1a1dfb512..000000000 --- a/patches/minecraft/net/minecraft/init/Biomes.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/init/Biomes.java -+++ b/net/minecraft/init/Biomes.java -@@ -4,6 +4,7 @@ - import net.minecraft.util.registry.IRegistry; - import net.minecraft.world.biome.Biome; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public abstract class Biomes { - public static final Biome field_76771_b; - public static final Biome field_180279_ad; diff --git a/patches/minecraft/net/minecraft/init/Blocks.java.patch b/patches/minecraft/net/minecraft/init/Blocks.java.patch deleted file mode 100644 index a13b4c927..000000000 --- a/patches/minecraft/net/minecraft/init/Blocks.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/init/Blocks.java -+++ b/net/minecraft/init/Blocks.java -@@ -6,6 +6,7 @@ - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.registry.IRegistry; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class Blocks { - private static final Set field_185780_dg; - public static final Block field_150350_a; diff --git a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch deleted file mode 100644 index 7ecb22537..000000000 --- a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/net/minecraft/init/Bootstrap.java -+++ b/net/minecraft/init/Bootstrap.java -@@ -79,6 +79,7 @@ - import net.minecraft.world.gen.ChunkGeneratorType; - import net.minecraftforge.api.distmarker.Dist; - import net.minecraftforge.api.distmarker.OnlyIn; -+ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -@@ -252,6 +253,9 @@ - BlockDispenser.func_199774_a(Items.field_203797_aN, ibehaviordispenseitem); - BlockDispenser.func_199774_a(Items.field_203795_aL, ibehaviordispenseitem); - BlockDispenser.func_199774_a(Items.field_204272_aO, ibehaviordispenseitem); -+ /*BlockDispenser.registerDispenseBehavior(Items.MILK_BUCKET, net.minecraftforge.fluids.DispenseFluidContainer.getInstance()); -+ BlockDispenser.registerDispenseBehavior(Items.BUCKET, net.minecraftforge.fluids.DispenseFluidContainer.getInstance()); -+ if (false)*/ - BlockDispenser.func_199774_a(Items.field_151133_ar, new BehaviorDefaultDispenseItem() { - private final BehaviorDefaultDispenseItem field_150840_b = new BehaviorDefaultDispenseItem(); - -@@ -420,6 +424,7 @@ - PaintingType.func_200831_a(); - StatList.func_212734_a(); - IRegistry.func_212613_e(); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.instance(); - if (SharedConstants.field_206244_b) { - func_210839_a("block", IRegistry.field_212618_g, Block::func_149739_a); - func_210839_a("biome", IRegistry.field_212624_m, Biome::func_210773_k); -@@ -429,6 +434,7 @@ - func_210839_a("entity", IRegistry.field_212629_r, EntityType::func_210760_d); - } - -+ if (false) // skip redirectOutputToLog, Forge already redirects stdout and stderr output to log so that they print with more context - func_179868_d(); - } - } diff --git a/patches/minecraft/net/minecraft/init/Enchantments.java.patch b/patches/minecraft/net/minecraft/init/Enchantments.java.patch deleted file mode 100644 index 55e4d5666..000000000 --- a/patches/minecraft/net/minecraft/init/Enchantments.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/init/Enchantments.java -+++ b/net/minecraft/init/Enchantments.java -@@ -5,6 +5,7 @@ - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.registry.IRegistry; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class Enchantments { - public static final Enchantment field_180310_c = func_185295_a("protection"); - public static final Enchantment field_77329_d = func_185295_a("fire_protection"); diff --git a/patches/minecraft/net/minecraft/init/Items.java.patch b/patches/minecraft/net/minecraft/init/Items.java.patch deleted file mode 100644 index 6db65d5f1..000000000 --- a/patches/minecraft/net/minecraft/init/Items.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/init/Items.java -+++ b/net/minecraft/init/Items.java -@@ -4,6 +4,7 @@ - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.registry.IRegistry; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class Items { - public static final Item field_190931_a; - public static final Item field_151037_a; diff --git a/patches/minecraft/net/minecraft/init/MobEffects.java.patch b/patches/minecraft/net/minecraft/init/MobEffects.java.patch deleted file mode 100644 index fbdd7c04b..000000000 --- a/patches/minecraft/net/minecraft/init/MobEffects.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/init/MobEffects.java -+++ b/net/minecraft/init/MobEffects.java -@@ -5,6 +5,7 @@ - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.registry.IRegistry; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class MobEffects { - public static final Potion field_76424_c; - public static final Potion field_76421_d; diff --git a/patches/minecraft/net/minecraft/init/Particles.java.patch b/patches/minecraft/net/minecraft/init/Particles.java.patch deleted file mode 100644 index 63e3f9029..000000000 --- a/patches/minecraft/net/minecraft/init/Particles.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/init/Particles.java -+++ b/net/minecraft/init/Particles.java -@@ -8,6 +8,7 @@ - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.registry.IRegistry; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class Particles { - public static final BasicParticleType field_197608_a; - public static final BasicParticleType field_197609_b; diff --git a/patches/minecraft/net/minecraft/init/PotionTypes.java.patch b/patches/minecraft/net/minecraft/init/PotionTypes.java.patch deleted file mode 100644 index 7454ba0b1..000000000 --- a/patches/minecraft/net/minecraft/init/PotionTypes.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/init/PotionTypes.java -+++ b/net/minecraft/init/PotionTypes.java -@@ -6,6 +6,7 @@ - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.registry.IRegistry; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class PotionTypes { - private static final Set field_185228_K; - public static final PotionType field_185229_a; diff --git a/patches/minecraft/net/minecraft/init/SoundEvents.java.patch b/patches/minecraft/net/minecraft/init/SoundEvents.java.patch deleted file mode 100644 index e03fc452e..000000000 --- a/patches/minecraft/net/minecraft/init/SoundEvents.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/init/SoundEvents.java -+++ b/net/minecraft/init/SoundEvents.java -@@ -4,6 +4,7 @@ - import net.minecraft.util.SoundEvent; - import net.minecraft.util.registry.IRegistry; - -+@net.minecraftforge.registries.ObjectHolder("minecraft") - public class SoundEvents { - public static final SoundEvent field_187674_a; - public static final SoundEvent field_204326_e; diff --git a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch deleted file mode 100644 index 36b61666c..000000000 --- a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ /dev/null @@ -1,90 +0,0 @@ ---- a/net/minecraft/inventory/ContainerEnchantment.java -+++ b/net/minecraft/inventory/ContainerEnchantment.java -@@ -61,7 +61,7 @@ - }); - this.func_75146_a(new Slot(this.field_75168_e, 1, 35, 47) { - public boolean func_75214_a(ItemStack p_75214_1_) { -- return p_75214_1_.func_77973_b() == Items.field_196128_bn; -+ return net.minecraftforge.common.Tags.Items.GEMS_LAPIS.func_199685_a_(p_75214_1_.func_77973_b()); - } - }); - -@@ -121,40 +121,29 @@ - - } - -+ private float getPower(BlockPos pos) { -+ return field_75172_h.func_180495_p(pos).getEnchantPowerBonus(field_75172_h, pos); -+ } -+ - public void func_75130_a(IInventory p_75130_1_) { - if (p_75130_1_ == this.field_75168_e) { - ItemStack itemstack = p_75130_1_.func_70301_a(0); - if (!itemstack.func_190926_b() && itemstack.func_77956_u()) { - if (!this.field_75172_h.field_72995_K) { - int l = 0; -+ float power = 0; - - for(int j = -1; j <= 1; ++j) { - for(int k = -1; k <= 1; ++k) { - if ((j != 0 || k != 0) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 0, j)) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 1, j))) { -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j * 2)).func_177230_c() == Blocks.field_150342_X) { -- ++l; -- } -+ power += getPower(field_178150_j.func_177982_a(k * 2, 0, j * 2)); -+ power += getPower(field_178150_j.func_177982_a(k * 2, 1, j * 2)); - -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 1, j * 2)).func_177230_c() == Blocks.field_150342_X) { -- ++l; -- } -- - if (k != 0 && j != 0) { -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j)).func_177230_c() == Blocks.field_150342_X) { -- ++l; -- } -- -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 1, j)).func_177230_c() == Blocks.field_150342_X) { -- ++l; -- } -- -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k, 0, j * 2)).func_177230_c() == Blocks.field_150342_X) { -- ++l; -- } -- -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k, 1, j * 2)).func_177230_c() == Blocks.field_150342_X) { -- ++l; -- } -+ power += getPower(field_178150_j.func_177982_a(k * 2, 0, j)); -+ power += getPower(field_178150_j.func_177982_a(k * 2, 1, j)); -+ power += getPower(field_178150_j.func_177982_a(k, 0, j * 2)); -+ power += getPower(field_178150_j.func_177982_a(k, 1, j * 2)); - } - } - } -@@ -163,12 +152,13 @@ - this.field_75169_l.setSeed((long)this.field_178149_f); - - for(int i1 = 0; i1 < 3; ++i1) { -- this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, l, itemstack); -+ this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, (int)power, itemstack); - this.field_185001_h[i1] = -1; - this.field_185002_i[i1] = -1; - if (this.field_75167_g[i1] < i1 + 1) { - this.field_75167_g[i1] = 0; - } -+ this.field_75167_g[i1] = net.minecraftforge.event.ForgeEventFactory.onEnchantmentLevelSet(field_75172_h, field_178150_j, i1, (int)power, itemstack, field_75167_g[i1]); - } - - for(int j1 = 0; j1 < 3; ++j1) { -@@ -300,9 +290,8 @@ - return ItemStack.field_190927_a; - } - -- if (itemstack1.func_77942_o() && itemstack1.func_190916_E() == 1) { -- this.field_75151_b.get(0).func_75215_d(itemstack1.func_77946_l()); -- itemstack1.func_190920_e(0); -+ if (itemstack1.func_77942_o()) { // Forge: Fix MC-17431 -+ ((Slot)this.field_75151_b.get(0)).func_75215_d(itemstack1.func_77979_a(1)); - } else if (!itemstack1.func_190926_b()) { - this.field_75151_b.get(0).func_75215_d(new ItemStack(itemstack1.func_77973_b())); - itemstack1.func_190918_g(1); diff --git a/patches/minecraft/net/minecraft/inventory/ContainerFurnace.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerFurnace.java.patch deleted file mode 100644 index c971d08bd..000000000 --- a/patches/minecraft/net/minecraft/inventory/ContainerFurnace.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/inventory/ContainerFurnace.java -+++ b/net/minecraft/inventory/ContainerFurnace.java -@@ -160,8 +160,8 @@ - } - - private boolean func_206253_a(ItemStack p_206253_1_) { -- for(IRecipe irecipe : this.field_201773_f.func_199532_z().func_199510_b()) { -- if (irecipe instanceof FurnaceRecipe && irecipe.func_192400_c().get(0).test(p_206253_1_)) { -+ for(IRecipe irecipe : this.field_201773_f.func_199532_z().getRecipes(net.minecraftforge.common.crafting.VanillaRecipeTypes.SMELTING)) { -+ if (irecipe.func_192400_c().get(0).test(p_206253_1_)) { - return true; - } - } diff --git a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch deleted file mode 100644 index 67aab5019..000000000 --- a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/inventory/ContainerPlayer.java -+++ b/net/minecraft/inventory/ContainerPlayer.java -@@ -38,7 +38,7 @@ - } - - public boolean func_75214_a(ItemStack p_75214_1_) { -- return entityequipmentslot == EntityLiving.func_184640_d(p_75214_1_); -+ return p_75214_1_.canEquip(entityequipmentslot, field_82862_h); - } - - public boolean func_82869_a(EntityPlayer p_82869_1_) { diff --git a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch deleted file mode 100644 index aa67a0ce5..000000000 --- a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- a/net/minecraft/inventory/ContainerRepair.java -+++ b/net/minecraft/inventory/ContainerRepair.java -@@ -61,6 +61,8 @@ - p_190901_1_.func_82242_a(-ContainerRepair.this.field_82854_e); - } - -+ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(p_190901_1_, p_190901_2_, ContainerRepair.this.field_82853_g.func_70301_a(0), ContainerRepair.this.field_82853_g.func_70301_a(1)); -+ - ContainerRepair.this.field_82853_g.func_70299_a(0, ItemStack.field_190927_a); - if (ContainerRepair.this.field_82856_l > 0) { - ItemStack itemstack = ContainerRepair.this.field_82853_g.func_70301_a(1); -@@ -77,7 +79,7 @@ - ContainerRepair.this.field_82854_e = 0; - IBlockState iblockstate1 = p_i45807_2_.func_180495_p(p_i45807_3_); - if (!p_i45807_2_.field_72995_K) { -- if (!p_190901_1_.field_71075_bZ.field_75098_d && iblockstate1.func_203425_a(BlockTags.field_200572_k) && p_190901_1_.func_70681_au().nextFloat() < 0.12F) { -+ if (!p_190901_1_.field_71075_bZ.field_75098_d && iblockstate1.func_203425_a(BlockTags.field_200572_k) && p_190901_1_.func_70681_au().nextFloat() < breakChance) { - IBlockState iblockstate = BlockAnvil.func_196433_f(iblockstate1); - if (iblockstate == null) { - p_i45807_2_.func_175698_g(p_i45807_3_); -@@ -130,8 +132,11 @@ - Map map = EnchantmentHelper.func_82781_a(itemstack1); - j = j + itemstack.func_82838_A() + (itemstack2.func_190926_b() ? 0 : itemstack2.func_82838_A()); - this.field_82856_l = 0; -+ boolean flag = false; -+ - if (!itemstack2.func_190926_b()) { -- boolean flag = itemstack2.func_77973_b() == Items.field_151134_bR && !ItemEnchantedBook.func_92110_g(itemstack2).isEmpty(); -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, field_82852_f, field_82857_m, j)) return; -+ flag = itemstack2.func_77973_b() == Items.field_151134_bR && !ItemEnchantedBook.func_92110_g(itemstack2).isEmpty(); - if (itemstack1.func_77984_f() && itemstack1.func_77973_b().func_82789_a(itemstack, itemstack2)) { - int l2 = Math.min(itemstack1.func_77952_i(), itemstack1.func_77958_k() / 4); - if (l2 <= 0) { -@@ -248,6 +253,7 @@ - i += k; - itemstack1.func_200302_a(new TextComponentString(this.field_82857_m)); - } -+ if (flag && !itemstack1.isBookEnchantable(itemstack2)) itemstack1 = ItemStack.field_190927_a; - - this.field_82854_e = j + i; - if (i <= 0) { diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches/minecraft/net/minecraft/inventory/container/BeaconContainer.java.patch similarity index 60% rename from patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch rename to patches/minecraft/net/minecraft/inventory/container/BeaconContainer.java.patch index 1fe539ab9..dc4132fe6 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/BeaconContainer.java.patch @@ -1,6 +1,15 @@ ---- a/net/minecraft/inventory/ContainerBeacon.java -+++ b/net/minecraft/inventory/ContainerBeacon.java -@@ -71,10 +71,8 @@ +--- a/net/minecraft/inventory/container/BeaconContainer.java ++++ b/net/minecraft/inventory/container/BeaconContainer.java +@@ -18,7 +18,7 @@ + public class BeaconContainer extends Container { + private final IInventory field_82866_e = new Inventory(1) { + public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) { +- return p_94041_2_.func_77973_b() == Items.field_151166_bC || p_94041_2_.func_77973_b() == Items.field_151045_i || p_94041_2_.func_77973_b() == Items.field_151043_k || p_94041_2_.func_77973_b() == Items.field_151042_j; ++ return p_94041_2_.isBeaconPayment(); + } + + public int func_70297_j_() { +@@ -88,10 +88,8 @@ } slot.func_75220_a(itemstack1, itemstack); @@ -13,7 +22,7 @@ } else if (p_82846_2_ >= 1 && p_82846_2_ < 28) { if (!this.func_75135_a(itemstack1, 28, 37, false)) { return ItemStack.field_190927_a; -@@ -109,8 +107,7 @@ +@@ -157,8 +155,7 @@ } public boolean func_75214_a(ItemStack p_75214_1_) { diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches/minecraft/net/minecraft/inventory/container/BrewingStandContainer.java.patch similarity index 62% rename from patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch rename to patches/minecraft/net/minecraft/inventory/container/BrewingStandContainer.java.patch index 442a54fe9..5f9380ffd 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/BrewingStandContainer.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/inventory/ContainerBrewingStand.java -+++ b/net/minecraft/inventory/ContainerBrewingStand.java -@@ -149,7 +149,7 @@ +--- a/net/minecraft/inventory/container/BrewingStandContainer.java ++++ b/net/minecraft/inventory/container/BrewingStandContainer.java +@@ -143,7 +143,7 @@ } public boolean func_75214_a(ItemStack p_75214_1_) { @@ -9,15 +9,15 @@ } public int func_75219_a() { -@@ -173,6 +173,7 @@ - public ItemStack func_190901_a(EntityPlayer p_190901_1_, ItemStack p_190901_2_) { - PotionType potiontype = PotionUtils.func_185191_c(p_190901_2_); - if (p_190901_1_ instanceof EntityPlayerMP) { +@@ -167,6 +167,7 @@ + public ItemStack func_190901_a(PlayerEntity p_190901_1_, ItemStack p_190901_2_) { + Potion potion = PotionUtils.func_185191_c(p_190901_2_); + if (p_190901_1_ instanceof ServerPlayerEntity) { + net.minecraftforge.event.ForgeEventFactory.onPlayerBrewedPotion(p_190901_1_, p_190901_2_); - CriteriaTriggers.field_192130_j.func_192173_a((EntityPlayerMP)p_190901_1_, potiontype); + CriteriaTriggers.field_192130_j.func_192173_a((ServerPlayerEntity)p_190901_1_, potion); } -@@ -181,8 +182,7 @@ +@@ -175,8 +176,7 @@ } public static boolean func_75243_a_(ItemStack p_75243_0_) { diff --git a/patches/minecraft/net/minecraft/inventory/Container.java.patch b/patches/minecraft/net/minecraft/inventory/container/Container.java.patch similarity index 66% rename from patches/minecraft/net/minecraft/inventory/Container.java.patch rename to patches/minecraft/net/minecraft/inventory/container/Container.java.patch index a29afa2db..113363262 100644 --- a/patches/minecraft/net/minecraft/inventory/Container.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/Container.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/inventory/Container.java -+++ b/net/minecraft/inventory/Container.java -@@ -67,9 +67,11 @@ +--- a/net/minecraft/inventory/container/Container.java ++++ b/net/minecraft/inventory/container/Container.java +@@ -116,9 +116,11 @@ ItemStack itemstack = this.field_75151_b.get(i).func_75211_c(); ItemStack itemstack1 = this.field_75153_a.get(i); if (!ItemStack.func_77989_b(itemstack1, itemstack)) { @@ -9,10 +9,10 @@ this.field_75153_a.set(i, itemstack1); + if (clientStackChanged) - for(int j = 0; j < this.field_75149_d.size(); ++j) { - this.field_75149_d.get(j).func_71111_a(this, i, itemstack1); + for(IContainerListener icontainerlistener : this.field_75149_d) { + icontainerlistener.func_71111_a(this, i, itemstack1); } -@@ -430,14 +432,15 @@ +@@ -476,14 +478,15 @@ ItemStack itemstack = slot.func_75211_c(); if (!itemstack.func_190926_b() && func_195929_a(p_75135_1_, itemstack)) { int j = itemstack.func_190916_E() + p_75135_1_.func_190916_E(); @@ -32,7 +32,7 @@ slot.func_75218_e(); flag = true; } -@@ -538,7 +541,7 @@ +@@ -584,7 +587,7 @@ p_94525_2_.func_190920_e(1); break; case 2: @@ -41,12 +41,3 @@ } p_94525_2_.func_190917_f(p_94525_3_); -@@ -576,7 +579,7 @@ - if (!p_192389_1_.field_72995_K) { - EntityPlayerMP entityplayermp = (EntityPlayerMP)p_192389_2_; - ItemStack itemstack = ItemStack.field_190927_a; -- IRecipe irecipe = p_192389_1_.func_73046_m().func_199529_aN().func_199515_b(p_192389_3_, p_192389_1_); -+ IRecipe irecipe = p_192389_1_.func_73046_m().func_199529_aN().getRecipe(p_192389_3_, p_192389_1_, net.minecraftforge.common.crafting.VanillaRecipeTypes.CRAFTING); - if (p_192389_4_.func_201561_a(p_192389_1_, entityplayermp, irecipe) && irecipe != null) { - itemstack = irecipe.func_77572_b(p_192389_3_); - } diff --git a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches/minecraft/net/minecraft/inventory/container/CraftingResultSlot.java.patch similarity index 51% rename from patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch rename to patches/minecraft/net/minecraft/inventory/container/CraftingResultSlot.java.patch index 0c65c814b..2bc3bb302 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/CraftingResultSlot.java.patch @@ -1,21 +1,21 @@ ---- a/net/minecraft/inventory/SlotCrafting.java -+++ b/net/minecraft/inventory/SlotCrafting.java -@@ -39,6 +39,7 @@ +--- a/net/minecraft/inventory/container/CraftingResultSlot.java ++++ b/net/minecraft/inventory/container/CraftingResultSlot.java +@@ -43,6 +43,7 @@ protected void func_75208_c(ItemStack p_75208_1_) { if (this.field_75237_g > 0) { p_75208_1_.func_77980_a(this.field_75238_b.field_70170_p, this.field_75238_b, this.field_75237_g); + net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerCraftingEvent(this.field_75238_b, p_75208_1_, this.field_75239_a); } - ((IRecipeHolder)this.field_75224_c).func_201560_d(this.field_75238_b); -@@ -47,7 +48,9 @@ + if (this.field_75224_c instanceof IRecipeHolder) { +@@ -54,8 +55,9 @@ - public ItemStack func_190901_a(EntityPlayer p_190901_1_, ItemStack p_190901_2_) { + public ItemStack func_190901_a(PlayerEntity p_190901_1_, ItemStack p_190901_2_) { this.func_75208_c(p_190901_2_); -- NonNullList nonnulllist = p_190901_1_.field_70170_p.func_199532_z().func_199513_c(this.field_75239_a, p_190901_1_.field_70170_p); + net.minecraftforge.common.ForgeHooks.setCraftingPlayer(p_190901_1_); -+ NonNullList nonnulllist = p_190901_1_.field_70170_p.func_199532_z().getRemainingItems(this.field_75239_a, p_190901_1_.field_70170_p, net.minecraftforge.common.crafting.VanillaRecipeTypes.CRAFTING); + NonNullList nonnulllist = p_190901_1_.field_70170_p.func_199532_z().func_215369_c(IRecipeType.field_222149_a, this.field_75239_a, p_190901_1_.field_70170_p); +- + net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); - for(int i = 0; i < nonnulllist.size(); ++i) { ItemStack itemstack = this.field_75239_a.func_70301_a(i); + ItemStack itemstack1 = nonnulllist.get(i); diff --git a/patches/minecraft/net/minecraft/inventory/container/EnchantmentContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/EnchantmentContainer.java.patch new file mode 100644 index 000000000..27509a151 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/container/EnchantmentContainer.java.patch @@ -0,0 +1,90 @@ +--- a/net/minecraft/inventory/container/EnchantmentContainer.java ++++ b/net/minecraft/inventory/container/EnchantmentContainer.java +@@ -55,7 +55,7 @@ + }); + this.func_75146_a(new Slot(this.field_75168_e, 1, 35, 47) { + public boolean func_75214_a(ItemStack p_75214_1_) { +- return p_75214_1_.func_77973_b() == Items.field_196128_bn; ++ return net.minecraftforge.common.Tags.Items.GEMS_LAPIS.func_199685_a_(p_75214_1_.func_77973_b()); + } + }); + +@@ -81,40 +81,28 @@ + this.func_216958_a(IntReferenceHolder.func_221497_a(this.field_185002_i, 2)); + } + ++ private float getPower(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) { ++ return world.func_180495_p(pos).getEnchantPowerBonus(world, pos); ++ } ++ + public void func_75130_a(IInventory p_75130_1_) { + if (p_75130_1_ == this.field_75168_e) { + ItemStack itemstack = p_75130_1_.func_70301_a(0); + if (!itemstack.func_190926_b() && itemstack.func_77956_u()) { + this.field_217006_g.func_221486_a((p_217002_2_, p_217002_3_) -> { +- int j = 0; ++ float power = 0; + + for(int k = -1; k <= 1; ++k) { + for(int l = -1; l <= 1; ++l) { + if ((k != 0 || l != 0) && p_217002_2_.func_175623_d(p_217002_3_.func_177982_a(l, 0, k)) && p_217002_2_.func_175623_d(p_217002_3_.func_177982_a(l, 1, k))) { +- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 0, k * 2)).func_177230_c() == Blocks.field_150342_X) { +- ++j; +- } ++ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 0, k * 2)); ++ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 1, k * 2)); + +- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 1, k * 2)).func_177230_c() == Blocks.field_150342_X) { +- ++j; +- } +- + if (l != 0 && k != 0) { +- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 0, k)).func_177230_c() == Blocks.field_150342_X) { +- ++j; +- } +- +- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l * 2, 1, k)).func_177230_c() == Blocks.field_150342_X) { +- ++j; +- } +- +- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l, 0, k * 2)).func_177230_c() == Blocks.field_150342_X) { +- ++j; +- } +- +- if (p_217002_2_.func_180495_p(p_217002_3_.func_177982_a(l, 1, k * 2)).func_177230_c() == Blocks.field_150342_X) { +- ++j; +- } ++ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 0, k)); ++ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l * 2, 1, k)); ++ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l, 0, k * 2)); ++ power += getPower(p_217002_2_, p_217002_3_.func_177982_a(l, 1, k * 2)); + } + } + } +@@ -123,12 +111,13 @@ + this.field_75169_l.setSeed((long)this.field_178149_f.func_221495_b()); + + for(int i1 = 0; i1 < 3; ++i1) { +- this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, j, itemstack); ++ this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, (int)power, itemstack); + this.field_185001_h[i1] = -1; + this.field_185002_i[i1] = -1; + if (this.field_75167_g[i1] < i1 + 1) { + this.field_75167_g[i1] = 0; + } ++ this.field_75167_g[i1] = net.minecraftforge.event.ForgeEventFactory.onEnchantmentLevelSet(p_217002_2_, p_217002_3_, i1, (int)power, itemstack, field_75167_g[i1]); + } + + for(int j1 = 0; j1 < 3; ++j1) { +@@ -262,9 +251,8 @@ + return ItemStack.field_190927_a; + } + +- if (itemstack1.func_77942_o() && itemstack1.func_190916_E() == 1) { +- this.field_75151_b.get(0).func_75215_d(itemstack1.func_77946_l()); +- itemstack1.func_190920_e(0); ++ if (itemstack1.func_77942_o()) { // Forge: Fix MC-17431 ++ ((Slot)this.field_75151_b.get(0)).func_75215_d(itemstack1.func_77979_a(1)); + } else if (!itemstack1.func_190926_b()) { + this.field_75151_b.get(0).func_75215_d(new ItemStack(itemstack1.func_77973_b())); + itemstack1.func_190918_g(1); diff --git a/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches/minecraft/net/minecraft/inventory/container/FurnaceResultSlot.java.patch similarity index 52% rename from patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch rename to patches/minecraft/net/minecraft/inventory/container/FurnaceResultSlot.java.patch index debb4bd28..34ef30cf5 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/FurnaceResultSlot.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/inventory/SlotFurnaceOutput.java -+++ b/net/minecraft/inventory/SlotFurnaceOutput.java -@@ -76,5 +76,6 @@ +--- a/net/minecraft/inventory/container/FurnaceResultSlot.java ++++ b/net/minecraft/inventory/container/FurnaceResultSlot.java +@@ -44,5 +44,6 @@ } this.field_75228_b = 0; diff --git a/patches/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch new file mode 100644 index 000000000..230354f5b --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/container/PlayerContainer.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/inventory/container/PlayerContainer.java ++++ b/net/minecraft/inventory/container/PlayerContainer.java +@@ -43,7 +43,7 @@ + } + + public boolean func_75214_a(ItemStack p_75214_1_) { +- return equipmentslottype == MobEntity.func_184640_d(p_75214_1_); ++ return p_75214_1_.canEquip(equipmentslottype, field_82862_h); + } + + public boolean func_82869_a(PlayerEntity p_82869_1_) { diff --git a/patches/minecraft/net/minecraft/inventory/container/RepairContainer.java.patch b/patches/minecraft/net/minecraft/inventory/container/RepairContainer.java.patch new file mode 100644 index 000000000..412549bf5 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/container/RepairContainer.java.patch @@ -0,0 +1,50 @@ +--- a/net/minecraft/inventory/container/RepairContainer.java ++++ b/net/minecraft/inventory/container/RepairContainer.java +@@ -63,6 +63,8 @@ + p_190901_1_.func_82242_a(-RepairContainer.this.field_82854_e.func_221495_b()); + } + ++ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(p_190901_1_, p_190901_2_, RepairContainer.this.field_82853_g.func_70301_a(0), RepairContainer.this.field_82853_g.func_70301_a(1)); ++ + RepairContainer.this.field_82853_g.func_70299_a(0, ItemStack.field_190927_a); + if (RepairContainer.this.field_82856_l > 0) { + ItemStack itemstack = RepairContainer.this.field_82853_g.func_70301_a(1); +@@ -79,7 +81,7 @@ + RepairContainer.this.field_82854_e.func_221494_a(0); + p_i50102_3_.func_221486_a((p_216931_1_, p_216931_2_) -> { + BlockState blockstate = p_216931_1_.func_180495_p(p_216931_2_); +- if (!p_190901_1_.field_71075_bZ.field_75098_d && blockstate.func_203425_a(BlockTags.field_200572_k) && p_190901_1_.func_70681_au().nextFloat() < 0.12F) { ++ if (!p_190901_1_.field_71075_bZ.field_75098_d && blockstate.func_203425_a(BlockTags.field_200572_k) && p_190901_1_.func_70681_au().nextFloat() < breakChance) { + BlockState blockstate1 = AnvilBlock.func_196433_f(blockstate); + if (blockstate1 == null) { + p_216931_1_.func_217377_a(p_216931_2_, false); +@@ -132,8 +134,11 @@ + Map map = EnchantmentHelper.func_82781_a(itemstack1); + j = j + itemstack.func_82838_A() + (itemstack2.func_190926_b() ? 0 : itemstack2.func_82838_A()); + this.field_82856_l = 0; ++ boolean flag = false; ++ + if (!itemstack2.func_190926_b()) { +- boolean flag = itemstack2.func_77973_b() == Items.field_151134_bR && !EnchantedBookItem.func_92110_g(itemstack2).isEmpty(); ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, field_82852_f, field_82857_m, j)) return; ++ flag = itemstack2.func_77973_b() == Items.field_151134_bR && !EnchantedBookItem.func_92110_g(itemstack2).isEmpty(); + if (itemstack1.func_77984_f() && itemstack1.func_77973_b().func_82789_a(itemstack, itemstack2)) { + int l2 = Math.min(itemstack1.func_77952_i(), itemstack1.func_77958_k() / 4); + if (l2 <= 0) { +@@ -250,6 +255,7 @@ + i += k; + itemstack1.func_200302_a(new StringTextComponent(this.field_82857_m)); + } ++ if (flag && !itemstack1.isBookEnchantable(itemstack2)) itemstack1 = ItemStack.field_190927_a; + + this.field_82854_e.func_221494_a(j + i); + if (i <= 0) { +@@ -354,4 +360,8 @@ + public int func_216976_f() { + return this.field_82854_e.func_221495_b(); + } ++ ++ public void setMaximumCost(int value) { ++ this.field_82854_e.func_221494_a(value); ++ } + } diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/container/Slot.java.patch similarity index 86% rename from patches/minecraft/net/minecraft/inventory/Slot.java.patch rename to patches/minecraft/net/minecraft/inventory/container/Slot.java.patch index 58a85bf04..c4872bb47 100644 --- a/patches/minecraft/net/minecraft/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/container/Slot.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/inventory/Slot.java -+++ b/net/minecraft/inventory/Slot.java -@@ -12,6 +12,9 @@ +--- a/net/minecraft/inventory/container/Slot.java ++++ b/net/minecraft/inventory/container/Slot.java +@@ -13,6 +13,9 @@ public int field_75222_d; public int field_75223_e; public int field_75221_f; @@ -10,7 +10,7 @@ public Slot(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) { this.field_75224_c = p_i1824_1_; -@@ -74,7 +77,7 @@ +@@ -75,7 +78,7 @@ @Nullable @OnlyIn(Dist.CLIENT) public String func_178171_c() { @@ -19,7 +19,7 @@ } public ItemStack func_75209_a(int p_75209_1_) { -@@ -93,4 +96,62 @@ +@@ -90,4 +93,62 @@ public boolean func_111238_b() { return true; } @@ -30,7 +30,7 @@ + */ + @OnlyIn(Dist.CLIENT) + public net.minecraft.util.ResourceLocation getBackgroundLocation() { -+ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.field_110575_b : backgroundLocation); ++ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.AtlasTexture.field_110575_b : backgroundLocation); + } + + /** @@ -58,9 +58,9 @@ + } + + @OnlyIn(Dist.CLIENT) -+ protected net.minecraft.client.renderer.texture.TextureMap getBackgroundMap() { ++ protected net.minecraft.client.renderer.texture.AtlasTexture getBackgroundMap() { + if (backgroundMap == null) backgroundMap = net.minecraft.client.Minecraft.func_71410_x().func_147117_R(); -+ return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap; ++ return (net.minecraft.client.renderer.texture.AtlasTexture)backgroundMap; + } + + /** diff --git a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches/minecraft/net/minecraft/item/ArmorItem.java.patch similarity index 54% rename from patches/minecraft/net/minecraft/item/ItemArmor.java.patch rename to patches/minecraft/net/minecraft/item/ArmorItem.java.patch index 51b4b26b7..8d20a9c2f 100644 --- a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch +++ b/patches/minecraft/net/minecraft/item/ArmorItem.java.patch @@ -1,11 +1,11 @@ ---- a/net/minecraft/item/ItemArmor.java -+++ b/net/minecraft/item/ItemArmor.java +--- a/net/minecraft/item/ArmorItem.java ++++ b/net/minecraft/item/ArmorItem.java @@ -104,4 +104,8 @@ public int func_200881_e() { return this.field_77879_b; } + + public float getToughness() { -+ return this.field_189415_e; ++ return this.field_189415_e; + } } diff --git a/patches/minecraft/net/minecraft/item/ArrowItem.java.patch b/patches/minecraft/net/minecraft/item/ArrowItem.java.patch new file mode 100644 index 000000000..cff1d60a1 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ArrowItem.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/item/ArrowItem.java ++++ b/net/minecraft/item/ArrowItem.java +@@ -15,4 +15,9 @@ + arrowentity.func_184555_a(p_200887_2_); + return arrowentity; + } ++ ++ public boolean isInfinite(ItemStack stack, ItemStack bow, net.minecraft.entity.player.PlayerEntity player) { ++ int enchant = net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantments.field_185312_x, bow); ++ return enchant <= 0 ? false : this.getClass() == ArrowItem.class; ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemAxe.java.patch b/patches/minecraft/net/minecraft/item/AxeItem.java.patch similarity index 82% rename from patches/minecraft/net/minecraft/item/ItemAxe.java.patch rename to patches/minecraft/net/minecraft/item/AxeItem.java.patch index 8048918a7..3558efd57 100644 --- a/patches/minecraft/net/minecraft/item/ItemAxe.java.patch +++ b/patches/minecraft/net/minecraft/item/AxeItem.java.patch @@ -1,11 +1,11 @@ ---- a/net/minecraft/item/ItemAxe.java -+++ b/net/minecraft/item/ItemAxe.java +--- a/net/minecraft/item/AxeItem.java ++++ b/net/minecraft/item/AxeItem.java @@ -21,7 +21,7 @@ protected static final Map field_203176_a = (new Builder()).put(Blocks.field_196626_Q, Blocks.field_209389_ab).put(Blocks.field_196617_K, Blocks.field_203204_R).put(Blocks.field_196639_V, Blocks.field_209394_ag).put(Blocks.field_196623_P, Blocks.field_203209_W).put(Blocks.field_196637_U, Blocks.field_209393_af).put(Blocks.field_196621_O, Blocks.field_203208_V).put(Blocks.field_196631_S, Blocks.field_209391_ad).put(Blocks.field_196619_M, Blocks.field_203206_T).put(Blocks.field_196634_T, Blocks.field_209392_ae).put(Blocks.field_196620_N, Blocks.field_203207_U).put(Blocks.field_196629_R, Blocks.field_209390_ac).put(Blocks.field_196618_L, Blocks.field_203205_S).build(); - protected ItemAxe(IItemTier p_i48530_1_, float p_i48530_2_, float p_i48530_3_, Item.Properties p_i48530_4_) { + protected AxeItem(IItemTier p_i48530_1_, float p_i48530_2_, float p_i48530_3_, Item.Properties p_i48530_4_) { - super(p_i48530_2_, p_i48530_3_, p_i48530_1_, field_150917_c, p_i48530_4_); + super(p_i48530_2_, p_i48530_3_, p_i48530_1_, field_150917_c, p_i48530_4_.addToolType(net.minecraftforge.common.ToolType.AXE, p_i48530_1_.func_200925_d())); } - public float func_150893_a(ItemStack p_150893_1_, IBlockState p_150893_2_) { + public float func_150893_a(ItemStack p_150893_1_, BlockState p_150893_2_) { diff --git a/patches/minecraft/net/minecraft/item/BlockItem.java.patch b/patches/minecraft/net/minecraft/item/BlockItem.java.patch new file mode 100644 index 000000000..f9a13ef03 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/BlockItem.java.patch @@ -0,0 +1,22 @@ +--- a/net/minecraft/item/BlockItem.java ++++ b/net/minecraft/item/BlockItem.java +@@ -69,7 +69,7 @@ + } + } + +- SoundType soundtype = blockstate1.func_215695_r(); ++ SoundType soundtype = blockstate1.getSoundType(world, blockpos, p_195942_1_.func_195999_j()); + world.func_184133_a(playerentity, blockpos, this.func_219983_a(blockstate1), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F); + itemstack.func_190918_g(1); + return ActionResultType.SUCCESS; +@@ -189,6 +189,10 @@ + } + + public Block func_179223_d() { ++ return this.getBlockRaw() == null ? null : this.getBlockRaw().delegate.get(); ++ } ++ ++ private Block getBlockRaw() { + return this.field_150939_a; + } + diff --git a/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch b/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch new file mode 100644 index 000000000..d41ce437e --- /dev/null +++ b/patches/minecraft/net/minecraft/item/BoneMealItem.java.patch @@ -0,0 +1,38 @@ +--- a/net/minecraft/item/BoneMealItem.java ++++ b/net/minecraft/item/BoneMealItem.java +@@ -27,7 +27,7 @@ + World world = p_195939_1_.func_195991_k(); + BlockPos blockpos = p_195939_1_.func_195995_a(); + BlockPos blockpos1 = blockpos.func_177972_a(p_195939_1_.func_196000_l()); +- if (func_195966_a(p_195939_1_.func_195996_i(), world, blockpos)) { ++ if (applyBonemeal(p_195939_1_.func_195996_i(), world, blockpos, p_195939_1_.func_195999_j())) { + if (!world.field_72995_K) { + world.func_217379_c(2005, blockpos, 0); + } +@@ -48,8 +48,17 @@ + } + } + ++ @Deprecated //Forge: Use Player/Hand version + public static boolean func_195966_a(ItemStack p_195966_0_, World p_195966_1_, BlockPos p_195966_2_) { ++ if (p_195966_1_ instanceof net.minecraft.world.ServerWorld) ++ return applyBonemeal(p_195966_0_, p_195966_1_, p_195966_2_, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.ServerWorld)p_195966_1_)); ++ return false; ++ } ++ ++ public static boolean applyBonemeal(ItemStack p_195966_0_, World p_195966_1_, BlockPos p_195966_2_, net.minecraft.entity.player.PlayerEntity player) { + BlockState blockstate = p_195966_1_.func_180495_p(p_195966_2_); ++ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, p_195966_1_, p_195966_2_, blockstate, p_195966_0_); ++ if (hook != 0) return hook > 0; + if (blockstate.func_177230_c() instanceof IGrowable) { + IGrowable igrowable = (IGrowable)blockstate.func_177230_c(); + if (igrowable.func_176473_a(p_195966_1_, p_195966_2_, blockstate, p_195966_1_.field_72995_K)) { +@@ -125,7 +134,7 @@ + } + + BlockState blockstate = p_195965_0_.func_180495_p(p_195965_1_); +- if (!blockstate.func_196958_f()) { ++ if (!blockstate.isAir(p_195965_0_, p_195965_1_)) { + for(int i = 0; i < p_195965_2_; ++i) { + double d0 = field_77697_d.nextGaussian() * 0.02D; + double d1 = field_77697_d.nextGaussian() * 0.02D; diff --git a/patches/minecraft/net/minecraft/item/ItemBow.java.patch b/patches/minecraft/net/minecraft/item/BowItem.java.patch similarity index 51% rename from patches/minecraft/net/minecraft/item/ItemBow.java.patch rename to patches/minecraft/net/minecraft/item/BowItem.java.patch index 1d5897ba7..7d6a6f68f 100644 --- a/patches/minecraft/net/minecraft/item/ItemBow.java.patch +++ b/patches/minecraft/net/minecraft/item/BowItem.java.patch @@ -1,21 +1,21 @@ ---- a/net/minecraft/item/ItemBow.java -+++ b/net/minecraft/item/ItemBow.java +--- a/net/minecraft/item/BowItem.java ++++ b/net/minecraft/item/BowItem.java @@ -22,7 +22,7 @@ if (p_210310_2_ == null) { return 0.0F; } else { - return p_210310_2_.func_184607_cu().func_77973_b() != Items.field_151031_f ? 0.0F : (float)(p_210310_0_.func_77988_m() - p_210310_2_.func_184605_cv()) / 20.0F; -+ return !(p_210310_2_.func_184607_cu().func_77973_b() instanceof ItemBow) ? 0.0F : (float)(p_210310_0_.func_77988_m() - p_210310_2_.func_184605_cv()) / 20.0F; ++ return !(p_210310_2_.func_184607_cu().func_77973_b() instanceof BowItem) ? 0.0F : (float)(p_210310_0_.func_77988_m() - p_210310_2_.func_184605_cv()) / 20.0F; } }); this.func_185043_a(new ResourceLocation("pulling"), (p_210309_0_, p_210309_1_, p_210309_2_) -> { -@@ -56,18 +56,23 @@ - EntityPlayer entityplayer = (EntityPlayer)p_77615_3_; - boolean flag = entityplayer.field_71075_bZ.field_75098_d || EnchantmentHelper.func_77506_a(Enchantments.field_185312_x, p_77615_1_) > 0; - ItemStack itemstack = this.func_185060_a(entityplayer); +@@ -35,18 +35,23 @@ + PlayerEntity playerentity = (PlayerEntity)p_77615_3_; + boolean flag = playerentity.field_71075_bZ.field_75098_d || EnchantmentHelper.func_77506_a(Enchantments.field_185312_x, p_77615_1_) > 0; + ItemStack itemstack = playerentity.func_213356_f(p_77615_1_); + + int i = this.func_77626_a(p_77615_1_) - p_77615_4_; -+ i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(p_77615_1_, p_77615_2_, entityplayer, i, !itemstack.func_190926_b() || flag); ++ i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(p_77615_1_, p_77615_2_, playerentity, i, !itemstack.func_190926_b() || flag); + if (i < 0) return; + if (!itemstack.func_190926_b() || flag) { @@ -27,31 +27,31 @@ float f = func_185059_b(i); if (!((double)f < 0.1D)) { - boolean flag1 = flag && itemstack.func_77973_b() == Items.field_151032_g; -+ boolean flag1 = entityplayer.field_71075_bZ.field_75098_d || (itemstack.func_77973_b() instanceof ItemArrow && ((ItemArrow) itemstack.func_77973_b()).isInfinite(itemstack, p_77615_1_, entityplayer)); ++ boolean flag1 = playerentity.field_71075_bZ.field_75098_d || (itemstack.func_77973_b() instanceof ArrowItem && ((ArrowItem)itemstack.func_77973_b()).isInfinite(itemstack, p_77615_1_, playerentity)); if (!p_77615_2_.field_72995_K) { - ItemArrow itemarrow = (ItemArrow)(itemstack.func_77973_b() instanceof ItemArrow ? itemstack.func_77973_b() : Items.field_151032_g); - EntityArrow entityarrow = itemarrow.func_200887_a(p_77615_2_, itemstack, entityplayer); -+ entityarrow = this.customizeArrow(entityarrow); - entityarrow.func_184547_a(entityplayer, entityplayer.field_70125_A, entityplayer.field_70177_z, 0.0F, f * 3.0F, 1.0F); + ArrowItem arrowitem = (ArrowItem)(itemstack.func_77973_b() instanceof ArrowItem ? itemstack.func_77973_b() : Items.field_151032_g); + AbstractArrowEntity abstractarrowentity = arrowitem.func_200887_a(p_77615_2_, itemstack, playerentity); ++ abstractarrowentity = customeArrow(abstractarrowentity); + abstractarrowentity.func_184547_a(playerentity, playerentity.field_70125_A, playerentity.field_70177_z, 0.0F, f * 3.0F, 1.0F); if (f == 1.0F) { - entityarrow.func_70243_d(true); -@@ -130,6 +135,10 @@ - public ActionResult func_77659_a(World p_77659_1_, EntityPlayer p_77659_2_, EnumHand p_77659_3_) { + abstractarrowentity.func_70243_d(true); +@@ -111,6 +116,10 @@ + public ActionResult func_77659_a(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_) { ItemStack itemstack = p_77659_2_.func_184586_b(p_77659_3_); - boolean flag = !this.func_185060_a(p_77659_2_).func_190926_b(); + boolean flag = !p_77659_2_.func_213356_f(itemstack).func_190926_b(); + + ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemstack, p_77659_1_, p_77659_2_, p_77659_3_, flag); + if (ret != null) return ret; + if (!p_77659_2_.field_71075_bZ.field_75098_d && !flag) { - return flag ? new ActionResult<>(EnumActionResult.PASS, itemstack) : new ActionResult<>(EnumActionResult.FAIL, itemstack); + return flag ? new ActionResult<>(ActionResultType.PASS, itemstack) : new ActionResult<>(ActionResultType.FAIL, itemstack); } else { -@@ -141,4 +150,8 @@ - public int func_77619_b() { - return 1; +@@ -122,4 +131,8 @@ + public Predicate func_220004_b() { + return field_220007_a; } + -+ public EntityArrow customizeArrow(EntityArrow arrow) { ++ public AbstractArrowEntity customeArrow(AbstractArrowEntity arrow) { + return arrow; + } } diff --git a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches/minecraft/net/minecraft/item/BucketItem.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/item/ItemBucket.java.patch rename to patches/minecraft/net/minecraft/item/BucketItem.java.patch index 4a5dbc8b4..a094c152e 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch +++ b/patches/minecraft/net/minecraft/item/BucketItem.java.patch @@ -1,24 +1,22 @@ ---- a/net/minecraft/item/ItemBucket.java -+++ b/net/minecraft/item/ItemBucket.java -@@ -37,6 +37,10 @@ - public ActionResult func_77659_a(World p_77659_1_, EntityPlayer p_77659_2_, EnumHand p_77659_3_) { +--- a/net/minecraft/item/BucketItem.java ++++ b/net/minecraft/item/BucketItem.java +@@ -38,6 +38,8 @@ + public ActionResult func_77659_a(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_) { ItemStack itemstack = p_77659_2_.func_184586_b(p_77659_3_); - RayTraceResult raytraceresult = this.func_77621_a(p_77659_1_, p_77659_2_, this.field_77876_a == Fluids.field_204541_a); -+ + RayTraceResult raytraceresult = func_219968_a(p_77659_1_, p_77659_2_, this.field_77876_a == Fluids.field_204541_a ? RayTraceContext.FluidMode.SOURCE_ONLY : RayTraceContext.FluidMode.NONE); + ActionResult ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(p_77659_2_, p_77659_1_, itemstack, raytraceresult); + if (ret != null) return ret; -+ - if (raytraceresult == null) { - return new ActionResult<>(EnumActionResult.PASS, itemstack); - } else if (raytraceresult.field_72313_a == RayTraceResult.Type.BLOCK) { -@@ -152,4 +156,12 @@ + if (raytraceresult.func_216346_c() == RayTraceResult.Type.MISS) { + return new ActionResult<>(ActionResultType.PASS, itemstack); + } else if (raytraceresult.func_216346_c() != RayTraceResult.Type.BLOCK) { +@@ -150,4 +152,12 @@ SoundEvent soundevent = this.field_77876_a.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187627_L : SoundEvents.field_187624_K; p_203791_2_.func_184133_a(p_203791_1_, p_203791_3_, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F); } + + @Override -+ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, @Nullable net.minecraft.nbt.NBTTagCompound nbt) { -+ if (this.getClass() == ItemBucket.class) ++ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, @Nullable net.minecraft.nbt.CompoundNBT nbt) { ++ if (this.getClass() == BucketItem.class) + return new net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper(stack); + else + return super.initCapabilities(stack, nbt); diff --git a/patches/minecraft/net/minecraft/item/EnumDyeColor.java.patch b/patches/minecraft/net/minecraft/item/DyeColor.java.patch similarity index 51% rename from patches/minecraft/net/minecraft/item/EnumDyeColor.java.patch rename to patches/minecraft/net/minecraft/item/DyeColor.java.patch index b9ba1a3a5..7ffbd6398 100644 --- a/patches/minecraft/net/minecraft/item/EnumDyeColor.java.patch +++ b/patches/minecraft/net/minecraft/item/DyeColor.java.patch @@ -1,22 +1,22 @@ ---- a/net/minecraft/item/EnumDyeColor.java -+++ b/net/minecraft/item/EnumDyeColor.java +--- a/net/minecraft/item/DyeColor.java ++++ b/net/minecraft/item/DyeColor.java @@ -43,6 +43,7 @@ private final int field_196066_w; private final float[] field_193352_x; private final int field_196067_y; + private final net.minecraft.tags.Tag tag; + private final int field_218390_z; - private EnumDyeColor(int p_i47810_3_, String p_i47810_4_, int p_i47810_5_, MaterialColor p_i47810_6_, int p_i47810_7_) { - this.field_196064_s = p_i47810_3_; + private DyeColor(int p_i50049_3_, String p_i50049_4_, int p_i50049_5_, MaterialColor p_i50049_6_, int p_i50049_7_, int p_i50049_8_) { @@ -55,6 +56,7 @@ + int j = (p_i50049_5_ & '\uff00') >> 8; + int k = (p_i50049_5_ & 255) >> 0; this.field_196066_w = k << 16 | j << 8 | i << 0; ++ this.tag = new net.minecraft.tags.ItemTags.Wrapper(new net.minecraft.util.ResourceLocation("minecraft", "dyes_" + p_i50049_4_)); this.field_193352_x = new float[]{(float)i / 255.0F, (float)j / 255.0F, (float)k / 255.0F}; - this.field_196067_y = p_i47810_7_; -+ this.tag = new net.minecraft.tags.ItemTags.Wrapper(new net.minecraft.util.ResourceLocation("minecraft", "dyes_" + p_i47810_4_)); + this.field_196067_y = p_i50049_7_; } - - public int func_196059_a() { -@@ -113,4 +115,21 @@ +@@ -120,4 +122,21 @@ public String func_176610_l() { return this.field_176785_v; } @@ -26,11 +26,11 @@ + } + + @Nullable -+ public static EnumDyeColor getColor(ItemStack stack) { -+ if (stack.func_77973_b() instanceof ItemDye) -+ return ((ItemDye)stack.func_77973_b()).func_195962_g(); ++ public static DyeColor getColor(ItemStack stack) { ++ if (stack.func_77973_b() instanceof DyeItem) ++ return ((DyeItem)stack.func_77973_b()).func_195962_g(); + -+ for (EnumDyeColor color : field_196062_q) { ++ for (DyeColor color : field_196062_q) { + if (stack.func_77973_b().func_206844_a(color.getTag())) + return color; + } diff --git a/patches/minecraft/net/minecraft/item/DyeableHorseArmorItem.java.patch b/patches/minecraft/net/minecraft/item/DyeableHorseArmorItem.java.patch new file mode 100644 index 000000000..52fe87e3f --- /dev/null +++ b/patches/minecraft/net/minecraft/item/DyeableHorseArmorItem.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/item/DyeableHorseArmorItem.java ++++ b/net/minecraft/item/DyeableHorseArmorItem.java +@@ -4,4 +4,7 @@ + public DyeableHorseArmorItem(int p_i50047_1_, String p_i50047_2_, Item.Properties p_i50047_3_) { + super(p_i50047_1_, p_i50047_2_, p_i50047_3_); + } ++ public DyeableHorseArmorItem(int p_i50047_1_, net.minecraft.util.ResourceLocation texture, Item.Properties p_i50047_3_) { ++ super(p_i50047_1_, texture, p_i50047_3_); ++ } + } diff --git a/patches/minecraft/net/minecraft/item/EnumRarity.java.patch b/patches/minecraft/net/minecraft/item/EnumRarity.java.patch deleted file mode 100644 index e88f6925b..000000000 --- a/patches/minecraft/net/minecraft/item/EnumRarity.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/item/EnumRarity.java -+++ b/net/minecraft/item/EnumRarity.java -@@ -2,7 +2,7 @@ - - import net.minecraft.util.text.TextFormatting; - --public enum EnumRarity { -+public enum EnumRarity implements net.minecraftforge.common.IExtensibleEnum { - COMMON(TextFormatting.WHITE), - UNCOMMON(TextFormatting.YELLOW), - RARE(TextFormatting.AQUA), -@@ -13,4 +13,8 @@ - private EnumRarity(TextFormatting p_i48837_3_) { - this.field_77937_e = p_i48837_3_; - } -+ -+ public static EnumRarity create(String enumName, TextFormatting p_i48837_3_) { -+ throw new IllegalStateException("Enum not extended"); -+ } - } diff --git a/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch b/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch new file mode 100644 index 000000000..19b52fe96 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/FilledMapItem.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/item/FilledMapItem.java ++++ b/net/minecraft/item/FilledMapItem.java +@@ -52,6 +52,16 @@ + + @Nullable + public static MapData func_195950_a(ItemStack p_195950_0_, World p_195950_1_) { ++ // FORGE: Add instance method for mods to override ++ Item map = p_195950_0_.func_77973_b(); ++ if (map instanceof FilledMapItem) { ++ return ((FilledMapItem)map).getCustomMapData(p_195950_0_, p_195950_1_); ++ } ++ return null; ++ } ++ ++ @Nullable ++ protected MapData getCustomMapData(ItemStack p_195950_0_, World p_195950_1_) { + MapData mapdata = func_219994_a(p_195950_0_, p_195950_1_); + if (mapdata == null && !p_195950_1_.field_72995_K) { + mapdata = func_195951_a(p_195950_0_, p_195950_1_, p_195950_1_.func_72912_H().func_76079_c(), p_195950_1_.func_72912_H().func_76074_e(), 3, false, false, p_195950_1_.field_73011_w.func_186058_p()); diff --git a/patches/minecraft/net/minecraft/item/HoeItem.java.patch b/patches/minecraft/net/minecraft/item/HoeItem.java.patch new file mode 100644 index 000000000..b75b128f5 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/HoeItem.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/item/HoeItem.java ++++ b/net/minecraft/item/HoeItem.java +@@ -31,7 +31,9 @@ + public ActionResultType func_195939_a(ItemUseContext p_195939_1_) { + World world = p_195939_1_.func_195991_k(); + BlockPos blockpos = p_195939_1_.func_195995_a(); +- if (p_195939_1_.func_196000_l() != Direction.DOWN && world.func_180495_p(blockpos.func_177984_a()).func_196958_f()) { ++ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(p_195939_1_); ++ if (hook != 0) return hook > 0 ? ActionResultType.SUCCESS : ActionResultType.FAIL; ++ if (p_195939_1_.func_196000_l() != Direction.DOWN && world.func_175623_d(blockpos.func_177984_a())) { + BlockState blockstate = field_195973_b.get(world.func_180495_p(blockpos).func_177230_c()); + if (blockstate != null) { + PlayerEntity playerentity = p_195939_1_.func_195999_j(); diff --git a/patches/minecraft/net/minecraft/item/HorseArmorItem.java.patch b/patches/minecraft/net/minecraft/item/HorseArmorItem.java.patch new file mode 100644 index 000000000..49f526153 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/HorseArmorItem.java.patch @@ -0,0 +1,27 @@ +--- a/net/minecraft/item/HorseArmorItem.java ++++ b/net/minecraft/item/HorseArmorItem.java +@@ -6,17 +6,21 @@ + + public class HorseArmorItem extends Item { + private final int field_219978_a; +- private final String field_219979_b; ++ private final ResourceLocation texture; + + public HorseArmorItem(int p_i50042_1_, String p_i50042_2_, Item.Properties p_i50042_3_) { ++ this(p_i50042_1_, new ResourceLocation("textures/entity/horse/armor/horse_armor_" + p_i50042_2_ + ".png"), p_i50042_3_); ++ } ++ ++ public HorseArmorItem(int p_i50042_1_, ResourceLocation texture, Item.Properties p_i50042_3_) { + super(p_i50042_3_); + this.field_219978_a = p_i50042_1_; +- this.field_219979_b = "textures/entity/horse/armor/horse_armor_" + p_i50042_2_ + ".png"; ++ this.texture = texture; + } + + @OnlyIn(Dist.CLIENT) + public ResourceLocation func_219976_d() { +- return new ResourceLocation(this.field_219979_b); ++ return texture; + } + + public int func_219977_e() { diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 9a46794da..499c17fde 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/Item.java +++ b/net/minecraft/item/Item.java -@@ -48,8 +48,8 @@ +@@ -38,8 +38,8 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -12,18 +12,18 @@ return p_210306_0_.func_77951_h() ? 1.0F : 0.0F; }; @@ -96,6 +96,10 @@ - this.field_77700_c = p_i48487_1_.field_200922_c; - this.field_77699_b = p_i48487_1_.field_200921_b; - this.field_77777_bU = p_i48487_1_.field_200920_a; + this.func_185043_a(new ResourceLocation("damaged"), field_185046_b); + this.func_185043_a(new ResourceLocation("damage"), field_185047_c); + } + this.canRepair = p_i48487_1_.canRepair; + this.toolClasses.putAll(p_i48487_1_.toolClasses); + Object tmp = p_i48487_1_.teisr == null ? null : net.minecraftforge.fml.DistExecutor.callWhenOn(Dist.CLIENT, p_i48487_1_.teisr); -+ this.teisr = tmp == null ? null : () -> (net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer) tmp; - if (this.field_77699_b > 0) { - this.func_185043_a(new ResourceLocation("damaged"), field_185046_b); - this.func_185043_a(new ResourceLocation("damage"), field_185047_c); -@@ -146,10 +150,12 @@ - return p_77654_1_; ++ this.teisr = tmp == null ? null : () -> (net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer) tmp; + + } + +@@ -155,10 +159,12 @@ + return this.func_219971_r() ? p_77654_3_.func_213357_a(p_77654_2_, p_77654_1_) : p_77654_1_; } + @Deprecated // Use ItemStack sensitive version. @@ -35,7 +35,12 @@ public final int func_77612_l() { return this.field_77699_b; } -@@ -204,6 +210,7 @@ +@@ -209,10 +215,12 @@ + } + + @Nullable ++ @Deprecated // Use ItemStack sensitive version. + public final Item func_77668_q() { return this.field_77700_c; } @@ -43,7 +48,7 @@ public boolean func_77634_r() { return this.field_77700_c != null; } -@@ -260,7 +267,7 @@ +@@ -273,7 +281,7 @@ } public boolean func_77616_k(ItemStack p_77616_1_) { @@ -51,19 +56,19 @@ + return this.getItemStackLimit(p_77616_1_) == 1 && this.func_77645_m(); } - @Nullable -@@ -277,8 +284,8 @@ + protected static RayTraceResult func_219968_a(World p_219968_0_, PlayerEntity p_219968_1_, RayTraceContext.FluidMode p_219968_2_) { +@@ -286,8 +294,8 @@ float f5 = MathHelper.func_76126_a(-f * ((float)Math.PI / 180F)); float f6 = f3 * f4; float f7 = f2 * f4; -- double d3 = 5.0D; +- double d0 = 5.0D; - Vec3d vec3d1 = vec3d.func_72441_c((double)f6 * 5.0D, (double)f5 * 5.0D, (double)f7 * 5.0D); -+ double d3 = p_77621_2_.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e(); -+ Vec3d vec3d1 = vec3d.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); - return p_77621_1_.func_200259_a(vec3d, vec3d1, p_77621_3_ ? RayTraceFluidMode.SOURCE_ONLY : RayTraceFluidMode.NEVER, false, false); ++ double d0 = p_219968_1_.func_110148_a(PlayerEntity.REACH_DISTANCE).func_111126_e();; ++ Vec3d vec3d1 = vec3d.func_72441_c((double)f6 * d0, (double)f5 * d0, (double)f7 * d0); + return p_219968_0_.func_217299_a(new RayTraceContext(vec3d, vec3d1, RayTraceContext.BlockMode.OUTLINE, p_219968_2_, p_219968_1_)); } -@@ -294,6 +301,7 @@ +@@ -303,6 +311,7 @@ } protected boolean func_194125_a(ItemGroup p_194125_1_) { @@ -71,17 +76,17 @@ ItemGroup itemgroup = this.func_77640_w(); return itemgroup != null && (p_194125_1_ == ItemGroup.field_78027_g || p_194125_1_ == itemgroup); } -@@ -307,10 +315,38 @@ +@@ -316,10 +325,38 @@ return false; } + @Deprecated // Use ItemStack sensitive version. - public Multimap func_111205_h(EntityEquipmentSlot p_111205_1_) { + public Multimap func_111205_h(EquipmentSlotType p_111205_1_) { return HashMultimap.create(); } + @Nullable -+ private final java.util.function.Supplier teisr; ++ private final java.util.function.Supplier teisr; + private final java.util.Map toolClasses = Maps.newHashMap(); + protected final boolean canRepair; + @@ -96,31 +101,31 @@ + } + + @Override -+ public int getHarvestLevel(ItemStack stack, net.minecraftforge.common.ToolType tool, @Nullable EntityPlayer player, @Nullable IBlockState blockState) { ++ public int getHarvestLevel(ItemStack stack, net.minecraftforge.common.ToolType tool, @Nullable PlayerEntity player, @Nullable BlockState blockState) { + return toolClasses.getOrDefault(tool, -1); + } + + @OnlyIn(Dist.CLIENT) + @Override -+ public final net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer getTileEntityItemStackRenderer() { -+ net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer renderer = teisr != null ? teisr.get() : null; -+ return renderer != null ? renderer : net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer.field_147719_a; ++ public final net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer getTileEntityItemStackRenderer() { ++ net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer renderer = teisr != null ? teisr.get() : null; ++ return renderer != null ? renderer : net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer.field_147719_a; + } + - public static void func_150900_l() { - func_179214_a(Blocks.field_150350_a, new ItemAir(Blocks.field_150350_a, new Item.Properties())); - func_200879_a(Blocks.field_150348_b, ItemGroup.field_78030_b); -@@ -1149,6 +1185,9 @@ - private Item field_200922_c; + public boolean func_219970_i(ItemStack p_219970_1_) { + return p_219970_1_.func_77973_b() == Items.field_222114_py; + } +@@ -349,6 +386,9 @@ private ItemGroup field_200923_d; - private EnumRarity field_208104_e = EnumRarity.COMMON; + private Rarity field_208104_e = Rarity.COMMON; + private Food field_221541_f; + private boolean canRepair = true; + private java.util.Map toolClasses = Maps.newHashMap(); -+ private java.util.function.Supplier> teisr; ++ private java.util.function.Supplier> teisr; - public Item.Properties func_200917_a(int p_200917_1_) { - if (this.field_200921_b > 0) { -@@ -1183,5 +1222,20 @@ + public Item.Properties func_221540_a(Food p_221540_1_) { + this.field_221541_f = p_221540_1_; +@@ -388,5 +428,20 @@ this.field_208104_e = p_208103_1_; return this; } @@ -135,7 +140,7 @@ + return this; + } + -+ public Item.Properties setTEISR(java.util.function.Supplier> teisr) { ++ public Item.Properties setTEISR(java.util.function.Supplier> teisr) { + this.teisr = teisr; + return this; + } diff --git a/patches/minecraft/net/minecraft/item/ItemArrow.java.patch b/patches/minecraft/net/minecraft/item/ItemArrow.java.patch deleted file mode 100644 index ba77f3dec..000000000 --- a/patches/minecraft/net/minecraft/item/ItemArrow.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/item/ItemArrow.java -+++ b/net/minecraft/item/ItemArrow.java -@@ -15,4 +15,9 @@ - entitytippedarrow.func_184555_a(p_200887_2_); - return entitytippedarrow; - } -+ -+ public boolean isInfinite(ItemStack stack, ItemStack bow, net.minecraft.entity.player.EntityPlayer player) { -+ int enchant = net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.init.Enchantments.field_185312_x, bow); -+ return enchant <= 0 ? false : this.getClass() == ItemArrow.class; -+ } - } diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch deleted file mode 100644 index bf993477d..000000000 --- a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/net/minecraft/item/ItemBlock.java -+++ b/net/minecraft/item/ItemBlock.java -@@ -59,7 +59,7 @@ - } - } - -- SoundType soundtype = block.func_185467_w(); -+ SoundType soundtype = iblockstate1.getSoundType(world, blockpos, p_195942_1_.func_195999_j()); - world.func_184133_a(entityplayer, blockpos, soundtype.func_185841_e(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F); - itemstack.func_190918_g(1); - return EnumActionResult.SUCCESS; -@@ -134,6 +134,10 @@ - } - - public Block func_179223_d() { -+ return this.getBlockRaw() == null ? null : this.getBlockRaw().delegate.get(); -+ } -+ -+ private Block getBlockRaw() { - return this.field_150939_a; - } - diff --git a/patches/minecraft/net/minecraft/item/ItemBoneMeal.java.patch b/patches/minecraft/net/minecraft/item/ItemBoneMeal.java.patch deleted file mode 100644 index eb1410617..000000000 --- a/patches/minecraft/net/minecraft/item/ItemBoneMeal.java.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- a/net/minecraft/item/ItemBoneMeal.java -+++ b/net/minecraft/item/ItemBoneMeal.java -@@ -27,7 +27,7 @@ - World world = p_195939_1_.func_195991_k(); - BlockPos blockpos = p_195939_1_.func_195995_a(); - BlockPos blockpos1 = blockpos.func_177972_a(p_195939_1_.func_196000_l()); -- if (func_195966_a(p_195939_1_.func_195996_i(), world, blockpos)) { -+ if (applyBonemeal(p_195939_1_.func_195996_i(), world, blockpos, p_195939_1_.func_195999_j())) { - if (!world.field_72995_K) { - world.func_175718_b(2005, blockpos, 0); - } -@@ -48,8 +48,19 @@ - } - } - -+ @Deprecated //Forge: Use Player/Hand version - public static boolean func_195966_a(ItemStack p_195966_0_, World p_195966_1_, BlockPos p_195966_2_) { -+ if (p_195966_1_ instanceof net.minecraft.world.WorldServer) -+ return applyBonemeal(p_195966_0_, p_195966_1_, p_195966_2_, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer)p_195966_1_)); -+ return false; -+ } -+ -+ public static boolean applyBonemeal(ItemStack p_195966_0_, World p_195966_1_, BlockPos p_195966_2_, net.minecraft.entity.player.EntityPlayer player) { - IBlockState iblockstate = p_195966_1_.func_180495_p(p_195966_2_); -+ -+ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, p_195966_1_, p_195966_2_, iblockstate, p_195966_0_); -+ if (hook != 0) return hook > 0; -+ - if (iblockstate.func_177230_c() instanceof IGrowable) { - IGrowable igrowable = (IGrowable)iblockstate.func_177230_c(); - if (igrowable.func_176473_a(p_195966_1_, p_195966_2_, iblockstate, p_195966_1_.field_72995_K)) { -@@ -125,12 +136,13 @@ - } - - IBlockState iblockstate = p_195965_0_.func_180495_p(p_195965_1_); -+ double height = iblockstate.isAir(p_195965_0_, p_195965_1_) ? 1.0f : iblockstate.func_196954_c(p_195965_0_, p_195965_1_).func_197758_c(EnumFacing.Axis.Y); - if (!iblockstate.func_196958_f()) { - for(int i = 0; i < p_195965_2_; ++i) { - double d0 = field_77697_d.nextGaussian() * 0.02D; - double d1 = field_77697_d.nextGaussian() * 0.02D; - double d2 = field_77697_d.nextGaussian() * 0.02D; -- p_195965_0_.func_195594_a(Particles.field_197632_y, (double)((float)p_195965_1_.func_177958_n() + field_77697_d.nextFloat()), (double)p_195965_1_.func_177956_o() + (double)field_77697_d.nextFloat() * iblockstate.func_196954_c(p_195965_0_, p_195965_1_).func_197758_c(EnumFacing.Axis.Y), (double)((float)p_195965_1_.func_177952_p() + field_77697_d.nextFloat()), d0, d1, d2); -+ p_195965_0_.func_195594_a(Particles.field_197632_y, (double)((float)p_195965_1_.func_177958_n() + field_77697_d.nextFloat()), (double)p_195965_1_.func_177956_o() + (double)field_77697_d.nextFloat() * height, (double)((float)p_195965_1_.func_177952_p() + field_77697_d.nextFloat()), d0, d1, d2); - } - - } diff --git a/patches/minecraft/net/minecraft/item/ItemGroup.java.patch b/patches/minecraft/net/minecraft/item/ItemGroup.java.patch index c13a39f54..411c9d11e 100644 --- a/patches/minecraft/net/minecraft/item/ItemGroup.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemGroup.java.patch @@ -1,16 +1,7 @@ --- a/net/minecraft/item/ItemGroup.java +++ b/net/minecraft/item/ItemGroup.java -@@ -12,7 +12,7 @@ - import net.minecraftforge.api.distmarker.OnlyIn; - - public abstract class ItemGroup { -- public static final ItemGroup[] field_78032_a = new ItemGroup[12]; -+ public static ItemGroup[] field_78032_a = new ItemGroup[12]; - public static final ItemGroup field_78030_b = (new ItemGroup(0, "buildingBlocks") { - @OnlyIn(Dist.CLIENT) - public ItemStack func_78016_d() { -@@ -105,11 +105,14 @@ - private EnumEnchantmentType[] field_111230_s = new EnumEnchantmentType[0]; +@@ -104,11 +104,14 @@ + private EnchantmentType[] field_111230_s = new EnchantmentType[0]; private ItemStack field_151245_t; + public ItemGroup(String label) { @@ -26,7 +17,7 @@ } @OnlyIn(Dist.CLIENT) -@@ -180,11 +183,13 @@ +@@ -179,11 +182,13 @@ @OnlyIn(Dist.CLIENT) public int func_78020_k() { @@ -40,7 +31,7 @@ return this.field_78033_n < 6; } -@@ -221,4 +226,58 @@ +@@ -220,4 +225,58 @@ } } diff --git a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch deleted file mode 100644 index c041baf52..000000000 --- a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/item/ItemHoe.java -+++ b/net/minecraft/item/ItemHoe.java -@@ -31,7 +31,9 @@ - public EnumActionResult func_195939_a(ItemUseContext p_195939_1_) { - World world = p_195939_1_.func_195991_k(); - BlockPos blockpos = p_195939_1_.func_195995_a(); -- if (p_195939_1_.func_196000_l() != EnumFacing.DOWN && world.func_180495_p(blockpos.func_177984_a()).func_196958_f()) { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(p_195939_1_); -+ if (hook != 0) return hook > 0 ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; -+ if (p_195939_1_.func_196000_l() != EnumFacing.DOWN && world.func_175623_d(blockpos.func_177984_a())) { - IBlockState iblockstate = field_195973_b.get(world.func_180495_p(blockpos).func_177230_c()); - if (iblockstate != null) { - EntityPlayer entityplayer = p_195939_1_.func_195999_j(); diff --git a/patches/minecraft/net/minecraft/item/ItemMap.java.patch b/patches/minecraft/net/minecraft/item/ItemMap.java.patch deleted file mode 100644 index b75651805..000000000 --- a/patches/minecraft/net/minecraft/item/ItemMap.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/item/ItemMap.java -+++ b/net/minecraft/item/ItemMap.java -@@ -48,6 +48,16 @@ - - @Nullable - public static MapData func_195950_a(ItemStack p_195950_0_, World p_195950_1_) { -+ // FORGE: Add instance method for mods to override -+ Item map = p_195950_0_.func_77973_b(); -+ if (map instanceof ItemMap) { -+ return ((ItemMap)map).getCustomMapData(p_195950_0_, p_195950_1_); -+ } -+ return null; -+ } -+ -+ @Nullable -+ protected MapData getCustomMapData(ItemStack p_195950_0_, World p_195950_1_) { - MapData mapdata = func_195953_a(p_195950_1_, "map_" + func_195949_f(p_195950_0_)); - if (mapdata == null && !p_195950_1_.field_72995_K) { - mapdata = func_195951_a(p_195950_0_, p_195950_1_, p_195950_1_.func_72912_H().func_76079_c(), p_195950_1_.func_72912_H().func_76074_e(), 3, false, false, p_195950_1_.field_73011_w.func_186058_p()); diff --git a/patches/minecraft/net/minecraft/item/ItemMinecart.java.patch b/patches/minecraft/net/minecraft/item/ItemMinecart.java.patch deleted file mode 100644 index 5c031231b..000000000 --- a/patches/minecraft/net/minecraft/item/ItemMinecart.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/net/minecraft/item/ItemMinecart.java -+++ b/net/minecraft/item/ItemMinecart.java -@@ -26,7 +26,7 @@ - double d2 = p_82487_1_.func_82616_c() + (double)enumfacing.func_82599_e() * 1.125D; - BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(enumfacing); - IBlockState iblockstate = world.func_180495_p(blockpos); -- RailShape railshape = iblockstate.func_177230_c() instanceof BlockRailBase ? iblockstate.func_177229_b(((BlockRailBase)iblockstate.func_177230_c()).func_176560_l()) : RailShape.NORTH_SOUTH; -+ RailShape railshape = iblockstate.func_177230_c() instanceof BlockRailBase ? ((BlockRailBase)iblockstate.func_177230_c()).getRailDirection(iblockstate, world, blockpos, null) : RailShape.NORTH_SOUTH; - double d3; - if (iblockstate.func_203425_a(BlockTags.field_203437_y)) { - if (railshape.func_208092_c()) { -@@ -35,12 +35,12 @@ - d3 = 0.1D; - } - } else { -- if (!iblockstate.func_196958_f() || !world.func_180495_p(blockpos.func_177977_b()).func_203425_a(BlockTags.field_203437_y)) { -+ if (!iblockstate.isAir(world, blockpos) || !world.func_180495_p(blockpos.func_177977_b()).func_203425_a(BlockTags.field_203437_y)) { - return this.field_96465_b.dispense(p_82487_1_, p_82487_2_); - } - - IBlockState iblockstate1 = world.func_180495_p(blockpos.func_177977_b()); -- RailShape railshape1 = iblockstate1.func_177230_c() instanceof BlockRailBase ? iblockstate1.func_177229_b(((BlockRailBase)iblockstate1.func_177230_c()).func_176560_l()) : RailShape.NORTH_SOUTH; -+ RailShape railshape1 = iblockstate1.func_177230_c() instanceof BlockRailBase ? ((BlockRailBase)iblockstate1.func_177230_c()).getRailDirection(iblockstate1, world, blockpos, null) : RailShape.NORTH_SOUTH; - if (enumfacing != EnumFacing.DOWN && railshape1.func_208092_c()) { - d3 = -0.4D; - } else { -@@ -79,7 +79,7 @@ - } else { - ItemStack itemstack = p_195939_1_.func_195996_i(); - if (!world.field_72995_K) { -- RailShape railshape = iblockstate.func_177230_c() instanceof BlockRailBase ? iblockstate.func_177229_b(((BlockRailBase)iblockstate.func_177230_c()).func_176560_l()) : RailShape.NORTH_SOUTH; -+ RailShape railshape = iblockstate.func_177230_c() instanceof BlockRailBase ? ((BlockRailBase)iblockstate.func_177230_c()).getRailDirection(iblockstate, world, blockpos, null) : RailShape.NORTH_SOUTH; - double d0 = 0.0D; - if (railshape.func_208092_c()) { - d0 = 0.5D; diff --git a/patches/minecraft/net/minecraft/item/ItemShears.java.patch b/patches/minecraft/net/minecraft/item/ItemShears.java.patch deleted file mode 100644 index 608f8b3fe..000000000 --- a/patches/minecraft/net/minecraft/item/ItemShears.java.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- a/net/minecraft/item/ItemShears.java -+++ b/net/minecraft/item/ItemShears.java -@@ -19,6 +19,7 @@ - } - - Block block = p_179218_3_.func_177230_c(); -+ if (block instanceof net.minecraftforge.common.IShearable) return true; - return !p_179218_3_.func_203425_a(BlockTags.field_206952_E) && block != Blocks.field_196553_aF && block != Blocks.field_150349_c && block != Blocks.field_196554_aH && block != Blocks.field_196555_aI && block != Blocks.field_150395_bd && block != Blocks.field_150473_bD && !block.func_203417_a(BlockTags.field_199897_a) ? super.func_179218_a(p_179218_1_, p_179218_2_, p_179218_3_, p_179218_4_, p_179218_5_) : true; - } - -@@ -35,4 +36,57 @@ - return 15.0F; - } - } -+ -+ -+ @Override -+ public boolean func_111207_a(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity, net.minecraft.util.EnumHand hand) { -+ if (entity.field_70170_p.field_72995_K) -+ return false; -+ if (entity instanceof net.minecraftforge.common.IShearable) { -+ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; -+ BlockPos pos = new BlockPos(entity.field_70165_t, entity.field_70163_u, entity.field_70161_v); -+ if (target.isShearable(itemstack, entity.field_70170_p, pos)) { -+ java.util.List drops = target.onSheared(itemstack, entity.field_70170_p, pos, -+ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.init.Enchantments.field_185308_t, itemstack)); -+ java.util.Random rand = new java.util.Random(); -+ for (ItemStack stack : drops) { -+ net.minecraft.entity.item.EntityItem ent = entity.func_70099_a(stack, 1.0F); -+ ent.field_70181_x += rand.nextFloat() * 0.05F; -+ ent.field_70159_w += (rand.nextFloat() - rand.nextFloat()) * 0.1F; -+ ent.field_70179_y += (rand.nextFloat() - rand.nextFloat()) * 0.1F; -+ } -+ itemstack.func_77972_a(1, entity); -+ } -+ return true; -+ } -+ return false; -+ } -+ -+ @Override -+ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) { -+ if (player.field_70170_p.field_72995_K || player.field_71075_bZ.field_75098_d) -+ return false; -+ Block block = player.field_70170_p.func_180495_p(pos).func_177230_c(); -+ if (block instanceof net.minecraftforge.common.IShearable) { -+ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)block; -+ if (target.isShearable(itemstack, player.field_70170_p, pos)) { -+ java.util.List drops = target.onSheared(itemstack, player.field_70170_p, pos, -+ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.init.Enchantments.field_185308_t, itemstack)); -+ java.util.Random rand = new java.util.Random(); -+ for (ItemStack stack : drops) { -+ float f = 0.7F; -+ double d = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ double d1 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ double d2 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ net.minecraft.entity.item.EntityItem entityitem = new net.minecraft.entity.item.EntityItem(player.field_70170_p, (double)pos.func_177958_n() + d, (double)pos.func_177956_o() + d1, (double)pos.func_177952_p() + d2, stack); -+ entityitem.func_174869_p(); -+ player.field_70170_p.func_72838_d(entityitem); -+ } -+ itemstack.func_77972_a(1, player); -+ player.func_71029_a(net.minecraft.stats.StatList.field_188065_ae.func_199076_b(block)); -+ return true; -+ } -+ } -+ return false; -+ } - } diff --git a/patches/minecraft/net/minecraft/item/ItemSpade.java.patch b/patches/minecraft/net/minecraft/item/ItemSpade.java.patch deleted file mode 100644 index 3bfc642e9..000000000 --- a/patches/minecraft/net/minecraft/item/ItemSpade.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/item/ItemSpade.java -+++ b/net/minecraft/item/ItemSpade.java -@@ -21,7 +21,7 @@ - protected static final Map field_195955_e = Maps.newHashMap(ImmutableMap.of(Blocks.field_196658_i, Blocks.field_185774_da.func_176223_P())); - - public ItemSpade(IItemTier p_i48469_1_, float p_i48469_2_, float p_i48469_3_, Item.Properties p_i48469_4_) { -- super(p_i48469_2_, p_i48469_3_, p_i48469_1_, field_150916_c, p_i48469_4_); -+ super(p_i48469_2_, p_i48469_3_, p_i48469_1_, field_150916_c, p_i48469_4_.addToolType(net.minecraftforge.common.ToolType.SHOVEL, p_i48469_1_.func_200925_d())); - } - - public boolean func_150897_b(IBlockState p_150897_1_) { diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index 398a1c235..c2f8e4685 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/item/ItemStack.java +++ b/net/minecraft/item/ItemStack.java -@@ -64,7 +64,7 @@ +@@ -65,7 +65,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,23 +9,23 @@ private static final Logger field_199558_c = LogManager.getLogger(); public static final ItemStack field_190927_a = new ItemStack((Item)null); public static final DecimalFormat field_111284_a = func_208306_D(); -@@ -80,6 +80,9 @@ - private BlockWorldState field_179550_j; +@@ -81,6 +81,9 @@ + private CachedBlockInfo field_179550_j; private boolean field_179551_k; + private net.minecraftforge.registries.IRegistryDelegate delegate; -+ private NBTTagCompound capNBT; ++ private CompoundNBT capNBT; + private static DecimalFormat func_208306_D() { DecimalFormat decimalformat = new DecimalFormat("#.##"); decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); -@@ -90,10 +93,14 @@ +@@ -91,10 +94,14 @@ this(p_i48203_1_, 1); } - public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_) { + public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_){ this(p_i48204_1_, p_i48204_2_, null); } -+ public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_, @Nullable NBTTagCompound capNBT) { ++ public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_, @Nullable CompoundNBT capNBT) { + super(ItemStack.class); + this.capNBT = capNBT; this.field_151002_e = p_i48204_1_ == null ? null : p_i48204_1_.func_199767_j(); @@ -35,15 +35,15 @@ } private void func_190923_F() { -@@ -102,6 +109,8 @@ +@@ -103,6 +110,8 @@ } - private ItemStack(NBTTagCompound p_i47263_1_) { + private ItemStack(CompoundNBT p_i47263_1_) { + super(ItemStack.class); + this.capNBT = p_i47263_1_.func_74764_b("ForgeCaps") ? p_i47263_1_.func_74775_l("ForgeCaps") : null; - Item item = IRegistry.field_212630_s.func_212608_b(new ResourceLocation(p_i47263_1_.func_74779_i("id"))); - this.field_151002_e = item == null ? Items.field_190931_a : item; + this.field_151002_e = Registry.field_212630_s.func_82594_a(new ResourceLocation(p_i47263_1_.func_74779_i("id"))); this.field_77994_a = p_i47263_1_.func_74771_c("Count"); + if (p_i47263_1_.func_150297_b("tag", 10)) { @@ -115,6 +124,7 @@ } @@ -51,7 +51,7 @@ + this.forgeInit(); } - public static ItemStack func_199557_a(NBTTagCompound p_199557_0_) { + public static ItemStack func_199557_a(CompoundNBT p_199557_0_) { @@ -129,7 +139,7 @@ public boolean func_190926_b() { if (this == field_190927_a) { @@ -61,7 +61,7 @@ return this.field_77994_a <= 0; } else { return true; -@@ -145,18 +155,27 @@ +@@ -145,10 +155,19 @@ } public Item func_77973_b() { @@ -69,40 +69,36 @@ + return this.field_190928_g || this.delegate == null ? Items.field_190931_a : this.delegate.get(); } - public EnumActionResult func_196084_a(ItemUseContext p_196084_1_) { -- EntityPlayer entityplayer = p_196084_1_.func_195999_j(); -- BlockPos blockpos = p_196084_1_.func_195995_a(); -- BlockWorldState blockworldstate = new BlockWorldState(p_196084_1_.func_195991_k(), blockpos, false); -- if (entityplayer != null && !entityplayer.field_71075_bZ.field_75099_e && !this.func_206847_b(p_196084_1_.func_195991_k().func_205772_D(), blockworldstate)) { + public ActionResultType func_196084_a(ItemUseContext p_196084_1_) { + if (!p_196084_1_.field_196006_g.field_72995_K) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(p_196084_1_); + return onItemUse(p_196084_1_, (c) -> func_77973_b().func_195939_a(p_196084_1_)); + } + -+ public EnumActionResult onItemUseFirst(ItemUseContext context) { ++ public ActionResultType onItemUseFirst(ItemUseContext context) { + return onItemUse(context, (c) -> func_77973_b().onItemUseFirst(this, context)); + } + -+ private EnumActionResult onItemUse(ItemUseContext context, java.util.function.Function callback) { -+ EntityPlayer entityplayer = context.func_195999_j(); -+ BlockPos blockpos = context.func_195995_a(); -+ BlockWorldState blockworldstate = new BlockWorldState(context.func_195991_k(), blockpos, false); -+ if (entityplayer != null && !entityplayer.field_71075_bZ.field_75099_e && !this.func_206847_b(context.func_195991_k().func_205772_D(), blockworldstate)) { - return EnumActionResult.PASS; ++ private ActionResultType onItemUse(ItemUseContext p_196084_1_, java.util.function.Function callback) { + PlayerEntity playerentity = p_196084_1_.func_195999_j(); + BlockPos blockpos = p_196084_1_.func_195995_a(); + CachedBlockInfo cachedblockinfo = new CachedBlockInfo(p_196084_1_.func_195991_k(), blockpos, false); +@@ -156,7 +175,7 @@ + return ActionResultType.PASS; } else { Item item = this.func_77973_b(); -- EnumActionResult enumactionresult = item.func_195939_a(p_196084_1_); -+ EnumActionResult enumactionresult = callback.apply(context); - if (entityplayer != null && enumactionresult == EnumActionResult.SUCCESS) { - entityplayer.func_71029_a(StatList.field_75929_E.func_199076_b(item)); +- ActionResultType actionresulttype = item.func_195939_a(p_196084_1_); ++ ActionResultType actionresulttype = callback.apply(p_196084_1_); + if (playerentity != null && actionresulttype == ActionResultType.SUCCESS) { + playerentity.func_71029_a(Stats.field_75929_E.func_199076_b(item)); } @@ -184,12 +203,15 @@ if (this.field_77990_d != null) { - p_77955_1_.func_74782_a("tag", this.field_77990_d); + p_77955_1_.func_218657_a("tag", this.field_77990_d); } - -+ NBTTagCompound cnbt = this.serializeCaps(); ++ CompoundNBT cnbt = this.serializeCaps(); + if (cnbt != null && !cnbt.isEmpty()) { -+ p_77955_1_.func_74782_a("ForgeCaps", cnbt); ++ p_77955_1_.func_218657_a("ForgeCaps", cnbt); + } return p_77955_1_; } @@ -119,8 +115,8 @@ public boolean func_77984_f() { - if (!this.field_190928_g && this.func_77973_b().func_77612_l() > 0) { + if (!this.field_190928_g && this.func_77973_b().getMaxDamage(this) > 0) { - NBTTagCompound nbttagcompound = this.func_77978_p(); - return nbttagcompound == null || !nbttagcompound.func_74767_n("Unbreakable"); + CompoundNBT compoundnbt = this.func_77978_p(); + return compoundnbt == null || !compoundnbt.func_74767_n("Unbreakable"); } else { @@ -206,7 +228,7 @@ } @@ -139,16 +135,16 @@ + return this.func_77973_b().getMaxDamage(this); } - public boolean func_96631_a(int p_96631_1_, Random p_96631_2_, @Nullable EntityPlayerMP p_96631_3_) { + public boolean func_96631_a(int p_96631_1_, Random p_96631_2_, @Nullable ServerPlayerEntity p_96631_3_) { @@ -286,7 +308,7 @@ } - public boolean func_150998_b(IBlockState p_150998_1_) { + public boolean func_150998_b(BlockState p_150998_1_) { - return this.func_77973_b().func_150897_b(p_150998_1_); + return this.func_77973_b().canHarvestBlock(this, p_150998_1_); } - public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_, EnumHand p_111282_3_) { + public boolean func_111282_a(PlayerEntity p_111282_1_, LivingEntity p_111282_2_, Hand p_111282_3_) { @@ -294,7 +316,7 @@ } @@ -176,7 +172,7 @@ } } -@@ -634,6 +656,7 @@ +@@ -639,6 +661,7 @@ } } @@ -184,7 +180,7 @@ return list; } -@@ -744,7 +767,7 @@ +@@ -760,7 +783,7 @@ } } } else { @@ -193,32 +189,29 @@ } return multimap; -@@ -875,4 +898,37 @@ - public void func_190918_g(int p_190918_1_) { - this.func_190917_f(-p_190918_1_); +@@ -899,4 +922,33 @@ + public boolean func_222117_E() { + return this.func_77973_b().func_219971_r(); } + + // FORGE START -+ public void deserializeNBT(NBTTagCompound nbt) -+ { -+ final ItemStack itemStack = ItemStack.func_199557_a(nbt); -+ getStack().func_77982_d(itemStack.func_77978_p()); -+ if (itemStack.capNBT != null) deserializeCaps(itemStack.capNBT); ++ public void deserializeNBT(CompoundNBT nbt) { ++ final ItemStack itemStack = ItemStack.func_199557_a(nbt); ++ getStack().func_77982_d(itemStack.func_77978_p()); ++ if (itemStack.capNBT != null) deserializeCaps(itemStack.capNBT); + } + + /** + * Set up forge's ItemStack additions. + */ -+ private void forgeInit() -+ { -+ Item item = getItemRaw(); -+ if (item != null) -+ { -+ this.delegate = item.delegate; -+ net.minecraftforge.common.capabilities.ICapabilityProvider provider = item.initCapabilities(this, this.capNBT); -+ this.gatherCapabilities(provider); -+ if (this.capNBT != null) deserializeCaps(this.capNBT); -+ } ++ private void forgeInit() { ++ Item item = getItemRaw(); ++ if (item != null) { ++ this.delegate = item.delegate; ++ net.minecraftforge.common.capabilities.ICapabilityProvider provider = item.initCapabilities(this, this.capNBT); ++ this.gatherCapabilities(provider); ++ if (this.capNBT != null) deserializeCaps(this.capNBT); ++ } + } + + /** @@ -226,8 +219,7 @@ + * In all other methods, FML replaces calls to this.item with the item delegate. + */ + @Nullable -+ private Item getItemRaw() -+ { ++ private Item getItemRaw() { + return this.field_151002_e; + } } diff --git a/patches/minecraft/net/minecraft/item/Items.java.patch b/patches/minecraft/net/minecraft/item/Items.java.patch new file mode 100644 index 000000000..c2fcd96b3 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/Items.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/item/Items.java ++++ b/net/minecraft/item/Items.java +@@ -12,6 +12,7 @@ + import net.minecraft.util.SoundEvents; + import net.minecraft.util.registry.Registry; + ++@net.minecraftforge.registries.ObjectHolder("minecraft") + public class Items { + public static final Item field_190931_a = func_221546_a(Blocks.field_150350_a, new AirItem(Blocks.field_150350_a, new Item.Properties())); + public static final Item field_221574_b = func_221542_a(Blocks.field_150348_b, ItemGroup.field_78030_b); diff --git a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches/minecraft/net/minecraft/item/LilyPadItem.java.patch similarity index 63% rename from patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch rename to patches/minecraft/net/minecraft/item/LilyPadItem.java.patch index fdae03e4d..9d123736d 100644 --- a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch +++ b/patches/minecraft/net/minecraft/item/LilyPadItem.java.patch @@ -1,18 +1,18 @@ ---- a/net/minecraft/item/ItemLilyPad.java -+++ b/net/minecraft/item/ItemLilyPad.java -@@ -45,7 +45,15 @@ - Material material = iblockstate.func_185904_a(); +--- a/net/minecraft/item/LilyPadItem.java ++++ b/net/minecraft/item/LilyPadItem.java +@@ -50,7 +50,15 @@ + Material material = blockstate.func_185904_a(); IFluidState ifluidstate = p_77659_1_.func_204610_c(blockpos); if ((ifluidstate.func_206886_c() == Fluids.field_204546_a || material == Material.field_151588_w) && p_77659_1_.func_175623_d(blockpos1)) { + + // special case for handling block placement with water lilies + net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(p_77659_1_, blockpos1); p_77659_1_.func_180501_a(blockpos1, Blocks.field_196651_dG.func_176223_P(), 11); -+ if (net.minecraftforge.event.ForgeEventFactory.onBlockPlace(p_77659_2_, blocksnapshot, net.minecraft.util.EnumFacing.UP)) { ++ if (net.minecraftforge.event.ForgeEventFactory.onBlockPlace(p_77659_2_, blocksnapshot, net.minecraft.util.Direction.UP)) { + blocksnapshot.restore(true, false); -+ return new ActionResult(EnumActionResult.FAIL, itemstack); ++ return new ActionResult(ActionResultType.FAIL, itemstack); + } + - if (p_77659_2_ instanceof EntityPlayerMP) { - CriteriaTriggers.field_193137_x.func_193173_a((EntityPlayerMP)p_77659_2_, blockpos1, itemstack); + if (p_77659_2_ instanceof ServerPlayerEntity) { + CriteriaTriggers.field_193137_x.func_193173_a((ServerPlayerEntity)p_77659_2_, blockpos1, itemstack); } diff --git a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch similarity index 52% rename from patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch rename to patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch index 74b265732..4c0dcf930 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch +++ b/patches/minecraft/net/minecraft/item/MilkBucketItem.java.patch @@ -1,21 +1,21 @@ ---- a/net/minecraft/item/ItemBucketMilk.java -+++ b/net/minecraft/item/ItemBucketMilk.java -@@ -17,6 +17,8 @@ +--- a/net/minecraft/item/MilkBucketItem.java ++++ b/net/minecraft/item/MilkBucketItem.java +@@ -16,6 +16,8 @@ } - public ItemStack func_77654_b(ItemStack p_77654_1_, World p_77654_2_, EntityLivingBase p_77654_3_) { + public ItemStack func_77654_b(ItemStack p_77654_1_, World p_77654_2_, LivingEntity p_77654_3_) { + if (!p_77654_2_.field_72995_K) p_77654_3_.curePotionEffects(p_77654_1_); // FORGE - move up so stack.shrink does not turn stack into air + - if (p_77654_3_ instanceof EntityPlayerMP) { - EntityPlayerMP entityplayermp = (EntityPlayerMP)p_77654_3_; - CriteriaTriggers.field_193138_y.func_193148_a(entityplayermp, p_77654_1_); -@@ -46,4 +48,9 @@ + if (p_77654_3_ instanceof ServerPlayerEntity) { + ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)p_77654_3_; + CriteriaTriggers.field_193138_y.func_193148_a(serverplayerentity, p_77654_1_); +@@ -45,4 +47,9 @@ p_77659_2_.func_184598_c(p_77659_3_); - return new ActionResult<>(EnumActionResult.SUCCESS, p_77659_2_.func_184586_b(p_77659_3_)); + return new ActionResult<>(ActionResultType.SUCCESS, p_77659_2_.func_184586_b(p_77659_3_)); } + + @Override -+ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, @javax.annotation.Nullable net.minecraft.nbt.NBTTagCompound nbt) { ++ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, @javax.annotation.Nullable net.minecraft.nbt.CompoundNBT nbt) { + return new net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper(stack); + } } diff --git a/patches/minecraft/net/minecraft/item/MinecartItem.java.patch b/patches/minecraft/net/minecraft/item/MinecartItem.java.patch new file mode 100644 index 000000000..957a16961 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/MinecartItem.java.patch @@ -0,0 +1,35 @@ +--- a/net/minecraft/item/MinecartItem.java ++++ b/net/minecraft/item/MinecartItem.java +@@ -26,7 +26,7 @@ + double d2 = p_82487_1_.func_82616_c() + (double)direction.func_82599_e() * 1.125D; + BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(direction); + BlockState blockstate = world.func_180495_p(blockpos); +- RailShape railshape = blockstate.func_177230_c() instanceof AbstractRailBlock ? blockstate.func_177229_b(((AbstractRailBlock)blockstate.func_177230_c()).func_176560_l()) : RailShape.NORTH_SOUTH; ++ RailShape railshape = blockstate.func_177230_c() instanceof AbstractRailBlock ? ((AbstractRailBlock)blockstate.func_177230_c()).getRailDirection(blockstate, world, blockpos, null) : RailShape.NORTH_SOUTH; + double d3; + if (blockstate.func_203425_a(BlockTags.field_203437_y)) { + if (railshape.func_208092_c()) { +@@ -35,12 +35,12 @@ + d3 = 0.1D; + } + } else { +- if (!blockstate.func_196958_f() || !world.func_180495_p(blockpos.func_177977_b()).func_203425_a(BlockTags.field_203437_y)) { ++ if (!blockstate.isAir(world, blockpos) || !world.func_180495_p(blockpos.func_177977_b()).func_203425_a(BlockTags.field_203437_y)) { + return this.field_96465_b.dispense(p_82487_1_, p_82487_2_); + } + + BlockState blockstate1 = world.func_180495_p(blockpos.func_177977_b()); +- RailShape railshape1 = blockstate1.func_177230_c() instanceof AbstractRailBlock ? blockstate1.func_177229_b(((AbstractRailBlock)blockstate1.func_177230_c()).func_176560_l()) : RailShape.NORTH_SOUTH; ++ RailShape railshape1 = blockstate1.func_177230_c() instanceof AbstractRailBlock ? ((AbstractRailBlock)blockstate1.func_177230_c()).getRailDirection(blockstate1, world, blockpos.func_177977_b(), null) : RailShape.NORTH_SOUTH; + if (direction != Direction.DOWN && railshape1.func_208092_c()) { + d3 = -0.4D; + } else { +@@ -79,7 +79,7 @@ + } else { + ItemStack itemstack = p_195939_1_.func_195996_i(); + if (!world.field_72995_K) { +- RailShape railshape = blockstate.func_177230_c() instanceof AbstractRailBlock ? blockstate.func_177229_b(((AbstractRailBlock)blockstate.func_177230_c()).func_176560_l()) : RailShape.NORTH_SOUTH; ++ RailShape railshape = blockstate.func_177230_c() instanceof AbstractRailBlock ? ((AbstractRailBlock)blockstate.func_177230_c()).getRailDirection(blockstate, world, blockpos, null) : RailShape.NORTH_SOUTH; + double d0 = 0.0D; + if (railshape.func_208092_c()) { + d0 = 0.5D; diff --git a/patches/minecraft/net/minecraft/item/ItemPickaxe.java.patch b/patches/minecraft/net/minecraft/item/PickaxeItem.java.patch similarity index 59% rename from patches/minecraft/net/minecraft/item/ItemPickaxe.java.patch rename to patches/minecraft/net/minecraft/item/PickaxeItem.java.patch index 2d842e369..8dae82bc1 100644 --- a/patches/minecraft/net/minecraft/item/ItemPickaxe.java.patch +++ b/patches/minecraft/net/minecraft/item/PickaxeItem.java.patch @@ -1,14 +1,14 @@ ---- a/net/minecraft/item/ItemPickaxe.java -+++ b/net/minecraft/item/ItemPickaxe.java +--- a/net/minecraft/item/PickaxeItem.java ++++ b/net/minecraft/item/PickaxeItem.java @@ -11,24 +11,17 @@ - private static final Set field_150915_c = Sets.newHashSet(Blocks.field_150408_cc, Blocks.field_150365_q, Blocks.field_150347_e, Blocks.field_150319_E, Blocks.field_150484_ah, Blocks.field_150482_ag, Blocks.field_196552_aC, Blocks.field_150340_R, Blocks.field_150352_o, Blocks.field_150432_aD, Blocks.field_150339_S, Blocks.field_150366_p, Blocks.field_150368_y, Blocks.field_150369_x, Blocks.field_150341_Y, Blocks.field_150424_aL, Blocks.field_150403_cj, Blocks.field_205164_gk, Blocks.field_150448_aq, Blocks.field_150450_ax, Blocks.field_150322_A, Blocks.field_196583_aj, Blocks.field_196585_ak, Blocks.field_196798_hA, Blocks.field_196799_hB, Blocks.field_180395_cM, Blocks.field_150348_b, Blocks.field_196650_c, Blocks.field_196652_d, Blocks.field_196654_e, Blocks.field_196655_f, Blocks.field_196656_g, Blocks.field_196657_h, Blocks.field_150333_U, Blocks.field_196640_bx, Blocks.field_196643_by, Blocks.field_196646_bz, Blocks.field_196571_bA, Blocks.field_196573_bB, Blocks.field_196575_bC, Blocks.field_196576_bD, Blocks.field_196578_bE, Blocks.field_185771_cX, Blocks.field_196581_bI, Blocks.field_196582_bJ, Blocks.field_196580_bH, Blocks.field_196579_bG, Blocks.field_150430_aB, Blocks.field_150456_au); + private static final Set field_150915_c = ImmutableSet.of(Blocks.field_150408_cc, Blocks.field_150365_q, Blocks.field_150347_e, Blocks.field_150319_E, Blocks.field_150484_ah, Blocks.field_150482_ag, Blocks.field_196552_aC, Blocks.field_150340_R, Blocks.field_150352_o, Blocks.field_150432_aD, Blocks.field_150339_S, Blocks.field_150366_p, Blocks.field_150368_y, Blocks.field_150369_x, Blocks.field_150341_Y, Blocks.field_150424_aL, Blocks.field_150403_cj, Blocks.field_205164_gk, Blocks.field_150448_aq, Blocks.field_150450_ax, Blocks.field_150322_A, Blocks.field_196583_aj, Blocks.field_196585_ak, Blocks.field_196798_hA, Blocks.field_196799_hB, Blocks.field_180395_cM, Blocks.field_150348_b, Blocks.field_196650_c, Blocks.field_196652_d, Blocks.field_196654_e, Blocks.field_196655_f, Blocks.field_196656_g, Blocks.field_196657_h, Blocks.field_150333_U, Blocks.field_222401_hJ, Blocks.field_196640_bx, Blocks.field_196643_by, Blocks.field_196646_bz, Blocks.field_196571_bA, Blocks.field_196573_bB, Blocks.field_196575_bC, Blocks.field_196576_bD, Blocks.field_196578_bE, Blocks.field_185771_cX, Blocks.field_196581_bI, Blocks.field_196582_bJ, Blocks.field_196580_bH, Blocks.field_196579_bG, Blocks.field_150430_aB, Blocks.field_150456_au, Blocks.field_222446_lj, Blocks.field_222447_lk, Blocks.field_222448_ll, Blocks.field_222449_lm, Blocks.field_222450_ln, Blocks.field_222451_lo, Blocks.field_222452_lp, Blocks.field_222453_lq, Blocks.field_222454_lr, Blocks.field_222455_ls, Blocks.field_222456_lt, Blocks.field_222457_lu, Blocks.field_222458_lv, Blocks.field_204409_il, Blocks.field_190975_dA, Blocks.field_190988_dw, Blocks.field_190989_dx, Blocks.field_190986_du, Blocks.field_190984_ds, Blocks.field_190990_dy, Blocks.field_190980_do, Blocks.field_196875_ie, Blocks.field_190982_dq, Blocks.field_190979_dn, Blocks.field_190978_dm, Blocks.field_190983_dr, Blocks.field_190987_dv, Blocks.field_190991_dz, Blocks.field_190977_dl, Blocks.field_190981_dp); - protected ItemPickaxe(IItemTier p_i48478_1_, int p_i48478_2_, float p_i48478_3_, Item.Properties p_i48478_4_) { + protected PickaxeItem(IItemTier p_i48478_1_, int p_i48478_2_, float p_i48478_3_, Item.Properties p_i48478_4_) { - super((float)p_i48478_2_, p_i48478_3_, p_i48478_1_, field_150915_c, p_i48478_4_); + super((float)p_i48478_2_, p_i48478_3_, p_i48478_1_, field_150915_c, p_i48478_4_.addToolType(net.minecraftforge.common.ToolType.PICKAXE, p_i48478_1_.func_200925_d())); } - public boolean func_150897_b(IBlockState p_150897_1_) { + public boolean func_150897_b(BlockState p_150897_1_) { Block block = p_150897_1_.func_177230_c(); int i = this.func_200891_e().func_200925_d(); - if (block == Blocks.field_150343_Z) { @@ -29,4 +29,4 @@ + return material == Material.field_151576_e || material == Material.field_151573_f || material == Material.field_151574_g; } - public float func_150893_a(ItemStack p_150893_1_, IBlockState p_150893_2_) { + public float func_150893_a(ItemStack p_150893_1_, BlockState p_150893_2_) { diff --git a/patches/minecraft/net/minecraft/item/Rarity.java.patch b/patches/minecraft/net/minecraft/item/Rarity.java.patch new file mode 100644 index 000000000..333800c24 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/Rarity.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/item/Rarity.java ++++ b/net/minecraft/item/Rarity.java +@@ -2,7 +2,7 @@ + + import net.minecraft.util.text.TextFormatting; + +-public enum Rarity { ++public enum Rarity implements net.minecraftforge.common.IExtensibleEnum { + COMMON(TextFormatting.WHITE), + UNCOMMON(TextFormatting.YELLOW), + RARE(TextFormatting.AQUA), +@@ -13,4 +13,8 @@ + private Rarity(TextFormatting p_i48837_3_) { + this.field_77937_e = p_i48837_3_; + } ++ ++ public static Rarity create(String name, TextFormatting p_i48837_3_) { ++ throw new IllegalStateException("Enum not extended"); ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ShearsItem.java.patch b/patches/minecraft/net/minecraft/item/ShearsItem.java.patch new file mode 100644 index 000000000..b7e7fcc03 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ShearsItem.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/item/ShearsItem.java ++++ b/net/minecraft/item/ShearsItem.java +@@ -38,4 +38,26 @@ + return 15.0F; + } + } ++ ++ @SuppressWarnings("deprecation") ++ @Override ++ public boolean func_111207_a(ItemStack stack, net.minecraft.entity.player.PlayerEntity playerIn, LivingEntity entity, net.minecraft.util.Hand hand) { ++ if (entity.field_70170_p.field_72995_K) return false; ++ if (entity instanceof net.minecraftforge.common.IShearable) { ++ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; ++ BlockPos pos = new BlockPos(entity.field_70165_t, entity.field_70163_u, entity.field_70161_v); ++ if (target.isShearable(stack, entity.field_70170_p, pos)) { ++ java.util.List drops = target.onSheared(stack, entity.field_70170_p, pos, ++ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantments.field_185308_t, stack)); ++ java.util.Random rand = new java.util.Random(); ++ drops.forEach(d -> { ++ net.minecraft.entity.item.ItemEntity ent = entity.func_70099_a(stack, 1.0F); ++ ent.func_213317_d(ent.func_213322_ci().func_72441_c((double)((rand.nextFloat() - rand.nextFloat()) * 0.1F), (double)(rand.nextFloat() * 0.05F), (double)((rand.nextFloat() - rand.nextFloat()) * 0.1F))); ++ }); ++ stack.func_222118_a(1, entity, e -> e.func_213334_d(hand)); ++ } ++ return true; ++ } ++ return false; ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ShovelItem.java.patch b/patches/minecraft/net/minecraft/item/ShovelItem.java.patch new file mode 100644 index 000000000..fdacac06f --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ShovelItem.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/item/ShovelItem.java ++++ b/net/minecraft/item/ShovelItem.java +@@ -21,7 +21,7 @@ + protected static final Map field_195955_e = Maps.newHashMap(ImmutableMap.of(Blocks.field_196658_i, Blocks.field_185774_da.func_176223_P())); + + public ShovelItem(IItemTier p_i48469_1_, float p_i48469_2_, float p_i48469_3_, Item.Properties p_i48469_4_) { +- super(p_i48469_2_, p_i48469_3_, p_i48469_1_, field_150916_c, p_i48469_4_); ++ super(p_i48469_2_, p_i48469_3_, p_i48469_1_, field_150916_c, p_i48469_4_.addToolType(net.minecraftforge.common.ToolType.SHOVEL, p_i48469_1_.func_200925_d())); + } + + public boolean func_150897_b(BlockState p_150897_1_) { +@@ -32,7 +32,7 @@ + public ActionResultType func_195939_a(ItemUseContext p_195939_1_) { + World world = p_195939_1_.func_195991_k(); + BlockPos blockpos = p_195939_1_.func_195995_a(); +- if (p_195939_1_.func_196000_l() != Direction.DOWN && world.func_180495_p(blockpos.func_177984_a()).func_196958_f()) { ++ if (p_195939_1_.func_196000_l() != Direction.DOWN && world.func_180495_p(blockpos.func_177984_a()).isAir(world, blockpos.func_177984_a())) { + BlockState blockstate = field_195955_e.get(world.func_180495_p(blockpos).func_177230_c()); + if (blockstate != null) { + PlayerEntity playerentity = p_195939_1_.func_195999_j(); diff --git a/patches/minecraft/net/minecraft/item/ItemTool.java.patch b/patches/minecraft/net/minecraft/item/ToolItem.java.patch similarity index 61% rename from patches/minecraft/net/minecraft/item/ItemTool.java.patch rename to patches/minecraft/net/minecraft/item/ToolItem.java.patch index 107c9e21d..86958c9e0 100644 --- a/patches/minecraft/net/minecraft/item/ItemTool.java.patch +++ b/patches/minecraft/net/minecraft/item/ToolItem.java.patch @@ -1,9 +1,9 @@ ---- a/net/minecraft/item/ItemTool.java -+++ b/net/minecraft/item/ItemTool.java +--- a/net/minecraft/item/ToolItem.java ++++ b/net/minecraft/item/ToolItem.java @@ -26,6 +26,7 @@ } - public float func_150893_a(ItemStack p_150893_1_, IBlockState p_150893_2_) { + public float func_150893_a(ItemStack p_150893_1_, BlockState p_150893_2_) { + if (getToolTypes(p_150893_1_).stream().anyMatch(e -> p_150893_2_.isToolEffective(e))) return field_77864_a; return this.field_150914_c.contains(p_150893_2_.func_177230_c()) ? this.field_77864_a : 1.0F; } diff --git a/patches/minecraft/net/minecraft/item/crafting/AbstractCookingRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/AbstractCookingRecipe.java.patch new file mode 100644 index 000000000..b330f8fc4 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/AbstractCookingRecipe.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/item/crafting/AbstractCookingRecipe.java ++++ b/net/minecraft/item/crafting/AbstractCookingRecipe.java +@@ -35,7 +35,6 @@ + return this.field_222143_e.func_77946_l(); + } + +- @OnlyIn(Dist.CLIENT) + public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { + return true; + } +@@ -54,7 +53,6 @@ + return this.field_222143_e; + } + +- @OnlyIn(Dist.CLIENT) + public String func_193358_e() { + return this.field_222141_c; + } diff --git a/patches/minecraft/net/minecraft/item/crafting/ArmorDyeRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/ArmorDyeRecipe.java.patch new file mode 100644 index 000000000..2c309f4ad --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/ArmorDyeRecipe.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/item/crafting/ArmorDyeRecipe.java ++++ b/net/minecraft/item/crafting/ArmorDyeRecipe.java +@@ -31,7 +31,7 @@ + + itemstack = itemstack1; + } else { +- if (!(itemstack1.func_77973_b() instanceof DyeItem)) { ++ if (!(itemstack.func_77973_b() instanceof DyeItem)) { + return false; + } + +@@ -74,7 +74,6 @@ + } + } + +- @OnlyIn(Dist.CLIENT) + public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { + return p_194133_1_ * p_194133_2_ >= 2; + } diff --git a/patches/minecraft/net/minecraft/item/crafting/BannerAddPatternRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/BannerAddPatternRecipe.java.patch deleted file mode 100644 index 9c7b83e70..000000000 --- a/patches/minecraft/net/minecraft/item/crafting/BannerAddPatternRecipe.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/item/crafting/BannerAddPatternRecipe.java -+++ b/net/minecraft/item/crafting/BannerAddPatternRecipe.java -@@ -15,8 +15,6 @@ - import net.minecraft.tileentity.TileEntityBanner; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class BannerAddPatternRecipe extends IRecipeHidden { - public BannerAddPatternRecipe(ResourceLocation p_i48172_1_) { -@@ -167,7 +165,6 @@ - return null; - } - -- @OnlyIn(Dist.CLIENT) - public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { - return p_194133_1_ >= 3 && p_194133_2_ >= 3; - } diff --git a/patches/minecraft/net/minecraft/item/crafting/BannerDuplicateRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/BannerDuplicateRecipe.java.patch index 371165ebd..18ab19056 100644 --- a/patches/minecraft/net/minecraft/item/crafting/BannerDuplicateRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/BannerDuplicateRecipe.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/item/crafting/BannerDuplicateRecipe.java +++ b/net/minecraft/item/crafting/BannerDuplicateRecipe.java -@@ -10,8 +10,6 @@ - import net.minecraft.util.NonNullList; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class BannerDuplicateRecipe extends IRecipeHidden { - public BannerDuplicateRecipe(ResourceLocation p_i48171_1_) { -@@ -77,8 +75,8 @@ +@@ -79,8 +79,8 @@ for(int i = 0; i < nonnulllist.size(); ++i) { ItemStack itemstack = p_179532_1_.func_70301_a(i); if (!itemstack.func_190926_b()) { @@ -17,11 +8,11 @@ - nonnulllist.set(i, new ItemStack(itemstack.func_77973_b().func_77668_q())); + if (itemstack.hasContainerItem()) { + nonnulllist.set(i, itemstack.getContainerItem()); - } else if (itemstack.func_77942_o() && TileEntityBanner.func_175113_c(itemstack) > 0) { + } else if (itemstack.func_77942_o() && BannerTileEntity.func_175113_c(itemstack) > 0) { ItemStack itemstack1 = itemstack.func_77946_l(); itemstack1.func_190920_e(1); -@@ -94,7 +92,6 @@ - return RecipeSerializers.field_199586_l; +@@ -96,7 +96,6 @@ + return IRecipeSerializer.field_222167_k; } - @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/item/crafting/BlastingRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/BlastingRecipe.java.patch new file mode 100644 index 000000000..87501b1c9 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/BlastingRecipe.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/item/crafting/BlastingRecipe.java ++++ b/net/minecraft/item/crafting/BlastingRecipe.java +@@ -11,7 +11,6 @@ + super(IRecipeType.field_222151_c, p_i50031_1_, p_i50031_2_, p_i50031_3_, p_i50031_4_, p_i50031_5_, p_i50031_6_); + } + +- @OnlyIn(Dist.CLIENT) + public ItemStack func_222128_h() { + return new ItemStack(Blocks.field_222424_lM); + } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeBookCloning.java.patch b/patches/minecraft/net/minecraft/item/crafting/BookCloningRecipe.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/item/crafting/RecipeBookCloning.java.patch rename to patches/minecraft/net/minecraft/item/crafting/BookCloningRecipe.java.patch index 022648b97..94b36464b 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeBookCloning.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/BookCloningRecipe.java.patch @@ -1,15 +1,6 @@ ---- a/net/minecraft/item/crafting/RecipeBookCloning.java -+++ b/net/minecraft/item/crafting/RecipeBookCloning.java -@@ -9,8 +9,6 @@ - import net.minecraft.util.NonNullList; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class RecipeBookCloning extends IRecipeHidden { - public RecipeBookCloning(ResourceLocation p_i48170_1_) { -@@ -86,8 +84,8 @@ +--- a/net/minecraft/item/crafting/BookCloningRecipe.java ++++ b/net/minecraft/item/crafting/BookCloningRecipe.java +@@ -81,8 +81,8 @@ for(int i = 0; i < nonnulllist.size(); ++i) { ItemStack itemstack = p_179532_1_.func_70301_a(i); @@ -17,11 +8,11 @@ - nonnulllist.set(i, new ItemStack(itemstack.func_77973_b().func_77668_q())); + if (itemstack.hasContainerItem()) { + nonnulllist.set(i, itemstack.getContainerItem()); - } else if (itemstack.func_77973_b() instanceof ItemWrittenBook) { + } else if (itemstack.func_77973_b() instanceof WrittenBookItem) { ItemStack itemstack1 = itemstack.func_77946_l(); itemstack1.func_190920_e(1); -@@ -103,7 +101,6 @@ - return RecipeSerializers.field_199578_d; +@@ -98,7 +98,6 @@ + return IRecipeSerializer.field_222160_d; } - @OnlyIn(Dist.CLIENT) diff --git a/patches/minecraft/net/minecraft/item/crafting/CampfireCookingRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/CampfireCookingRecipe.java.patch new file mode 100644 index 000000000..ba94427dc --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/CampfireCookingRecipe.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/item/crafting/CampfireCookingRecipe.java ++++ b/net/minecraft/item/crafting/CampfireCookingRecipe.java +@@ -11,7 +11,6 @@ + super(IRecipeType.field_222153_e, p_i50030_1_, p_i50030_2_, p_i50030_3_, p_i50030_4_, p_i50030_5_, p_i50030_6_); + } + +- @OnlyIn(Dist.CLIENT) + public ItemStack func_222128_h() { + return new ItemStack(Blocks.field_222433_lV); + } diff --git a/patches/minecraft/net/minecraft/item/crafting/FireworkRocketRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/FireworkRocketRecipe.java.patch index c47f887e2..974f5ccb5 100644 --- a/patches/minecraft/net/minecraft/item/crafting/FireworkRocketRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/FireworkRocketRecipe.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/item/crafting/FireworkRocketRecipe.java +++ b/net/minecraft/item/crafting/FireworkRocketRecipe.java -@@ -9,8 +9,6 @@ - import net.minecraft.nbt.NBTTagList; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class FireworkRocketRecipe extends IRecipeHidden { - private static final Ingredient field_196209_a = Ingredient.func_199804_a(Items.field_151121_aF); -@@ -80,7 +78,6 @@ +@@ -74,7 +74,6 @@ return itemstack; } diff --git a/patches/minecraft/net/minecraft/item/crafting/FireworkStarFadeRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/FireworkStarFadeRecipe.java.patch index fd15c1210..dc268b845 100644 --- a/patches/minecraft/net/minecraft/item/crafting/FireworkStarFadeRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/FireworkStarFadeRecipe.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/item/crafting/FireworkStarFadeRecipe.java +++ b/net/minecraft/item/crafting/FireworkStarFadeRecipe.java -@@ -10,8 +10,6 @@ - import net.minecraft.item.ItemStack; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class FireworkStarFadeRecipe extends IRecipeHidden { - private static final Ingredient field_196217_a = Ingredient.func_199804_a(Items.field_196153_dF); -@@ -73,7 +71,6 @@ +@@ -68,7 +68,6 @@ } } diff --git a/patches/minecraft/net/minecraft/item/crafting/FireworkStarRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/FireworkStarRecipe.java.patch index bf2e64390..95c5b8677 100644 --- a/patches/minecraft/net/minecraft/item/crafting/FireworkStarRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/FireworkStarRecipe.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/item/crafting/FireworkStarRecipe.java +++ b/net/minecraft/item/crafting/FireworkStarRecipe.java -@@ -15,8 +15,6 @@ - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.Util; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class FireworkStarRecipe extends IRecipeHidden { - private static final Ingredient field_196212_a = Ingredient.func_199804_a(Items.field_151059_bz, Items.field_151008_G, Items.field_151074_bl, Items.field_196182_dv, Items.field_196183_dw, Items.field_196185_dy, Items.field_196184_dx, Items.field_196151_dA, Items.field_196186_dz); -@@ -116,7 +114,6 @@ +@@ -111,7 +111,6 @@ return itemstack; } diff --git a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipe.java.patch index fda96f381..2b3c22d4a 100644 --- a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipe.java.patch @@ -1,61 +1,10 @@ --- a/net/minecraft/item/crafting/FurnaceRecipe.java +++ b/net/minecraft/item/crafting/FurnaceRecipe.java -@@ -11,8 +11,6 @@ - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.registry.IRegistry; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class FurnaceRecipe implements IRecipe { - private final ResourceLocation field_201832_a; -@@ -32,14 +30,13 @@ - } - - public boolean func_77569_a(IInventory p_77569_1_, World p_77569_2_) { -- return p_77569_1_ instanceof TileEntityFurnace && this.field_201834_c.test(p_77569_1_.func_70301_a(0)); -+ return this.field_201834_c.test(p_77569_1_.func_70301_a(0)); - } - - public ItemStack func_77572_b(IInventory p_77572_1_) { - return this.field_201835_d.func_77946_l(); +@@ -11,7 +11,6 @@ + super(IRecipeType.field_222150_b, p_i48715_1_, p_i48715_2_, p_i48715_3_, p_i48715_4_, p_i48715_5_, p_i48715_6_); } - @OnlyIn(Dist.CLIENT) - public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { - return true; + public ItemStack func_222128_h() { + return new ItemStack(Blocks.field_150460_al); } -@@ -62,7 +59,6 @@ - return this.field_201835_d; - } - -- @OnlyIn(Dist.CLIENT) - public String func_193358_e() { - return this.field_201833_b; - } -@@ -75,7 +71,13 @@ - return this.field_201832_a; - } - -+ @Override -+ public net.minecraftforge.common.crafting.RecipeType getType() { -+ return net.minecraftforge.common.crafting.VanillaRecipeTypes.SMELTING; -+ } -+ - public static class Serializer implements IRecipeSerializer { -+ private static ResourceLocation NAME = new ResourceLocation("minecraft", "smelting"); - public FurnaceRecipe func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_) { - String s = JsonUtils.func_151219_a(p_199425_2_, "group", ""); - Ingredient ingredient; -@@ -114,8 +116,9 @@ - p_199427_1_.func_150787_b(p_199427_2_.field_201837_f); - } - -- public String func_199567_a() { -- return "smelting"; -+ @Override -+ public ResourceLocation getName() { -+ return NAME; - } - } - } diff --git a/patches/minecraft/net/minecraft/item/crafting/IRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/IRecipe.java.patch index b68671f66..191724805 100644 --- a/patches/minecraft/net/minecraft/item/crafting/IRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/IRecipe.java.patch @@ -1,28 +1,16 @@ --- a/net/minecraft/item/crafting/IRecipe.java +++ b/net/minecraft/item/crafting/IRecipe.java -@@ -1,20 +1,16 @@ - package net.minecraft.item.crafting; +@@ -15,8 +15,7 @@ - import net.minecraft.inventory.IInventory; --import net.minecraft.item.Item; - import net.minecraft.item.ItemStack; - import net.minecraft.util.NonNullList; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - --public interface IRecipe { -+public interface IRecipe extends net.minecraftforge.common.extensions.IForgeRecipe { - boolean func_77569_a(IInventory p_77569_1_, World p_77569_2_); - - ItemStack func_77572_b(IInventory p_77572_1_); + ItemStack func_77572_b(C p_77572_1_); - @OnlyIn(Dist.CLIENT) - boolean func_194133_a(int p_194133_1_, int p_194133_2_); +- boolean func_194133_a(int p_194133_1_, int p_194133_2_); ++ default boolean func_194133_a(int p_194133_1_, int p_194133_2_) { return true; } ItemStack func_77571_b(); -@@ -23,9 +19,9 @@ + +@@ -24,9 +23,9 @@ NonNullList nonnulllist = NonNullList.func_191197_a(p_179532_1_.func_70302_i_(), ItemStack.field_190927_a); for(int i = 0; i < nonnulllist.size(); ++i) { @@ -35,7 +23,7 @@ } } -@@ -40,7 +36,6 @@ +@@ -41,12 +40,10 @@ return false; } @@ -43,3 +31,8 @@ default String func_193358_e() { return ""; } + +- @OnlyIn(Dist.CLIENT) + default ItemStack func_222128_h() { + return new ItemStack(Blocks.field_150462_ai); + } diff --git a/patches/minecraft/net/minecraft/item/crafting/IRecipePlacer.java.patch b/patches/minecraft/net/minecraft/item/crafting/IRecipePlacer.java.patch index 3f0d232ca..1a0f0d345 100644 --- a/patches/minecraft/net/minecraft/item/crafting/IRecipePlacer.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/IRecipePlacer.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/item/crafting/IRecipePlacer.java +++ b/net/minecraft/item/crafting/IRecipePlacer.java @@ -7,10 +7,10 @@ - default void func_201501_a(int p_201501_1_, int p_201501_2_, int p_201501_3_, IRecipe p_201501_4_, Iterator p_201501_5_, int p_201501_6_) { + default void func_201501_a(int p_201501_1_, int p_201501_2_, int p_201501_3_, IRecipe p_201501_4_, Iterator p_201501_5_, int p_201501_6_) { int i = p_201501_1_; int j = p_201501_2_; - if (p_201501_4_ instanceof ShapedRecipe) { diff --git a/patches/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch b/patches/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch deleted file mode 100644 index 0f8ff7136..000000000 --- a/patches/minecraft/net/minecraft/item/crafting/IRecipeSerializer.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/net/minecraft/item/crafting/IRecipeSerializer.java -+++ b/net/minecraft/item/crafting/IRecipeSerializer.java -@@ -11,5 +11,11 @@ - - void func_199427_a_(PacketBuffer p_199427_1_, T p_199427_2_); - -- String func_199567_a(); -+ @Deprecated //Modders, do not use, this is un-namespaced and thus could cause clashes. -+ default String func_199567_a() { -+ ResourceLocation name = getName(); //To keep compatibility with vanilla, anything in the "minecraft" namespace doesn't get a prefix. -+ return name.func_110624_b().equals("minecraft") ? name.func_110623_a() : name.toString(); -+ } -+ -+ ResourceLocation getName(); - } diff --git a/patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch b/patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch index a8ab59574..1a88a17db 100644 --- a/patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch @@ -1,11 +1,7 @@ --- a/net/minecraft/item/crafting/Ingredient.java +++ b/net/minecraft/item/crafting/Ingredient.java -@@ -26,10 +26,14 @@ - import net.minecraft.util.JsonUtils; - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.registry.IRegistry; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; +@@ -30,6 +30,12 @@ + import net.minecraftforge.api.distmarker.OnlyIn; public class Ingredient implements Predicate { + //Because Mojang caches things... we need to invalidate them.. so... here we go.. @@ -17,7 +13,7 @@ private static final Predicate field_209362_b = (p_209361_0_) -> { return !p_209361_0_.func_199799_a().stream().allMatch(ItemStack::func_190926_b); }; -@@ -37,14 +41,16 @@ +@@ -37,14 +43,16 @@ private final Ingredient.IItemList[] field_199807_b; private ItemStack[] field_193371_b; private IntList field_194140_c; @@ -35,7 +31,7 @@ public ItemStack[] func_193365_a() { this.func_199806_d(); return this.field_193371_b; -@@ -96,6 +102,10 @@ +@@ -96,6 +104,10 @@ public final void func_199564_a(PacketBuffer p_199564_1_) { this.func_199806_d(); @@ -46,7 +42,7 @@ p_199564_1_.func_150787_b(this.field_193371_b.length); for(int i = 0; i < this.field_193371_b.length; ++i) { -@@ -122,6 +132,25 @@ +@@ -122,6 +134,25 @@ return this.field_199807_b.length == 0 && (this.field_193371_b == null || this.field_193371_b.length == 0) && (this.field_194140_c == null || this.field_194140_c.isEmpty()); } @@ -72,7 +68,7 @@ public static Ingredient func_209357_a(Stream p_209357_0_) { Ingredient ingredient = new Ingredient(p_209357_0_); return ingredient.field_199807_b.length == 0 ? field_193370_a : ingredient; -@@ -133,7 +162,6 @@ +@@ -133,7 +164,6 @@ })); } @@ -80,7 +76,7 @@ public static Ingredient func_193369_a(ItemStack... p_193369_0_) { return func_209357_a(Arrays.stream(p_193369_0_).map((p_209356_0_) -> { return new Ingredient.SingleItemList(p_209356_0_); -@@ -146,6 +174,9 @@ +@@ -146,6 +176,9 @@ public static Ingredient func_199566_b(PacketBuffer p_199566_0_) { int i = p_199566_0_.func_150792_a(); @@ -90,7 +86,7 @@ return func_209357_a(Stream.generate(() -> { return new Ingredient.SingleItemList(p_199566_0_.func_150791_c()); }).limit((long)i)); -@@ -153,6 +184,8 @@ +@@ -153,6 +186,8 @@ public static Ingredient func_199802_a(@Nullable JsonElement p_199802_0_) { if (p_199802_0_ != null && !p_199802_0_.isJsonNull()) { @@ -99,19 +95,19 @@ if (p_199802_0_.isJsonObject()) { return func_209357_a(Stream.of(func_199803_a(p_199802_0_.getAsJsonObject()))); } else if (p_199802_0_.isJsonArray()) { -@@ -173,6 +206,11 @@ +@@ -173,6 +208,11 @@ } public static Ingredient.IItemList func_199803_a(JsonObject p_199803_0_) { + if (p_199803_0_.has("constant")) { -+ Ingredient.IItemList ret = net.minecraftforge.common.crafting.CraftingHelper.getConstant(new ResourceLocation(JsonUtils.func_151200_h(p_199803_0_, "constant"))); -+ if (ret == null) throw new JsonSyntaxException("Ingredient referenced invalid constant: " + JsonUtils.func_151200_h(p_199803_0_, "constant")); ++ Ingredient.IItemList ret = net.minecraftforge.common.crafting.CraftingHelper.getConstant(new ResourceLocation(JSONUtils.func_151200_h(p_199803_0_, "constant"))); ++ if (ret == null) throw new JsonSyntaxException("Ingredient referenced invalid constant: " + JSONUtils.func_151200_h(p_199803_0_, "constant")); + return ret; + } if (p_199803_0_.has("item") && p_199803_0_.has("tag")) { throw new JsonParseException("An ingredient entry is either a tag or an item, not both"); } else if (p_199803_0_.has("item")) { -@@ -196,6 +234,12 @@ +@@ -194,6 +234,12 @@ } } diff --git a/patches/minecraft/net/minecraft/item/crafting/MapCloningRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/MapCloningRecipe.java.patch new file mode 100644 index 000000000..c3b177fbf --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/MapCloningRecipe.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/item/crafting/MapCloningRecipe.java ++++ b/net/minecraft/item/crafting/MapCloningRecipe.java +@@ -71,7 +71,6 @@ + } + } + +- @OnlyIn(Dist.CLIENT) + public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { + return p_194133_1_ >= 3 && p_194133_2_ >= 3; + } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeItemHelper.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeItemHelper.java.patch deleted file mode 100644 index 3e4868252..000000000 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeItemHelper.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/item/crafting/RecipeItemHelper.java -+++ b/net/minecraft/item/crafting/RecipeItemHelper.java -@@ -26,9 +26,13 @@ - } - - public void func_194112_a(ItemStack p_194112_1_) { -- if (!p_194112_1_.func_190926_b()) { -- int i = func_194113_b(p_194112_1_); -- int j = p_194112_1_.func_190916_E(); -+ this.accountStack(p_194112_1_, -1); -+ } -+ -+ public void accountStack(ItemStack stack, int forceCount) { -+ if (!stack.func_190926_b()) { -+ int i = func_194113_b(stack); -+ int j = forceCount == -1 ? stack.func_190916_E() : forceCount; - this.func_194117_b(i, j); - } - diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeManager.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeManager.java.patch index ffe6fe7ad..5f9748e08 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeManager.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeManager.java.patch @@ -1,19 +1,7 @@ --- a/net/minecraft/item/crafting/RecipeManager.java +++ b/net/minecraft/item/crafting/RecipeManager.java -@@ -25,7 +25,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - --public class RecipeManager implements IResourceManagerReloadListener { -+public class RecipeManager extends net.minecraftforge.common.extensions.ForgeRecipeManager { - private static final Logger field_199521_c = LogManager.getLogger(); - public static final int field_199519_a = "recipes/".length(); - public static final int field_199520_b = ".json".length(); -@@ -36,9 +36,10 @@ - Gson gson = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().create(); - this.field_199523_e = false; - this.field_199522_d.clear(); -+ super.func_195410_a(p_195410_1_); +@@ -46,7 +46,7 @@ + func_215374_a(this.field_199522_d); for(ResourceLocation resourcelocation : p_195410_1_.func_199003_a("recipes", (p_199516_0_) -> { - return p_199516_0_.endsWith(".json"); @@ -21,49 +9,12 @@ })) { String s = resourcelocation.func_110623_a(); ResourceLocation resourcelocation1 = new ResourceLocation(resourcelocation.func_110624_b(), s.substring(field_199519_a, s.length() - field_199520_b)); -@@ -47,6 +48,8 @@ - JsonObject jsonobject = JsonUtils.func_188178_a(gson, IOUtils.toString(iresource.func_199027_b(), StandardCharsets.UTF_8), JsonObject.class); +@@ -55,6 +55,8 @@ + JsonObject jsonobject = JSONUtils.func_188178_a(gson, IOUtils.toString(iresource.func_199027_b(), StandardCharsets.UTF_8), JsonObject.class); if (jsonobject == null) { field_199521_c.error("Couldn't load recipe {} as it's null or empty", (Object)resourcelocation1); -+ } else if (jsonobject.has("conditions") && !net.minecraftforge.common.crafting.CraftingHelper.processConditions(JsonUtils.func_151214_t(jsonobject, "conditions"))) { ++ } else if (jsonobject.has("conditions") && !net.minecraftforge.common.crafting.CraftingHelper.processConditions(JSONUtils.func_151214_t(jsonobject, "conditions"))) { + field_199521_c.info("Skipping loading recipe {} as it's conditions were not met", resourcelocation1); } else { - this.func_199509_a(RecipeSerializers.func_199572_a(resourcelocation1, jsonobject)); + this.func_199509_a(func_215377_a(resourcelocation1, jsonobject)); } -@@ -67,9 +70,12 @@ - throw new IllegalStateException("Duplicate recipe ignored with ID " + p_199509_1_.func_199560_c()); - } else { - this.field_199522_d.put(p_199509_1_.func_199560_c(), p_199509_1_); -+ if(!p_199509_1_.getType().getBaseClass().isAssignableFrom(p_199509_1_.getClass())) throw new IllegalStateException(String.format("Recipe type %s is not valid for class %s", p_199509_1_.getType().getBaseClass().getName(), p_199509_1_.getClass().getName())); -+ ((java.util.List) getRecipes(p_199509_1_.getType())).add(p_199509_1_); - } - } - -+ @Deprecated //Forge Use getResult(IInventory, World, RecipeType) - public ItemStack func_199514_a(IInventory p_199514_1_, World p_199514_2_) { - for(IRecipe irecipe : this.field_199522_d.values()) { - if (irecipe.func_77569_a(p_199514_1_, p_199514_2_)) { -@@ -81,6 +87,7 @@ - } - - @Nullable -+ @Deprecated //Forge: Use getRecipe(IInventory, World, RecipeType) - public IRecipe func_199515_b(IInventory p_199515_1_, World p_199515_2_) { - for(IRecipe irecipe : this.field_199522_d.values()) { - if (irecipe.func_77569_a(p_199515_1_, p_199515_2_)) { -@@ -91,6 +98,7 @@ - return null; - } - -+ @Deprecated //Forge: Use getRemainingItems(IInventory, World, RecipeType) - public NonNullList func_199513_c(IInventory p_199513_1_, World p_199513_2_) { - for(IRecipe irecipe : this.field_199522_d.values()) { - if (irecipe.func_77569_a(p_199513_1_, p_199513_2_)) { -@@ -123,5 +131,7 @@ - @OnlyIn(Dist.CLIENT) - public void func_199518_d() { - this.field_199522_d.clear(); -+ this.sortedRecipes.clear(); - } -+ - } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch deleted file mode 100644 index bb765c284..000000000 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/net/minecraft/item/crafting/RecipeRepairItem.java -+++ b/net/minecraft/item/crafting/RecipeRepairItem.java -@@ -4,12 +4,9 @@ - import java.util.List; - import net.minecraft.inventory.IInventory; - import net.minecraft.inventory.InventoryCrafting; --import net.minecraft.item.Item; - import net.minecraft.item.ItemStack; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class RecipeRepairItem extends IRecipeHidden { - public RecipeRepairItem(ResourceLocation p_i48163_1_) { -@@ -59,11 +56,10 @@ - ItemStack itemstack3 = list.get(0); - ItemStack itemstack4 = list.get(1); - if (itemstack3.func_77973_b() == itemstack4.func_77973_b() && itemstack3.func_190916_E() == 1 && itemstack4.func_190916_E() == 1 && itemstack3.func_77973_b().func_77645_m()) { -- Item item = itemstack3.func_77973_b(); -- int j = item.func_77612_l() - itemstack3.func_77952_i(); -- int k = item.func_77612_l() - itemstack4.func_77952_i(); -- int l = j + k + item.func_77612_l() * 5 / 100; -- int i1 = item.func_77612_l() - l; -+ int j = itemstack3.func_77958_k() - itemstack3.func_77952_i(); -+ int k = itemstack3.func_77958_k() - itemstack4.func_77952_i(); -+ int l = j + k + itemstack3.func_77958_k() * 5 / 100; -+ int i1 = itemstack3.func_77958_k() - l; - if (i1 < 0) { - i1 = 0; - } -@@ -77,7 +73,6 @@ - return ItemStack.field_190927_a; - } - -- @OnlyIn(Dist.CLIENT) - public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { - return p_194133_1_ * p_194133_2_ >= 2; - } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeSerializers.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeSerializers.java.patch deleted file mode 100644 index 8aa19f506..000000000 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeSerializers.java.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- a/net/minecraft/item/crafting/RecipeSerializers.java -+++ b/net/minecraft/item/crafting/RecipeSerializers.java -@@ -10,7 +10,7 @@ - import net.minecraft.util.ResourceLocation; - - public class RecipeSerializers { -- private static final Map> field_199590_p = Maps.newHashMap(); -+ private static final Map> field_199590_p = Maps.newHashMap(); - public static final IRecipeSerializer field_199575_a = func_199573_a(new ShapedRecipe.Serializer()); - public static final IRecipeSerializer field_199576_b = func_199573_a(new ShapelessRecipe.Serializer()); - public static final RecipeSerializers.SimpleSerializer field_199577_c = func_199573_a(new RecipeSerializers.SimpleSerializer<>("crafting_special_armordye", RecipesArmorDyes::new)); -@@ -27,18 +27,19 @@ - public static final RecipeSerializers.SimpleSerializer field_199588_n = func_199573_a(new RecipeSerializers.SimpleSerializer<>("crafting_special_shielddecoration", ShieldRecipes::new)); - public static final RecipeSerializers.SimpleSerializer field_199589_o = func_199573_a(new RecipeSerializers.SimpleSerializer<>("crafting_special_shulkerboxcoloring", ShulkerBoxColoringRecipe::new)); - public static final IRecipeSerializer field_201839_p = func_199573_a(new FurnaceRecipe.Serializer()); -+ private static final java.util.Set VANILLA_TYPES = new java.util.HashSet<>(field_199590_p.keySet()); //Copy of vanilla so we can keep track for compatibility. - - public static , T extends IRecipe> S func_199573_a(S p_199573_0_) { -- if (field_199590_p.containsKey(p_199573_0_.func_199567_a())) { -- throw new IllegalArgumentException("Duplicate recipe serializer " + p_199573_0_.func_199567_a()); -+ if (field_199590_p.containsKey(p_199573_0_.getName())) { -+ throw new IllegalArgumentException("Duplicate recipe serializer " + p_199573_0_.getName()); - } else { -- field_199590_p.put(p_199573_0_.func_199567_a(), p_199573_0_); -+ field_199590_p.put(p_199573_0_.getName(), p_199573_0_); - return p_199573_0_; - } - } - - public static IRecipe func_199572_a(ResourceLocation p_199572_0_, JsonObject p_199572_1_) { -- String s = JsonUtils.func_151200_h(p_199572_1_, "type"); -+ ResourceLocation s = new ResourceLocation(JsonUtils.func_151200_h(p_199572_1_, "type")); - IRecipeSerializer irecipeserializer = field_199590_p.get(s); - if (irecipeserializer == null) { - throw new JsonSyntaxException("Invalid or unsupported recipe type '" + s + "'"); -@@ -49,7 +50,7 @@ - - public static IRecipe func_199571_a(PacketBuffer p_199571_0_) { - ResourceLocation resourcelocation = p_199571_0_.func_192575_l(); -- String s = p_199571_0_.func_150789_c(32767); -+ ResourceLocation s = new ResourceLocation(p_199571_0_.func_150789_c(32767)); - IRecipeSerializer irecipeserializer = field_199590_p.get(s); - if (irecipeserializer == null) { - throw new IllegalArgumentException("Unknown recipe serializer " + s); -@@ -68,10 +69,12 @@ - public static final class SimpleSerializer implements IRecipeSerializer { - private final String field_199569_a; - private final Function field_199570_b; -+ private final ResourceLocation name; - - public SimpleSerializer(String p_i48188_1_, Function p_i48188_2_) { - this.field_199569_a = p_i48188_1_; - this.field_199570_b = p_i48188_2_; -+ this.name = new ResourceLocation(field_199569_a); - } - - public T func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_) { -@@ -85,8 +88,9 @@ - public void func_199427_a_(PacketBuffer p_199427_1_, T p_199427_2_) { - } - -- public String func_199567_a() { -- return this.field_199569_a; -+ @Override -+ public ResourceLocation getName() { -+ return this.name; - } - } - } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeTippedArrow.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeTippedArrow.java.patch deleted file mode 100644 index c462a1c5b..000000000 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeTippedArrow.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/item/crafting/RecipeTippedArrow.java -+++ b/net/minecraft/item/crafting/RecipeTippedArrow.java -@@ -7,8 +7,6 @@ - import net.minecraft.potion.PotionUtils; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class RecipeTippedArrow extends IRecipeHidden { - public RecipeTippedArrow(ResourceLocation p_i48184_1_) { -@@ -53,7 +51,6 @@ - } - } - -- @OnlyIn(Dist.CLIENT) - public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { - return p_194133_1_ >= 2 && p_194133_2_ >= 2; - } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch deleted file mode 100644 index fa11356e4..000000000 --- a/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- a/net/minecraft/item/crafting/RecipesArmorDyes.java -+++ b/net/minecraft/item/crafting/RecipesArmorDyes.java -@@ -10,8 +10,6 @@ - import net.minecraft.item.ItemStack; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class RecipesArmorDyes extends IRecipeHidden { - public RecipesArmorDyes(ResourceLocation p_i48173_1_) { -@@ -35,7 +33,7 @@ - - itemstack = itemstack1; - } else { -- if (!(itemstack1.func_77973_b() instanceof ItemDye)) { -+ if (!itemstack1.func_77973_b().func_206844_a(net.minecraftforge.common.Tags.Items.DYES)) { - return false; - } - -@@ -79,11 +77,12 @@ - ++j; - } - } else { -- if (!(item instanceof ItemDye)) { -+ net.minecraft.item.EnumDyeColor color = net.minecraft.item.EnumDyeColor.getColor(itemstack1); -+ if (color == null) { - return ItemStack.field_190927_a; - } - -- float[] afloat = ((ItemDye)item).func_195962_g().func_193349_f(); -+ float[] afloat = color.func_193349_f(); - int l1 = (int)(afloat[0] * 255.0F); - int i2 = (int)(afloat[1] * 255.0F); - int k2 = (int)(afloat[2] * 255.0F); -@@ -114,7 +113,6 @@ - } - } - -- @OnlyIn(Dist.CLIENT) - public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { - return p_194133_1_ * p_194133_2_ >= 2; - } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch deleted file mode 100644 index 60970175e..000000000 --- a/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/item/crafting/RecipesMapCloning.java -+++ b/net/minecraft/item/crafting/RecipesMapCloning.java -@@ -6,8 +6,6 @@ - import net.minecraft.item.ItemStack; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class RecipesMapCloning extends IRecipeHidden { - public RecipesMapCloning(ResourceLocation p_i48165_1_) { -@@ -76,7 +74,6 @@ - } - } - -- @OnlyIn(Dist.CLIENT) - public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { - return p_194133_1_ >= 3 && p_194133_2_ >= 3; - } diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch index 08d130491..eed5bfddd 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipe.java.patch @@ -1,14 +1,11 @@ --- a/net/minecraft/item/crafting/ShapedRecipe.java +++ b/net/minecraft/item/crafting/ShapedRecipe.java -@@ -21,10 +21,21 @@ - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.registry.IRegistry; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; +@@ -23,7 +23,20 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; --public class ShapedRecipe implements IRecipe { -+public class ShapedRecipe implements IRecipe, net.minecraftforge.common.crafting.IShapedRecipe { +-public class ShapedRecipe implements ICraftingRecipe { ++public class ShapedRecipe implements ICraftingRecipe, net.minecraftforge.common.crafting.IShapedRecipe { + static int MAX_WIDTH = 3; + static int MAX_HEIGHT = 3; + /** @@ -25,15 +22,15 @@ private final int field_77576_b; private final int field_77577_c; private final NonNullList field_77574_d; -@@ -49,7 +60,6 @@ - return RecipeSerializers.field_199575_a; +@@ -48,7 +61,6 @@ + return IRecipeSerializer.field_222157_a; } - @OnlyIn(Dist.CLIENT) public String func_193358_e() { return this.field_194137_e; } -@@ -62,13 +72,12 @@ +@@ -61,7 +73,6 @@ return this.field_77574_d; } @@ -41,14 +38,7 @@ public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { return p_194133_1_ >= this.field_77576_b && p_194133_2_ >= this.field_77577_c; } - - public boolean func_77569_a(IInventory p_77569_1_, World p_77569_2_) { -- if (!(p_77569_1_ instanceof InventoryCrafting)) { -+ if (false) { - return false; - } else { - for(int i = 0; i <= p_77569_1_.func_174922_i() - this.field_77576_b; ++i) { -@@ -118,10 +127,20 @@ +@@ -113,10 +124,20 @@ return this.field_77576_b; } @@ -69,7 +59,7 @@ private static NonNullList func_192402_a(String[] p_192402_0_, Map p_192402_1_, int p_192402_2_, int p_192402_3_) { NonNullList nonnulllist = NonNullList.func_191197_a(p_192402_2_ * p_192402_3_, Ingredient.field_193370_a); Set set = Sets.newHashSet(p_192402_1_.keySet()); -@@ -203,15 +222,15 @@ +@@ -198,15 +219,15 @@ private static String[] func_192407_a(JsonArray p_192407_0_) { String[] astring = new String[p_192407_0_.size()]; @@ -81,7 +71,7 @@ throw new JsonSyntaxException("Invalid pattern: empty pattern not allowed"); } else { for(int i = 0; i < astring.length; ++i) { - String s = JsonUtils.func_151206_a(p_192407_0_.get(i), "pattern[" + i + "]"); + String s = JSONUtils.func_151206_a(p_192407_0_.get(i), "pattern[" + i + "]"); - if (s.length() > 3) { - throw new JsonSyntaxException("Invalid pattern: too many columns, 3 is maximum"); + if (s.length() > MAX_WIDTH) { @@ -89,10 +79,10 @@ } if (i > 0 && astring[0].length() != s.length()) { -@@ -253,11 +272,12 @@ +@@ -248,11 +269,12 @@ throw new JsonParseException("Disallowed data tag found"); } else { - int i = JsonUtils.func_151208_a(p_199798_0_, "count", 1); + int i = JSONUtils.func_151208_a(p_199798_0_, "count", 1); - return new ItemStack(item, i); + return net.minecraftforge.common.crafting.CraftingHelper.getItemStack(p_199798_0_, true); } @@ -101,17 +91,5 @@ public static class Serializer implements IRecipeSerializer { + private static final ResourceLocation NAME = new ResourceLocation("minecraft", "crafting_shaped"); public ShapedRecipe func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_) { - String s = JsonUtils.func_151219_a(p_199425_2_, "group", ""); - Map map = ShapedRecipe.func_192408_a(JsonUtils.func_152754_s(p_199425_2_, "key")); -@@ -269,8 +289,9 @@ - return new ShapedRecipe(p_199425_1_, s, i, j, nonnulllist, itemstack); - } - -- public String func_199567_a() { -- return "crafting_shaped"; -+ @Override -+ public ResourceLocation getName() { -+ return NAME; - } - - public ShapedRecipe func_199426_a_(ResourceLocation p_199426_1_, PacketBuffer p_199426_2_) { + String s = JSONUtils.func_151219_a(p_199425_2_, "group", ""); + Map map = ShapedRecipe.func_192408_a(JSONUtils.func_152754_s(p_199425_2_, "key")); diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipe.java.patch index 6294a3ab4..912e8ff36 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipe.java.patch @@ -1,14 +1,6 @@ --- a/net/minecraft/item/crafting/ShapelessRecipe.java +++ b/net/minecraft/item/crafting/ShapelessRecipe.java -@@ -12,20 +12,20 @@ - import net.minecraft.util.NonNullList; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class ShapelessRecipe implements IRecipe { - private final ResourceLocation field_199562_a; +@@ -19,12 +19,14 @@ private final String field_194138_c; private final ItemStack field_77580_a; private final NonNullList field_77579_b; @@ -23,45 +15,36 @@ } public ResourceLocation func_199560_c() { -@@ -36,7 +36,6 @@ - return RecipeSerializers.field_199576_b; +@@ -35,7 +37,6 @@ + return IRecipeSerializer.field_222158_b; } - @OnlyIn(Dist.CLIENT) public String func_193358_e() { return this.field_194138_c; } -@@ -50,10 +49,11 @@ - } +@@ -50,36 +51,39 @@ - public boolean func_77569_a(IInventory p_77569_1_, World p_77569_2_) { -- if (!(p_77569_1_ instanceof InventoryCrafting)) { -+ if (false) { - return false; - } else { - RecipeItemHelper recipeitemhelper = new RecipeItemHelper(); -+ java.util.List inputs = new java.util.ArrayList<>(); - int i = 0; + public boolean func_77569_a(CraftingInventory p_77569_1_, World p_77569_2_) { + RecipeItemHelper recipeitemhelper = new RecipeItemHelper(); ++ java.util.List inputs = new java.util.ArrayList<>(); + int i = 0; - for(int j = 0; j < p_77569_1_.func_174923_h(); ++j) { -@@ -61,12 +61,15 @@ - ItemStack itemstack = p_77569_1_.func_70301_a(k + j * p_77569_1_.func_174922_i()); - if (!itemstack.func_190926_b()) { - ++i; -+ if (isSimple) - recipeitemhelper.func_194112_a(new ItemStack(itemstack.func_77973_b())); -+ else -+ inputs.add(itemstack); - } - } + for(int j = 0; j < p_77569_1_.func_70302_i_(); ++j) { + ItemStack itemstack = p_77569_1_.func_70301_a(j); + if (!itemstack.func_190926_b()) { + ++i; ++ if (isSimple) + recipeitemhelper.func_221264_a(itemstack, 1); ++ else inputs.add(itemstack); } - -- return i == this.field_77579_b.size() && recipeitemhelper.func_194116_a(this, (IntList)null); -+ return i == this.field_77579_b.size() && (isSimple ? recipeitemhelper.func_194116_a(this, (IntList)null) : net.minecraftforge.common.util.RecipeMatcher.findMatches(inputs, this.field_77579_b) != null); } + +- return i == this.field_77579_b.size() && recipeitemhelper.func_194116_a(this, (IntList)null); ++ return i == this.field_77579_b.size() && (isSimple ? recipeitemhelper.func_194116_a(this, (IntList)null) : net.minecraftforge.common.util.RecipeMatcher.findMatches(inputs, this.field_77579_b) != null); } -@@ -74,19 +77,19 @@ + public ItemStack func_77572_b(CraftingInventory p_77572_1_) { return this.field_77580_a.func_77946_l(); } @@ -73,8 +56,8 @@ public static class Serializer implements IRecipeSerializer { + private static final ResourceLocation NAME = new ResourceLocation("minecraft", "crafting_shapeless"); public ShapelessRecipe func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_) { - String s = JsonUtils.func_151219_a(p_199425_2_, "group", ""); - NonNullList nonnulllist = func_199568_a(JsonUtils.func_151214_t(p_199425_2_, "ingredients")); + String s = JSONUtils.func_151219_a(p_199425_2_, "group", ""); + NonNullList nonnulllist = func_199568_a(JSONUtils.func_151214_t(p_199425_2_, "ingredients")); if (nonnulllist.isEmpty()) { throw new JsonParseException("No ingredients for shapeless recipe"); - } else if (nonnulllist.size() > 9) { @@ -82,17 +65,5 @@ + } else if (nonnulllist.size() > ShapedRecipe.MAX_WIDTH * ShapedRecipe.MAX_HEIGHT) { + throw new JsonParseException("Too many ingredients for shapeless recipe the max is " + (ShapedRecipe.MAX_WIDTH * ShapedRecipe.MAX_HEIGHT)); } else { - ItemStack itemstack = ShapedRecipe.func_199798_a(JsonUtils.func_152754_s(p_199425_2_, "result")); + ItemStack itemstack = ShapedRecipe.func_199798_a(JSONUtils.func_152754_s(p_199425_2_, "result")); return new ShapelessRecipe(p_199425_1_, s, itemstack, nonnulllist); -@@ -106,8 +109,9 @@ - return nonnulllist; - } - -- public String func_199567_a() { -- return "crafting_shapeless"; -+ @Override -+ public ResourceLocation getName() { -+ return NAME; - } - - public ShapelessRecipe func_199426_a_(ResourceLocation p_199426_1_, PacketBuffer p_199426_2_) { diff --git a/patches/minecraft/net/minecraft/item/crafting/ShieldRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShieldRecipes.java.patch index c8e1a00fb..c9bd39032 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShieldRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShieldRecipes.java.patch @@ -1,15 +1,6 @@ --- a/net/minecraft/item/crafting/ShieldRecipes.java +++ b/net/minecraft/item/crafting/ShieldRecipes.java -@@ -8,8 +8,6 @@ - import net.minecraft.nbt.NBTTagCompound; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class ShieldRecipes extends IRecipeHidden { - public ShieldRecipes(ResourceLocation p_i48160_1_) { -@@ -84,7 +82,6 @@ +@@ -79,7 +79,6 @@ } } diff --git a/patches/minecraft/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java.patch index f87f27f0b..93c2632a5 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java.patch @@ -1,51 +1,42 @@ --- a/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java +++ b/net/minecraft/item/crafting/ShulkerBoxColoringRecipe.java -@@ -10,8 +10,6 @@ - import net.minecraft.item.ItemStack; - import net.minecraft.util.ResourceLocation; - import net.minecraft.world.World; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; +@@ -27,7 +27,7 @@ + if (Block.func_149634_a(itemstack.func_77973_b()) instanceof ShulkerBoxBlock) { + ++i; + } else { +- if (!(itemstack.func_77973_b() instanceof DyeItem)) { ++ if (!itemstack.func_77973_b().func_206844_a(net.minecraftforge.common.Tags.Items.DYES)) { + return false; + } - public class ShulkerBoxColoringRecipe extends IRecipeHidden { - public ShulkerBoxColoringRecipe(ResourceLocation p_i48159_1_) { -@@ -31,7 +29,7 @@ - if (Block.func_149634_a(itemstack.func_77973_b()) instanceof BlockShulkerBox) { - ++i; - } else { -- if (!(itemstack.func_77973_b() instanceof ItemDye)) { -+ if (!itemstack.func_77973_b().func_206844_a(net.minecraftforge.common.Tags.Items.DYES)) { - return false; - } +@@ -45,7 +45,7 @@ -@@ -50,7 +48,7 @@ - - public ItemStack func_77572_b(IInventory p_77572_1_) { + public ItemStack func_77572_b(CraftingInventory p_77572_1_) { ItemStack itemstack = ItemStack.field_190927_a; -- ItemDye itemdye = (ItemDye)Items.field_196106_bc; -+ net.minecraft.item.EnumDyeColor color = net.minecraft.item.EnumDyeColor.WHITE; +- DyeItem dyeitem = (DyeItem)Items.field_222069_lA; ++ net.minecraft.item.DyeColor dyecolor = net.minecraft.item.DyeColor.WHITE; for(int i = 0; i < p_77572_1_.func_70302_i_(); ++i) { ItemStack itemstack1 = p_77572_1_.func_70301_a(i); -@@ -58,13 +56,14 @@ +@@ -53,13 +53,14 @@ Item item = itemstack1.func_77973_b(); - if (Block.func_149634_a(item) instanceof BlockShulkerBox) { + if (Block.func_149634_a(item) instanceof ShulkerBoxBlock) { itemstack = itemstack1; -- } else if (item instanceof ItemDye) { -- itemdye = (ItemDye)item; +- } else if (item instanceof DyeItem) { +- dyeitem = (DyeItem)item; + } else { -+ net.minecraft.item.EnumDyeColor tmp = net.minecraft.item.EnumDyeColor.getColor(itemstack1); -+ if (tmp != null) color = tmp; ++ net.minecraft.item.DyeColor tmp = net.minecraft.item.DyeColor.getColor(itemstack1); ++ if (tmp != null) dyecolor = tmp; } } } -- ItemStack itemstack2 = BlockShulkerBox.func_190953_b(itemdye.func_195962_g()); -+ ItemStack itemstack2 = BlockShulkerBox.func_190953_b(color); +- ItemStack itemstack2 = ShulkerBoxBlock.func_190953_b(dyeitem.func_195962_g()); ++ ItemStack itemstack2 = ShulkerBoxBlock.func_190953_b(dyecolor); if (itemstack.func_77942_o()) { itemstack2.func_77982_d(itemstack.func_77978_p().func_74737_b()); } -@@ -72,7 +71,6 @@ +@@ -67,7 +68,6 @@ return itemstack2; } diff --git a/patches/minecraft/net/minecraft/item/crafting/SmokingRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/SmokingRecipe.java.patch new file mode 100644 index 000000000..a1c3a601c --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/SmokingRecipe.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/item/crafting/SmokingRecipe.java ++++ b/net/minecraft/item/crafting/SmokingRecipe.java +@@ -11,7 +11,6 @@ + super(IRecipeType.field_222152_d, p_i50022_1_, p_i50022_2_, p_i50022_3_, p_i50022_4_, p_i50022_5_, p_i50022_6_); + } + +- @OnlyIn(Dist.CLIENT) + public ItemStack func_222128_h() { + return new ItemStack(Blocks.field_222423_lL); + } diff --git a/patches/minecraft/net/minecraft/item/crafting/StonecuttingRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/StonecuttingRecipe.java.patch new file mode 100644 index 000000000..8dc8a9e25 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/StonecuttingRecipe.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/item/crafting/StonecuttingRecipe.java ++++ b/net/minecraft/item/crafting/StonecuttingRecipe.java +@@ -17,7 +17,6 @@ + return this.field_222131_a.test(p_77569_1_.func_70301_a(0)); + } + +- @OnlyIn(Dist.CLIENT) + public ItemStack func_222128_h() { + return new ItemStack(Blocks.field_222430_lS); + } diff --git a/patches/minecraft/net/minecraft/item/crafting/SuspiciousStewRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/SuspiciousStewRecipe.java.patch new file mode 100644 index 000000000..4d4060897 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/SuspiciousStewRecipe.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/item/crafting/SuspiciousStewRecipe.java ++++ b/net/minecraft/item/crafting/SuspiciousStewRecipe.java +@@ -68,7 +68,6 @@ + return itemstack2; + } + +- @OnlyIn(Dist.CLIENT) + public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { + return p_194133_1_ >= 2 && p_194133_2_ >= 2; + } diff --git a/patches/minecraft/net/minecraft/item/crafting/TippedArrowRecipe.java.patch b/patches/minecraft/net/minecraft/item/crafting/TippedArrowRecipe.java.patch new file mode 100644 index 000000000..4d5926b6b --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/TippedArrowRecipe.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/item/crafting/TippedArrowRecipe.java ++++ b/net/minecraft/item/crafting/TippedArrowRecipe.java +@@ -53,7 +53,6 @@ + } + } + +- @OnlyIn(Dist.CLIENT) + public boolean func_194133_a(int p_194133_1_, int p_194133_2_) { + return p_194133_1_ >= 2 && p_194133_2_ >= 2; + } diff --git a/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch b/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch new file mode 100644 index 000000000..4c14a9a4b --- /dev/null +++ b/patches/minecraft/net/minecraft/nbt/CompoundNBT.java.patch @@ -0,0 +1,26 @@ +--- a/net/minecraft/nbt/CompoundNBT.java ++++ b/net/minecraft/nbt/CompoundNBT.java +@@ -72,6 +72,7 @@ + + @Nullable + public INBT func_218657_a(String p_218657_1_, INBT p_218657_2_) { ++ if (p_218657_2_ == null) throw new IllegalArgumentException("Invalid null NBT value with key " + p_218657_1_); + return this.field_74784_a.put(p_218657_1_, p_218657_2_); + } + +@@ -390,6 +391,7 @@ + } + + private static byte func_152447_a(DataInput p_152447_0_, NBTSizeTracker p_152447_1_) throws IOException { ++ p_152447_1_.func_152450_a(8); + return p_152447_0_.readByte(); + } + +@@ -398,6 +400,7 @@ + } + + static INBT func_152449_a(byte p_152449_0_, String p_152449_1_, DataInput p_152449_2_, int p_152449_3_, NBTSizeTracker p_152449_4_) throws IOException { ++ p_152449_4_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. + INBT inbt = INBT.func_150284_a(p_152449_0_); + + try { diff --git a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch index 36bba54f4..9d9c8a1c2 100644 --- a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -1,49 +1,40 @@ --- a/net/minecraft/nbt/CompressedStreamTools.java +++ b/net/minecraft/nbt/CompressedStreamTools.java -@@ -18,8 +18,6 @@ - import net.minecraft.crash.CrashReport; - import net.minecraft.crash.CrashReportCategory; - import net.minecraft.crash.ReportedException; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class CompressedStreamTools { - public static NBTTagCompound func_74796_a(InputStream p_74796_0_) throws IOException { -@@ -46,7 +44,6 @@ +@@ -38,7 +38,6 @@ } - @OnlyIn(Dist.CLIENT) - public static void func_74793_a(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException { + public static void func_74793_a(CompoundNBT p_74793_0_, File p_74793_1_) throws IOException { File file1 = new File(p_74793_1_.getAbsolutePath() + "_tmp"); if (file1.exists()) { -@@ -65,7 +62,6 @@ +@@ -57,7 +56,6 @@ } } - @OnlyIn(Dist.CLIENT) - public static void func_74795_b(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException { + public static void func_74795_b(CompoundNBT p_74795_0_, File p_74795_1_) throws IOException { DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(p_74795_1_)); -@@ -78,7 +74,6 @@ +@@ -70,7 +68,6 @@ } @Nullable - @OnlyIn(Dist.CLIENT) - public static NBTTagCompound func_74797_a(File p_74797_0_) throws IOException { + public static CompoundNBT func_74797_a(File p_74797_0_) throws IOException { if (!p_74797_0_.exists()) { return null; -@@ -123,10 +118,12 @@ +@@ -115,10 +112,12 @@ - private static INBTBase func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) throws IOException { + private static INBT func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) throws IOException { byte b0 = p_152455_0_.readByte(); + p_152455_2_.func_152450_a(8); // Forge: Count everything! if (b0 == 0) { - return new NBTTagEnd(); + return new EndNBT(); } else { - p_152455_0_.readUTF(); + NBTSizeTracker.readUTF(p_152455_2_, p_152455_0_.readUTF()); //Forge: Count this string. + p_152455_2_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. - INBTBase inbtbase = INBTBase.func_150284_a(b0); + INBT inbt = INBT.func_150284_a(b0); try { diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch deleted file mode 100644 index 716d5080c..000000000 --- a/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/nbt/NBTTagCompound.java -+++ b/net/minecraft/nbt/NBTTagCompound.java -@@ -71,6 +71,7 @@ - } - - public void func_74782_a(String p_74782_1_, INBTBase p_74782_2_) { -+ if (p_74782_2_ == null) throw new IllegalArgumentException("Invalid null NBT value with key " + p_74782_1_); - this.field_74784_a.put(p_74782_1_, p_74782_2_); - } - -@@ -389,6 +390,7 @@ - } - - private static byte func_152447_a(DataInput p_152447_0_, NBTSizeTracker p_152447_1_) throws IOException { -+ p_152447_1_.func_152450_a(8); - return p_152447_0_.readByte(); - } - -@@ -397,6 +399,7 @@ - } - - static INBTBase func_152449_a(byte p_152449_0_, String p_152449_1_, DataInput p_152449_2_, int p_152449_3_, NBTSizeTracker p_152449_4_) throws IOException { -+ p_152449_4_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. - INBTBase inbtbase = INBTBase.func_150284_a(p_152449_0_); - - try { diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch b/patches/minecraft/net/minecraft/nbt/StringNBT.java.patch similarity index 84% rename from patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch rename to patches/minecraft/net/minecraft/nbt/StringNBT.java.patch index c9dd0206a..3399f81ce 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch +++ b/patches/minecraft/net/minecraft/nbt/StringNBT.java.patch @@ -1,5 +1,5 @@ ---- a/net/minecraft/nbt/NBTTagString.java -+++ b/net/minecraft/nbt/NBTTagString.java +--- a/net/minecraft/nbt/StringNBT.java ++++ b/net/minecraft/nbt/StringNBT.java @@ -26,7 +26,7 @@ public void func_152446_a(DataInput p_152446_1_, int p_152446_2_, NBTSizeTracker p_152446_3_) throws IOException { p_152446_3_.func_152450_a(288L); diff --git a/patches/minecraft/net/minecraft/network/NetHandlerHandshakeTCP.java.patch b/patches/minecraft/net/minecraft/network/NetHandlerHandshakeTCP.java.patch deleted file mode 100644 index c28466f0d..000000000 --- a/patches/minecraft/net/minecraft/network/NetHandlerHandshakeTCP.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/network/NetHandlerHandshakeTCP.java -+++ b/net/minecraft/network/NetHandlerHandshakeTCP.java -@@ -17,6 +17,7 @@ - } - - public void func_147383_a(CPacketHandshake p_147383_1_) { -+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(p_147383_1_, this.field_147386_b)) return; - switch(p_147383_1_.func_149594_c()) { - case LOGIN: - this.field_147386_b.func_150723_a(EnumConnectionState.LOGIN); diff --git a/patches/minecraft/net/minecraft/network/NetHandlerLoginServer.java.patch b/patches/minecraft/net/minecraft/network/NetHandlerLoginServer.java.patch deleted file mode 100644 index 1a7a2ca87..000000000 --- a/patches/minecraft/net/minecraft/network/NetHandlerLoginServer.java.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- a/net/minecraft/network/NetHandlerLoginServer.java -+++ b/net/minecraft/network/NetHandlerLoginServer.java -@@ -54,7 +54,13 @@ - } - - public void func_73660_a() { -- if (this.field_147328_g == NetHandlerLoginServer.LoginState.READY_TO_ACCEPT) { -+ if (this.field_147328_g == LoginState.NEGOTIATING) { -+ // We force the state into "NEGOTIATING" which is otherwise unused. Once we're completed we move the negotiation onto "READY_TO_ACCEPT" -+ // Might want to promote player object creation to here as well.. -+ boolean negotiationComplete = net.minecraftforge.fml.network.NetworkHooks.tickNegotiation(this, this.field_147333_a, this.field_181025_l); -+ if (negotiationComplete) -+ this.field_147328_g = LoginState.READY_TO_ACCEPT; -+ } else if (this.field_147328_g == NetHandlerLoginServer.LoginState.READY_TO_ACCEPT) { - this.func_147326_c(); - } else if (this.field_147328_g == NetHandlerLoginServer.LoginState.DELAY_ACCEPT) { - EntityPlayerMP entityplayermp = this.field_147327_f.func_184103_al().func_177451_a(this.field_147337_i.getId()); -@@ -125,7 +131,7 @@ - this.field_147328_g = NetHandlerLoginServer.LoginState.KEY; - this.field_147333_a.func_179290_a(new SPacketEncryptionRequest("", this.field_147327_f.func_71250_E().getPublic(), this.field_147330_e)); - } else { -- this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; -+ this.field_147328_g = NetHandlerLoginServer.LoginState.NEGOTIATING; - } - - } -@@ -139,7 +145,7 @@ - this.field_147335_k = p_147315_1_.func_149300_a(privatekey); - this.field_147328_g = NetHandlerLoginServer.LoginState.AUTHENTICATING; - this.field_147333_a.func_150727_a(this.field_147335_k); -- Thread thread = new Thread("User Authenticator #" + field_147331_b.incrementAndGet()) { -+ Thread thread = new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, "User Authenticator #" + field_147331_b.incrementAndGet()) { - public void run() { - GameProfile gameprofile = NetHandlerLoginServer.this.field_147337_i; - -@@ -148,11 +154,11 @@ - NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.field_147327_f.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.func_191235_a()); - if (NetHandlerLoginServer.this.field_147337_i != null) { - NetHandlerLoginServer.field_147332_c.info("UUID of player {} is {}", NetHandlerLoginServer.this.field_147337_i.getName(), NetHandlerLoginServer.this.field_147337_i.getId()); -- NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; -+ NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.NEGOTIATING; - } else if (NetHandlerLoginServer.this.field_147327_f.func_71264_H()) { - NetHandlerLoginServer.field_147332_c.warn("Failed to verify username but will let them in anyway!"); - NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.func_152506_a(gameprofile); -- NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; -+ NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.NEGOTIATING; - } else { - NetHandlerLoginServer.this.func_194026_b(new TextComponentTranslation("multiplayer.disconnect.unverified_username")); - NetHandlerLoginServer.field_147332_c.error("Username '{}' tried to join with an invalid session", (Object)gameprofile.getName()); -@@ -161,7 +167,7 @@ - if (NetHandlerLoginServer.this.field_147327_f.func_71264_H()) { - NetHandlerLoginServer.field_147332_c.warn("Authentication servers are down but will let them in anyway!"); - NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.func_152506_a(gameprofile); -- NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; -+ NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.NEGOTIATING; - } else { - NetHandlerLoginServer.this.func_194026_b(new TextComponentTranslation("multiplayer.disconnect.authservers_down")); - NetHandlerLoginServer.field_147332_c.error("Couldn't verify username because servers are unavailable"); -@@ -182,6 +188,7 @@ - } - - public void func_209526_a(CPacketCustomPayloadLogin p_209526_1_) { -+ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209526_1_, this.field_147333_a)) - this.func_194026_b(new TextComponentTranslation("multiplayer.disconnect.unexpected_query_response")); - } - diff --git a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch index 245facaf8..dd962807a 100644 --- a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -1,40 +1,40 @@ --- a/net/minecraft/network/NetworkManager.java +++ b/net/minecraft/network/NetworkManager.java -@@ -75,6 +75,7 @@ +@@ -76,6 +76,7 @@ private float field_211397_t; private int field_211398_u; private boolean field_211399_v; + private java.util.function.Consumer activationHandler; - public NetworkManager(EnumPacketDirection p_i46004_1_) { + public NetworkManager(PacketDirection p_i46004_1_) { this.field_179294_g = p_i46004_1_; -@@ -84,6 +85,7 @@ +@@ -85,6 +86,7 @@ super.channelActive(p_channelActive_1_); this.field_150746_k = p_channelActive_1_.channel(); this.field_150743_l = this.field_150746_k.remoteAddress(); + if (activationHandler != null) activationHandler.accept(this); try { - this.func_150723_a(EnumConnectionState.HANDSHAKING); -@@ -264,7 +266,9 @@ + this.func_150723_a(ProtocolType.HANDSHAKING); +@@ -269,7 +271,9 @@ @OnlyIn(Dist.CLIENT) public static NetworkManager func_181124_a(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_) { + if (p_181124_0_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false"); - final NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.CLIENTBOUND); + final NetworkManager networkmanager = new NetworkManager(PacketDirection.CLIENTBOUND); + networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel; Class oclass; LazyLoadBase lazyloadbase; if (Epoll.isAvailable() && p_181124_2_) { -@@ -292,6 +296,7 @@ +@@ -297,6 +301,7 @@ @OnlyIn(Dist.CLIENT) public static NetworkManager func_150722_a(SocketAddress p_150722_0_) { - final NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.CLIENTBOUND); + final NetworkManager networkmanager = new NetworkManager(PacketDirection.CLIENTBOUND); + networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel; (new Bootstrap()).group(field_179296_e.func_179281_c()).handler(new ChannelInitializer() { protected void initChannel(Channel p_initChannel_1_) throws Exception { p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager); -@@ -383,6 +388,14 @@ +@@ -388,6 +393,14 @@ return this.field_211397_t; } @@ -42,10 +42,10 @@ + return field_150746_k; + } + -+ public EnumPacketDirection getDirection() { ++ public PacketDirection getDirection() { + return this.field_179294_g; + } + static class QueuedPacket { - private final Packet field_150774_a; + private final IPacket field_150774_a; @Nullable diff --git a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch index f6e46aa09..f40a170de 100644 --- a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/network/NetworkSystem.java +++ b/net/minecraft/network/NetworkSystem.java -@@ -40,12 +40,13 @@ +@@ -41,12 +41,13 @@ import org.apache.logging.log4j.Logger; public class NetworkSystem { @@ -16,7 +16,7 @@ }); private final MinecraftServer field_151273_d; public volatile boolean field_151277_a; -@@ -58,6 +59,7 @@ +@@ -59,6 +60,7 @@ } public void func_151265_a(@Nullable InetAddress p_151265_1_, int p_151265_2_) throws IOException { @@ -24,12 +24,12 @@ synchronized(this.field_151274_e) { Class oclass; LazyLoadBase lazyloadbase; -@@ -79,7 +81,7 @@ +@@ -80,7 +82,7 @@ ; } -- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND)); -+ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(READ_TIMEOUT)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(EnumPacketDirection.CLIENTBOUND)); - NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); +- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(PacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(PacketDirection.CLIENTBOUND)); ++ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(READ_TIMEOUT)).addLast("legacy_query", new LegacyPingHandler(NetworkSystem.this)).addLast("splitter", new NettyVarint21FrameDecoder()).addLast("decoder", new NettyPacketDecoder(PacketDirection.SERVERBOUND)).addLast("prepender", new NettyVarint21FrameEncoder()).addLast("encoder", new NettyPacketEncoder(PacketDirection.CLIENTBOUND)); + NetworkManager networkmanager = new NetworkManager(PacketDirection.SERVERBOUND); NetworkSystem.this.field_151272_f.add(networkmanager); p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager); diff --git a/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch b/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch index fe0b048f9..03523adf3 100644 --- a/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch +++ b/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/network/PacketBuffer.java +++ b/net/minecraft/network/PacketBuffer.java -@@ -256,6 +256,15 @@ +@@ -265,6 +265,15 @@ } public PacketBuffer func_150788_a(ItemStack p_150788_1_) { @@ -16,16 +16,16 @@ if (p_150788_1_.func_190926_b()) { this.writeBoolean(false); } else { -@@ -265,7 +274,7 @@ +@@ -274,7 +283,7 @@ this.writeByte(p_150788_1_.func_190916_E()); - NBTTagCompound nbttagcompound = null; + CompoundNBT compoundnbt = null; if (item.func_77645_m() || item.func_77651_p()) { -- nbttagcompound = p_150788_1_.func_77978_p(); -+ nbttagcompound = limitedTag ? p_150788_1_.getShareTag() : p_150788_1_.func_77978_p(); +- compoundnbt = p_150788_1_.func_77978_p(); ++ compoundnbt = limitedTag ? p_150788_1_.getShareTag() : p_150788_1_.func_77978_p(); } - this.func_150786_a(nbttagcompound); -@@ -281,7 +290,7 @@ + this.func_150786_a(compoundnbt); +@@ -290,7 +299,7 @@ int i = this.func_150792_a(); int j = this.readByte(); ItemStack itemstack = new ItemStack(Item.func_150899_d(i), j); diff --git a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch index c6f512491..d1c68139d 100644 --- a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -66,7 +66,7 @@ + mutex.acquireUninterruptibly(); + ret = this.json; + if (ret == null) { -+ ret = net.minecraft.network.status.server.SPacketServerInfo.field_149297_a.toJson(this); ++ ret = net.minecraft.network.status.server.SServerInfoPacket.field_149297_a.toJson(this); + this.json = ret; + } + mutex.release(); @@ -86,11 +86,11 @@ private final int field_151336_a; private final int field_151334_b; @@ -143,6 +190,10 @@ - serverstatusresponse.func_151320_a(JsonUtils.func_151200_h(jsonobject, "favicon")); + serverstatusresponse.func_151320_a(JSONUtils.func_151200_h(jsonobject, "favicon")); } + if (jsonobject.has("forgeData")) { -+ serverstatusresponse.setForgeData(net.minecraftforge.fml.network.FMLStatusPing.Serializer.deserialize(JsonUtils.func_152754_s(jsonobject, "forgeData"), p_deserialize_3_)); ++ serverstatusresponse.setForgeData(net.minecraftforge.fml.network.FMLStatusPing.Serializer.deserialize(JSONUtils.func_152754_s(jsonobject, "forgeData"), p_deserialize_3_)); + } + return serverstatusresponse; diff --git a/patches/minecraft/net/minecraft/network/datasync/DataSerializers.java.patch b/patches/minecraft/net/minecraft/network/datasync/DataSerializers.java.patch index 8d3f6d8b6..b94bcaa2b 100644 --- a/patches/minecraft/net/minecraft/network/datasync/DataSerializers.java.patch +++ b/patches/minecraft/net/minecraft/network/datasync/DataSerializers.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/network/datasync/DataSerializers.java +++ b/net/minecraft/network/datasync/DataSerializers.java -@@ -320,16 +320,16 @@ +@@ -301,16 +301,16 @@ }; - public static void func_187189_a(DataSerializer p_187189_0_) { + public static void func_187189_a(IDataSerializer p_187189_0_) { - field_187204_n.func_186808_c(p_187189_0_); + if (field_187204_n.func_186808_c(p_187189_0_) >= 256) throw new RuntimeException("Vanilla DataSerializer ID limit exceeded"); } @Nullable - public static DataSerializer func_187190_a(int p_187190_0_) { -- return field_187204_n.func_186813_a(p_187190_0_); + public static IDataSerializer func_187190_a(int p_187190_0_) { +- return field_187204_n.func_148745_a(p_187190_0_); + return net.minecraftforge.common.ForgeHooks.getSerializer(p_187190_0_, field_187204_n); } - public static int func_187188_b(DataSerializer p_187188_0_) { + public static int func_187188_b(IDataSerializer p_187188_0_) { - return field_187204_n.func_186815_a(p_187188_0_); + return net.minecraftforge.common.ForgeHooks.getSerializerId(p_187188_0_, field_187204_n); } diff --git a/patches/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch b/patches/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch index 37309acb4..502b95656 100644 --- a/patches/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch +++ b/patches/minecraft/net/minecraft/network/datasync/EntityDataManager.java.patch @@ -3,7 +3,7 @@ @@ -35,11 +35,13 @@ } - public static DataParameter func_187226_a(Class p_187226_0_, DataSerializer p_187226_1_) { + public static DataParameter func_187226_a(Class p_187226_0_, IDataSerializer p_187226_1_) { - if (field_190303_a.isDebugEnabled()) { + if (true || field_190303_a.isDebugEnabled()) { // Forge: This is very useful for mods that register keys on classes that are not their own try { diff --git a/patches/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch b/patches/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch new file mode 100644 index 000000000..0e83ffd3d --- /dev/null +++ b/patches/minecraft/net/minecraft/network/handshake/ServerHandshakeNetHandler.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/network/handshake/ServerHandshakeNetHandler.java ++++ b/net/minecraft/network/handshake/ServerHandshakeNetHandler.java +@@ -21,6 +21,7 @@ + } + + public void func_147383_a(CHandshakePacket p_147383_1_) { ++ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(p_147383_1_, this.field_147386_b)) return; + switch(p_147383_1_.func_149594_c()) { + case LOGIN: + this.field_147386_b.func_150723_a(ProtocolType.LOGIN); diff --git a/patches/minecraft/net/minecraft/network/handshake/client/CPacketHandshake.java.patch b/patches/minecraft/net/minecraft/network/handshake/client/CHandshakePacket.java.patch similarity index 75% rename from patches/minecraft/net/minecraft/network/handshake/client/CPacketHandshake.java.patch rename to patches/minecraft/net/minecraft/network/handshake/client/CHandshakePacket.java.patch index 918d8b616..c0bd3b03d 100644 --- a/patches/minecraft/net/minecraft/network/handshake/client/CPacketHandshake.java.patch +++ b/patches/minecraft/net/minecraft/network/handshake/client/CHandshakePacket.java.patch @@ -1,17 +1,17 @@ ---- a/net/minecraft/network/handshake/client/CPacketHandshake.java -+++ b/net/minecraft/network/handshake/client/CPacketHandshake.java -@@ -13,6 +13,7 @@ +--- a/net/minecraft/network/handshake/client/CHandshakePacket.java ++++ b/net/minecraft/network/handshake/client/CHandshakePacket.java +@@ -14,6 +14,7 @@ private String field_149598_b; private int field_149599_c; - private EnumConnectionState field_149597_d; + private ProtocolType field_149597_d; + private String fmlVersion = net.minecraftforge.fml.network.FMLNetworkConstants.NETVERSION; - public CPacketHandshake() { + public CHandshakePacket() { } -@@ -30,11 +31,13 @@ +@@ -31,11 +32,13 @@ this.field_149598_b = p_148837_1_.func_150789_c(255); this.field_149599_c = p_148837_1_.readUnsignedShort(); - this.field_149597_d = EnumConnectionState.func_150760_a(p_148837_1_.func_150792_a()); + this.field_149597_d = ProtocolType.func_150760_a(p_148837_1_.func_150792_a()); + this.fmlVersion = net.minecraftforge.fml.network.NetworkHooks.getFMLVersion(this.field_149598_b); + this.field_149598_b = this.field_149598_b.split("\0")[0]; } @@ -23,7 +23,7 @@ p_148840_1_.writeShort(this.field_149599_c); p_148840_1_.func_150787_b(this.field_149597_d.func_150759_c()); } -@@ -50,4 +53,8 @@ +@@ -51,4 +54,8 @@ public int func_149595_d() { return this.field_149600_a; } diff --git a/patches/minecraft/net/minecraft/network/login/ServerLoginNetHandler.java.patch b/patches/minecraft/net/minecraft/network/login/ServerLoginNetHandler.java.patch new file mode 100644 index 000000000..910a518fd --- /dev/null +++ b/patches/minecraft/net/minecraft/network/login/ServerLoginNetHandler.java.patch @@ -0,0 +1,66 @@ +--- a/net/minecraft/network/login/ServerLoginNetHandler.java ++++ b/net/minecraft/network/login/ServerLoginNetHandler.java +@@ -53,7 +53,13 @@ + } + + public void func_73660_a() { +- if (this.field_147328_g == ServerLoginNetHandler.State.READY_TO_ACCEPT) { ++ if (this.field_147328_g == State.NEGOTIATING) { ++ // We force the state into "NEGOTIATING" which is otherwise unused. Once we're completed we move the negotiation onto "READY_TO_ACCEPT" ++ // Might want to promote player object creation to here as well.. ++ boolean negotiationComplete = net.minecraftforge.fml.network.NetworkHooks.tickNegotiation(this, this.field_147333_a, this.field_181025_l); ++ if (negotiationComplete) ++ this.field_147328_g = State.READY_TO_ACCEPT; ++ } else if (this.field_147328_g == ServerLoginNetHandler.State.READY_TO_ACCEPT) { + this.func_147326_c(); + } else if (this.field_147328_g == ServerLoginNetHandler.State.DELAY_ACCEPT) { + ServerPlayerEntity serverplayerentity = this.field_147327_f.func_184103_al().func_177451_a(this.field_147337_i.getId()); +@@ -124,7 +130,7 @@ + this.field_147328_g = ServerLoginNetHandler.State.KEY; + this.field_147333_a.func_179290_a(new SEncryptionRequestPacket("", this.field_147327_f.func_71250_E().getPublic(), this.field_147330_e)); + } else { +- this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT; ++ this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING; + } + + } +@@ -138,7 +144,7 @@ + this.field_147335_k = p_147315_1_.func_149300_a(privatekey); + this.field_147328_g = ServerLoginNetHandler.State.AUTHENTICATING; + this.field_147333_a.func_150727_a(this.field_147335_k); +- Thread thread = new Thread("User Authenticator #" + field_147331_b.incrementAndGet()) { ++ Thread thread = new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, "User Authenticator #" + field_147331_b.incrementAndGet()) { + public void run() { + GameProfile gameprofile = ServerLoginNetHandler.this.field_147337_i; + +@@ -147,11 +153,11 @@ + ServerLoginNetHandler.this.field_147337_i = ServerLoginNetHandler.this.field_147327_f.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.func_191235_a()); + if (ServerLoginNetHandler.this.field_147337_i != null) { + ServerLoginNetHandler.field_147332_c.info("UUID of player {} is {}", ServerLoginNetHandler.this.field_147337_i.getName(), ServerLoginNetHandler.this.field_147337_i.getId()); +- ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT; ++ ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING; + } else if (ServerLoginNetHandler.this.field_147327_f.func_71264_H()) { + ServerLoginNetHandler.field_147332_c.warn("Failed to verify username but will let them in anyway!"); + ServerLoginNetHandler.this.field_147337_i = ServerLoginNetHandler.this.func_152506_a(gameprofile); +- ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT; ++ ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING; + } else { + ServerLoginNetHandler.this.func_194026_b(new TranslationTextComponent("multiplayer.disconnect.unverified_username")); + ServerLoginNetHandler.field_147332_c.error("Username '{}' tried to join with an invalid session", (Object)gameprofile.getName()); +@@ -160,7 +166,7 @@ + if (ServerLoginNetHandler.this.field_147327_f.func_71264_H()) { + ServerLoginNetHandler.field_147332_c.warn("Authentication servers are down but will let them in anyway!"); + ServerLoginNetHandler.this.field_147337_i = ServerLoginNetHandler.this.func_152506_a(gameprofile); +- ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.READY_TO_ACCEPT; ++ ServerLoginNetHandler.this.field_147328_g = ServerLoginNetHandler.State.NEGOTIATING; + } else { + ServerLoginNetHandler.this.func_194026_b(new TranslationTextComponent("multiplayer.disconnect.authservers_down")); + ServerLoginNetHandler.field_147332_c.error("Couldn't verify username because servers are unavailable"); +@@ -181,6 +187,7 @@ + } + + public void func_209526_a(CCustomPayloadLoginPacket p_209526_1_) { ++ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209526_1_, this.field_147333_a)) + this.func_194026_b(new TranslationTextComponent("multiplayer.disconnect.unexpected_query_response")); + } + diff --git a/patches/minecraft/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java.patch b/patches/minecraft/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java.patch new file mode 100644 index 000000000..74a47fd28 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java ++++ b/net/minecraft/network/login/client/CCustomPayloadLoginPacket.java +@@ -8,7 +8,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public class CCustomPayloadLoginPacket implements IPacket { ++public class CCustomPayloadLoginPacket implements IPacket, net.minecraftforge.fml.network.ICustomPacket { + private int field_209922_a; + private PacketBuffer field_209923_b; + diff --git a/patches/minecraft/net/minecraft/network/login/client/CPacketCustomPayloadLogin.java.patch b/patches/minecraft/net/minecraft/network/login/client/CPacketCustomPayloadLogin.java.patch deleted file mode 100644 index 5bee70098..000000000 --- a/patches/minecraft/net/minecraft/network/login/client/CPacketCustomPayloadLogin.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/network/login/client/CPacketCustomPayloadLogin.java -+++ b/net/minecraft/network/login/client/CPacketCustomPayloadLogin.java -@@ -8,7 +8,7 @@ - import net.minecraftforge.api.distmarker.Dist; - import net.minecraftforge.api.distmarker.OnlyIn; - --public class CPacketCustomPayloadLogin implements Packet { -+public class CPacketCustomPayloadLogin implements Packet, net.minecraftforge.fml.network.ICustomPacket { - private int field_209922_a; - private PacketBuffer field_209923_b; - diff --git a/patches/minecraft/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java.patch b/patches/minecraft/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java.patch new file mode 100644 index 000000000..f83916c0c --- /dev/null +++ b/patches/minecraft/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java ++++ b/net/minecraft/network/login/server/SCustomPayloadLoginPacket.java +@@ -8,7 +8,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public class SCustomPayloadLoginPacket implements IPacket { ++public class SCustomPayloadLoginPacket implements IPacket, net.minecraftforge.fml.network.ICustomPacket { + private int field_209919_a; + private ResourceLocation field_209920_b; + private PacketBuffer field_209921_c; diff --git a/patches/minecraft/net/minecraft/network/login/server/SPacketLoginSuccess.java.patch b/patches/minecraft/net/minecraft/network/login/server/SLoginSuccessPacket.java.patch similarity index 76% rename from patches/minecraft/net/minecraft/network/login/server/SPacketLoginSuccess.java.patch rename to patches/minecraft/net/minecraft/network/login/server/SLoginSuccessPacket.java.patch index d8212658b..0e66083f3 100644 --- a/patches/minecraft/net/minecraft/network/login/server/SPacketLoginSuccess.java.patch +++ b/patches/minecraft/net/minecraft/network/login/server/SLoginSuccessPacket.java.patch @@ -1,5 +1,5 @@ ---- a/net/minecraft/network/login/server/SPacketLoginSuccess.java -+++ b/net/minecraft/network/login/server/SPacketLoginSuccess.java +--- a/net/minecraft/network/login/server/SLoginSuccessPacket.java ++++ b/net/minecraft/network/login/server/SLoginSuccessPacket.java @@ -22,7 +22,7 @@ public void func_148837_a(PacketBuffer p_148837_1_) throws IOException { String s = p_148837_1_.func_150789_c(36); diff --git a/patches/minecraft/net/minecraft/network/login/server/SPacketCustomPayloadLogin.java.patch b/patches/minecraft/net/minecraft/network/login/server/SPacketCustomPayloadLogin.java.patch deleted file mode 100644 index 1dbd9abf7..000000000 --- a/patches/minecraft/net/minecraft/network/login/server/SPacketCustomPayloadLogin.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/network/login/server/SPacketCustomPayloadLogin.java -+++ b/net/minecraft/network/login/server/SPacketCustomPayloadLogin.java -@@ -8,7 +8,7 @@ - import net.minecraftforge.api.distmarker.Dist; - import net.minecraftforge.api.distmarker.OnlyIn; - --public class SPacketCustomPayloadLogin implements Packet { -+public class SPacketCustomPayloadLogin implements Packet, net.minecraftforge.fml.network.ICustomPacket { - private int field_209919_a; - private ResourceLocation field_209920_b; - private PacketBuffer field_209921_c; diff --git a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch similarity index 56% rename from patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch rename to patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch index cd12d0877..d06db7116 100644 --- a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches/minecraft/net/minecraft/network/play/ServerPlayNetHandler.java.patch @@ -1,59 +1,59 @@ ---- a/net/minecraft/network/NetHandlerPlayServer.java -+++ b/net/minecraft/network/NetHandlerPlayServer.java -@@ -328,9 +328,11 @@ +--- a/net/minecraft/network/play/ServerPlayNetHandler.java ++++ b/net/minecraft/network/play/ServerPlayNetHandler.java +@@ -336,9 +336,11 @@ } entity.func_70080_a(d3, d4, d5, f, f1); + this.field_147369_b.func_70080_a(d3, d4, d5, this.field_147369_b.field_70177_z, this.field_147369_b.field_70125_A); // Forge - Resync player position on vehicle moving - boolean flag2 = worldserver.func_195586_b(entity, entity.func_174813_aQ().func_186664_h(0.0625D)); + boolean flag2 = serverworld.func_195586_b(entity, entity.func_174813_aQ().func_186664_h(0.0625D)); if (flag && (flag1 || !flag2)) { entity.func_70080_a(d0, d1, d2, f, f1); -+ this.field_147369_b.func_70080_a(d0, d1, d2, this.field_147369_b.field_70177_z, this.field_147369_b.field_70125_A); // Forge - Resync player position on vehicle moving - this.field_147371_a.func_179290_a(new SPacketMoveVehicle(entity)); ++ this.field_147369_b.func_70080_a(d3, d4, d5, this.field_147369_b.field_70177_z, this.field_147369_b.field_70125_A); // Forge - Resync player position on vehicle moving + this.field_147371_a.func_179290_a(new SMoveVehiclePacket(entity)); return; } -@@ -798,7 +800,9 @@ +@@ -825,7 +827,9 @@ double d1 = this.field_147369_b.field_70163_u - ((double)blockpos.func_177956_o() + 0.5D) + 1.5D; double d2 = this.field_147369_b.field_70161_v - ((double)blockpos.func_177952_p() + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; - if (d3 > 36.0D) { -+ double dist = field_147369_b.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e() + 1; ++ double dist = field_147369_b.func_110148_a(net.minecraft.entity.player.PlayerEntity.REACH_DISTANCE).func_111126_e() + 1; + dist *= dist; + if (d3 > dist) { return; } else if (blockpos.func_177956_o() >= this.field_147367_d.func_71207_Z()) { return; -@@ -837,7 +841,9 @@ - EnumFacing enumfacing = p_184337_1_.func_187024_b(); +@@ -865,7 +869,9 @@ + Direction direction = blockraytraceresult.func_216354_b(); this.field_147369_b.func_143004_u(); - if (blockpos.func_177956_o() < this.field_147367_d.func_71207_Z() - 1 || enumfacing != EnumFacing.UP && blockpos.func_177956_o() < this.field_147367_d.func_71207_Z()) { -- if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < 64.0D && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) { -+ double dist = field_147369_b.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e() + 3; + if (blockpos.func_177956_o() < this.field_147367_d.func_71207_Z() - 1 || direction != Direction.UP && blockpos.func_177956_o() < this.field_147367_d.func_71207_Z()) { +- if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < 64.0D && !this.field_147367_d.func_175579_a(serverworld, blockpos, this.field_147369_b) && serverworld.func_175723_af().func_177746_a(blockpos)) { ++ double dist = field_147369_b.func_110148_a(net.minecraft.entity.player.PlayerEntity.REACH_DISTANCE).func_111126_e() + 3; + dist *= dist; -+ if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < dist && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) { - this.field_147369_b.field_71134_c.func_187251_a(this.field_147369_b, worldserver, itemstack, enumhand, blockpos, enumfacing, p_184337_1_.func_187026_d(), p_184337_1_.func_187025_e(), p_184337_1_.func_187020_f()); ++ if (this.field_184362_y == null && this.field_147369_b.func_70092_e((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D) < dist && !this.field_147367_d.func_175579_a(serverworld, blockpos, this.field_147369_b) && serverworld.func_175723_af().func_177746_a(blockpos)) { + this.field_147369_b.field_71134_c.func_219441_a(this.field_147369_b, serverworld, itemstack, hand, blockraytraceresult); } } else { -@@ -962,7 +968,9 @@ +@@ -985,7 +991,9 @@ if (s.startsWith("/")) { this.func_147361_d(s); } else { -- ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", this.field_147369_b.func_145748_c_(), s); -+ ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", this.field_147369_b.func_145748_c_(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); +- ITextComponent itextcomponent = new TranslationTextComponent("chat.type.text", this.field_147369_b.func_145748_c_(), s); ++ ITextComponent itextcomponent = new TranslationTextComponent("chat.type.text", this.field_147369_b.func_145748_c_(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); + itextcomponent = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, itextcomponent); + if (itextcomponent == null) return; this.field_147367_d.func_184103_al().func_148544_a(itextcomponent, false); } -@@ -1060,6 +1068,7 @@ - this.field_147369_b.func_190775_a(entity, enumhand); - } else if (p_147340_1_.func_149565_c() == CPacketUseEntity.Action.INTERACT_AT) { - EnumHand enumhand1 = p_147340_1_.func_186994_b(); -+ if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(field_147369_b, entity, p_147340_1_.func_179712_b(), enumhand1) != null) return; - entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), enumhand1); - } else if (p_147340_1_.func_149565_c() == CPacketUseEntity.Action.ATTACK) { - if (entity instanceof EntityItem || entity instanceof EntityXPOrb || entity instanceof EntityArrow || entity == this.field_147369_b) { -@@ -1090,7 +1099,7 @@ +@@ -1083,6 +1091,7 @@ + this.field_147369_b.func_190775_a(entity, hand); + } else if (p_147340_1_.func_149565_c() == CUseEntityPacket.Action.INTERACT_AT) { + Hand hand1 = p_147340_1_.func_186994_b(); ++ if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(field_147369_b, entity, p_147340_1_.func_179712_b(), hand1) != null) return; + entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), hand1); + } else if (p_147340_1_.func_149565_c() == CUseEntityPacket.Action.ATTACK) { + if (entity instanceof ItemEntity || entity instanceof ExperienceOrbEntity || entity instanceof AbstractArrowEntity || entity == this.field_147369_b) { +@@ -1113,7 +1122,7 @@ return; } @@ -62,11 +62,12 @@ if (this.field_147367_d.func_71199_h()) { this.field_147369_b.func_71033_a(GameType.SPECTATOR); this.field_147369_b.func_71121_q().func_82736_K().func_82764_b("spectatorsGenerateChunks", "false", this.field_147367_d); -@@ -1270,5 +1279,7 @@ +@@ -1290,6 +1299,8 @@ } - public void func_147349_a(CPacketCustomPayload p_147349_1_) { -+ PacketThreadUtil.func_180031_a(p_147349_1_, this, this.field_147369_b.func_71121_q()); + public void func_147349_a(CCustomPayloadPacket p_147349_1_) { ++ PacketThreadUtil.func_218796_a(p_147349_1_, this, this.field_147369_b.func_71121_q()); + net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147349_1_, this.field_147371_a); } - } + + public void func_217263_a(CSetDifficultyPacket p_217263_1_) { diff --git a/patches/minecraft/net/minecraft/network/play/client/CPacketClickWindow.java.patch b/patches/minecraft/net/minecraft/network/play/client/CClickWindowPacket.java.patch similarity index 74% rename from patches/minecraft/net/minecraft/network/play/client/CPacketClickWindow.java.patch rename to patches/minecraft/net/minecraft/network/play/client/CClickWindowPacket.java.patch index cf818260c..14348bc64 100644 --- a/patches/minecraft/net/minecraft/network/play/client/CPacketClickWindow.java.patch +++ b/patches/minecraft/net/minecraft/network/play/client/CClickWindowPacket.java.patch @@ -1,5 +1,5 @@ ---- a/net/minecraft/network/play/client/CPacketClickWindow.java -+++ b/net/minecraft/network/play/client/CPacketClickWindow.java +--- a/net/minecraft/network/play/client/CClickWindowPacket.java ++++ b/net/minecraft/network/play/client/CClickWindowPacket.java @@ -49,7 +49,7 @@ p_148840_1_.writeByte(this.field_149553_c); p_148840_1_.writeShort(this.field_149550_d); diff --git a/patches/minecraft/net/minecraft/network/play/client/CPacketCreativeInventoryAction.java.patch b/patches/minecraft/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java.patch similarity index 69% rename from patches/minecraft/net/minecraft/network/play/client/CPacketCreativeInventoryAction.java.patch rename to patches/minecraft/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java.patch index a8b0c2c74..7a8874202 100644 --- a/patches/minecraft/net/minecraft/network/play/client/CPacketCreativeInventoryAction.java.patch +++ b/patches/minecraft/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java.patch @@ -1,5 +1,5 @@ ---- a/net/minecraft/network/play/client/CPacketCreativeInventoryAction.java -+++ b/net/minecraft/network/play/client/CPacketCreativeInventoryAction.java +--- a/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java ++++ b/net/minecraft/network/play/client/CCreativeInventoryActionPacket.java @@ -32,7 +32,7 @@ public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { diff --git a/patches/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/client/CCustomPayloadPacket.java.patch similarity index 56% rename from patches/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch rename to patches/minecraft/net/minecraft/network/play/client/CCustomPayloadPacket.java.patch index 02bbd473e..aa6f287f6 100644 --- a/patches/minecraft/net/minecraft/network/play/client/CPacketCustomPayload.java.patch +++ b/patches/minecraft/net/minecraft/network/play/client/CCustomPayloadPacket.java.patch @@ -1,16 +1,15 @@ ---- a/net/minecraft/network/play/client/CPacketCustomPayload.java -+++ b/net/minecraft/network/play/client/CPacketCustomPayload.java -@@ -9,7 +9,8 @@ +--- a/net/minecraft/network/play/client/CCustomPayloadPacket.java ++++ b/net/minecraft/network/play/client/CCustomPayloadPacket.java +@@ -9,7 +9,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; --public class CPacketCustomPayload implements Packet { -+public class CPacketCustomPayload implements Packet, net.minecraftforge.fml.network.ICustomPacket -+{ - public static final ResourceLocation field_210344_a = new ResourceLocation("minecraft:brand"); +-public class CCustomPayloadPacket implements IPacket { ++public class CCustomPayloadPacket implements IPacket, net.minecraftforge.fml.network.ICustomPacket { + public static final ResourceLocation field_210344_a = new ResourceLocation("brand"); private ResourceLocation field_149562_a; private PacketBuffer field_149561_c; -@@ -35,7 +36,7 @@ +@@ -35,7 +35,7 @@ public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { p_148840_1_.func_192572_a(this.field_149562_a); @@ -18,4 +17,4 @@ + p_148840_1_.writeBytes((ByteBuf)this.field_149561_c.copy()); //This may be access multiple times, from multiple threads, lets be safe like the S->C packet } - public void func_148833_a(INetHandlerPlayServer p_148833_1_) { + public void func_148833_a(IServerPlayNetHandler p_148833_1_) { diff --git a/patches/minecraft/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java.patch b/patches/minecraft/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java.patch new file mode 100644 index 000000000..dfe6a4754 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java ++++ b/net/minecraft/network/play/server/SCustomPayloadPlayPacket.java +@@ -8,7 +8,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public class SCustomPayloadPlayPacket implements IPacket { ++public class SCustomPayloadPlayPacket implements IPacket, net.minecraftforge.fml.network.ICustomPacket { + public static final ResourceLocation field_209911_b = new ResourceLocation("brand"); + public static final ResourceLocation field_209913_d = new ResourceLocation("debug/path"); + public static final ResourceLocation field_209914_e = new ResourceLocation("debug/neighbors_update"); diff --git a/patches/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch deleted file mode 100644 index 7b7203acf..000000000 --- a/patches/minecraft/net/minecraft/network/play/server/SPacketCustomPayload.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/network/play/server/SPacketCustomPayload.java -+++ b/net/minecraft/network/play/server/SPacketCustomPayload.java -@@ -8,7 +8,7 @@ - import net.minecraftforge.api.distmarker.Dist; - import net.minecraftforge.api.distmarker.OnlyIn; - --public class SPacketCustomPayload implements Packet { -+public class SPacketCustomPayload implements Packet, net.minecraftforge.fml.network.ICustomPacket { - public static final ResourceLocation field_209910_a = new ResourceLocation("minecraft:trader_list"); - public static final ResourceLocation field_209911_b = new ResourceLocation("minecraft:brand"); - public static final ResourceLocation field_209912_c = new ResourceLocation("minecraft:book_open"); diff --git a/patches/minecraft/net/minecraft/network/status/server/SPacketServerInfo.java.patch b/patches/minecraft/net/minecraft/network/status/server/SServerInfoPacket.java.patch similarity index 61% rename from patches/minecraft/net/minecraft/network/status/server/SPacketServerInfo.java.patch rename to patches/minecraft/net/minecraft/network/status/server/SServerInfoPacket.java.patch index 3c6c0c123..3eeb50c60 100644 --- a/patches/minecraft/net/minecraft/network/status/server/SPacketServerInfo.java.patch +++ b/patches/minecraft/net/minecraft/network/status/server/SServerInfoPacket.java.patch @@ -1,5 +1,5 @@ ---- a/net/minecraft/network/status/server/SPacketServerInfo.java -+++ b/net/minecraft/network/status/server/SPacketServerInfo.java +--- a/net/minecraft/network/status/server/SServerInfoPacket.java ++++ b/net/minecraft/network/status/server/SServerInfoPacket.java @@ -30,7 +30,7 @@ } @@ -8,4 +8,4 @@ + p_148840_1_.func_180714_a(this.field_149296_b.getJson()); //Forge: Let the response cache the JSON } - public void func_148833_a(INetHandlerStatusClient p_148833_1_) { + public void func_148833_a(IClientStatusNetHandler p_148833_1_) { diff --git a/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch b/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch new file mode 100644 index 000000000..b8ae970f3 --- /dev/null +++ b/patches/minecraft/net/minecraft/particles/ParticleTypes.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/particles/ParticleTypes.java ++++ b/net/minecraft/particles/ParticleTypes.java +@@ -2,6 +2,7 @@ + + import net.minecraft.util.registry.Registry; + ++//@net.minecraftforge.registries.ObjectHolder("minecraft") + public class ParticleTypes { + public static final BasicParticleType field_197608_a = func_218415_a("ambient_entity_effect", false); + public static final BasicParticleType field_197609_b = func_218415_a("angry_villager", false); diff --git a/patches/minecraft/net/minecraft/pathfinding/FlyingNodeProcessor.java.patch b/patches/minecraft/net/minecraft/pathfinding/FlyingNodeProcessor.java.patch index cfef8765d..afa20676b 100644 --- a/patches/minecraft/net/minecraft/pathfinding/FlyingNodeProcessor.java.patch +++ b/patches/minecraft/net/minecraft/pathfinding/FlyingNodeProcessor.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/pathfinding/FlyingNodeProcessor.java +++ b/net/minecraft/pathfinding/FlyingNodeProcessor.java -@@ -206,7 +206,9 @@ +@@ -207,7 +207,9 @@ EnumSet enumset = EnumSet.noneOf(PathNodeType.class); PathNodeType pathnodetype = PathNodeType.BLOCKED; BlockPos blockpos = new BlockPos(p_186319_5_); @@ -10,12 +10,12 @@ if (enumset.contains(PathNodeType.FENCE)) { return PathNodeType.FENCE; } else { -@@ -238,6 +240,8 @@ - if (pathnodetype1 != PathNodeType.DAMAGE_FIRE && block != Blocks.field_196814_hQ && pathnodetype1 != PathNodeType.LAVA) { +@@ -239,6 +241,8 @@ + if (pathnodetype1 != PathNodeType.DAMAGE_FIRE && block != Blocks.field_196814_hQ && pathnodetype1 != PathNodeType.LAVA && block != Blocks.field_222433_lV) { if (pathnodetype1 == PathNodeType.DAMAGE_CACTUS) { pathnodetype = PathNodeType.DAMAGE_CACTUS; + } else if (pathnodetype1 == PathNodeType.DAMAGE_OTHER) { // Forge: consider modded damage types + pathnodetype = PathNodeType.DAMAGE_OTHER; + } else if (pathnodetype1 == PathNodeType.DAMAGE_OTHER) { + pathnodetype = PathNodeType.DAMAGE_OTHER; } else { - pathnodetype = pathnodetype1 != PathNodeType.WALKABLE && pathnodetype1 != PathNodeType.OPEN && pathnodetype1 != PathNodeType.WATER ? PathNodeType.WALKABLE : PathNodeType.OPEN; - } diff --git a/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch b/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch index f91d2a218..f77ae1810 100644 --- a/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch +++ b/patches/minecraft/net/minecraft/pathfinding/WalkNodeProcessor.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/pathfinding/WalkNodeProcessor.java +++ b/net/minecraft/pathfinding/WalkNodeProcessor.java -@@ -27,6 +27,7 @@ +@@ -26,6 +26,7 @@ public class WalkNodeProcessor extends NodeProcessor { protected float field_176183_h; -+ protected EntityLiving currentEntity; ++ protected MobEntity currentEntity; - public void func_186315_a(IBlockReader p_186315_1_, EntityLiving p_186315_2_) { + public void func_186315_a(IWorldReader p_186315_1_, MobEntity p_186315_2_) { super.func_186315_a(p_186315_1_, p_186315_2_); -@@ -254,7 +255,9 @@ +@@ -258,7 +259,9 @@ PathNodeType pathnodetype = PathNodeType.BLOCKED; - double d0 = (double)p_186319_5_.field_70130_N / 2.0D; + double d0 = (double)p_186319_5_.func_213311_cf() / 2.0D; BlockPos blockpos = new BlockPos(p_186319_5_); + this.currentEntity = p_186319_5_; pathnodetype = this.func_193577_a(p_186319_1_, p_186319_2_, p_186319_3_, p_186319_4_, p_186319_6_, p_186319_7_, p_186319_8_, p_186319_9_, p_186319_10_, enumset, pathnodetype, blockpos); @@ -18,21 +18,21 @@ if (enumset.contains(PathNodeType.FENCE)) { return PathNodeType.FENCE; } else { -@@ -331,6 +334,7 @@ - if (pathnodetype1 == PathNodeType.DAMAGE_CACTUS) { - pathnodetype = PathNodeType.DAMAGE_CACTUS; +@@ -348,6 +351,7 @@ + if (pathnodetype1 == PathNodeType.DAMAGE_OTHER) { + pathnodetype = PathNodeType.DAMAGE_OTHER; } + if (pathnodetype1 == PathNodeType.DAMAGE_OTHER) pathnodetype = PathNodeType.DAMAGE_OTHER; // Forge: consider modded damage types } pathnodetype = this.func_193578_a(p_186330_1_, p_186330_2_, p_186330_3_, p_186330_4_, pathnodetype); -@@ -343,11 +347,15 @@ +@@ -360,12 +364,14 @@ for(int i = -1; i <= 1; ++i) { for(int j = -1; j <= 1; ++j) { if (i != 0 || j != 0) { - Block block = p_193578_1_.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(i + p_193578_2_, p_193578_3_, j + p_193578_4_)).func_177230_c(); - if (block == Blocks.field_150434_aF) { -+ IBlockState state = p_193578_1_.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(i + p_193578_2_, p_193578_3_, j + p_193578_4_)); ++ BlockState state = p_193578_1_.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(i + p_193578_2_, p_193578_3_, j + p_193578_4_)); + Block block = state.func_177230_c(); + PathNodeType type = block.getAiPathNodeType(state, p_193578_1_, blockpos$pooledmutableblockpos, this.currentEntity); + if (block == Blocks.field_150434_aF || type == PathNodeType.DAMAGE_CACTUS) { @@ -40,21 +40,21 @@ - } else if (block == Blocks.field_150480_ab) { + } else if (block == Blocks.field_150480_ab || type == PathNodeType.DAMAGE_FIRE) { p_193578_5_ = PathNodeType.DANGER_FIRE; -+ } else if (type == PathNodeType.DAMAGE_OTHER) { -+ p_193578_5_ = PathNodeType.DAMAGE_OTHER; +- } else if (block == Blocks.field_222434_lW) { ++ } else if (block == Blocks.field_222434_lW || type == PathNodeType.DAMAGE_OTHER) { + p_193578_5_ = PathNodeType.DANGER_OTHER; } } - } -@@ -361,9 +369,11 @@ +@@ -380,9 +386,11 @@ protected PathNodeType func_189553_b(IBlockReader p_189553_1_, int p_189553_2_, int p_189553_3_, int p_189553_4_) { BlockPos blockpos = new BlockPos(p_189553_2_, p_189553_3_, p_189553_4_); - IBlockState iblockstate = p_189553_1_.func_180495_p(blockpos); -+ PathNodeType type = iblockstate.getAiPathNodeType(p_189553_1_, blockpos, this.currentEntity); + BlockState blockstate = p_189553_1_.func_180495_p(blockpos); ++ PathNodeType type = blockstate.getAiPathNodeType(p_189553_1_, blockpos, this.currentEntity); + if (type != null) return type; - Block block = iblockstate.func_177230_c(); - Material material = iblockstate.func_185904_a(); -- if (iblockstate.func_196958_f()) { -+ if (iblockstate.isAir(p_189553_1_, blockpos)) { + Block block = blockstate.func_177230_c(); + Material material = blockstate.func_185904_a(); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(p_189553_1_, blockpos)) { return PathNodeType.OPEN; } else if (!block.func_203417_a(BlockTags.field_212185_E) && block != Blocks.field_196651_dG) { if (block == Blocks.field_150480_ab) { diff --git a/patches/minecraft/net/minecraft/potion/Effect.java.patch b/patches/minecraft/net/minecraft/potion/Effect.java.patch new file mode 100644 index 000000000..799bf104d --- /dev/null +++ b/patches/minecraft/net/minecraft/potion/Effect.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/potion/Effect.java ++++ b/net/minecraft/potion/Effect.java +@@ -20,7 +20,7 @@ + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; + +-public class Effect { ++public class Effect extends net.minecraftforge.registries.ForgeRegistryEntry implements net.minecraftforge.common.extensions.IForgeEffect { + private final Map field_111188_I = Maps.newHashMap(); + private final EffectType field_220305_b; + private final int field_76414_N; +@@ -149,7 +149,6 @@ + return this; + } + +- @OnlyIn(Dist.CLIENT) + public Map func_111186_k() { + return this.field_111188_I; + } diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/EffectInstance.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/potion/PotionEffect.java.patch rename to patches/minecraft/net/minecraft/potion/EffectInstance.java.patch index 9a39cf009..8c0be7197 100644 --- a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches/minecraft/net/minecraft/potion/EffectInstance.java.patch @@ -1,34 +1,34 @@ ---- a/net/minecraft/potion/PotionEffect.java -+++ b/net/minecraft/potion/PotionEffect.java -@@ -19,6 +19,8 @@ - private boolean field_100013_f; - private boolean field_188421_h; - private boolean field_205349_i; -+ /** List of ItemStack that can cure the potion effect **/ -+ private java.util.List curativeItems; +--- a/net/minecraft/potion/EffectInstance.java ++++ b/net/minecraft/potion/EffectInstance.java +@@ -8,7 +8,7 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; - public PotionEffect(Potion p_i46811_1_) { - this(p_i46811_1_, 0, 0); -@@ -52,6 +54,7 @@ +-public class EffectInstance implements Comparable { ++public class EffectInstance implements Comparable, net.minecraftforge.common.extensions.IForgeEffectInstance { + private static final Logger field_180155_a = LogManager.getLogger(); + private final Effect field_188420_b; + private int field_76460_b; +@@ -52,6 +52,7 @@ this.field_82724_e = p_i1577_1_.field_82724_e; this.field_188421_h = p_i1577_1_.field_188421_h; this.field_205349_i = p_i1577_1_.field_205349_i; + this.curativeItems = p_i1577_1_.curativeItems == null ? null : new java.util.ArrayList(p_i1577_1_.curativeItems); } - public boolean func_199308_a(PotionEffect p_199308_1_) { -@@ -88,6 +91,10 @@ + public boolean func_199308_a(EffectInstance p_199308_1_) { +@@ -88,6 +89,10 @@ } - public Potion func_188419_a() { + public Effect func_188419_a() { + return this.getPotionRaw() == null ? null : this.getPotionRaw().delegate.get(); + } + -+ private Potion getPotionRaw() { ++ private Effect getPotionRaw() { return this.field_188420_b; } -@@ -188,11 +195,12 @@ +@@ -188,11 +193,12 @@ p_82719_1_.func_74757_a("Ambient", this.func_82720_e()); p_82719_1_.func_74757_a("ShowParticles", this.func_188418_e()); p_82719_1_.func_74757_a("ShowIcon", this.func_205348_f()); @@ -36,81 +36,46 @@ return p_82719_1_; } - public static PotionEffect func_82722_b(NBTTagCompound p_82722_0_) { + public static EffectInstance func_82722_b(CompoundNBT p_82722_0_) { - int i = p_82722_0_.func_74771_c("Id"); + int i = p_82722_0_.func_74771_c("Id") & 0xFF; - Potion potion = Potion.func_188412_a(i); - if (potion == null) { + Effect effect = Effect.func_188412_a(i); + if (effect == null) { return null; -@@ -210,7 +218,7 @@ +@@ -210,7 +216,7 @@ flag2 = p_82722_0_.func_74767_n("ShowIcon"); } -- return new PotionEffect(potion, k, j < 0 ? 0 : j, flag, flag1, flag2); -+ return readCurativeItems(new PotionEffect(potion, k, j < 0 ? 0 : j, flag, flag1, flag2), p_82722_0_); +- return new EffectInstance(effect, k, j < 0 ? 0 : j, flag, flag1, flag2); ++ return readCurativeItems(new EffectInstance(effect, k, j < 0 ? 0 : j, flag, flag1, flag2), p_82722_0_); } } -@@ -226,6 +234,67 @@ +@@ -226,6 +232,32 @@ - public int compareTo(PotionEffect p_compareTo_1_) { + public int compareTo(EffectInstance p_compareTo_1_) { int i = 32147; - return (this.func_76459_b() <= 32147 || p_compareTo_1_.func_76459_b() <= 32147) && (!this.func_82720_e() || !p_compareTo_1_.func_82720_e()) ? ComparisonChain.start().compare(this.func_82720_e(), p_compareTo_1_.func_82720_e()).compare(this.func_76459_b(), p_compareTo_1_.func_76459_b()).compare(this.func_188419_a().func_76401_j(), p_compareTo_1_.func_188419_a().func_76401_j()).result() : ComparisonChain.start().compare(this.func_82720_e(), p_compareTo_1_.func_82720_e()).compare(this.func_188419_a().func_76401_j(), p_compareTo_1_.func_188419_a().func_76401_j()).result(); + return (this.func_76459_b() <= 32147 || p_compareTo_1_.func_76459_b() <= 32147) && (!this.func_82720_e() || !p_compareTo_1_.func_82720_e()) ? ComparisonChain.start().compare(this.func_82720_e(), p_compareTo_1_.func_82720_e()).compare(this.func_76459_b(), p_compareTo_1_.func_76459_b()).compare(this.func_188419_a().getGuiSortColor(this), p_compareTo_1_.func_188419_a().getGuiSortColor(this)).result() : ComparisonChain.start().compare(this.func_82720_e(), p_compareTo_1_.func_82720_e()).compare(this.func_188419_a().getGuiSortColor(this), p_compareTo_1_.func_188419_a().getGuiSortColor(this)).result(); } + -+ /*** -+ * Returns a list of curative items for the potion effect -+ * By default, this list is initialized using {@link Potion#getCurativeItems} -+ * -+ * @return The list (ItemStack) of curative items for the potion effect -+ */ ++ //======================= FORGE START =========================== ++ private java.util.List curativeItems; ++ ++ @Override + public java.util.List getCurativeItems() { -+ if (this.curativeItems == null) { //Lazy load this so that we don't create a circular dep on Items. ++ if (this.curativeItems == null) //Lazy load this so that we don't create a circular dep on Items. + this.curativeItems = func_188419_a().getCurativeItems(); -+ } + return this.curativeItems; + } -+ -+ /*** -+ * Checks the given ItemStack to see if it is in the list of curative items for the potion effect -+ * @param stack The ItemStack being checked against the list of curative items for this PotionEffect -+ * @return true if the given ItemStack is in the list of curative items for this PotionEffect, false otherwise -+ */ -+ public boolean isCurativeItem(net.minecraft.item.ItemStack stack) { -+ return this.getCurativeItems().stream().anyMatch(e -> e.func_77969_a(stack)); -+ } -+ -+ /*** -+ * Sets the list of curative items for this potion effect, overwriting any already present -+ * @param curativeItems The list of ItemStacks being set to the potion effect -+ */ ++ @Override + public void setCurativeItems(java.util.List curativeItems) { + this.curativeItems = curativeItems; + } -+ -+ /*** -+ * Adds the given stack to the list of curative items for this PotionEffect -+ * @param stack The ItemStack being added to the curative item list -+ */ -+ public void addCurativeItem(net.minecraft.item.ItemStack stack) { -+ if (!this.isCurativeItem(stack)) { -+ this.getCurativeItems().add(stack); -+ } -+ } -+ -+ private void writeCurativeItems(NBTTagCompound nbt) { -+ net.minecraft.nbt.NBTTagList list = new net.minecraft.nbt.NBTTagList(); -+ for (net.minecraft.item.ItemStack stack : getCurativeItems()) { -+ list.add(stack.func_77955_b(new NBTTagCompound())); -+ } -+ nbt.func_74782_a("CurativeItems", list); -+ } -+ -+ private static PotionEffect readCurativeItems(PotionEffect effect, NBTTagCompound nbt) { ++ private static EffectInstance readCurativeItems(EffectInstance effect, CompoundNBT nbt) { + if (nbt.func_150297_b("CurativeItems", net.minecraftforge.common.util.Constants.NBT.TAG_LIST)) { + java.util.List items = new java.util.ArrayList(); -+ net.minecraft.nbt.NBTTagList list = nbt.func_150295_c("CurativeItems", net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND); ++ net.minecraft.nbt.ListNBT list = nbt.func_150295_c("CurativeItems", net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND); + for (int i = 0; i < list.size(); i++) { + items.add(net.minecraft.item.ItemStack.func_199557_a(list.func_150305_b(i))); + } diff --git a/patches/minecraft/net/minecraft/potion/Effects.java.patch b/patches/minecraft/net/minecraft/potion/Effects.java.patch new file mode 100644 index 000000000..95f5b59f5 --- /dev/null +++ b/patches/minecraft/net/minecraft/potion/Effects.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/potion/Effects.java ++++ b/net/minecraft/potion/Effects.java +@@ -9,6 +9,7 @@ + import net.minecraft.world.Difficulty; + import net.minecraft.world.ServerWorld; + ++@net.minecraftforge.registries.ObjectHolder("minecraft") + public class Effects { + public static final Effect field_76424_c = func_220308_a(1, "speed", (new Effect(EffectType.BENEFICIAL, 8171462)).func_220304_a(SharedMonsterAttributes.field_111263_d, "91AEAA56-376B-4498-935B-2F7F68070635", (double)0.2F, AttributeModifier.Operation.MULTIPLY_TOTAL)); + public static final Effect field_76421_d = func_220308_a(2, "slowness", (new Effect(EffectType.HARMFUL, 5926017)).func_220304_a(SharedMonsterAttributes.field_111263_d, "7107DE5E-7CE8-4030-940E-514C1F160890", (double)-0.15F, AttributeModifier.Operation.MULTIPLY_TOTAL)); diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index f48b9c5be..019651479 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -1,93 +1,11 @@ --- a/net/minecraft/potion/Potion.java +++ b/net/minecraft/potion/Potion.java -@@ -23,7 +23,7 @@ - import net.minecraftforge.api.distmarker.Dist; - import net.minecraftforge.api.distmarker.OnlyIn; +@@ -6,7 +6,7 @@ + import net.minecraft.util.ResourceLocation; + import net.minecraft.util.registry.Registry; -public class Potion { +public class Potion extends net.minecraftforge.registries.ForgeRegistryEntry { - private final Map field_111188_I = Maps.newHashMap(); - private final boolean field_76418_K; - private final int field_76414_N; -@@ -161,7 +161,6 @@ - return this.field_76417_J; - } + private final String field_185179_d; + private final ImmutableList field_185180_e; -- @OnlyIn(Dist.CLIENT) - public boolean func_76398_f() { - return this.field_76418_K; - } -@@ -258,4 +257,73 @@ - private static void func_210759_a(int p_210759_0_, String p_210759_1_, Potion p_210759_2_) { - IRegistry.field_212631_t.func_177775_a(p_210759_0_, new ResourceLocation(p_210759_1_), p_210759_2_); - } -+ -+ /** -+ * If the Potion effect should be displayed in the players inventory -+ * @param effect the active PotionEffect -+ * @return true to display it (default), false to hide it. -+ */ -+ public boolean shouldRender(PotionEffect effect) { return true; } -+ -+ /** -+ * If the standard PotionEffect text (name and duration) should be drawn when this potion is active. -+ * @param effect the active PotionEffect -+ * @return true to draw the standard text -+ */ -+ public boolean shouldRenderInvText(PotionEffect effect) { return true; } -+ -+ /** -+ * If the Potion effect should be displayed in the player's ingame HUD -+ * @param effect the active PotionEffect -+ * @return true to display it (default), false to hide it. -+ */ -+ public boolean shouldRenderHUD(PotionEffect effect) { return true; } -+ -+ /** -+ * Called to draw the this Potion onto the player's inventory when it's active. -+ * This can be used to e.g. render Potion icons from your own texture. -+ * -+ * @param effect the active PotionEffect -+ * @param gui the gui instance -+ * @param x the x coordinate -+ * @param y the y coordinate -+ * @param z the z level -+ */ -+ @OnlyIn(Dist.CLIENT) -+ public void renderInventoryEffect(PotionEffect effect, net.minecraft.client.gui.Gui gui, int x, int y, float z) { } -+ -+ /** -+ * Called to draw the this Potion onto the player's ingame HUD when it's active. -+ * This can be used to e.g. render Potion icons from your own texture. -+ * @param effect the active PotionEffect -+ * @param gui the gui instance -+ * @param x the x coordinate -+ * @param y the y coordinate -+ * @param z the z level -+ * @param alpha the alpha value, blinks when the potion is about to run out -+ */ -+ @OnlyIn(Dist.CLIENT) -+ public void renderHUDEffect(PotionEffect effect, net.minecraft.client.gui.Gui gui, int x, int y, float z, float alpha) { } -+ -+ /** -+ * Get a fresh list of items that can cure this Potion. -+ * All new PotionEffects created from this Potion will call this to initialize the default curative items -+ * @see PotionEffect#getCurativeItems -+ * @return A list of items that can cure this Potion -+ */ -+ public java.util.List getCurativeItems() { -+ java.util.ArrayList ret = new java.util.ArrayList(); -+ ret.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.field_151117_aB)); -+ return ret; -+ } -+ -+ /** -+ * Used for determining {@code PotionEffect} sort order in GUIs. -+ * Defaults to the {@code PotionEffect}'s liquid color. -+ * @param potionEffect the {@code PotionEffect} instance containing the potion -+ * @return a value used to sort {@code PotionEffect}s in GUIs -+ */ -+ public int getGuiSortColor(PotionEffect potionEffect) { -+ return this.func_76401_j(); -+ } - } diff --git a/patches/minecraft/net/minecraft/potion/PotionBrewing.java.patch b/patches/minecraft/net/minecraft/potion/PotionBrewing.java.patch index ffdd30ac1..7de69e80c 100644 --- a/patches/minecraft/net/minecraft/potion/PotionBrewing.java.patch +++ b/patches/minecraft/net/minecraft/potion/PotionBrewing.java.patch @@ -1,6 +1,15 @@ --- a/net/minecraft/potion/PotionBrewing.java +++ b/net/minecraft/potion/PotionBrewing.java -@@ -68,7 +68,7 @@ +@@ -57,7 +57,7 @@ + int i = 0; + + for(int j = field_185213_a.size(); i < j; ++i) { +- if ((field_185213_a.get(i)).field_185200_c == p_222124_0_) { ++ if ((field_185213_a.get(i)).field_185200_c.get() == p_222124_0_) { + return true; + } + } +@@ -79,7 +79,7 @@ for(int j = field_185214_b.size(); i < j; ++i) { PotionBrewing.MixPredicate mixpredicate = field_185214_b.get(i); @@ -9,38 +18,38 @@ return true; } } -@@ -82,7 +82,7 @@ +@@ -93,7 +93,7 @@ for(int j = field_185213_a.size(); i < j; ++i) { - PotionBrewing.MixPredicate mixpredicate = field_185213_a.get(i); -- if (mixpredicate.field_185198_a == potiontype && mixpredicate.field_185199_b.test(p_185209_1_)) { -+ if (mixpredicate.field_185198_a.get() == potiontype && mixpredicate.field_185199_b.test(p_185209_1_)) { + PotionBrewing.MixPredicate mixpredicate = field_185213_a.get(i); +- if (mixpredicate.field_185198_a == potion && mixpredicate.field_185199_b.test(p_185209_1_)) { ++ if (mixpredicate.field_185198_a.get() == potion && mixpredicate.field_185199_b.test(p_185209_1_)) { return true; } } -@@ -98,8 +98,8 @@ +@@ -109,8 +109,8 @@ for(int j = field_185214_b.size(); i < j; ++i) { PotionBrewing.MixPredicate mixpredicate = field_185214_b.get(i); - if (mixpredicate.field_185198_a == item && mixpredicate.field_185199_b.test(p_185212_0_)) { -- return PotionUtils.func_185188_a(new ItemStack((IItemProvider)mixpredicate.field_185200_c), potiontype); +- return PotionUtils.func_185188_a(new ItemStack((IItemProvider)mixpredicate.field_185200_c), potion); + if (mixpredicate.field_185198_a.get() == item && mixpredicate.field_185199_b.test(p_185212_0_)) { -+ return PotionUtils.func_185188_a(new ItemStack((IItemProvider)mixpredicate.field_185200_c.get()), potiontype); ++ return PotionUtils.func_185188_a(new ItemStack((IItemProvider)mixpredicate.field_185200_c.get()), potion); } } -@@ -107,8 +107,8 @@ +@@ -118,8 +118,8 @@ for(int k = field_185213_a.size(); i < k; ++i) { - PotionBrewing.MixPredicate mixpredicate1 = field_185213_a.get(i); -- if (mixpredicate1.field_185198_a == potiontype && mixpredicate1.field_185199_b.test(p_185212_0_)) { -- return PotionUtils.func_185188_a(new ItemStack(item), (PotionType)mixpredicate1.field_185200_c); -+ if (mixpredicate1.field_185198_a.get() == potiontype && mixpredicate1.field_185199_b.test(p_185212_0_)) { -+ return PotionUtils.func_185188_a(new ItemStack(item), (PotionType)mixpredicate1.field_185200_c.get()); + PotionBrewing.MixPredicate mixpredicate1 = field_185213_a.get(i); +- if (mixpredicate1.field_185198_a == potion && mixpredicate1.field_185199_b.test(p_185212_0_)) { +- return PotionUtils.func_185188_a(new ItemStack(item), (Potion)mixpredicate1.field_185200_c); ++ if (mixpredicate1.field_185198_a.get() == potion && mixpredicate1.field_185199_b.test(p_185212_0_)) { ++ return PotionUtils.func_185188_a(new ItemStack(item), (Potion)mixpredicate1.field_185200_c.get()); } } } -@@ -201,15 +201,15 @@ +@@ -212,15 +212,15 @@ field_185213_a.add(new PotionBrewing.MixPredicate<>(p_193357_0_, Ingredient.func_199804_a(p_193357_1_), p_193357_2_)); } @@ -52,14 +61,12 @@ - private final T field_185200_c; + private final net.minecraftforge.registries.IRegistryDelegate field_185200_c; -- public MixPredicate(T p_i47570_1_, Ingredient p_i47570_2_, T p_i47570_3_) { + public MixPredicate(T p_i47570_1_, Ingredient p_i47570_2_, T p_i47570_3_) { - this.field_185198_a = p_i47570_1_; -- this.field_185199_b = p_i47570_2_; ++ this.field_185198_a = p_i47570_1_.delegate; + this.field_185199_b = p_i47570_2_; - this.field_185200_c = p_i47570_3_; -+ public MixPredicate(T inputIn, Ingredient reagentIn, T outputIn) { -+ this.field_185198_a = inputIn.delegate; -+ this.field_185199_b = reagentIn; -+ this.field_185200_c = outputIn.delegate; ++ this.field_185200_c = p_i47570_3_.delegate; } } } diff --git a/patches/minecraft/net/minecraft/potion/PotionType.java.patch b/patches/minecraft/net/minecraft/potion/PotionType.java.patch deleted file mode 100644 index 23b384c3d..000000000 --- a/patches/minecraft/net/minecraft/potion/PotionType.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/potion/PotionType.java -+++ b/net/minecraft/potion/PotionType.java -@@ -7,7 +7,7 @@ - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.registry.IRegistry; - --public class PotionType { -+public class PotionType extends net.minecraftforge.registries.ForgeRegistryEntry { - private final String field_185179_d; - private final ImmutableList field_185180_e; - diff --git a/patches/minecraft/net/minecraft/resources/FallbackResourceManager.java.patch b/patches/minecraft/net/minecraft/resources/FallbackResourceManager.java.patch new file mode 100644 index 000000000..8354ff966 --- /dev/null +++ b/patches/minecraft/net/minecraft/resources/FallbackResourceManager.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/resources/FallbackResourceManager.java ++++ b/net/minecraft/resources/FallbackResourceManager.java +@@ -30,7 +30,6 @@ + this.field_199023_a.add(p_199021_1_); + } + +- @OnlyIn(Dist.CLIENT) + public Set func_199001_a() { + return Collections.emptySet(); + } +@@ -59,7 +58,6 @@ + throw new FileNotFoundException(p_199002_1_.toString()); + } + +- @OnlyIn(Dist.CLIENT) + public boolean func_219533_b(ResourceLocation p_219533_1_) { + if (!this.func_219541_f(p_219533_1_)) { + return false; diff --git a/patches/minecraft/net/minecraft/resources/IResourceManager.java.patch b/patches/minecraft/net/minecraft/resources/IResourceManager.java.patch index 7c263520e..5d5f83ecb 100644 --- a/patches/minecraft/net/minecraft/resources/IResourceManager.java.patch +++ b/patches/minecraft/net/minecraft/resources/IResourceManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/IResourceManager.java +++ b/net/minecraft/resources/IResourceManager.java -@@ -10,7 +10,6 @@ +@@ -10,18 +10,15 @@ import net.minecraftforge.api.distmarker.OnlyIn; public interface IResourceManager { @@ -8,3 +8,14 @@ Set func_199001_a(); IResource func_199002_a(ResourceLocation p_199002_1_) throws IOException; + +- @OnlyIn(Dist.CLIENT) + boolean func_219533_b(ResourceLocation p_219533_1_); + + List func_199004_b(ResourceLocation p_199004_1_) throws IOException; + + Collection func_199003_a(String p_199003_1_, Predicate p_199003_2_); + +- @OnlyIn(Dist.CLIENT) + void func_199021_a(IResourcePack p_199021_1_); + } diff --git a/patches/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch b/patches/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch index 6295a9359..0c2d4a0ee 100644 --- a/patches/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch +++ b/patches/minecraft/net/minecraft/resources/IResourceManagerReloadListener.java.patch @@ -1,16 +1,22 @@ --- a/net/minecraft/resources/IResourceManagerReloadListener.java +++ b/net/minecraft/resources/IResourceManagerReloadListener.java -@@ -1,5 +1,15 @@ - package net.minecraft.resources; +@@ -5,6 +5,11 @@ + import net.minecraft.profiler.IProfiler; + import net.minecraft.util.Unit; -+ +/** + * @deprecated Forge: {@link net.minecraftforge.resource.ISelectiveResourceReloadListener}, which selectively allows + * individual resource types being reloaded should rather be used where possible. + */ +@Deprecated - public interface IResourceManagerReloadListener { + public interface IResourceManagerReloadListener extends IFutureReloadListener { + default CompletableFuture func_215226_a(IFutureReloadListener.IStage p_215226_1_, IResourceManager p_215226_2_, IProfiler p_215226_3_, IProfiler p_215226_4_, Executor p_215226_5_, Executor p_215226_6_) { + return p_215226_1_.func_216872_a(Unit.INSTANCE).thenRunAsync(() -> { +@@ -13,4 +18,9 @@ + } + void func_195410_a(IResourceManager p_195410_1_); ++ + @javax.annotation.Nullable + default net.minecraftforge.resource.IResourceType getResourceType() { + return null; diff --git a/patches/minecraft/net/minecraft/resources/ResourcePackInfo.java.patch b/patches/minecraft/net/minecraft/resources/ResourcePackInfo.java.patch index 53ef92b1b..4ff1e15fa 100644 --- a/patches/minecraft/net/minecraft/resources/ResourcePackInfo.java.patch +++ b/patches/minecraft/net/minecraft/resources/ResourcePackInfo.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/ResourcePackInfo.java +++ b/net/minecraft/resources/ResourcePackInfo.java -@@ -29,6 +29,7 @@ +@@ -30,6 +30,7 @@ private final ResourcePackInfo.Priority field_195805_g; private final boolean field_195806_h; private final boolean field_195807_i; @@ -8,7 +8,7 @@ @Nullable public static T func_195793_a(String p_195793_0_, boolean p_195793_1_, Supplier p_195793_2_, ResourcePackInfo.IFactory p_195793_3_, ResourcePackInfo.Priority p_195793_4_) { -@@ -52,7 +53,12 @@ +@@ -53,7 +54,12 @@ return (T)null; } @@ -21,7 +21,7 @@ this.field_195800_b = p_i47907_1_; this.field_195801_c = p_i47907_3_; this.field_195802_d = p_i47907_4_; -@@ -61,12 +67,18 @@ +@@ -62,12 +68,18 @@ this.field_195806_h = p_i47907_2_; this.field_195805_g = p_i47907_7_; this.field_195807_i = p_i47907_8_; @@ -30,18 +30,18 @@ + @Deprecated public ResourcePackInfo(String p_i47908_1_, boolean p_i47908_2_, Supplier p_i47908_3_, IResourcePack p_i47908_4_, PackMetadataSection p_i47908_5_, ResourcePackInfo.Priority p_i47908_6_) { -- this(p_i47908_1_, p_i47908_2_, p_i47908_3_, new TextComponentString(p_i47908_4_.func_195762_a()), p_i47908_5_.func_198963_a(), PackCompatibility.func_198969_a(p_i47908_5_.func_198962_b()), p_i47908_6_, false); +- this(p_i47908_1_, p_i47908_2_, p_i47908_3_, new StringTextComponent(p_i47908_4_.func_195762_a()), p_i47908_5_.func_198963_a(), PackCompatibility.func_198969_a(p_i47908_5_.func_198962_b()), p_i47908_6_, false); + this(p_i47908_1_, p_i47908_2_, p_i47908_3_, p_i47908_4_, p_i47908_5_, p_i47908_6_, false); } + public ResourcePackInfo(String p_i47908_1_, boolean p_i47908_2_, Supplier p_i47908_3_, IResourcePack p_i47908_4_, PackMetadataSection p_i47908_5_, ResourcePackInfo.Priority p_i47908_6_, boolean hidden) { -+ this(p_i47908_1_, p_i47908_2_, p_i47908_3_, new TextComponentString(p_i47908_4_.func_195762_a()), p_i47908_5_.func_198963_a(), PackCompatibility.func_198969_a(p_i47908_5_.func_198962_b()), p_i47908_6_, hidden, hidden); ++ this(p_i47908_1_, p_i47908_2_, p_i47908_3_, new StringTextComponent(p_i47908_4_.func_195762_a()), p_i47908_5_.func_198963_a(), PackCompatibility.func_198969_a(p_i47908_5_.func_198962_b()), p_i47908_6_, hidden, hidden); + } + @OnlyIn(Dist.CLIENT) public ITextComponent func_195789_b() { return this.field_195802_d; -@@ -106,6 +118,8 @@ +@@ -107,6 +119,8 @@ public ResourcePackInfo.Priority func_195792_i() { return this.field_195805_g; } diff --git a/patches/minecraft/net/minecraft/resources/SimpleReloadableResourceManager.java.patch b/patches/minecraft/net/minecraft/resources/SimpleReloadableResourceManager.java.patch index 0910c722e..e9b19a43a 100644 --- a/patches/minecraft/net/minecraft/resources/SimpleReloadableResourceManager.java.patch +++ b/patches/minecraft/net/minecraft/resources/SimpleReloadableResourceManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/SimpleReloadableResourceManager.java +++ b/net/minecraft/resources/SimpleReloadableResourceManager.java -@@ -45,7 +45,6 @@ +@@ -50,7 +50,6 @@ } @@ -8,50 +8,33 @@ public Set func_199001_a() { return this.field_199016_e; } -@@ -86,35 +85,46 @@ +@@ -64,7 +63,6 @@ + } } - public void func_199005_a(List p_199005_1_) { -+ try (net.minecraftforge.fml.common.progress.ProgressBar resReload = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Loading Resources", p_199005_1_.size() + 1, true)) { +- @OnlyIn(Dist.CLIENT) + public boolean func_219533_b(ResourceLocation p_219533_1_) { + IResourceManager iresourcemanager = this.field_199014_c.get(p_219533_1_.func_110624_b()); + return iresourcemanager != null ? iresourcemanager.func_219533_b(p_219533_1_) : false; +@@ -118,18 +116,20 @@ + return iasyncreloader; + } + +- @OnlyIn(Dist.CLIENT) + public IAsyncReloader func_219535_a(Executor p_219535_1_, Executor p_219535_2_, CompletableFuture p_219535_3_) { + return this.func_219538_b(p_219535_1_, p_219535_2_, this.field_219539_d, p_219535_3_); + } + + public IAsyncReloader func_219537_a(Executor p_219537_1_, Executor p_219537_2_, CompletableFuture p_219537_3_, List p_219537_4_) { ++ net.minecraftforge.fml.common.progress.StartupProgressManager.start("Loading Resources", p_219537_4_.size(), true, bar -> { this.func_199008_b(); - field_199012_a.info("Reloading ResourceManager: {}", p_199005_1_.stream().map(IResourcePack::func_195762_a).collect(Collectors.joining(", "))); + field_199012_a.info("Reloading ResourceManager: {}", p_219537_4_.stream().map(IResourcePack::func_195762_a).collect(Collectors.joining(", "))); - for(IResourcePack iresourcepack : p_199005_1_) { -+ resReload.step(iresourcepack.func_195762_a()); - this.func_199009_a(iresourcepack); + for(IResourcePack iresourcepack : p_219537_4_) { ++ bar.step(iresourcepack.func_195762_a()); + this.func_199021_a(iresourcepack); } ++ }); -+ resReload.step("Reloading listeners"); - if (field_199012_a.isDebugEnabled()) { - this.func_199011_d(); - } else { - this.func_199010_c(); - } -+ }; // Forge: end progress bar - + return this.func_219538_b(p_219537_1_, p_219537_2_, this.field_199015_d, p_219537_3_); } - - public void func_199006_a(IResourceManagerReloadListener p_199006_1_) { -+ try (net.minecraftforge.fml.common.progress.ProgressBar resReload = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Loading Resource", 1)) { -+ resReload.step(p_199006_1_.getClass()); - this.field_199015_d.add(p_199006_1_); - if (field_199012_a.isDebugEnabled()) { - field_199012_a.info(this.func_199007_b(p_199006_1_)); - } else { - p_199006_1_.func_195410_a(this); - } -+ }; // Forge: end progress bar - - } - - private void func_199010_c() { -+ try (net.minecraftforge.fml.common.progress.ProgressBar resReload = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Reloading", this.field_199015_d.size())) { - for(IResourceManagerReloadListener iresourcemanagerreloadlistener : this.field_199015_d) { -+ resReload.step(iresourcemanagerreloadlistener.getClass()); -+ if (!net.minecraftforge.resource.SelectiveReloadStateHandler.INSTANCE.test(iresourcemanagerreloadlistener)) continue; // Forge: Selective reloading for vanilla listeners - iresourcemanagerreloadlistener.func_195410_a(this); - } -+ }; // Forge: end progress bar - - } - diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index 4d8e33f8a..ab30b66ba 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,55 +1,40 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -335,20 +335,19 @@ - worldserver.func_72912_H().func_76060_a(this.func_71265_f()); - } - -- WorldServerMulti worldservermulti = (new WorldServerMulti(this, p_212369_1_, DimensionType.NETHER, worldserver, this.field_71304_b)).func_212251_i__(); -- this.field_71305_c.put(DimensionType.NETHER, worldservermulti); -- worldservermulti.func_72954_a(new ServerWorldEventHandler(this, worldservermulti)); -- if (!this.func_71264_H()) { -- worldservermulti.func_72912_H().func_76060_a(this.func_71265_f()); -+ for (DimensionType dim : DimensionType.func_212681_b()) { -+ WorldServer world = worldserver; -+ if (dim != DimensionType.OVERWORLD) { -+ world = (new WorldServerMulti(this, p_212369_1_, dim, worldserver, this.field_71304_b)).func_212251_i__(); -+ this.field_71305_c.put(dim, world); -+ world.func_72954_a(new ServerWorldEventHandler(this, world)); -+ if (!this.func_71264_H()) { -+ world.func_72912_H().func_76060_a(func_71265_f()); -+ } -+ } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- WorldServerMulti worldservermulti1 = (new WorldServerMulti(this, p_212369_1_, DimensionType.THE_END, worldserver, this.field_71304_b)).func_212251_i__(); -- this.field_71305_c.put(DimensionType.THE_END, worldservermulti1); -- worldservermulti1.func_72954_a(new ServerWorldEventHandler(this, worldservermulti1)); -- if (!this.func_71264_H()) { -- worldservermulti1.func_72912_H().func_76060_a(this.func_71265_f()); -- } -- - this.func_184103_al().func_212504_a(worldserver); - if (p_212369_3_.func_201357_P() != null) { - this.func_201300_aS().func_201381_a(p_212369_3_.func_201357_P()); -@@ -514,6 +513,7 @@ - - for(WorldServer worldserver1 : this.func_212370_w()) { - if (worldserver1 != null) { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver1)); - worldserver1.close(); +@@ -182,7 +182,7 @@ + private final GameProfileRepository field_152365_W; + private final PlayerProfileCache field_152366_X; + private long field_147142_T; +- protected final Thread field_175590_aa = Util.func_200696_a(new Thread(this, "Server thread"), (p_213187_0_) -> { ++ protected final Thread field_175590_aa = Util.func_200696_a(new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, this, "Server thread"), (p_213187_0_) -> { + p_213187_0_.setUncaughtExceptionHandler((p_213206_0_, p_213206_1_) -> { + field_147145_h.error(p_213206_1_); + }); +@@ -386,6 +386,7 @@ + if (dimensiontype != DimensionType.OVERWORLD) { + this.field_71305_c.put(dimensiontype, new ServerMultiWorld(serverworld1, this, this.field_213217_au, p_213194_1_, dimensiontype, this.field_71304_b, p_213194_4_)); } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(field_71305_c.get(dimensiontype))); } -@@ -547,6 +547,7 @@ + + } +@@ -541,6 +542,7 @@ + for(ServerWorld serverworld1 : this.func_212370_w()) { + if (serverworld1 != null) { + try { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(serverworld1)); + serverworld1.close(); + } catch (IOException ioexception) { + field_147145_h.error("Exception closing the level", (Throwable)ioexception); +@@ -581,6 +583,7 @@ public void run() { try { if (this.func_71197_b()) { + net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarted(this); this.field_211151_aa = Util.func_211177_b(); - this.field_147147_p.func_151315_a(new TextComponentString(this.field_71286_C)); - this.field_147147_p.func_151321_a(new ServerStatusResponse.Version("1.13.2", 404)); -@@ -570,7 +571,10 @@ - + this.field_147147_p.func_151315_a(new StringTextComponent(this.field_71286_C)); + this.field_147147_p.func_151321_a(new ServerStatusResponse.Version(SharedConstants.func_215069_a().getName(), SharedConstants.func_215069_a().getProtocolVersion())); +@@ -612,7 +615,10 @@ + this.field_71304_b.func_219897_b(); this.field_71296_Q = true; } + net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStopping(this); @@ -59,7 +44,7 @@ this.func_71228_a((CrashReport)null); } } catch (Throwable throwable1) { -@@ -589,6 +593,7 @@ +@@ -631,6 +637,7 @@ field_147145_h.error("We were unable to save this crash report to disk."); } @@ -67,7 +52,7 @@ this.func_71228_a(crashreport); } finally { try { -@@ -597,6 +602,7 @@ +@@ -639,6 +646,7 @@ } catch (Throwable throwable) { field_147145_h.error("Exception stopping the server", throwable); } finally { @@ -75,89 +60,65 @@ this.func_71240_o(); } -@@ -652,6 +658,7 @@ +@@ -735,6 +743,7 @@ - public void func_71217_p(BooleanSupplier p_71217_1_) { + protected void func_71217_p(BooleanSupplier p_71217_1_) { long i = Util.func_211178_c(); + net.minecraftforge.fml.hooks.BasicEventHooks.onPreServerTick(); ++this.field_71315_w; - if (this.field_71295_T) { - this.field_71295_T = false; -@@ -672,6 +679,7 @@ + this.func_71190_q(p_71217_1_); + if (i - this.field_147142_T >= 5000000000L) { +@@ -749,6 +758,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); this.field_147147_p.func_151318_b().func_151330_a(agameprofile); + this.field_147147_p.invalidateJson(); } - if (this.field_71315_w % 900 == 0) { -@@ -696,6 +704,7 @@ - this.field_211152_ao = this.field_211152_ao * 0.8F + (float)l / 1000000.0F * 0.19999999F; - this.field_71304_b.func_76319_b(); + if (this.field_71315_w % 6000 == 0) { +@@ -776,6 +786,7 @@ + long i1 = Util.func_211178_c(); + this.field_213215_ap.func_181747_a(i1 - i); this.field_71304_b.func_76319_b(); + net.minecraftforge.fml.hooks.BasicEventHooks.onPostServerTick(); } - public void func_71190_q(BooleanSupplier p_71190_1_) { -@@ -723,6 +732,7 @@ + protected void func_71190_q(BooleanSupplier p_71190_1_) { +@@ -796,6 +807,7 @@ } this.field_71304_b.func_76320_a("tick"); -+ net.minecraftforge.fml.hooks.BasicEventHooks.onPreWorldTick(worldserver); ++ net.minecraftforge.fml.hooks.BasicEventHooks.onPreWorldTick(serverworld); try { - worldserver.func_72835_b(p_71190_1_); -@@ -740,6 +750,7 @@ - throw new ReportedException(crashreport1); + serverworld.func_72835_b(p_71190_1_); +@@ -804,6 +816,7 @@ + serverworld.func_72914_a(crashreport); + throw new ReportedException(crashreport); } ++ net.minecraftforge.fml.hooks.BasicEventHooks.onPostWorldTick(serverworld); -+ net.minecraftforge.fml.hooks.BasicEventHooks.onPostWorldTick(worldserver); this.field_71304_b.func_76319_b(); - this.field_71304_b.func_76320_a("tracker"); - worldserver.func_73039_n().func_72788_a(); -@@ -752,6 +763,8 @@ + this.field_71304_b.func_76319_b(); +@@ -814,6 +827,8 @@ }))[this.field_71315_w % 100] = Util.func_211178_c() - i; } -+ this.field_71304_b.func_76318_c("dim_unloading"); ++ this.field_71304_b.func_219895_b("dim_unloading"); + net.minecraftforge.common.DimensionManager.unloadWorlds(this, this.field_71315_w % 200 == 0); - this.field_71304_b.func_76318_c("connection"); + this.field_71304_b.func_219895_b("connection"); this.func_147137_ag().func_151269_c(); - this.field_71304_b.func_76318_c("players"); -@@ -774,6 +787,14 @@ + this.field_71304_b.func_219895_b("players"); +@@ -942,7 +957,7 @@ } - public static void main(String[] p_main_0_) { -+ //Forge: Copied from DedicatedServer.init as to run as early as possible, Old code left in place intentionally. -+ //Done in good faith with permission: https://github.com/MinecraftForge/MinecraftForge/issues/3659#issuecomment-390467028 -+ ServerEula eula = new ServerEula(new File("eula.txt")); -+ if (!eula.func_154346_a()) { -+ field_147145_h.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); -+ eula.func_154348_b(); -+ return; -+ } - Bootstrap.func_151354_b(); - - try { -@@ -876,7 +897,7 @@ - } - - public void func_71256_s() { -- this.field_175590_aa = new Thread(this, "Server thread"); -+ this.field_175590_aa = new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, this, "Server thread"); - this.field_175590_aa.setUncaughtExceptionHandler((p_195574_0_, p_195574_1_) -> { - field_147145_h.error(p_195574_1_); - }); -@@ -896,7 +917,7 @@ - } - - public WorldServer func_71218_a(DimensionType p_71218_1_) { + public ServerWorld func_71218_a(DimensionType p_71218_1_) { - return this.field_71305_c.get(p_71218_1_); + return net.minecraftforge.common.DimensionManager.getWorld(this, p_71218_1_, true, true); } - public Iterable func_212370_w() { -@@ -935,7 +956,7 @@ + public Iterable func_212370_w() { +@@ -981,7 +996,7 @@ } public String getServerModName() { @@ -166,10 +127,10 @@ } public CrashReport func_71230_b(CrashReport p_71230_1_) { -@@ -1472,4 +1493,14 @@ - return 0; - } +@@ -1516,4 +1531,14 @@ } + + public abstract boolean func_213199_b(GameProfile p_213199_1_); + + @Nullable + public long[] getTickTime(DimensionType dim) { @@ -177,7 +138,7 @@ + } + + @Deprecated //Forge Internal use Only, You can screw up a lot of things if you mess with this map. -+ public synchronized Map forgeGetWorldMap() { ++ public synchronized Map forgeGetWorldMap() { + return this.field_71305_c; + } } diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index 4950d04c9..c6b46bbdd 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,58 +1,58 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -91,6 +91,7 @@ +@@ -95,6 +95,7 @@ public boolean func_71197_b() throws IOException { Thread thread = new Thread("Server console handler") { public void run() { + if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); - String s4; -@@ -112,6 +113,7 @@ + String s3; +@@ -116,6 +117,7 @@ field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } + net.minecraftforge.fml.server.ServerModLoader.begin(this); field_155771_h.info("Loading properties"); - this.field_71340_o = new PropertyManager(new File("server.properties")); - this.field_154332_n = new ServerEula(new File("eula.txt")); -@@ -183,6 +185,7 @@ - if (!PreYggdrasilConverter.func_152714_a(this.field_71340_o)) { - return false; - } else { -+ net.minecraftforge.fml.server.ServerModLoader.end(); - this.func_184105_a(new DedicatedPlayerList(this)); - long j = Util.func_211178_c(); - if (this.func_71270_I() == null) { -@@ -220,6 +223,7 @@ - TileEntitySkull.func_184293_a(this.func_152358_ax()); - TileEntitySkull.func_184294_a(this.func_147130_as()); - PlayerProfileCache.func_187320_a(this.func_71266_T()); -+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; - field_155771_h.info("Preparing level \"{}\"", (Object)this.func_71270_I()); - JsonObject jsonobject = new JsonObject(); - if (worldtype == WorldType.field_77138_c) { -@@ -232,6 +236,7 @@ - long i1 = Util.func_211178_c() - j; - String s3 = String.format(Locale.ROOT, "%.3fs", (double)i1 / 1.0E9D); - field_155771_h.info("Done ({})! For help, type \"help\"", (Object)s3); -+ this.field_211151_aa = Util.func_211177_b(); //Forge: Update server time to prevent watchdog/spaming during long load. - if (this.field_71340_o.func_187239_a("announce-player-achievements")) { - this.func_200252_aR().func_82764_b("announceAdvancements", this.field_71340_o.func_73670_a("announce-player-achievements", true) ? "true" : "false", this); - this.field_71340_o.func_187238_b("announce-player-achievements"); -@@ -259,7 +264,8 @@ - } - - Items.field_190931_a.func_150895_a(ItemGroup.field_78027_g, NonNullList.func_191196_a()); -- return true; -+ // <3 you Grum for this, saves us ~30 patch files! --^ -+ return net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(this); + ServerProperties serverproperties = this.field_71340_o.func_219034_a(); + if (this.func_71264_H()) { +@@ -173,6 +175,7 @@ + if (!PreYggdrasilConverter.func_219587_e(this)) { + return false; + } else { ++ net.minecraftforge.fml.server.ServerModLoader.end(); + this.func_184105_a(new DedicatedPlayerList(this)); + long i = Util.func_211178_c(); + String s = serverproperties.field_219022_p; +@@ -194,6 +197,7 @@ + SkullTileEntity.func_184293_a(this.func_152358_ax()); + SkullTileEntity.func_184294_a(this.func_147130_as()); + PlayerProfileCache.func_187320_a(this.func_71266_T()); ++ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; + field_155771_h.info("Preparing level \"{}\"", (Object)this.func_71270_I()); + JsonObject jsonobject = new JsonObject(); + if (worldtype == WorldType.field_77138_c) { +@@ -206,6 +210,7 @@ + long l = Util.func_211178_c() - i; + String s2 = String.format(Locale.ROOT, "%.3fs", (double)l / 1.0E9D); + field_155771_h.info("Done ({})! For help, type \"help\"", (Object)s2); ++ this.field_211151_aa = Util.func_211177_b(); //Forge: Update server time to prevent watchdog/spaming during long load. + if (serverproperties.field_219027_u != null) { + this.func_200252_aR().func_82764_b("announceAdvancements", serverproperties.field_219027_u ? "true" : "false", this); } +@@ -231,7 +236,8 @@ + } + + Items.field_190931_a.func_150895_a(ItemGroup.field_78027_g, NonNullList.func_191196_a()); +- return true; ++ // <3 you Grum for this, saves us ~30 patch files! --^ ++ return net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(this); } } -@@ -568,4 +574,9 @@ - this.func_195571_aL().func_197059_a(this.field_184115_n.func_195540_f(), p_71252_1_); - return this.field_184115_n.func_70008_c(); + +@@ -535,4 +541,9 @@ + public boolean func_213199_b(GameProfile p_213199_1_) { + return false; } + + @Override //Forge: Enable formated text for colors in console. diff --git a/patches/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch b/patches/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch index bee1dd90e..89fee4eda 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/ServerHangWatchdog.java.patch @@ -8,4 +8,4 @@ + Error error = new Error(String.format("ServerHangWatchdog detected that a single server tick took %.2f seconds (should be max 0.05)", k / 1000F)); // Forge: don't just make a crash report with a seemingly-inexplicable Error for(ThreadInfo threadinfo : athreadinfo) { - if (threadinfo.getThreadId() == this.field_180249_b.func_175583_aK().getId()) { + if (threadinfo.getThreadId() == this.field_180249_b.func_213170_ax().getId()) { diff --git a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch index 3d605342a..4e062f2c5 100644 --- a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/gui/MinecraftServerGui.java +++ b/net/minecraft/server/gui/MinecraftServerGui.java -@@ -129,11 +129,16 @@ +@@ -138,8 +138,10 @@ return jpanel; } @@ -10,6 +10,10 @@ + latch.countDown(); } + public void func_219050_b() { +@@ -154,6 +156,9 @@ + } + public void func_164247_a(JTextArea p_164247_1_, JScrollPane p_164247_2_, String p_164247_3_) { + try { + latch.await(); diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index 144611fb6..6f778469b 100644 --- a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/integrated/IntegratedServer.java +++ b/net/minecraft/server/integrated/IntegratedServer.java -@@ -91,9 +91,10 @@ +@@ -89,9 +89,10 @@ this.func_71245_h(true); field_147148_h.info("Generating keypair"); this.func_71253_a(CryptManager.func_75891_b()); @@ -12,19 +12,19 @@ } public void func_71217_p(BooleanSupplier p_71217_1_) { -@@ -146,6 +147,7 @@ +@@ -126,6 +127,7 @@ } - public EnumDifficulty func_147135_j() { + public Difficulty func_147135_j() { + if (this.field_71349_l.field_71441_e == null) return this.field_71349_l.field_71474_y.field_74318_M; // Fix NPE just in case. return this.field_71349_l.field_71441_e.func_72912_H().func_176130_y(); } -@@ -245,6 +247,7 @@ +@@ -213,6 +215,7 @@ } - public void func_71263_m() { + public void func_71263_m(boolean p_71263_1_) { + if (func_71278_l()) - Futures.getUnchecked(this.func_152344_a(() -> { - for(EntityPlayerMP entityplayermp : Lists.newArrayList(this.func_184103_al().func_181057_v())) { - if (!entityplayermp.func_110124_au().equals(this.field_211528_n)) { + this.func_213167_f(() -> { + for(ServerPlayerEntity serverplayerentity : Lists.newArrayList(this.func_184103_al().func_181057_v())) { + if (!serverplayerentity.func_110124_au().equals(this.field_211528_n)) { diff --git a/patches/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java.patch deleted file mode 100644 index 415b10dbb..000000000 --- a/patches/minecraft/net/minecraft/server/management/PlayerChunkMapEntry.java.patch +++ /dev/null @@ -1,129 +0,0 @@ ---- a/net/minecraft/server/management/PlayerChunkMapEntry.java -+++ b/net/minecraft/server/management/PlayerChunkMapEntry.java -@@ -31,13 +31,19 @@ - private int field_187288_h; - private long field_187289_i; - private boolean field_187290_j; -+ /*private boolean loading = true; -+ private final Runnable loadedRunnable;*/ - - public PlayerChunkMapEntry(PlayerChunkMap p_i1518_1_, int p_i1518_2_, int p_i1518_3_) { - this.field_187282_b = p_i1518_1_; - this.field_187284_d = new ChunkPos(p_i1518_2_, p_i1518_3_); - ChunkProviderServer chunkproviderserver = p_i1518_1_.func_72688_a().func_72863_F(); - chunkproviderserver.func_212469_a(p_i1518_2_, p_i1518_3_); -+ //this.loadedRunnable = () -> { - this.field_187286_f = chunkproviderserver.func_186025_d(p_i1518_2_, p_i1518_3_, true, false); -+ /*this.loading = false; -+ }; Forge: Pending if we find a better way to async load/gen chunks. -+ mapIn.getWorld().getChunkProvider().loadChunk(chunkX, chunkZ, this.loadedRunnable);*/ - } - - public ChunkPos func_187264_a() { -@@ -55,6 +61,8 @@ - this.field_187283_c.add(p_187276_1_); - if (this.field_187290_j) { - this.func_187278_c(p_187276_1_); -+ // chunk watch event - the chunk is ready -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(this.field_187286_f, p_187276_1_)); - } - - } -@@ -62,11 +70,26 @@ - - public void func_187277_b(EntityPlayerMP p_187277_1_) { - if (this.field_187283_c.contains(p_187277_1_)) { -+ // If we haven't loaded yet don't load the chunk just so we can clean it up -+ if (this.field_187286_f == null) { -+ this.field_187283_c.remove(p_187277_1_); -+ -+ if (this.field_187283_c.isEmpty()) { -+ /*if (this.loading) -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(this.playerChunkMap.getWorld(), this.pos.x, this.pos.z, this.loadedRunnable); -+ */ -+ this.field_187282_b.func_187305_b(this); -+ } -+ -+ return; -+ } -+ - if (this.field_187290_j) { - p_187277_1_.field_71135_a.func_147359_a(new SPacketUnloadChunk(this.field_187284_d.field_77276_a, this.field_187284_d.field_77275_b)); - } - - this.field_187283_c.remove(p_187277_1_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(this.field_187286_f, p_187277_1_)); - if (this.field_187283_c.isEmpty()) { - this.field_187282_b.func_187305_b(this); - } -@@ -75,6 +98,7 @@ - } - - public boolean func_187268_a(boolean p_187268_1_) { -+ //if (this.loading) return false; - if (this.field_187286_f != null) { - return true; - } else { -@@ -100,6 +124,8 @@ - for(EntityPlayerMP entityplayermp : this.field_187283_c) { - entityplayermp.field_71135_a.func_147359_a(packet); - this.field_187282_b.func_72688_a().func_73039_n().func_85172_a(entityplayermp, this.field_187286_f); -+ // chunk watch event - delayed to here as the chunk wasn't ready in addPlayer -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(this.field_187286_f, entityplayermp)); - } - } - -@@ -130,7 +156,7 @@ - } - - this.field_187288_h |= 1 << (p_187265_2_ >> 4); -- if (this.field_187287_g < 64) { -+ { //Forge; Cache everything, so always run - short short1 = (short)(p_187265_1_ << 12 | p_187265_3_ << 8 | p_187265_2_); - - for(int i = 0; i < this.field_187287_g; ++i) { -@@ -139,6 +165,8 @@ - } - } - -+ if (this.field_187287_g == this.field_187285_e.length) -+ this.field_187285_e = java.util.Arrays.copyOf(this.field_187285_e, this.field_187285_e.length << 1); - this.field_187285_e[this.field_187287_g++] = short1; - } - -@@ -163,20 +191,22 @@ - int k = (this.field_187285_e[0] >> 8 & 15) + this.field_187284_d.field_77275_b * 16; - BlockPos blockpos = new BlockPos(i, j, k); - this.func_187267_a(new SPacketBlockChange(this.field_187282_b.func_72688_a(), blockpos)); -- if (this.field_187282_b.func_72688_a().func_180495_p(blockpos).func_177230_c().func_149716_u()) { -+ if (this.field_187282_b.func_72688_a().func_180495_p(blockpos).hasTileEntity()) { - this.func_187273_a(this.field_187282_b.func_72688_a().func_175625_s(blockpos)); - } -- } else if (this.field_187287_g == 64) { -+ } else if (this.field_187287_g >= net.minecraftforge.common.ForgeConfig.SERVER.clumpingThreshold.get()) { - this.func_187267_a(new SPacketChunkData(this.field_187286_f, this.field_187288_h)); -+ //TODO: Fix Mojang's fuckup to modded by combining all TE data into the chunk data packet... seriously... packet size explosion! - } else { - this.func_187267_a(new SPacketMultiBlockChange(this.field_187287_g, this.field_187285_e, this.field_187286_f)); -- -+ //} Keep this in the else until we figure out a fix for mojang's derpitude on the data packet so we don't double send crap. -+ //{// Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small - for(int l = 0; l < this.field_187287_g; ++l) { - int i1 = (this.field_187285_e[l] >> 12 & 15) + this.field_187284_d.field_77276_a * 16; - int j1 = this.field_187285_e[l] & 255; - int k1 = (this.field_187285_e[l] >> 8 & 15) + this.field_187284_d.field_77275_b * 16; - BlockPos blockpos1 = new BlockPos(i1, j1, k1); -- if (this.field_187282_b.func_72688_a().func_180495_p(blockpos1).func_177230_c().func_149716_u()) { -+ if (this.field_187282_b.func_72688_a().func_180495_p(blockpos1).hasTileEntity()) { - this.func_187273_a(this.field_187282_b.func_72688_a().func_175625_s(blockpos1)); - } - } -@@ -240,4 +270,8 @@ - - return d0; - } -+ -+ public List getWatchingPlayers() { -+ return func_187274_e() ? java.util.Collections.unmodifiableList(field_187283_c) : java.util.Collections.emptyList(); -+ } - } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch index 362b77f1c..61f53d185 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerInteractionManager.java.patch @@ -1,118 +1,107 @@ --- a/net/minecraft/server/management/PlayerInteractionManager.java +++ b/net/minecraft/server/management/PlayerInteractionManager.java -@@ -75,7 +75,7 @@ +@@ -74,7 +74,7 @@ if (this.field_73097_j) { int i = this.field_73100_i - this.field_73093_n; - IBlockState iblockstate = this.field_73092_a.func_180495_p(this.field_180241_i); -- if (iblockstate.func_196958_f()) { -+ if (iblockstate.isAir(field_73092_a, this.field_180241_i)) { + BlockState blockstate = this.field_73092_a.func_180495_p(this.field_180241_i); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(field_73092_a, field_180241_i)) { this.field_73097_j = false; } else { - float f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180241_i) * (float)(i + 1); -@@ -92,13 +92,13 @@ + float f = blockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180241_i) * (float)(i + 1); +@@ -91,13 +91,13 @@ } } else if (this.field_73088_d) { - IBlockState iblockstate1 = this.field_73092_a.func_180495_p(this.field_180240_f); -- if (iblockstate1.func_196958_f()) { -+ if (iblockstate1.isAir(field_73092_a, this.field_180240_f)) { + BlockState blockstate1 = this.field_73092_a.func_180495_p(this.field_180240_f); +- if (blockstate1.func_196958_f()) { ++ if (blockstate1.isAir(field_73092_a, field_180240_f)) { this.field_73092_a.func_175715_c(this.field_73090_b.func_145782_y(), this.field_180240_f, -1); this.field_73094_o = -1; this.field_73088_d = false; } else { int k = this.field_73100_i - this.field_73089_e; -- float f1 = iblockstate1.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180241_i) * (float)(k + 1); -+ float f1 = iblockstate1.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180240_f) * (float)(k + 1); // Forge: Fix network break progress using wrong position +- float f1 = blockstate1.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180241_i) * (float)(k + 1); ++ float f1 = blockstate1.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, this.field_180240_f) * (float)(k + 1); // Forge: Fix network break progress using wrong position int l = (int)(f1 * 10.0F); if (l != this.field_73094_o) { this.field_73092_a.func_175715_c(this.field_73090_b.func_145782_y(), this.field_180240_f, l); -@@ -110,6 +110,13 @@ +@@ -109,6 +109,12 @@ } - public void func_180784_a(BlockPos p_180784_1_, EnumFacing p_180784_2_) { -+ double reachDist = field_73090_b.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e(); -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(field_73090_b, p_180784_1_, p_180784_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(field_73090_b, reachDist + 1)); + public void func_180784_a(BlockPos p_180784_1_, Direction p_180784_2_) { ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(field_73090_b, p_180784_1_, p_180784_2_); + if (event.isCanceled()) { // Restore block and te data -+ field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); ++ field_73090_b.field_71135_a.func_147359_a(new SChangeBlockPacket(field_73092_a, p_180784_1_)); + field_73092_a.func_184138_a(p_180784_1_, field_73092_a.func_180495_p(p_180784_1_), field_73092_a.func_180495_p(p_180784_1_), 3); + return; + } if (this.func_73083_d()) { - if (!this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_)) { + if (!this.field_73092_a.func_175719_a((PlayerEntity)null, p_180784_1_, p_180784_2_)) { this.func_180237_b(p_180784_1_); -@@ -134,16 +141,30 @@ - } - } - -- this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); +@@ -137,12 +143,26 @@ this.field_73089_e = this.field_73100_i; float f = 1.0F; - IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180784_1_); -- if (!iblockstate.func_196958_f()) { -+ if (!iblockstate.isAir(field_73092_a, p_180784_1_)) { + BlockState blockstate = this.field_73092_a.func_180495_p(p_180784_1_); +- if (!blockstate.func_196958_f()) { ++ if (!blockstate.isAir(field_73092_a, p_180784_1_)) { + if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) { - iblockstate.func_196942_a(this.field_73092_a, p_180784_1_, this.field_73090_b); -+ this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); + blockstate.func_196942_a(this.field_73092_a, p_180784_1_, this.field_73090_b); ++ this.field_73092_a.func_175719_a((PlayerEntity)null, p_180784_1_, p_180784_2_); + } else { // Restore block and te data -+ field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); ++ field_73090_b.field_71135_a.func_147359_a(new SChangeBlockPacket(field_73092_a, p_180784_1_)); + field_73092_a.func_184138_a(p_180784_1_, field_73092_a.func_180495_p(p_180784_1_), field_73092_a.func_180495_p(p_180784_1_), 3); + } - f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180784_1_); + f = blockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180784_1_); } -- if (!iblockstate.func_196958_f() && f >= 1.0F) { -+ +- if (!blockstate.func_196958_f() && f >= 1.0F) { + if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) { + if (f >= 1.0F) { // Restore block and te data -+ field_73090_b.field_71135_a.func_147359_a(new SPacketBlockChange(field_73092_a, p_180784_1_)); ++ field_73090_b.field_71135_a.func_147359_a(new SChangeBlockPacket(field_73092_a, p_180784_1_)); + field_73092_a.func_184138_a(p_180784_1_, field_73092_a.func_180495_p(p_180784_1_), field_73092_a.func_180495_p(p_180784_1_), 3); + } + return; + } + -+ if (!iblockstate.isAir(field_73092_a, p_180784_1_) && f >= 1.0F) { ++ if (!blockstate.isAir(field_73092_a, p_180784_1_) && f >= 1.0F) { this.func_180237_b(p_180784_1_); } else { this.field_73088_d = true; -@@ -161,7 +182,7 @@ +@@ -160,7 +180,7 @@ if (p_180785_1_.equals(this.field_180240_f)) { int i = this.field_73100_i - this.field_73089_e; - IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180785_1_); -- if (!iblockstate.func_196958_f()) { -+ if (!iblockstate.isAir(field_73092_a, p_180785_1_)) { - float f = iblockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180785_1_) * (float)(i + 1); + BlockState blockstate = this.field_73092_a.func_180495_p(p_180785_1_); +- if (!blockstate.func_196958_f()) { ++ if (!blockstate.isAir(field_73092_a, p_180785_1_)) { + float f = blockstate.func_185903_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180785_1_) * (float)(i + 1); if (f >= 0.7F) { this.field_73088_d = false; -@@ -184,11 +205,14 @@ +@@ -183,9 +203,11 @@ } private boolean func_180235_c(BlockPos p_180235_1_) { -- IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180235_1_); -- iblockstate.func_177230_c().func_176208_a(this.field_73092_a, p_180235_1_, iblockstate, this.field_73090_b); -- boolean flag = this.field_73092_a.func_175698_g(p_180235_1_); + return removeBlock(p_180235_1_, false); + } -+ private boolean removeBlock(BlockPos pos, boolean canHarvest) { -+ IBlockState iblockstate = this.field_73092_a.func_180495_p(pos); -+ boolean flag = iblockstate.removedByPlayer(field_73092_a, pos, field_73090_b, canHarvest, field_73092_a.func_204610_c(pos)); -+ ++ private boolean removeBlock(BlockPos p_180235_1_, boolean canHarvest) { + BlockState blockstate = this.field_73092_a.func_180495_p(p_180235_1_); +- blockstate.func_177230_c().func_176208_a(this.field_73092_a, p_180235_1_, blockstate, this.field_73090_b); +- boolean flag = this.field_73092_a.func_217377_a(p_180235_1_, false); ++ boolean flag = blockstate.removedByPlayer(field_73092_a, p_180235_1_, field_73090_b, canHarvest, field_73092_a.func_204610_c(p_180235_1_)); if (flag) { -- iblockstate.func_177230_c().func_176206_d(this.field_73092_a, p_180235_1_, iblockstate); -+ iblockstate.func_177230_c().func_176206_d(this.field_73092_a, pos, iblockstate); + blockstate.func_177230_c().func_176206_d(this.field_73092_a, p_180235_1_, blockstate); } - - return flag; -@@ -196,7 +220,8 @@ +@@ -195,7 +217,8 @@ public boolean func_180237_b(BlockPos p_180237_1_) { - IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180237_1_); -- if (!this.field_73090_b.func_184614_ca().func_77973_b().func_195938_a(iblockstate, this.field_73092_a, p_180237_1_, this.field_73090_b)) { + BlockState blockstate = this.field_73092_a.func_180495_p(p_180237_1_); +- if (!this.field_73090_b.func_184614_ca().func_77973_b().func_195938_a(blockstate, this.field_73092_a, p_180237_1_, this.field_73090_b)) { + int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(field_73092_a, field_73091_c, field_73090_b, p_180237_1_); + if (exp == -1) { return false; } else { TileEntity tileentity = this.field_73092_a.func_175625_s(p_180237_1_); -@@ -205,6 +230,11 @@ - this.field_73092_a.func_184138_a(p_180237_1_, iblockstate, iblockstate, 3); +@@ -204,6 +227,11 @@ + this.field_73092_a.func_184138_a(p_180237_1_, blockstate, blockstate, 3); return false; } else { + ItemStack stack = field_73090_b.func_184614_ca(); @@ -123,7 +112,7 @@ if (this.field_73091_c.func_82752_c()) { if (this.field_73091_c == GameType.SPECTATOR) { return false; -@@ -223,17 +253,28 @@ +@@ -222,17 +250,28 @@ } } @@ -131,34 +120,34 @@ + boolean flag1 = false; if (!this.func_73083_d()) { ItemStack itemstack2 = this.field_73090_b.func_184614_ca(); -- boolean flag = this.field_73090_b.func_184823_b(iblockstate); +- boolean flag = this.field_73090_b.func_184823_b(blockstate); + ItemStack copy = itemstack2.func_77946_l(); -+ boolean flag = iblockstate.canHarvestBlock(field_73092_a, p_180237_1_, field_73090_b); - itemstack2.func_179548_a(this.field_73092_a, iblockstate, p_180237_1_, this.field_73090_b); ++ boolean flag = blockstate.canHarvestBlock(field_73092_a, p_180237_1_, field_73090_b); + itemstack2.func_179548_a(this.field_73092_a, blockstate, p_180237_1_, this.field_73090_b); + if (itemstack2.func_190926_b() && !copy.func_190926_b()) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_73090_b, copy, EnumHand.MAIN_HAND); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_73090_b, copy, Hand.MAIN_HAND); + } + flag1 = this.removeBlock(p_180237_1_, flag); if (flag1 && flag) { ItemStack itemstack1 = itemstack2.func_190926_b() ? ItemStack.field_190927_a : itemstack2.func_77946_l(); - iblockstate.func_177230_c().func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, iblockstate, tileentity, itemstack1); + blockstate.func_177230_c().func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, blockstate, tileentity, itemstack1); } + } else { + flag1 = this.func_180235_c(p_180237_1_); } + if (!this.func_73083_d() && flag1 && exp > 0) { // Drop experience -+ iblockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); ++ blockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); + } + return flag1; } } -@@ -245,8 +286,11 @@ +@@ -244,8 +283,11 @@ } else if (p_187250_1_.func_184811_cZ().func_185141_a(p_187250_3_.func_77973_b())) { - return EnumActionResult.PASS; + return ActionResultType.PASS; } else { -+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187250_1_, p_187250_4_); ++ ActionResultType cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187250_1_, p_187250_4_); + if (cancelResult != null) return cancelResult; int i = p_187250_3_.func_190916_E(); int j = p_187250_3_.func_77952_i(); @@ -166,7 +155,7 @@ ActionResult actionresult = p_187250_3_.func_77957_a(p_187250_2_, p_187250_1_, p_187250_4_); ItemStack itemstack = actionresult.func_188398_b(); if (itemstack == p_187250_3_ && itemstack.func_190916_E() == i && itemstack.func_77988_m() <= 0 && itemstack.func_77952_i() == j) { -@@ -263,6 +307,7 @@ +@@ -262,6 +304,7 @@ } if (itemstack.func_190926_b()) { @@ -174,59 +163,48 @@ p_187250_1_.func_184611_a(p_187250_4_, ItemStack.field_190927_a); } -@@ -297,19 +342,50 @@ - - return EnumActionResult.PASS; +@@ -286,19 +329,39 @@ + return ActionResultType.PASS; + } } else { -- boolean flag = !p_187251_1_.func_184614_ca().func_190926_b() || !p_187251_1_.func_184592_cb().func_190926_b(); -+ double reachDist = p_187251_1_.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e(); -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks -+ .onRightClickBlock(p_187251_1_, p_187251_4_, p_187251_5_, p_187251_6_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(p_187251_1_, reachDist + 1)); +- boolean flag = !p_219441_1_.func_184614_ca().func_190926_b() || !p_219441_1_.func_184592_cb().func_190926_b(); ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks.onRightClickBlock(field_73090_b, p_219441_4_, blockpos, p_219441_5_.func_216354_b()); + if (event.isCanceled()) return event.getCancellationResult(); + -+ EnumActionResult result = EnumActionResult.PASS; ++ ActionResultType result = ActionResultType.PASS; + if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) { -+ result = p_187251_3_.onItemUseFirst(new ItemUseContext(p_187251_1_, p_187251_3_, p_187251_5_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_)); -+ if (result != EnumActionResult.PASS) { ++ result = p_219441_3_.onItemUseFirst(new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_)); ++ if (result != ActionResultType.PASS) { + return result; + } + } + -+ boolean flag = !(p_187251_1_.func_184614_ca().doesSneakBypassUse(p_187251_2_, p_187251_5_, p_187251_1_) && p_187251_1_.func_184592_cb().doesSneakBypassUse(p_187251_2_, p_187251_5_, p_187251_1_)); - boolean flag1 = p_187251_1_.func_70093_af() && flag; -- if (!flag1 && iblockstate.func_196943_a(p_187251_2_, p_187251_5_, p_187251_1_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_)) { -- return EnumActionResult.SUCCESS; -- } else if (!p_187251_3_.func_190926_b() && !p_187251_1_.func_184811_cZ().func_185141_a(p_187251_3_.func_77973_b())) { -+ -+ if ((!flag1 || event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW) && -+ event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && -+ iblockstate.func_196943_a(p_187251_2_, p_187251_5_, p_187251_1_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_)) { -+ result = EnumActionResult.SUCCESS; -+ } -+ -+ if (!p_187251_3_.func_190926_b() && !p_187251_1_.func_184811_cZ().func_185141_a(p_187251_3_.func_77973_b())) { - ItemUseContext itemusecontext = new ItemUseContext(p_187251_1_, p_187251_1_.func_184586_b(p_187251_4_), p_187251_5_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_); ++ boolean flag = !(field_73090_b.func_184614_ca().doesSneakBypassUse(p_219441_2_, blockpos, p_219441_1_) && field_73090_b.func_184592_cb().doesSneakBypassUse(p_219441_2_, blockpos, p_219441_1_)); + boolean flag1 = p_219441_1_.func_70093_af() && flag; +- if (!flag1 && blockstate.func_215687_a(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_)) { +- return ActionResultType.SUCCESS; +- } else if (!p_219441_3_.func_190926_b() && !p_219441_1_.func_184811_cZ().func_185141_a(p_219441_3_.func_77973_b())) { ++ if (!p_219441_3_.func_190926_b() && !p_219441_1_.func_184811_cZ().func_185141_a(p_219441_3_.func_77973_b())) { + ItemUseContext itemusecontext = new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_); if (this.func_73083_d()) { - int i = p_187251_3_.func_190916_E(); -+ if ((result != EnumActionResult.SUCCESS && event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) || -+ (result == EnumActionResult.SUCCESS && event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW)) { - EnumActionResult enumactionresult = p_187251_3_.func_196084_a(itemusecontext); - p_187251_3_.func_190920_e(i); - return enumactionresult; -+ } else { -+ return result; -+ } + int i = p_219441_3_.func_190916_E(); ++ if ((result != ActionResultType.SUCCESS && event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) || ++ (result == ActionResultType.SUCCESS && event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW)) { + ActionResultType actionresulttype = p_219441_3_.func_196084_a(itemusecontext); + p_219441_3_.func_190920_e(i); + return actionresulttype; ++ } else return result; } else { -- return p_187251_3_.func_196084_a(itemusecontext); -+ if ((result != EnumActionResult.SUCCESS && event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) || -+ (result == EnumActionResult.SUCCESS && event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW)) { -+ ItemStack copyBeforeUse = p_187251_3_.func_77946_l(); -+ result = p_187251_3_.func_196084_a(itemusecontext); -+ if (p_187251_3_.func_190926_b()) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187251_1_, copyBeforeUse, p_187251_4_); +- return p_219441_3_.func_196084_a(itemusecontext); ++ if ((result != ActionResultType.SUCCESS && event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) || ++ (result == ActionResultType.SUCCESS && event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW)) { ++ ItemStack copyBeforeUse = p_219441_3_.func_77946_l(); ++ result = p_219441_3_.func_196084_a(itemusecontext); ++ if (p_219441_3_.func_190926_b()) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(field_73090_b, copyBeforeUse, p_219441_4_); + } + } + return result; } } else { - return EnumActionResult.PASS; + return ActionResultType.PASS; diff --git a/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch index a13721fd5..615bb9f87 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerList.java.patch @@ -1,76 +1,68 @@ --- a/net/minecraft/server/management/PlayerList.java +++ b/net/minecraft/server/management/PlayerList.java -@@ -107,7 +107,16 @@ - String s = gameprofile1 == null ? gameprofile.getName() : gameprofile1.getName(); +@@ -109,6 +109,14 @@ playerprofilecache.func_152649_a(gameprofile); - NBTTagCompound nbttagcompound = this.func_72380_a(p_72355_2_); -- p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK)); + CompoundNBT compoundnbt = this.func_72380_a(p_72355_2_); + ServerWorld serverworld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); + + //Forge: Make sure the dimension hasn't been deleted, if so stick them in the overworld. -+ WorldServer playerWorld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); -+ if (playerWorld == null) { ++ if (serverworld == null) { + p_72355_2_.field_71093_bK = DimensionType.OVERWORLD; -+ playerWorld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); -+ p_72355_2_.func_70107_b(playerWorld.func_72912_H().func_76079_c(), playerWorld.func_72912_H().func_76075_d(), playerWorld.func_72912_H().func_76074_e()); ++ serverworld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); ++ p_72355_2_.func_70107_b(serverworld.func_72912_H().func_76079_c(), serverworld.func_72912_H().func_76075_d(), serverworld.func_72912_H().func_76074_e()); + } + -+ p_72355_2_.func_70029_a(playerWorld); - p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p); + p_72355_2_.func_70029_a(serverworld); + p_72355_2_.field_71134_c.func_73080_a((ServerWorld)p_72355_2_.field_70170_p); String s1 = "local"; - if (p_72355_1_.func_74430_c() != null) { -@@ -178,6 +187,7 @@ +@@ -162,8 +170,9 @@ + + if (compoundnbt != null && compoundnbt.func_150297_b("RootVehicle", 10)) { + CompoundNBT compoundnbt1 = compoundnbt.func_74775_l("RootVehicle"); ++ final ServerWorld worldf = serverworld; + Entity entity1 = EntityType.func_220335_a(compoundnbt1.func_74775_l("Entity"), serverworld, (p_217885_1_) -> { +- return !serverworld.func_217470_d(p_217885_1_) ? null : p_217885_1_; ++ return !worldf.func_217470_d(p_217885_1_) ? null : p_217885_1_; + }); + if (entity1 != null) { + UUID uuid = compoundnbt1.func_186857_a("Attach"); +@@ -190,6 +199,7 @@ } p_72355_2_.func_71116_b(); + net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerLoggedIn( p_72355_2_ ); } - protected void func_96456_a(ServerScoreboard p_96456_1_, EntityPlayerMP p_96456_2_) { -@@ -260,6 +270,7 @@ - nbttagcompound1 = nbttagcompound; - p_72380_1_.func_70020_e(nbttagcompound); + protected void func_96456_a(ServerScoreboard p_96456_1_, ServerPlayerEntity p_96456_2_) { +@@ -251,6 +261,7 @@ + compoundnbt1 = compoundnbt; + p_72380_1_.func_70020_e(compoundnbt); field_148546_d.debug("loading single player"); + net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_72380_1_, this.field_72412_k, p_72380_1_.func_110124_au().toString()); } else { - nbttagcompound1 = this.field_72412_k.func_75752_b(p_72380_1_); + compoundnbt1 = this.field_72412_k.func_75752_b(p_72380_1_); } -@@ -268,6 +279,7 @@ +@@ -259,6 +270,7 @@ } - protected void func_72391_b(EntityPlayerMP p_72391_1_) { + protected void func_72391_b(ServerPlayerEntity p_72391_1_) { + if (p_72391_1_.field_71135_a == null) return; this.field_72412_k.func_75753_a(p_72391_1_); - StatisticsManagerServer statisticsmanagerserver = this.field_148547_k.get(p_72391_1_.func_110124_au()); - if (statisticsmanagerserver != null) { -@@ -291,6 +303,7 @@ - p_72377_1_.field_71135_a.func_147359_a(new SPacketPlayerListItem(SPacketPlayerListItem.Action.ADD_PLAYER, this.field_72404_b.get(i))); - } - -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); - worldserver.func_72838_d(p_72377_1_); - this.func_72375_a(p_72377_1_, (WorldServer)null); - this.field_72400_f.func_201300_aS().func_201383_a(p_72377_1_); -@@ -301,6 +314,7 @@ + ServerStatisticsManager serverstatisticsmanager = this.field_148547_k.get(p_72391_1_.func_110124_au()); + if (serverstatisticsmanager != null) { +@@ -273,6 +285,7 @@ } - public void func_72367_e(EntityPlayerMP p_72367_1_) { -+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerLoggedOut( p_72367_1_ ); - WorldServer worldserver = p_72367_1_.func_71121_q(); - p_72367_1_.func_195066_a(StatList.field_75947_j); + public void func_72367_e(ServerPlayerEntity p_72367_1_) { ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerLoggedOut(p_72367_1_); + ServerWorld serverworld = p_72367_1_.func_71121_q(); + p_72367_1_.func_195066_a(Stats.field_75947_j); this.func_72391_b(p_72367_1_); -@@ -318,6 +332,7 @@ - worldserver.func_72964_e(p_72367_1_.field_70176_ah, p_72367_1_.field_70164_aj).func_76630_e(); - } - } -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); - - worldserver.func_72900_e(p_72367_1_); - worldserver.func_184164_w().func_72695_c(p_72367_1_); -@@ -391,13 +406,21 @@ +@@ -363,10 +376,18 @@ } - public EntityPlayerMP func_72368_a(EntityPlayerMP p_72368_1_, DimensionType p_72368_2_, boolean p_72368_3_) { -+ WorldServer world = field_72400_f.func_71218_a(p_72368_2_); + public ServerPlayerEntity func_72368_a(ServerPlayerEntity p_72368_1_, DimensionType p_72368_2_, boolean p_72368_3_) { ++ ServerWorld world = field_72400_f.func_71218_a(p_72368_2_); + if (world == null) + p_72368_2_ = p_72368_1_.getSpawnDimension(); + else if (!world.func_201675_m().func_76567_e()) @@ -78,135 +70,39 @@ + if (field_72400_f.func_71218_a(p_72368_2_) == null) + p_72368_2_ = DimensionType.OVERWORLD; + - p_72368_1_.func_71121_q().func_73039_n().func_72787_a(p_72368_1_); - p_72368_1_.func_71121_q().func_73039_n().func_72790_b(p_72368_1_); - p_72368_1_.func_71121_q().func_184164_w().func_72695_c(p_72368_1_); this.field_72404_b.remove(p_72368_1_); -- this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK).func_72973_f(p_72368_1_); +- p_72368_1_.func_71121_q().func_217434_e(p_72368_1_); - BlockPos blockpos = p_72368_1_.func_180470_cg(); - boolean flag = p_72368_1_.func_82245_bX(); -+ this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK).removeEntityDangerously(p_72368_1_, true); // Forge: keep data until copyFrom called ++ p_72368_1_.func_71121_q().removePlayer(p_72368_1_, true); // Forge: keep data until copyFrom called + BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_); + boolean flag = p_72368_1_.isSpawnForced(p_72368_2_); p_72368_1_.field_71093_bK = p_72368_2_; PlayerInteractionManager playerinteractionmanager; if (this.field_72400_f.func_71242_L()) { -@@ -409,6 +432,8 @@ - EntityPlayerMP entityplayermp = new EntityPlayerMP(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), playerinteractionmanager); - entityplayermp.field_71135_a = p_72368_1_.field_71135_a; - entityplayermp.func_193104_a(p_72368_1_, p_72368_3_); +@@ -378,6 +399,8 @@ + ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), playerinteractionmanager); + serverplayerentity.field_71135_a = p_72368_1_.field_71135_a; + serverplayerentity.func_193104_a(p_72368_1_, p_72368_3_); + p_72368_1_.remove(false); // Forge: clone event had a chance to see old data, now discard it -+ entityplayermp.field_71093_bK = p_72368_2_; - entityplayermp.func_145769_d(p_72368_1_.func_145782_y()); - entityplayermp.func_184819_a(p_72368_1_.func_184591_cq()); ++ serverplayerentity.field_71093_bK = p_72368_2_; + serverplayerentity.func_145769_d(p_72368_1_.func_145782_y()); + serverplayerentity.func_184819_a(p_72368_1_.func_184591_cq()); -@@ -422,7 +447,7 @@ - BlockPos blockpos1 = EntityPlayer.func_180467_a(this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), blockpos, flag); - if (blockpos1 != null) { - entityplayermp.func_70012_b((double)((float)blockpos1.func_177958_n() + 0.5F), (double)((float)blockpos1.func_177956_o() + 0.1F), (double)((float)blockpos1.func_177952_p() + 0.5F), 0.0F, 0.0F); -- entityplayermp.func_180473_a(blockpos, flag); -+ entityplayermp.setSpawnPoint(blockpos, flag, p_72368_1_.field_71093_bK); +@@ -392,7 +415,7 @@ + if (optional.isPresent()) { + Vec3d vec3d = optional.get(); + serverplayerentity.func_70012_b(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c, 0.0F, 0.0F); +- serverplayerentity.func_180473_a(blockpos, flag); ++ serverplayerentity.setSpawnPoint(blockpos, flag, p_72368_2_); } else { - entityplayermp.field_71135_a.func_147359_a(new SPacketChangeGameState(0, 0.0F)); + serverplayerentity.field_71135_a.func_147359_a(new SChangeGameStatePacket(0, 0.0F)); } -@@ -434,7 +459,7 @@ - entityplayermp.func_70107_b(entityplayermp.field_70165_t, entityplayermp.field_70163_u + 1.0D, entityplayermp.field_70161_v); - } - -- entityplayermp.field_71135_a.func_147359_a(new SPacketRespawn(entityplayermp.field_71093_bK, entityplayermp.field_70170_p.func_175659_aa(), entityplayermp.field_70170_p.func_72912_H().func_76067_t(), entityplayermp.field_71134_c.func_73081_b())); -+ entityplayermp.field_71135_a.func_147359_a(new SPacketRespawn(entityplayermp.field_71093_bK, world.func_175659_aa(), world.func_72912_H().func_76067_t(), entityplayermp.field_71134_c.func_73081_b())); // Forge: Use new dimensions information - BlockPos blockpos2 = worldserver.func_175694_M(); - entityplayermp.field_71135_a.func_147364_a(entityplayermp.field_70165_t, entityplayermp.field_70163_u, entityplayermp.field_70161_v, entityplayermp.field_70177_z, entityplayermp.field_70125_A); - entityplayermp.field_71135_a.func_147359_a(new SPacketSpawnPosition(blockpos2)); -@@ -447,6 +472,7 @@ - this.field_177454_f.put(entityplayermp.func_110124_au(), entityplayermp); - entityplayermp.func_71116_b(); - entityplayermp.func_70606_j(entityplayermp.func_110143_aJ()); -+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerRespawnEvent(entityplayermp, p_72368_3_); - return entityplayermp; +@@ -416,6 +439,7 @@ + this.field_177454_f.put(serverplayerentity.func_110124_au(), serverplayerentity); + serverplayerentity.func_71116_b(); + serverplayerentity.func_70606_j(serverplayerentity.func_110143_aJ()); ++ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerRespawnEvent(serverplayerentity, p_72368_3_); + return serverplayerentity; } -@@ -457,15 +483,19 @@ - } - - public void func_187242_a(EntityPlayerMP p_187242_1_, DimensionType p_187242_2_) { -+ changePlayerDimension(p_187242_1_, p_187242_2_, field_72400_f.func_71218_a(p_187242_2_).func_85176_s()); -+ } -+ -+ public void changePlayerDimension(EntityPlayerMP p_187242_1_, DimensionType p_187242_2_, net.minecraftforge.common.util.ITeleporter teleporter) { - DimensionType dimensiontype = p_187242_1_.field_71093_bK; - WorldServer worldserver = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK); - p_187242_1_.field_71093_bK = p_187242_2_; - WorldServer worldserver1 = this.field_72400_f.func_71218_a(p_187242_1_.field_71093_bK); -- p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, p_187242_1_.field_70170_p.func_175659_aa(), p_187242_1_.field_70170_p.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b())); -+ p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b())); - this.func_187243_f(p_187242_1_); -- worldserver.func_72973_f(p_187242_1_); -- p_187242_1_.field_70128_L = false; -- this.func_82448_a(p_187242_1_, dimensiontype, worldserver, worldserver1); -+ worldserver.removeEntityDangerously(p_187242_1_, true); //Forge: the player entity is moved to the new world, NOT cloned. So keep the data alive with no matching invalidate call. -+ p_187242_1_.revive(); -+ this.transferEntityToWorld(p_187242_1_, dimensiontype, worldserver, worldserver1, teleporter); - this.func_72375_a(p_187242_1_, worldserver); - p_187242_1_.field_71135_a.func_147364_a(p_187242_1_.field_70165_t, p_187242_1_.field_70163_u, p_187242_1_.field_70161_v, p_187242_1_.field_70177_z, p_187242_1_.field_70125_A); - p_187242_1_.field_71134_c.func_73080_a(worldserver1); -@@ -477,29 +507,25 @@ - p_187242_1_.field_71135_a.func_147359_a(new SPacketEntityEffect(p_187242_1_.func_145782_y(), potioneffect)); - } - -+ // Fix MC-88179: on non-death SPacketRespawn, also resend attributes -+ net.minecraft.entity.ai.attributes.AttributeMap attributemap = (net.minecraft.entity.ai.attributes.AttributeMap) p_187242_1_.func_110140_aT(); -+ java.util.Collection watchedAttribs = attributemap.func_111160_c(); -+ if (!watchedAttribs.isEmpty()) p_187242_1_.field_71135_a.func_147359_a(new net.minecraft.network.play.server.SPacketEntityProperties(p_187242_1_.func_145782_y(), watchedAttribs)); -+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(p_187242_1_, dimensiontype, p_187242_2_); - } - - public void func_82448_a(Entity p_82448_1_, DimensionType p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) { -- double d0 = p_82448_1_.field_70165_t; -- double d1 = p_82448_1_.field_70161_v; -+ transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.func_85176_s()); -+ } -+ -+ public void transferEntityToWorld(Entity p_82448_1_, DimensionType p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraftforge.common.util.ITeleporter teleporter) { -+ double moveFactor = p_82448_3_.func_201675_m().getMovementFactor() / p_82448_4_.func_201675_m().getMovementFactor(); -+ double d0 = MathHelper.func_151237_a(p_82448_1_.field_70165_t * moveFactor, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); -+ double d1 = MathHelper.func_151237_a(p_82448_1_.field_70161_v * moveFactor, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); - double d2 = 8.0D; - float f = p_82448_1_.field_70177_z; - p_82448_3_.field_72984_F.func_76320_a("moving"); -- if (p_82448_1_.field_71093_bK == DimensionType.NETHER) { -- d0 = MathHelper.func_151237_a(d0 / 8.0D, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); -- d1 = MathHelper.func_151237_a(d1 / 8.0D, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); -- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); -- if (p_82448_1_.func_70089_S()) { -- p_82448_3_.func_72866_a(p_82448_1_, false); -- } -- } else if (p_82448_1_.field_71093_bK == DimensionType.OVERWORLD) { -- d0 = MathHelper.func_151237_a(d0 * 8.0D, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); -- d1 = MathHelper.func_151237_a(d1 * 8.0D, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); -- p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); -- if (p_82448_1_.func_70089_S()) { -- p_82448_3_.func_72866_a(p_82448_1_, false); -- } -- } else { -+ if (p_82448_1_.field_71093_bK == DimensionType.THE_END && teleporter.isVanilla()) { - BlockPos blockpos; - if (p_82448_2_ == DimensionType.THE_END) { - blockpos = p_82448_4_.func_175694_M(); -@@ -517,13 +543,14 @@ - } - - p_82448_3_.field_72984_F.func_76319_b(); -- if (p_82448_2_ != DimensionType.THE_END) { -+ if (p_82448_2_ != DimensionType.THE_END || !teleporter.isVanilla()) { - p_82448_3_.field_72984_F.func_76320_a("placing"); - d0 = (double)MathHelper.func_76125_a((int)d0, -29999872, 29999872); - d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872); - if (p_82448_1_.func_70089_S()) { - p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); -- p_82448_4_.func_85176_s().func_180266_a(p_82448_1_, f); -+ p_82448_4_.func_72866_a(p_82448_1_, false); -+ teleporter.placeEntity(p_82448_4_, p_82448_1_, f); - p_82448_4_.func_72838_d(p_82448_1_); - p_82448_4_.func_72866_a(p_82448_1_, false); - } diff --git a/patches/minecraft/net/minecraft/tags/Tag.java.patch b/patches/minecraft/net/minecraft/tags/Tag.java.patch index 78758c654..b1ad6785d 100644 --- a/patches/minecraft/net/minecraft/tags/Tag.java.patch +++ b/patches/minecraft/net/minecraft/tags/Tag.java.patch @@ -1,18 +1,17 @@ --- a/net/minecraft/tags/Tag.java +++ b/net/minecraft/tags/Tag.java -@@ -151,9 +151,11 @@ - this.func_200159_a(new ResourceLocation(s.substring(1))); - } +@@ -147,8 +147,10 @@ } -+ net.minecraftforge.common.ForgeHooks.deserializeTagAdditions(this, p_200158_1_, p_200158_2_, p_200158_3_); + this.field_200052_a.addAll(list); ++ net.minecraftforge.common.ForgeHooks.deserializeTagAdditions(this, p_219783_1_, p_219783_2_); return this; } + public Tag.Builder remove(Tag.ITagEntry e) { this.field_200052_a.remove(e); return this; } } public interface ITagEntry { -@@ -192,6 +194,8 @@ +@@ -187,6 +189,8 @@ public Collection func_200578_a() { return this.field_200165_a; } @@ -21,7 +20,7 @@ } public static class TagEntry implements Tag.ITagEntry { -@@ -238,5 +242,7 @@ +@@ -233,5 +237,7 @@ public void func_200576_a(JsonArray p_200576_1_, Function p_200576_2_) { p_200576_1_.add("#" + this.func_200577_a()); } diff --git a/patches/minecraft/net/minecraft/tileentity/AbstractFurnaceTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/AbstractFurnaceTileEntity.java.patch new file mode 100644 index 000000000..23306cdf0 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/AbstractFurnaceTileEntity.java.patch @@ -0,0 +1,115 @@ +--- a/net/minecraft/tileentity/AbstractFurnaceTileEntity.java ++++ b/net/minecraft/tileentity/AbstractFurnaceTileEntity.java +@@ -169,9 +169,9 @@ + super.func_145839_a(p_145839_1_); + this.field_214012_a = NonNullList.func_191197_a(this.func_70302_i_(), ItemStack.field_190927_a); + ItemStackHelper.func_191283_b(p_145839_1_, this.field_214012_a); +- this.field_214018_j = p_145839_1_.func_74765_d("BurnTime"); +- this.field_214020_l = p_145839_1_.func_74765_d("CookTime"); +- this.field_214021_m = p_145839_1_.func_74765_d("CookTimeTotal"); ++ this.field_214018_j = p_145839_1_.func_74762_e("BurnTime"); ++ this.field_214020_l = p_145839_1_.func_74762_e("CookTime"); ++ this.field_214021_m = p_145839_1_.func_74762_e("CookTimeTotal"); + this.field_214019_k = this.func_213997_a(this.field_214012_a.get(1)); + int i = p_145839_1_.func_74765_d("RecipesUsedSize"); + +@@ -185,9 +185,9 @@ + + public CompoundNBT func_189515_b(CompoundNBT p_189515_1_) { + super.func_189515_b(p_189515_1_); +- p_189515_1_.func_74777_a("BurnTime", (short)this.field_214018_j); +- p_189515_1_.func_74777_a("CookTime", (short)this.field_214020_l); +- p_189515_1_.func_74777_a("CookTimeTotal", (short)this.field_214021_m); ++ p_189515_1_.func_74768_a("BurnTime", this.field_214018_j); ++ p_189515_1_.func_74768_a("CookTime", this.field_214020_l); ++ p_189515_1_.func_74768_a("CookTimeTotal", this.field_214021_m); + ItemStackHelper.func_191282_a(p_189515_1_, this.field_214012_a); + p_189515_1_.func_74777_a("RecipesUsedSize", (short)this.field_214022_n.size()); + int i = 0; +@@ -217,12 +217,14 @@ + this.field_214019_k = this.field_214018_j; + if (this.func_214006_r()) { + flag1 = true; ++ if (itemstack.hasContainerItem()) ++ this.field_214012_a.set(1, itemstack.getContainerItem()); ++ else + if (!itemstack.func_190926_b()) { + Item item = itemstack.func_77973_b(); + itemstack.func_190918_g(1); + if (itemstack.func_190926_b()) { +- Item item1 = item.func_77668_q(); +- this.field_214012_a.set(1, item1 == null ? ItemStack.field_190927_a : new ItemStack(item1)); ++ this.field_214012_a.set(1, itemstack.getContainerItem()); + } + } + } +@@ -266,10 +268,10 @@ + return true; + } else if (!itemstack1.func_77969_a(itemstack)) { + return false; +- } else if (itemstack1.func_190916_E() < this.func_70297_j_() && itemstack1.func_190916_E() < itemstack1.func_77976_d()) { ++ } else if (itemstack1.func_190916_E() + itemstack.func_190916_E() <= this.func_70297_j_() && itemstack1.func_190916_E() + itemstack.func_190916_E() <= itemstack1.func_77976_d()) { // Forge fix: make furnace respect stack sizes in furnace recipes + return true; + } else { +- return itemstack1.func_190916_E() < itemstack.func_77976_d(); ++ return itemstack1.func_190916_E() + itemstack.func_190916_E() <= itemstack.func_77976_d(); // Forge fix: make furnace respect stack sizes in furnace recipes + } + } + } else { +@@ -285,7 +287,7 @@ + if (itemstack2.func_190926_b()) { + this.field_214012_a.set(2, itemstack1.func_77946_l()); + } else if (itemstack2.func_77973_b() == itemstack1.func_77973_b()) { +- itemstack2.func_190917_f(1); ++ itemstack2.func_190917_f(itemstack1.func_190916_E()); + } + + if (!this.field_145850_b.field_72995_K) { +@@ -305,7 +307,8 @@ + return 0; + } else { + Item item = p_213997_1_.func_77973_b(); +- return func_214001_f().getOrDefault(item, 0); ++ int ret = p_213997_1_.getBurnTime(); ++ return net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(p_213997_1_, ret == -1 ? func_214001_f().getOrDefault(item, 0) : ret); + } + } + +@@ -314,7 +317,8 @@ + } + + public static boolean func_213991_b(ItemStack p_213991_0_) { +- return func_214001_f().containsKey(p_213991_0_.func_77973_b()); ++ int ret = p_213991_0_.getBurnTime(); ++ return net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(p_213991_0_, ret == -1 ? func_214001_f().getOrDefault(p_213991_0_.func_77973_b(), 0) : ret) > 0; + } + + public int[] func_180463_a(Direction p_180463_1_) { +@@ -462,4 +466,27 @@ + } + + } ++ ++ net.minecraftforge.common.util.LazyOptional[] handlers = ++ net.minecraftforge.items.wrapper.SidedInvWrapper.create(this, Direction.UP, Direction.DOWN, Direction.NORTH); ++ ++ @Override ++ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable Direction facing) { ++ if (!this.field_145846_f && facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { ++ if (facing == Direction.UP) ++ return handlers[0].cast(); ++ else if (facing == Direction.DOWN) ++ return handlers[1].cast(); ++ else ++ return handlers[2].cast(); ++ } ++ return super.getCapability(capability, facing); ++ } ++ ++ @Override ++ public void func_145843_s() { ++ super.func_145843_s(); ++ for (int x = 0; x < handlers.length; x++) ++ handlers[x].invalidate(); ++ } + } diff --git a/patches/minecraft/net/minecraft/tileentity/BannerPattern.java.patch b/patches/minecraft/net/minecraft/tileentity/BannerPattern.java.patch index 872640a4b..a4b6ecef6 100644 --- a/patches/minecraft/net/minecraft/tileentity/BannerPattern.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/BannerPattern.java.patch @@ -1,24 +1,26 @@ --- a/net/minecraft/tileentity/BannerPattern.java +++ b/net/minecraft/tileentity/BannerPattern.java -@@ -7,7 +7,7 @@ - import net.minecraftforge.api.distmarker.Dist; +@@ -13,7 +13,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; + import org.apache.commons.lang3.tuple.Pair; -public enum BannerPattern { +public enum BannerPattern implements net.minecraftforge.common.IExtensibleEnum { BASE("base", "b"), SQUARE_BOTTOM_LEFT("square_bottom_left", "bl", " ", " ", "# "), SQUARE_BOTTOM_RIGHT("square_bottom_right", "br", " ", " ", " #"), -@@ -106,4 +106,12 @@ - +@@ -100,6 +100,14 @@ return null; } -+ + + public static BannerPattern create(String enumName, String p_i47246_3_, String p_i47246_4_, ItemStack p_i47246_5_) { -+ throw new IllegalStateException("Enum not extended"); ++ throw new IllegalStateException("Enum not extended"); + } -+ ++ + public static BannerPattern create(String enumName, String p_i47247_3_, String p_i47247_4_, String p_i47247_5_, String p_i47247_6_, String p_i47247_7_) { -+ throw new IllegalStateException("Enum not extended"); ++ throw new IllegalStateException("Enum not extended"); + } - } ++ + public static class Builder { + private final List> field_222478_a = Lists.newArrayList(); + diff --git a/patches/minecraft/net/minecraft/tileentity/BeaconTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/BeaconTileEntity.java.patch new file mode 100644 index 000000000..0e845da20 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/BeaconTileEntity.java.patch @@ -0,0 +1,23 @@ +--- a/net/minecraft/tileentity/BeaconTileEntity.java ++++ b/net/minecraft/tileentity/BeaconTileEntity.java +@@ -111,8 +111,8 @@ + for(int i1 = 0; i1 < 10 && blockpos.func_177956_o() <= l; ++i1) { + BlockState blockstate = this.field_145850_b.func_180495_p(blockpos); + Block block = blockstate.func_177230_c(); +- if (block instanceof IBeaconBeamColorProvider) { +- float[] afloat = ((IBeaconBeamColorProvider)block).func_196457_d().func_193349_f(); ++ float[] afloat = blockstate.getBeaconColorMultiplier(this.field_145850_b, blockpos, func_174877_v()); ++ if (afloat != null) { + if (this.field_213934_g.size() <= 1) { + beacontileentity$beamsegment = new BeaconTileEntity.BeamSegment(afloat); + this.field_213934_g.add(beacontileentity$beamsegment); +@@ -181,8 +181,7 @@ + + for(int k = p_213927_1_ - i; k <= p_213927_1_ + i && flag; ++k) { + for(int l = p_213927_3_ - i; l <= p_213927_3_ + i; ++l) { +- Block block = this.field_145850_b.func_180495_p(new BlockPos(k, j, l)).func_177230_c(); +- if (block != Blocks.field_150475_bE && block != Blocks.field_150340_R && block != Blocks.field_150484_ah && block != Blocks.field_150339_S) { ++ if (!this.field_145850_b.func_180495_p(new BlockPos(k, j, l)).isBeaconBase(this.field_145850_b, new BlockPos(k, j, l), func_174877_v())) { + flag = false; + break; + } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/BrewingStandTileEntity.java.patch similarity index 81% rename from patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch rename to patches/minecraft/net/minecraft/tileentity/BrewingStandTileEntity.java.patch index 7ac23232a..1e2043135 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/BrewingStandTileEntity.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/tileentity/TileEntityBrewingStand.java -+++ b/net/minecraft/tileentity/TileEntityBrewingStand.java -@@ -133,6 +133,7 @@ +--- a/net/minecraft/tileentity/BrewingStandTileEntity.java ++++ b/net/minecraft/tileentity/BrewingStandTileEntity.java +@@ -146,6 +146,7 @@ private boolean func_145934_k() { ItemStack itemstack = this.field_145945_j.get(3); @@ -8,7 +8,7 @@ if (itemstack.func_190926_b()) { return false; } else if (!PotionBrewing.func_185205_a(itemstack)) { -@@ -150,16 +151,15 @@ +@@ -163,16 +164,16 @@ } private void func_145940_l() { @@ -21,6 +21,7 @@ + net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(field_145945_j, itemstack, field_145947_i); itemstack.func_190918_g(1); ++ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(field_145945_j); BlockPos blockpos = this.func_174877_v(); - if (itemstack.func_77973_b().func_77634_r()) { - ItemStack itemstack1 = new ItemStack(itemstack.func_77973_b().func_77668_q()); @@ -28,16 +29,8 @@ + ItemStack itemstack1 = itemstack.getContainerItem(); if (itemstack.func_190926_b()) { itemstack = itemstack1; - } else { -@@ -169,6 +169,7 @@ - - this.field_145945_j.set(3, itemstack); - this.field_145850_b.func_175718_b(1035, blockpos, 0); -+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(field_145945_j); - } - - public void func_145839_a(NBTTagCompound p_145839_1_) { -@@ -234,13 +235,13 @@ + } else if (!this.field_145850_b.field_72995_K) { +@@ -229,13 +230,13 @@ public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) { if (p_94041_1_ == 3) { @@ -53,20 +46,20 @@ } } } -@@ -302,4 +303,27 @@ - public void func_174888_l() { - this.field_145945_j.clear(); +@@ -267,4 +268,27 @@ + protected Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_) { + return new BrewingStandContainer(p_213906_1_, p_213906_2_, this, this.field_213954_a); } + + net.minecraftforge.common.util.LazyOptional[] handlers = -+ net.minecraftforge.items.wrapper.SidedInvWrapper.create(this, EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH); ++ net.minecraftforge.items.wrapper.SidedInvWrapper.create(this, Direction.UP, Direction.DOWN, Direction.NORTH); + + @Override -+ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable EnumFacing facing) { ++ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable Direction facing) { + if (!this.field_145846_f && facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { -+ if (facing == EnumFacing.UP) ++ if (facing == Direction.UP) + return handlers[0].cast(); -+ else if (facing == EnumFacing.DOWN) ++ else if (facing == Direction.DOWN) + return handlers[1].cast(); + else + return handlers[2].cast(); diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch b/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch similarity index 64% rename from patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch rename to patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch index 96fe88247..a74e0756c 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityChest.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/ChestTileEntity.java.patch @@ -1,25 +1,25 @@ ---- a/net/minecraft/tileentity/TileEntityChest.java -+++ b/net/minecraft/tileentity/TileEntityChest.java -@@ -33,6 +33,7 @@ +--- a/net/minecraft/tileentity/ChestTileEntity.java ++++ b/net/minecraft/tileentity/ChestTileEntity.java +@@ -38,6 +38,7 @@ protected float field_145986_n; protected int field_145987_o; private int field_145983_q; + private net.minecraftforge.common.util.LazyOptional chestHandler; - protected TileEntityChest(TileEntityType p_i48287_1_) { + protected ChestTileEntity(TileEntityType p_i48287_1_) { super(p_i48287_1_); -@@ -219,7 +220,7 @@ +@@ -212,7 +213,7 @@ public static int func_195481_a(IBlockReader p_195481_0_, BlockPos p_195481_1_) { - IBlockState iblockstate = p_195481_0_.func_180495_p(p_195481_1_); -- if (iblockstate.func_177230_c().func_149716_u()) { -+ if (iblockstate.hasTileEntity()) { + BlockState blockstate = p_195481_0_.func_180495_p(p_195481_1_); +- if (blockstate.func_177230_c().func_149716_u()) { ++ if (blockstate.hasTileEntity()) { TileEntity tileentity = p_195481_0_.func_175625_s(p_195481_1_); - if (tileentity instanceof TileEntityChest) { - return ((TileEntityChest)tileentity).field_145987_o; -@@ -234,4 +235,57 @@ - p_199722_0_.func_199721_a(p_199722_1_.func_190576_q()); - p_199722_1_.func_199721_a(nonnulllist); + if (tileentity instanceof ChestTileEntity) { + return ((ChestTileEntity)tileentity).field_145987_o; +@@ -231,4 +232,57 @@ + protected Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_) { + return ChestContainer.func_216992_a(p_213906_1_, p_213906_2_, this); } + + @Override @@ -32,7 +32,7 @@ + } + + @Override -+ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability cap, EnumFacing side) { ++ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability cap, Direction side) { + if (!this.field_145846_f && cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (this.chestHandler == null) { + this.chestHandler = net.minecraftforge.common.util.LazyOptional.of(this::createHandler); @@ -43,19 +43,19 @@ + } + + private net.minecraftforge.items.IItemHandlerModifiable createHandler() { -+ IBlockState state = this.func_195044_w(); -+ if (!(state.func_177230_c() instanceof BlockChest)) { ++ BlockState state = this.func_195044_w(); ++ if (!(state.func_177230_c() instanceof ChestBlock)) { + return new net.minecraftforge.items.wrapper.InvWrapper(this); + } -+ ChestType type = state.func_177229_b(BlockChest.field_196314_b); ++ ChestType type = state.func_177229_b(ChestBlock.field_196314_b); + if (type != ChestType.SINGLE) { -+ BlockPos opos = this.func_174877_v().func_177972_a(BlockChest.func_196311_i(state)); -+ IBlockState ostate = this.func_145831_w().func_180495_p(opos); ++ BlockPos opos = this.func_174877_v().func_177972_a(ChestBlock.func_196311_i(state)); ++ BlockState ostate = this.func_145831_w().func_180495_p(opos); + if (state.func_177230_c() == ostate.func_177230_c()) { -+ ChestType otype = ostate.func_177229_b(BlockChest.field_196314_b); -+ if (otype != ChestType.SINGLE && type != otype && state.func_177229_b(BlockChest.field_176459_a) == ostate.func_177229_b(BlockChest.field_176459_a)) { ++ ChestType otype = ostate.func_177229_b(ChestBlock.field_196314_b); ++ if (otype != ChestType.SINGLE && type != otype && state.func_177229_b(ChestBlock.field_176459_a) == ostate.func_177229_b(ChestBlock.field_176459_a)) { + TileEntity ote = this.func_145831_w().func_175625_s(opos); -+ if (ote instanceof TileEntityChest) { ++ if (ote instanceof ChestTileEntity) { + IInventory top = type == ChestType.RIGHT ? this : (IInventory)ote; + IInventory bottom = type == ChestType.RIGHT ? (IInventory)ote : this; + return new net.minecraftforge.items.wrapper.CombinedInvWrapper( diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch rename to patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch index a3abe2ce3..23ab27459 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/HopperTileEntity.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/tileentity/TileEntityHopper.java -+++ b/net/minecraft/tileentity/TileEntityHopper.java -@@ -159,6 +159,7 @@ +--- a/net/minecraft/tileentity/HopperTileEntity.java ++++ b/net/minecraft/tileentity/HopperTileEntity.java +@@ -147,6 +147,7 @@ } private boolean func_145883_k() { @@ -8,7 +8,7 @@ IInventory iinventory = this.func_145895_l(); if (iinventory == null) { return false; -@@ -234,6 +235,8 @@ +@@ -191,6 +192,8 @@ } public static boolean func_145891_a(IHopper p_145891_0_) { @@ -16,19 +16,19 @@ + if (ret != null) return ret; IInventory iinventory = func_145884_b(p_145891_0_); if (iinventory != null) { - EnumFacing enumfacing = EnumFacing.DOWN; -@@ -399,7 +402,7 @@ - BlockPos blockpos = new BlockPos(p_145893_1_, p_145893_3_, p_145893_5_); - IBlockState iblockstate = p_145893_0_.func_180495_p(blockpos); - Block block = iblockstate.func_177230_c(); -- if (block.func_149716_u()) { -+ if (iblockstate.hasTileEntity()) { + Direction direction = Direction.DOWN; +@@ -339,7 +342,7 @@ + Block block = blockstate.func_177230_c(); + if (block instanceof ISidedInventoryProvider) { + iinventory = ((ISidedInventoryProvider)block).func_219966_a(blockstate, p_145893_0_, blockpos); +- } else if (block.func_149716_u()) { ++ } else if (blockstate.hasTileEntity()) { TileEntity tileentity = p_145893_0_.func_175625_s(blockpos); if (tileentity instanceof IInventory) { iinventory = (IInventory)tileentity; -@@ -483,4 +486,13 @@ - } - +@@ -418,4 +421,13 @@ + protected Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_) { + return new HopperContainer(p_213906_1_, p_213906_2_, this); } + + @Override diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch b/patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch similarity index 73% rename from patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch rename to patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch index fefef4ca8..6bb5812d4 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityLockable.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/LockableTileEntity.java.patch @@ -1,9 +1,9 @@ ---- a/net/minecraft/tileentity/TileEntityLockable.java -+++ b/net/minecraft/tileentity/TileEntityLockable.java -@@ -36,4 +36,23 @@ - public void func_174892_a(LockCode p_174892_1_) { - this.field_174901_a = p_174892_1_; +--- a/net/minecraft/tileentity/LockableTileEntity.java ++++ b/net/minecraft/tileentity/LockableTileEntity.java +@@ -80,4 +80,23 @@ } + + protected abstract Container func_213906_a(int p_213906_1_, PlayerInventory p_213906_2_); + + private net.minecraftforge.common.util.LazyOptional itemHandler = net.minecraftforge.common.util.LazyOptional.of(() -> createUnSidedHandler()); + protected net.minecraftforge.items.IItemHandler createUnSidedHandler() { @@ -11,7 +11,7 @@ + } + + @javax.annotation.Nullable -+ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability cap, @javax.annotation.Nullable net.minecraft.util.EnumFacing side) { ++ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability cap, @javax.annotation.Nullable net.minecraft.util.Direction side) { + if (!this.field_145846_f && cap == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ) { + return itemHandler.cast(); + } diff --git a/patches/minecraft/net/minecraft/tileentity/MobSpawnerBaseLogic.java.patch b/patches/minecraft/net/minecraft/tileentity/MobSpawnerBaseLogic.java.patch deleted file mode 100644 index 5d73d49fc..000000000 --- a/patches/minecraft/net/minecraft/tileentity/MobSpawnerBaseLogic.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/net/minecraft/tileentity/MobSpawnerBaseLogic.java -+++ b/net/minecraft/tileentity/MobSpawnerBaseLogic.java -@@ -114,8 +114,9 @@ - - EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; - entity.func_70012_b(entity.field_70165_t, entity.field_70163_u, entity.field_70161_v, world.field_73012_v.nextFloat() * 360.0F, 0.0F); -- if (entityliving == null || entityliving.func_205020_a(world, true) && entityliving.func_70058_J()) { -+ if (entityliving == null || net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(entityliving, func_98271_a(), (float)entity.field_70165_t, (float)entity.field_70163_u, (float)entity.field_70161_v, this)) { - if (this.field_98282_f.func_185277_b().func_186856_d() == 1 && this.field_98282_f.func_185277_b().func_150297_b("id", 8) && entity instanceof EntityLiving) { -+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, this.func_98271_a(), (float)entity.field_70165_t, (float)entity.field_70163_u, (float)entity.field_70161_v, this)) - ((EntityLiving)entity).func_204210_a(world.func_175649_E(new BlockPos(entity)), (IEntityLivingData)null, (NBTTagCompound)null); - } - -@@ -257,4 +258,9 @@ - public double func_177223_e() { - return this.field_98284_d; - } -+ -+ @Nullable -+ public Entity getSpawnerEntity() { -+ return null; -+ } - } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch similarity index 68% rename from patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch rename to patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch index 8538dab6e..b47c2e500 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/PistonTileEntity.java.patch @@ -1,8 +1,8 @@ ---- a/net/minecraft/tileentity/TileEntityPiston.java -+++ b/net/minecraft/tileentity/TileEntityPiston.java -@@ -105,7 +105,7 @@ +--- a/net/minecraft/tileentity/PistonTileEntity.java ++++ b/net/minecraft/tileentity/PistonTileEntity.java +@@ -106,7 +106,7 @@ AxisAlignedBB axisalignedbb = this.func_190607_a(this.func_191515_a(list)); - List list1 = this.field_145850_b.func_72839_b((Entity)null, this.func_190610_a(axisalignedbb, enumfacing, d0).func_111270_a(axisalignedbb)); + List list1 = this.field_145850_b.func_72839_b((Entity)null, this.func_190610_a(axisalignedbb, direction, d0).func_111270_a(axisalignedbb)); if (!list1.isEmpty()) { - boolean flag = this.field_200231_a.func_177230_c() == Blocks.field_180399_cE; + boolean flag = this.field_200231_a.func_177230_c().isStickyBlock(this.field_200231_a); diff --git a/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch new file mode 100644 index 000000000..76d9fcb71 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/ShulkerBoxTileEntity.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/tileentity/ShulkerBoxTileEntity.java ++++ b/net/minecraft/tileentity/ShulkerBoxTileEntity.java +@@ -288,6 +288,11 @@ + return new ShulkerBoxContainer(p_213906_1_, p_213906_2_, this); + } + ++ @Override ++ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() { ++ return new net.minecraftforge.items.wrapper.SidedInvWrapper(this, Direction.UP); ++ } ++ + public static enum AnimationStatus { + CLOSED, + OPENING, diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index e53901a2e..4dde1ea57 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -8,14 +8,13 @@ +public abstract class TileEntity extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeTileEntity { private static final Logger field_145852_a = LogManager.getLogger(); private final TileEntityType field_200663_e; - protected World field_145850_b; -@@ -24,9 +24,13 @@ - protected boolean field_145846_f; @Nullable - private IBlockState field_195045_e; -+ private NBTTagCompound customTileData; +@@ -26,9 +26,12 @@ + @Nullable + private BlockState field_195045_e; + private boolean field_222816_g; ++ private CompoundNBT customTileData; -+ public TileEntity(TileEntityType p_i48289_1_) { + super(TileEntity.class); this.field_200663_e = p_i48289_1_; @@ -23,25 +22,25 @@ } @Nullable -@@ -44,6 +48,8 @@ +@@ -46,6 +49,8 @@ - public void func_145839_a(NBTTagCompound p_145839_1_) { + public void func_145839_a(CompoundNBT p_145839_1_) { this.field_174879_c = new BlockPos(p_145839_1_.func_74762_e("x"), p_145839_1_.func_74762_e("y"), p_145839_1_.func_74762_e("z")); + if (p_145839_1_.func_74764_b("ForgeData")) this.customTileData = p_145839_1_.func_74775_l("ForgeData"); + if (getCapabilities() != null && p_145839_1_.func_74764_b("ForgeCaps")) deserializeCaps(p_145839_1_.func_74775_l("ForgeCaps")); } - public NBTTagCompound func_189515_b(NBTTagCompound p_189515_1_) { -@@ -59,6 +65,8 @@ + public CompoundNBT func_189515_b(CompoundNBT p_189515_1_) { +@@ -61,6 +66,8 @@ p_189516_1_.func_74768_a("x", this.field_174879_c.func_177958_n()); p_189516_1_.func_74768_a("y", this.field_174879_c.func_177956_o()); p_189516_1_.func_74768_a("z", this.field_174879_c.func_177952_p()); -+ if (this.customTileData != null) p_189516_1_.func_74782_a("ForgeData", this.customTileData); -+ if (getCapabilities() != null) p_189516_1_.func_74782_a("ForgeCaps", serializeCaps()); ++ if (this.customTileData != null) p_189516_1_.func_218657_a("ForgeData", this.customTileData); ++ if (getCapabilities() != null) p_189516_1_.func_218657_a("ForgeCaps", serializeCaps()); return p_189516_1_; } } -@@ -92,14 +100,13 @@ +@@ -93,14 +100,13 @@ if (this.field_145850_b != null) { this.field_195045_e = this.field_145850_b.func_180495_p(this.field_174879_c); this.field_145850_b.func_175646_b(this.field_174879_c, this); @@ -57,7 +56,7 @@ public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) { double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_; double d1 = (double)this.field_174879_c.func_177956_o() + 0.5D - p_145835_3_; -@@ -139,6 +146,7 @@ +@@ -140,6 +146,7 @@ public void func_145843_s() { this.field_145846_f = true; @@ -65,15 +64,17 @@ } public void func_145829_t() { -@@ -180,4 +188,11 @@ - public TileEntityType func_200662_C() { +@@ -182,6 +189,13 @@ return this.field_200663_e; } -+ + + @Override -+ public NBTTagCompound getTileData() { ++ public CompoundNBT getTileData() { + if (this.customTileData == null) -+ this.customTileData = new NBTTagCompound(); ++ this.customTileData = new CompoundNBT(); + return this.customTileData; + } - } ++ + public void func_222814_r() { + if (!this.field_222816_g) { + this.field_222816_g = true; diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch deleted file mode 100644 index d95062550..000000000 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/net/minecraft/tileentity/TileEntityBeacon.java -+++ b/net/minecraft/tileentity/TileEntityBeacon.java -@@ -128,7 +128,7 @@ - boolean flag = true; - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); - -- for(int i1 = j + 1; i1 < 256; ++i1) { -+ for(int i1 = j + 1; i1 < this.func_145831_w().func_72800_K(); ++i1) { - IBlockState iblockstate = this.field_145850_b.func_180495_p(blockpos$mutableblockpos.func_181079_c(i, i1, k)); - Block block = iblockstate.func_177230_c(); - float[] afloat; -@@ -142,10 +142,15 @@ - break; - } - -+ float[] custom = iblockstate.getBeaconColorMultiplier(this.field_145850_b, blockpos$mutableblockpos, func_174877_v()); -+ if (custom != null) { -+ afloat = custom; -+ } else { - tileentitybeacon$beamsegment.func_177262_a(); - continue; -+ } - } -- -+ else - afloat = ((BlockStainedGlassPane)block).func_196419_d().func_193349_f(); - } - -@@ -174,8 +179,7 @@ - - for(int i2 = i - k1; i2 <= i + k1 && flag1; ++i2) { - for(int j1 = k - k1; j1 <= k + k1; ++j1) { -- Block block1 = this.field_145850_b.func_180495_p(new BlockPos(i2, l1, j1)).func_177230_c(); -- if (block1 != Blocks.field_150475_bE && block1 != Blocks.field_150340_R && block1 != Blocks.field_150484_ah && block1 != Blocks.field_150339_S) { -+ if (!this.field_145850_b.func_180495_p(new BlockPos(i2, l1, j1)).isBeaconBase(this.field_145850_b, new BlockPos(i2, l1, j1), this.func_174877_v())) { - flag1 = false; - break; - } -@@ -346,7 +350,7 @@ - } - - public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) { -- return p_94041_2_.func_77973_b() == Items.field_151166_bC || p_94041_2_.func_77973_b() == Items.field_151045_i || p_94041_2_.func_77973_b() == Items.field_151043_k || p_94041_2_.func_77973_b() == Items.field_151042_j; -+ return p_94041_2_.isBeaconPayment(); - } - - public String func_174875_k() { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch deleted file mode 100644 index 519087c7f..000000000 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ /dev/null @@ -1,121 +0,0 @@ ---- a/net/minecraft/tileentity/TileEntityFurnace.java -+++ b/net/minecraft/tileentity/TileEntityFurnace.java -@@ -184,9 +184,9 @@ - super.func_145839_a(p_145839_1_); - this.field_145957_n = NonNullList.func_191197_a(this.func_70302_i_(), ItemStack.field_190927_a); - ItemStackHelper.func_191283_b(p_145839_1_, this.field_145957_n); -- this.field_145956_a = p_145839_1_.func_74765_d("BurnTime"); -- this.field_174906_k = p_145839_1_.func_74765_d("CookTime"); -- this.field_174905_l = p_145839_1_.func_74765_d("CookTimeTotal"); -+ this.field_145956_a = p_145839_1_.func_74762_e("BurnTime"); -+ this.field_174906_k = p_145839_1_.func_74762_e("CookTime"); -+ this.field_174905_l = p_145839_1_.func_74762_e("CookTimeTotal"); - this.field_145963_i = func_145952_a(this.field_145957_n.get(1)); - int i = p_145839_1_.func_74765_d("RecipesUsedSize"); - -@@ -204,9 +204,9 @@ - - public NBTTagCompound func_189515_b(NBTTagCompound p_189515_1_) { - super.func_189515_b(p_189515_1_); -- p_189515_1_.func_74777_a("BurnTime", (short)this.field_145956_a); -- p_189515_1_.func_74777_a("CookTime", (short)this.field_174906_k); -- p_189515_1_.func_74777_a("CookTimeTotal", (short)this.field_174905_l); -+ p_189515_1_.func_74768_a("BurnTime", this.field_145956_a); -+ p_189515_1_.func_74768_a("CookTime", this.field_174906_k); -+ p_189515_1_.func_74768_a("CookTimeTotal", this.field_174905_l); - ItemStackHelper.func_191282_a(p_189515_1_, this.field_145957_n); - p_189515_1_.func_74777_a("RecipesUsedSize", (short)this.field_203901_m.size()); - int i = 0; -@@ -247,12 +247,16 @@ - if (!this.field_145850_b.field_72995_K) { - ItemStack itemstack = this.field_145957_n.get(1); - if (this.func_145950_i() || !itemstack.func_190926_b() && !this.field_145957_n.get(0).func_190926_b()) { -- IRecipe irecipe = this.field_145850_b.func_199532_z().func_199515_b(this, this.field_145850_b); -+ IRecipe irecipe = this.field_145850_b.func_199532_z().getRecipe(this, this.field_145850_b, net.minecraftforge.common.crafting.VanillaRecipeTypes.SMELTING); - if (!this.func_145950_i() && this.func_201566_b(irecipe)) { - this.field_145956_a = func_145952_a(itemstack); - this.field_145963_i = this.field_145956_a; - if (this.func_145950_i()) { - flag1 = true; -+ if (itemstack.hasContainerItem()) { -+ this.field_145957_n.set(1, itemstack.getContainerItem()); -+ } -+ else - if (!itemstack.func_190926_b()) { - Item item = itemstack.func_77973_b(); - itemstack.func_190918_g(1); -@@ -292,7 +296,7 @@ - } - - private int func_201562_r() { -- FurnaceRecipe furnacerecipe = (FurnaceRecipe)this.field_145850_b.func_199532_z().func_199515_b(this, this.field_145850_b); -+ FurnaceRecipe furnacerecipe = this.field_145850_b.func_199532_z().getRecipe(this, this.field_145850_b, net.minecraftforge.common.crafting.VanillaRecipeTypes.SMELTING); - return furnacerecipe != null ? furnacerecipe.func_201830_h() : 200; - } - -@@ -307,10 +311,10 @@ - return true; - } else if (!itemstack1.func_77969_a(itemstack)) { - return false; -- } else if (itemstack1.func_190916_E() < this.func_70297_j_() && itemstack1.func_190916_E() < itemstack1.func_77976_d()) { -+ } else if (itemstack1.func_190916_E() + itemstack.func_190916_E() <= this.func_70297_j_() && itemstack1.func_190916_E() < itemstack1.func_77976_d()) { // Forge fix: make furnace respect stack sizes in furnace recipes - return true; - } else { -- return itemstack1.func_190916_E() < itemstack.func_77976_d(); -+ return itemstack1.func_190916_E() + itemstack.func_190916_E() <= itemstack.func_77976_d(); // Forge fix: make furnace respect stack sizes in furnace recipes - } - } - } else { -@@ -326,7 +330,7 @@ - if (itemstack2.func_190926_b()) { - this.field_145957_n.set(2, itemstack1.func_77946_l()); - } else if (itemstack2.func_77973_b() == itemstack1.func_77973_b()) { -- itemstack2.func_190917_f(1); -+ itemstack2.func_190917_f(itemstack1.func_190916_E()); - } - - if (!this.field_145850_b.field_72995_K) { -@@ -346,12 +350,13 @@ - return 0; - } else { - Item item = p_145952_0_.func_77973_b(); -- return func_201564_p().getOrDefault(item, 0); -+ int ret = p_145952_0_.getBurnTime(); -+ return net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(p_145952_0_, ret == -1 ? func_201564_p().getOrDefault(item, 0) : ret); - } - } - - public static boolean func_145954_b(ItemStack p_145954_0_) { -- return func_201564_p().containsKey(p_145954_0_.func_77973_b()); -+ return func_145952_a(p_145954_0_) > 0; - } - - public boolean func_70300_a(EntityPlayer p_70300_1_) { -@@ -500,4 +505,27 @@ - - this.field_203901_m.clear(); - } -+ -+ net.minecraftforge.common.util.LazyOptional[] handlers = -+ net.minecraftforge.items.wrapper.SidedInvWrapper.create(this, EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH); -+ -+ @Override -+ public net.minecraftforge.common.util.LazyOptional getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable EnumFacing facing) { -+ if (!this.field_145846_f && facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { -+ if (facing == EnumFacing.UP) -+ return handlers[0].cast(); -+ else if (facing == EnumFacing.DOWN) -+ return handlers[1].cast(); -+ else -+ return handlers[2].cast(); -+ } -+ return super.getCapability(capability, facing); -+ } -+ -+ @Override -+ public void func_145843_s() { -+ super.func_145843_s(); -+ for (int x = 0; x < handlers.length; x++) -+ handlers[x].invalidate(); -+ } - } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityLockableLoot.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityLockableLoot.java.patch deleted file mode 100644 index 66b4faaa7..000000000 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityLockableLoot.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/tileentity/TileEntityLockableLoot.java -+++ b/net/minecraft/tileentity/TileEntityLockableLoot.java -@@ -69,6 +69,7 @@ - - LootContext.Builder lootcontext$builder = new LootContext.Builder((WorldServer)this.field_145850_b); - lootcontext$builder.func_204313_a(this.field_174879_c); -+ lootcontext$builder.func_186470_a(p_184281_1_); - if (p_184281_1_ != null) { - lootcontext$builder.func_186469_a(p_184281_1_.func_184817_da()); - } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java.patch deleted file mode 100644 index 26c39cce6..000000000 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/net/minecraft/tileentity/TileEntityShulkerBox.java -+++ b/net/minecraft/tileentity/TileEntityShulkerBox.java -@@ -329,6 +329,11 @@ - return !this.func_190581_E() || !this.func_191420_l() || this.func_145818_k_() || this.field_184284_m != null; - } - -+ @Override -+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler() { -+ return new net.minecraftforge.items.wrapper.SidedInvWrapper(this, EnumFacing.UP); -+ } -+ - public static enum AnimationStatus { - CLOSED, - OPENING, diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityType.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityType.java.patch index 1f09e3ff3..d0dac6399 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityType.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityType.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/tileentity/TileEntityType.java +++ b/net/minecraft/tileentity/TileEntityType.java -@@ -12,7 +12,7 @@ +@@ -16,7 +16,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public class TileEntityType { +public class TileEntityType extends net.minecraftforge.registries.ForgeRegistryEntry> { private static final Logger field_206866_A = LogManager.getLogger(); - public static final TileEntityType field_200971_b = func_200966_a("furnace", TileEntityType.Builder.func_200963_a(TileEntityFurnace::new)); - public static final TileEntityType field_200972_c = func_200966_a("chest", TileEntityType.Builder.func_200963_a(TileEntityChest::new)); -@@ -52,7 +52,7 @@ + public static final TileEntityType field_200971_b = func_200966_a("furnace", TileEntityType.Builder.func_223042_a(FurnaceTileEntity::new, Blocks.field_150460_al)); + public static final TileEntityType field_200972_c = func_200966_a("chest", TileEntityType.Builder.func_223042_a(ChestTileEntity::new, Blocks.field_150486_ae)); +@@ -64,7 +64,7 @@ try { - type = DataFixesManager.func_210901_a().getSchema(DataFixUtils.makeKey(1631)).getChoiceType(TypeReferences.field_211294_j, p_200966_0_); + type = DataFixesManager.func_210901_a().getSchema(DataFixUtils.makeKey(SharedConstants.func_215069_a().getWorldVersion())).getChoiceType(TypeReferences.field_211294_j, p_200966_0_); - } catch (IllegalStateException illegalstateexception) { + } catch (IllegalArgumentException illegalstateexception) { if (SharedConstants.field_206244_b) { diff --git a/patches/minecraft/net/minecraft/util/ActionResult.java.patch b/patches/minecraft/net/minecraft/util/ActionResult.java.patch index 5e37095f8..b00b66422 100644 --- a/patches/minecraft/net/minecraft/util/ActionResult.java.patch +++ b/patches/minecraft/net/minecraft/util/ActionResult.java.patch @@ -6,7 +6,7 @@ } + + //Just a generic helper function to make typecasing easier... -+ public static ActionResult newResult(EnumActionResult result, T value) { ++ public static ActionResult newResult(ActionResultType result, T value) { + return new ActionResult(result, value); + } } diff --git a/patches/minecraft/net/minecraft/util/ClassInheritanceMultiMap.java.patch b/patches/minecraft/net/minecraft/util/ClassInheritanceMultiMap.java.patch deleted file mode 100644 index a1778866c..000000000 --- a/patches/minecraft/net/minecraft/util/ClassInheritanceMultiMap.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/util/ClassInheritanceMultiMap.java -+++ b/net/minecraft/util/ClassInheritanceMultiMap.java -@@ -12,7 +12,8 @@ - import java.util.Set; - - public class ClassInheritanceMultiMap extends AbstractSet { -- private static final Set> field_181158_a = Sets.newHashSet(); -+ // Forge: Use concurrent collection to allow creating chunks from multiple threads safely -+ private static final Set> field_181158_a = java.util.Collections.newSetFromMap(new java.util.concurrent.ConcurrentHashMap, Boolean>()); - private final Map, List> field_180218_a = Maps.newHashMap(); - private final Set> field_180216_b = Sets.newIdentityHashSet(); - private final Class field_180217_c; diff --git a/patches/minecraft/net/minecraft/util/Direction.java.patch b/patches/minecraft/net/minecraft/util/Direction.java.patch new file mode 100644 index 000000000..418822d3c --- /dev/null +++ b/patches/minecraft/net/minecraft/util/Direction.java.patch @@ -0,0 +1,42 @@ +--- a/net/minecraft/util/Direction.java ++++ b/net/minecraft/util/Direction.java +@@ -119,7 +119,6 @@ + return func_82600_a(this.field_176759_h); + } + +- @OnlyIn(Dist.CLIENT) + public Direction func_176732_a(Direction.Axis p_176732_1_) { + switch(p_176732_1_) { + case X: +@@ -160,7 +159,6 @@ + } + } + +- @OnlyIn(Dist.CLIENT) + private Direction func_176744_n() { + switch(this) { + case NORTH: +@@ -178,7 +176,6 @@ + } + } + +- @OnlyIn(Dist.CLIENT) + private Direction func_176738_p() { + switch(this) { + case EAST: +@@ -231,7 +228,6 @@ + } + + @Nullable +- @OnlyIn(Dist.CLIENT) + public static Direction func_176739_a(@Nullable String p_176739_0_) { + return p_176739_0_ == null ? null : field_176761_p.get(p_176739_0_.toLowerCase(Locale.ROOT)); + } +@@ -353,7 +349,6 @@ + } + + @Nullable +- @OnlyIn(Dist.CLIENT) + public static Direction.Axis func_176717_a(String p_176717_0_) { + return field_176725_d.get(p_176717_0_.toLowerCase(Locale.ROOT)); + } diff --git a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch deleted file mode 100644 index 7740fe7a6..000000000 --- a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- a/net/minecraft/util/EnumFacing.java -+++ b/net/minecraft/util/EnumFacing.java -@@ -13,8 +13,6 @@ - import net.minecraft.entity.Entity; - import net.minecraft.util.math.MathHelper; - import net.minecraft.util.math.Vec3i; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public enum EnumFacing implements IStringSerializable { - DOWN(0, 1, -1, "down", EnumFacing.AxisDirection.NEGATIVE, EnumFacing.Axis.Y, new Vec3i(0, -1, 0)), -@@ -109,7 +107,6 @@ - return func_82600_a(this.field_176759_h); - } - -- @OnlyIn(Dist.CLIENT) - public EnumFacing func_176732_a(EnumFacing.Axis p_176732_1_) { - switch(p_176732_1_) { - case X: -@@ -150,7 +147,6 @@ - } - } - -- @OnlyIn(Dist.CLIENT) - private EnumFacing func_176744_n() { - switch(this) { - case NORTH: -@@ -168,7 +164,6 @@ - } - } - -- @OnlyIn(Dist.CLIENT) - private EnumFacing func_176738_p() { - switch(this) { - case EAST: -@@ -221,7 +216,6 @@ - } - - @Nullable -- @OnlyIn(Dist.CLIENT) - public static EnumFacing func_176739_a(@Nullable String p_176739_0_) { - return p_176739_0_ == null ? null : field_176761_p.get(p_176739_0_.toLowerCase(Locale.ROOT)); - } -@@ -295,7 +289,6 @@ - throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_); - } - -- @OnlyIn(Dist.CLIENT) - public Vec3i func_176730_m() { - return this.field_176756_m; - } -@@ -339,7 +332,6 @@ - } - - @Nullable -- @OnlyIn(Dist.CLIENT) - public static EnumFacing.Axis func_176717_a(String p_176717_0_) { - return field_176725_d.get(p_176717_0_.toLowerCase(Locale.ROOT)); - } diff --git a/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch b/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch index 2a5c51459..2c3cb9a0a 100644 --- a/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch +++ b/patches/minecraft/net/minecraft/util/ScreenShotHelper.java.patch @@ -29,12 +29,12 @@ SimpleResource.field_199031_a.execute(() -> { try { nativeimage.func_209271_a(file2); - ITextComponent itextcomponent = (new TextComponentString(file2.getName())).func_211708_a(TextFormatting.UNDERLINE).func_211710_a((p_212451_1_) -> { + ITextComponent itextcomponent = (new StringTextComponent(file2.getName())).func_211708_a(TextFormatting.UNDERLINE).func_211710_a((p_212451_1_) -> { p_212451_1_.func_150241_a(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath())); }); + if (event.getResultMessage() != null) { + p_148259_5_.accept(event.getResultMessage()); + } else - p_148259_5_.accept(new TextComponentTranslation("screenshot.success", itextcomponent)); + p_148259_5_.accept(new TranslationTextComponent("screenshot.success", itextcomponent)); } catch (Exception exception) { field_148261_a.warn("Couldn't save screenshot", (Throwable)exception); diff --git a/patches/minecraft/net/minecraft/util/SharedConstants.java.patch b/patches/minecraft/net/minecraft/util/SharedConstants.java.patch index 5cd4f2963..e0b080dd5 100644 --- a/patches/minecraft/net/minecraft/util/SharedConstants.java.patch +++ b/patches/minecraft/net/minecraft/util/SharedConstants.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/SharedConstants.java +++ b/net/minecraft/util/SharedConstants.java -@@ -29,6 +29,7 @@ +@@ -57,6 +57,7 @@ } static { diff --git a/patches/minecraft/net/minecraft/util/SoundEvent.java.patch b/patches/minecraft/net/minecraft/util/SoundEvent.java.patch index f9359fc9e..0ee27eff1 100644 --- a/patches/minecraft/net/minecraft/util/SoundEvent.java.patch +++ b/patches/minecraft/net/minecraft/util/SoundEvent.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/SoundEvent.java +++ b/net/minecraft/util/SoundEvent.java -@@ -4,7 +4,7 @@ +@@ -3,7 +3,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; diff --git a/patches/minecraft/net/minecraft/util/SoundEvents.java.patch b/patches/minecraft/net/minecraft/util/SoundEvents.java.patch new file mode 100644 index 000000000..4dfb06a40 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/SoundEvents.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/util/SoundEvents.java ++++ b/net/minecraft/util/SoundEvents.java +@@ -2,6 +2,7 @@ + + import net.minecraft.util.registry.Registry; + ++@net.minecraftforge.registries.ObjectHolder("minecraft") + public class SoundEvents { + public static final SoundEvent field_187674_a = func_219592_a("ambient.cave"); + public static final SoundEvent field_204326_e = func_219592_a("ambient.underwater.enter"); diff --git a/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch b/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch index fd3743d63..508e4d06d 100644 --- a/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch +++ b/patches/minecraft/net/minecraft/util/math/RayTraceResult.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/util/math/RayTraceResult.java +++ b/net/minecraft/util/math/RayTraceResult.java -@@ -9,7 +9,12 @@ - public EnumFacing field_178784_b; - public Vec3d field_72307_f; - public Entity field_72308_g; +@@ -8,7 +8,12 @@ + } + + public abstract RayTraceResult.Type func_216346_c(); + /** Used to determine what sub-segment is hit */ + public int subHit = -1; + /** Used to add extra hit info */ + public Object hitInfo = null; + - public RayTraceResult(Vec3d p_i47094_1_, EnumFacing p_i47094_2_, BlockPos p_i47094_3_) { - this(RayTraceResult.Type.BLOCK, p_i47094_1_, p_i47094_2_, p_i47094_3_); + public Vec3d func_216347_e() { + return this.field_72307_f; } diff --git a/patches/minecraft/net/minecraft/util/math/Vec3d.java.patch b/patches/minecraft/net/minecraft/util/math/Vec3d.java.patch index 0e9e55aa5..6b9a4cd52 100644 --- a/patches/minecraft/net/minecraft/util/math/Vec3d.java.patch +++ b/patches/minecraft/net/minecraft/util/math/Vec3d.java.patch @@ -1,15 +1,14 @@ --- a/net/minecraft/util/math/Vec3d.java +++ b/net/minecraft/util/math/Vec3d.java -@@ -2,8 +2,6 @@ +@@ -80,7 +80,6 @@ + return this.func_216372_d(p_186678_1_, p_186678_1_, p_186678_1_); + } - import java.util.EnumSet; - import net.minecraft.util.EnumFacing; --import net.minecraftforge.api.distmarker.Dist; --import net.minecraftforge.api.distmarker.OnlyIn; - - public class Vec3d { - public static final Vec3d field_186680_a = new Vec3d(0.0D, 0.0D, 0.0D); -@@ -136,12 +134,10 @@ +- @OnlyIn(Dist.CLIENT) + public Vec3d func_216371_e() { + return this.func_186678_a(-1.0D); + } +@@ -150,12 +149,10 @@ return new Vec3d(d0, d1, d2); } diff --git a/patches/minecraft/net/minecraft/util/registry/Bootstrap.java.patch b/patches/minecraft/net/minecraft/util/registry/Bootstrap.java.patch new file mode 100644 index 000000000..652058f95 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/registry/Bootstrap.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/util/registry/Bootstrap.java ++++ b/net/minecraft/util/registry/Bootstrap.java +@@ -43,6 +43,7 @@ + EntityOptions.func_197445_a(); + IDispenseItemBehavior.func_218401_c(); + ArgumentTypes.func_197483_a(); ++ if (false) // skip redirectOutputToLog, Forge already redirects stdout and stderr output to log so that they print with more context + func_179868_d(); + } + } diff --git a/patches/minecraft/net/minecraft/util/registry/IRegistry.java.patch b/patches/minecraft/net/minecraft/util/registry/IRegistry.java.patch deleted file mode 100644 index 4453f19a9..000000000 --- a/patches/minecraft/net/minecraft/util/registry/IRegistry.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- a/net/minecraft/util/registry/IRegistry.java -+++ b/net/minecraft/util/registry/IRegistry.java -@@ -30,25 +30,29 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -+/* -+ * Attention Modders: This SHOULD NOT be used, you should use ForgeRegistries instead. As it has a cleaner modder facing API. -+ * We will be wrapping all of these in our API as nessasary for syncing and management. -+ */ - public interface IRegistry extends IObjectIntIterable { - Logger field_212616_e = LogManager.getLogger(); - IRegistry> field_212617_f = new RegistryNamespaced<>(); -- IRegistry field_212618_g = func_212610_a("block", new RegistryNamespacedDefaultedByKey<>(new ResourceLocation("air"))); -+ @Deprecated IRegistry field_212618_g = func_212610_a("block", net.minecraftforge.registries.GameData.getWrapperDefaulted(Block.class)); - IRegistry field_212619_h = func_212610_a("fluid", new RegistryNamespacedDefaultedByKey<>(new ResourceLocation("empty"))); - IRegistry field_212620_i = func_212610_a("motive", new RegistryNamespacedDefaultedByKey<>(new ResourceLocation("kebab"))); -- IRegistry field_212621_j = func_212610_a("potion", new RegistryNamespacedDefaultedByKey<>(new ResourceLocation("empty"))); -- IRegistry field_212622_k = func_212610_a("dimension_type", new RegistryNamespaced<>()); -+ @Deprecated IRegistry field_212621_j = func_212610_a("potion", net.minecraftforge.registries.GameData.getWrapperDefaulted(PotionType.class)); -+ @Deprecated IRegistry field_212622_k = func_212610_a("dimension_type", net.minecraftforge.common.DimensionManager.getRegistry()); - IRegistry field_212623_l = func_212610_a("custom_stat", new RegistryNamespaced<>()); -- IRegistry field_212624_m = func_212610_a("biome", new RegistryNamespaced<>()); -+ @Deprecated IRegistry field_212624_m = func_212610_a("biome", net.minecraftforge.registries.GameData.getWrapper(Biome.class)); - IRegistry> field_212625_n = func_212610_a("biome_source_type", new RegistryNamespaced<>()); -- IRegistry> field_212626_o = func_212610_a("block_entity_type", new RegistryNamespaced<>()); -+ @Deprecated IRegistry> field_212626_o = func_212610_a("block_entity_type", (IRegistry>)net.minecraftforge.registries.GameData.getWrapper(TileEntityType.class)); - IRegistry> field_212627_p = func_212610_a("chunk_generator_type", new RegistryNamespaced<>()); -- IRegistry field_212628_q = func_212610_a("enchantment", new RegistryNamespaced<>()); -- IRegistry> field_212629_r = func_212610_a("entity_type", new RegistryNamespaced<>()); -- IRegistry field_212630_s = func_212610_a("item", new RegistryNamespaced<>()); -- IRegistry field_212631_t = func_212610_a("mob_effect", new RegistryNamespaced<>()); -+ @Deprecated IRegistry field_212628_q = func_212610_a("enchantment", net.minecraftforge.registries.GameData.getWrapper(Enchantment.class)); -+ @Deprecated IRegistry> field_212629_r = func_212610_a("entity_type", (IRegistry>) net.minecraftforge.registries.GameData.getWrapper(EntityType.class)); -+ @Deprecated IRegistry field_212630_s = func_212610_a("item", net.minecraftforge.registries.GameData.getWrapper(Item.class)); -+ @Deprecated IRegistry field_212631_t = func_212610_a("mob_effect", net.minecraftforge.registries.GameData.getWrapper(Potion.class)); - IRegistry> field_212632_u = func_212610_a("particle_type", new RegistryNamespaced<>()); -- IRegistry field_212633_v = func_212610_a("sound_event", new RegistryNamespaced<>()); -+ @Deprecated IRegistry field_212633_v = func_212610_a("sound_event", net.minecraftforge.registries.GameData.getWrapper(SoundEvent.class)); - IRegistry> field_212634_w = func_212610_a("stats", new RegistryNamespaced<>()); - - static IRegistry func_212610_a(String p_212610_0_, IRegistry p_212610_1_) { diff --git a/patches/minecraft/net/minecraft/util/registry/Registry.java.patch b/patches/minecraft/net/minecraft/util/registry/Registry.java.patch new file mode 100644 index 000000000..29159a6c9 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/registry/Registry.java.patch @@ -0,0 +1,86 @@ +--- a/net/minecraft/util/registry/Registry.java ++++ b/net/minecraft/util/registry/Registry.java +@@ -66,32 +66,36 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + ++/* ++ * Attention Modders: This SHOULD NOT be used, you should use ForgeRegistries instead. As it has a cleaner modder facing API. ++ * We will be wrapping all of these in our API as nessasary for syncing and management. ++ */ + public abstract class Registry implements IObjectIntIterable { + protected static final Logger field_212616_e = LogManager.getLogger(); + private static final Map> field_218376_a = Maps.newLinkedHashMap(); + public static final MutableRegistry> field_212617_f = new SimpleRegistry<>(); +- public static final Registry field_212633_v = func_222935_a("sound_event", () -> { ++ @Deprecated public static final Registry field_212633_v = forge("sound_event", SoundEvent.class, () -> { + return SoundEvents.field_187638_cR; + }); + public static final DefaultedRegistry field_212619_h = func_222933_a("fluid", "empty", () -> { + return Fluids.field_204541_a; + }); +- public static final Registry field_212631_t = func_222935_a("mob_effect", () -> { ++ @Deprecated public static final Registry field_212631_t = forge("mob_effect", Effect.class, () -> { + return Effects.field_188425_z; + }); +- public static final DefaultedRegistry field_212618_g = func_222933_a("block", "air", () -> { ++ @Deprecated public static final DefaultedRegistry field_212618_g = forgeDefaulted("block", Block.class, () -> { + return Blocks.field_150350_a; + }); +- public static final Registry field_212628_q = func_222935_a("enchantment", () -> { ++ @Deprecated public static final Registry field_212628_q = forge("enchantment", Enchantment.class, () -> { + return Enchantments.field_185308_t; + }); +- public static final DefaultedRegistry> field_212629_r = func_222933_a("entity_type", "pig", () -> { ++ @Deprecated public static final DefaultedRegistry> field_212629_r = forgeDefaulted("entity_type", EntityType.class, () -> { + return EntityType.field_200784_X; + }); +- public static final DefaultedRegistry field_212630_s = func_222933_a("item", "air", () -> { ++ @Deprecated public static final DefaultedRegistry field_212630_s = forgeDefaulted("item", Item.class, () -> { + return Items.field_190931_a; + }); +- public static final DefaultedRegistry field_212621_j = func_222933_a("potion", "empty", () -> { ++ @Deprecated public static final DefaultedRegistry field_212621_j = forgeDefaulted("potion", Potion.class, () -> { + return Potions.field_185229_a; + }); + public static final Registry> field_218377_o = func_222935_a("carver", () -> { +@@ -106,7 +110,7 @@ + public static final Registry> field_218380_r = func_222935_a("decorator", () -> { + return Placement.field_215022_h; + }); +- public static final Registry field_212624_m = func_222935_a("biome", () -> { ++ @Deprecated public static final Registry field_212624_m = forge("biome", Biome.class, () -> { + return Biomes.field_180279_ad; + }); + public static final Registry> field_212632_u = func_222935_a("particle_type", () -> { +@@ -115,13 +119,13 @@ + public static final Registry> field_212625_n = func_222935_a("biome_source_type", () -> { + return BiomeProviderType.field_206859_d; + }); +- public static final Registry> field_212626_o = func_222935_a("block_entity_type", () -> { ++ @Deprecated public static final Registry> field_212626_o = forge("block_entity_type", TileEntityType.class, () -> { + return TileEntityType.field_200971_b; + }); + public static final Registry> field_212627_p = func_222935_a("chunk_generator_type", () -> { + return ChunkGeneratorType.field_205489_f; + }); +- public static final Registry field_212622_k = func_222935_a("dimension_type", () -> { ++ public static final Registry field_212622_k = func_222939_a("dimension_type", net.minecraftforge.common.DimensionManager.getRegistry(), () -> { + return DimensionType.OVERWORLD; + }); + public static final DefaultedRegistry field_212620_i = func_222933_a("motive", "kebab", () -> { +@@ -230,6 +234,14 @@ + return ((MutableRegistry)p_218343_0_).func_218382_a(p_218343_1_, new ResourceLocation(p_218343_2_), p_218343_3_); + } + ++ private static > Registry forge(String name, Class cls, Supplier def) { ++ return func_222939_a(name, net.minecraftforge.registries.GameData.getWrapper(cls), def); ++ } ++ ++ private static > DefaultedRegistry forgeDefaulted(String name, Class cls, Supplier def) { ++ return Registry.>func_222939_a(name, net.minecraftforge.registries.GameData.getWrapperDefaulted(cls), def); ++ } ++ + static { + field_218376_a.entrySet().forEach((p_218326_0_) -> { + if (p_218326_0_.getValue().get() == null) { diff --git a/patches/minecraft/net/minecraft/util/text/TextComponentTranslation.java.patch b/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch similarity index 62% rename from patches/minecraft/net/minecraft/util/text/TextComponentTranslation.java.patch rename to patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch index 5f4daaf74..0d8ad18a1 100644 --- a/patches/minecraft/net/minecraft/util/text/TextComponentTranslation.java.patch +++ b/patches/minecraft/net/minecraft/util/text/TranslationTextComponent.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/util/text/TextComponentTranslation.java -+++ b/net/minecraft/util/text/TextComponentTranslation.java -@@ -101,6 +101,10 @@ +--- a/net/minecraft/util/text/TranslationTextComponent.java ++++ b/net/minecraft/util/text/TranslationTextComponent.java +@@ -104,6 +104,10 @@ } } @@ -9,5 +9,5 @@ + j = net.minecraftforge.fml.TextComponentMessageFormatHandler.handle(this, this.field_150278_b, this.field_150277_e, p_150269_1_); + } if (j < p_150269_1_.length()) { - ITextComponent itextcomponent1 = new TextComponentString(String.format(p_150269_1_.substring(j))); + ITextComponent itextcomponent1 = new StringTextComponent(String.format(p_150269_1_.substring(j))); itextcomponent1.func_150256_b().func_150221_a(this.func_150256_b()); diff --git a/patches/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch b/patches/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch index 97f647595..e2d8894bc 100644 --- a/patches/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch +++ b/patches/minecraft/net/minecraft/util/text/translation/LanguageMap.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/util/text/translation/LanguageMap.java +++ b/net/minecraft/util/text/translation/LanguageMap.java @@ -35,7 +35,7 @@ - String s = field_111053_a.matcher(JsonUtils.func_151206_a(entry.getValue(), entry.getKey())).replaceAll("%$1s"); + String s = field_111053_a.matcher(JSONUtils.func_151206_a(entry.getValue(), entry.getKey())).replaceAll("%$1s"); this.field_74816_c.put(entry.getKey(), s); } - diff --git a/patches/minecraft/net/minecraft/village/Village.java.patch b/patches/minecraft/net/minecraft/village/Village.java.patch deleted file mode 100644 index 3f5e0ca5d..000000000 --- a/patches/minecraft/net/minecraft/village/Village.java.patch +++ /dev/null @@ -1,159 +0,0 @@ ---- a/net/minecraft/village/Village.java -+++ b/net/minecraft/village/Village.java -@@ -30,7 +30,7 @@ - import net.minecraft.util.text.ITextComponent; - import net.minecraft.world.World; - --public class Village { -+public class Village extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeVillage { - private World field_75586_a; - private final List field_75584_b = Lists.newArrayList(); - private BlockPos field_75585_c = BlockPos.field_177992_a; -@@ -40,15 +40,18 @@ - private int field_75581_g; - private int field_75588_h; - private int field_82694_i; -- private final Map field_82693_j = Maps.newHashMap(); -+ private final Map field_82693_j = Maps.newHashMap(); - private final List field_75589_i = Lists.newArrayList(); - private int field_75587_j; - - public Village() { -+ this(null); - } - - public Village(World p_i1675_1_) { -+ super(Village.class); - this.field_75586_a = p_i1675_1_; -+ this.gatherCapabilities(); - } - - public void func_82691_a(World p_82691_1_) { -@@ -237,9 +240,9 @@ - double d0 = Double.MAX_VALUE; - EntityPlayer entityplayer = null; - -- for(String s : this.field_82693_j.keySet()) { -- if (this.func_82687_d(s)) { -- EntityPlayer entityplayer1 = this.field_75586_a.func_72924_a(s); -+ for(UUID s : this.field_82693_j.keySet()) { -+ if (this.isPlayerReputationTooLow(s)) { -+ EntityPlayer entityplayer1 = this.field_75586_a.func_152378_a(s); - if (entityplayer1 != null) { - double d1 = entityplayer1.func_70068_e(p_82685_1_); - if (!(d1 > d0)) { -@@ -276,6 +279,7 @@ - villagedoorinfo.func_75466_d(); - } - -+ if (field_75586_a.func_175667_e(villagedoorinfo.func_179852_d())) // Forge: check that the door block is loaded to avoid loading chunks - if (!this.func_179860_f(villagedoorinfo.func_179852_d()) || Math.abs(this.field_75581_g - villagedoorinfo.func_75473_b()) > 1200) { - this.field_75585_c = this.field_75585_c.func_177973_b(villagedoorinfo.func_179852_d()); - flag = true; -@@ -317,22 +321,43 @@ - } - } - -+ @Deprecated //Hasn't worked since 1.9, use UUID version below. - public int func_82684_a(String p_82684_1_) { -+ return this.getPlayerReputation(findUUID(p_82684_1_)); -+ } -+ -+ public int getPlayerReputation(UUID p_82684_1_) { - Integer integer = this.field_82693_j.get(p_82684_1_); - return integer == null ? 0 : integer; - } - -+ private UUID findUUID(String name) { -+ if (this.field_75586_a == null || this.field_75586_a.func_73046_m() == null) -+ return EntityPlayer.func_175147_b(name); -+ GameProfile profile = this.field_75586_a.func_73046_m().func_152358_ax().func_152655_a(name); -+ return profile == null ? EntityPlayer.func_175147_b(name) : profile.getId(); -+ } -+ -+ @Deprecated //Hasn't worked since 1.9, use UUID version below. - public int func_82688_a(String p_82688_1_, int p_82688_2_) { -- int i = this.func_82684_a(p_82688_1_); -+ return this.modifyPlayerReputation(findUUID(p_82688_1_), p_82688_2_); -+ } -+ -+ public int modifyPlayerReputation(UUID p_82688_1_, int p_82688_2_) { -+ int i = this.getPlayerReputation(p_82688_1_); - int j = MathHelper.func_76125_a(i + p_82688_2_, -30, 10); - this.field_82693_j.put(p_82688_1_, j); - return j; - } - - public boolean func_82687_d(String p_82687_1_) { -- return this.func_82684_a(p_82687_1_) <= -15; -+ return this.isPlayerReputationTooLow(findUUID(p_82687_1_)); - } - -+ public boolean isPlayerReputationTooLow(UUID uuid) { -+ return this.getPlayerReputation(uuid) <= -15; -+ } -+ - public void func_82690_a(NBTTagCompound p_82690_1_) { - this.field_75588_h = p_82690_1_.func_74762_e("PopSize"); - this.field_75583_e = p_82690_1_.func_74762_e("Radius"); -@@ -354,17 +379,14 @@ - - for(int j = 0; j < nbttaglist1.size(); ++j) { - NBTTagCompound nbttagcompound1 = nbttaglist1.func_150305_b(j); -- if (nbttagcompound1.func_74764_b("UUID") && this.field_75586_a != null && this.field_75586_a.func_73046_m() != null) { -- PlayerProfileCache playerprofilecache = this.field_75586_a.func_73046_m().func_152358_ax(); -- GameProfile gameprofile = playerprofilecache.func_152652_a(UUID.fromString(nbttagcompound1.func_74779_i("UUID"))); -- if (gameprofile != null) { -- this.field_82693_j.put(gameprofile.getName(), nbttagcompound1.func_74762_e("S")); -- } -+ if (nbttagcompound1.func_74764_b("UUID")) { -+ this.field_82693_j.put(UUID.fromString(nbttagcompound1.func_74779_i("UUID")), Integer.valueOf(nbttagcompound1.func_74762_e("S"))); - } else { -- this.field_82693_j.put(nbttagcompound1.func_74779_i("Name"), nbttagcompound1.func_74762_e("S")); -+ //World is never set here, so this will always be offline UUIDs, sadly there is no way to convert this. -+ this.field_82693_j.put(findUUID(nbttagcompound1.func_74779_i("Name")), Integer.valueOf(nbttagcompound1.func_74762_e("S"))); - } - } -- -+ if (p_82690_1_.func_74764_b("ForgeCaps")) this.deserializeCaps(p_82690_1_.func_74775_l("ForgeCaps")); - } - - public void func_82689_b(NBTTagCompound p_82689_1_) { -@@ -396,14 +418,12 @@ - p_82689_1_.func_74782_a("Doors", nbttaglist); - NBTTagList nbttaglist1 = new NBTTagList(); - -- for(String s : this.field_82693_j.keySet()) { -+ for(UUID s : this.field_82693_j.keySet()) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); -- PlayerProfileCache playerprofilecache = this.field_75586_a.func_73046_m().func_152358_ax(); - - try { -- GameProfile gameprofile = playerprofilecache.func_152655_a(s); -- if (gameprofile != null) { -- nbttagcompound1.func_74778_a("UUID", gameprofile.getId().toString()); -+ { -+ nbttagcompound1.func_74778_a("UUID", s.toString()); - nbttagcompound1.func_74768_a("S", this.field_82693_j.get(s)); - nbttaglist1.add((INBTBase)nbttagcompound1); - } -@@ -413,6 +433,8 @@ - } - - p_82689_1_.func_74782_a("Players", nbttaglist1); -+ NBTTagCompound capTag = this.serializeCaps(); -+ if (capTag != null) p_82689_1_.func_74782_a("ForgeCaps", capTag); - } - - public void func_82692_h() { -@@ -424,8 +446,8 @@ - } - - public void func_82683_b(int p_82683_1_) { -- for(String s : this.field_82693_j.keySet()) { -- this.func_82688_a(s, p_82683_1_); -+ for(UUID s : this.field_82693_j.keySet()) { -+ this.modifyPlayerReputation(s, p_82683_1_); - } - - } diff --git a/patches/minecraft/net/minecraft/village/VillageCollection.java.patch b/patches/minecraft/net/minecraft/village/VillageCollection.java.patch deleted file mode 100644 index aabea56e3..000000000 --- a/patches/minecraft/net/minecraft/village/VillageCollection.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/village/VillageCollection.java -+++ b/net/minecraft/village/VillageCollection.java -@@ -125,6 +125,7 @@ - } - - private void func_180609_b(BlockPos p_180609_1_) { -+ if (!this.field_75556_a.func_205050_e(p_180609_1_, 16)) return; // Forge: prevent loading unloaded chunks when checking for doors - int i = 16; - int j = 4; - int k = 16; diff --git a/patches/minecraft/net/minecraft/village/VillageSiege.java.patch b/patches/minecraft/net/minecraft/village/VillageSiege.java.patch index 98a6c8ff9..46bd1f29e 100644 --- a/patches/minecraft/net/minecraft/village/VillageSiege.java.patch +++ b/patches/minecraft/net/minecraft/village/VillageSiege.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/village/VillageSiege.java +++ b/net/minecraft/village/VillageSiege.java -@@ -115,6 +115,7 @@ +@@ -84,6 +84,7 @@ + } Vec3d vec3d = this.func_179867_a(new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i)); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.village.VillageSiegeEvent(this, field_75537_a, playerentity, vec3d))) return false; if (vec3d != null) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.village.VillageSiegeEvent(this, field_75537_a, entityplayer, field_75531_f, vec3d))) return false; break; } - } diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index 1374edb44..3cc83ddc2 100644 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,33 +1,33 @@ --- a/net/minecraft/world/Explosion.java +++ b/net/minecraft/world/Explosion.java -@@ -41,6 +41,7 @@ +@@ -47,6 +47,7 @@ private DamageSource field_199593_j; private final List field_77281_g = Lists.newArrayList(); - private final Map field_77288_k = Maps.newHashMap(); + private final Map 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 p_i45752_10_) { -@@ -63,6 +64,7 @@ - this.field_77286_a = p_i45754_10_; - this.field_82755_b = p_i45754_11_; +@@ -69,6 +70,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 void func_77278_a() { -@@ -89,8 +91,8 @@ + public static float func_222259_a(Vec3d p_222259_0_, Entity p_222259_1_) { +@@ -128,8 +130,8 @@ BlockPos blockpos = new BlockPos(d4, d6, d8); - IBlockState iblockstate = this.field_77287_j.func_180495_p(blockpos); + BlockState blockstate = this.field_77287_j.func_180495_p(blockpos); IFluidState ifluidstate = this.field_77287_j.func_204610_c(blockpos); -- if (!iblockstate.func_196958_f() || !ifluidstate.func_206888_e()) { -- float f2 = Math.max(iblockstate.func_177230_c().func_149638_a(), ifluidstate.func_210200_l()); -+ if (!iblockstate.isAir(field_77287_j, blockpos) || !ifluidstate.func_206888_e()) { -+ float f2 = Math.max(iblockstate.getExplosionResistance(field_77287_j, blockpos, field_77283_e, this), ifluidstate.getExplosionResistance(field_77287_j, blockpos, field_77283_e, this)); +- 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, iblockstate, ifluidstate, f2); + f2 = this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, blockstate, ifluidstate, f2); } -@@ -120,6 +122,7 @@ +@@ -159,6 +161,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 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)); @@ -35,22 +35,20 @@ Vec3d vec3d = new Vec3d(this.field_77284_b, this.field_77285_c, this.field_77282_d); for(int k2 = 0; k2 < list.size(); ++k2) { -@@ -191,20 +194,19 @@ - this.field_77287_j.func_195594_a(Particles.field_197601_L, d0, d1, d2, d3, d4, d5); +@@ -229,9 +232,9 @@ + this.field_77287_j.func_195594_a(ParticleTypes.field_197601_L, d0, d1, d2, d3, d4, d5); } -- if (!iblockstate.func_196958_f()) { -+ if (!iblockstate.isAir(field_77287_j, blockpos)) { - if (block.func_149659_a(this)) { - iblockstate.func_196941_a(this.field_77287_j, blockpos, 1.0F / this.field_77280_f, 0); - } - -- 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); -+ iblockstate.onBlockExploded(this.field_77287_j, blockpos, this); - } - } - } +- if (!blockstate.func_196958_f()) { +- 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.isAir(this.field_77287_j, blockpos)) { ++ if (this.field_77287_j instanceof ServerWorld && blockstate.canDropFromExplosion(this.field_77287_j, blockpos, this)) { ++ 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); + if (this.field_222260_b == Explosion.Mode.DESTROY) { + lootcontext$builder.func_216015_a(LootParameters.field_216290_j, this.field_77280_f); +@@ -248,7 +251,7 @@ if (this.field_77286_a) { for(BlockPos blockpos1 : this.field_77281_g) { @@ -59,12 +57,14 @@ this.field_77287_j.func_175656_a(blockpos1, Blocks.field_150480_ab.func_176223_P()); } } -@@ -242,4 +244,8 @@ - public List func_180343_e() { +@@ -287,6 +290,10 @@ return this.field_77281_g; } -+ + + public Vec3d getPosition() { + return this.position; + } - } ++ + public static enum Mode { + NONE, + BREAK, diff --git a/patches/minecraft/net/minecraft/world/IWorld.java.patch b/patches/minecraft/net/minecraft/world/IWorld.java.patch index 810876edd..8f50dfac4 100644 --- a/patches/minecraft/net/minecraft/world/IWorld.java.patch +++ b/patches/minecraft/net/minecraft/world/IWorld.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/IWorld.java +++ b/net/minecraft/world/IWorld.java -@@ -21,16 +21,16 @@ +@@ -24,16 +24,16 @@ long func_72905_C(); default float func_130001_d() { diff --git a/patches/minecraft/net/minecraft/world/IWorldReader.java.patch b/patches/minecraft/net/minecraft/world/IWorldReader.java.patch new file mode 100644 index 000000000..5926cdaaf --- /dev/null +++ b/patches/minecraft/net/minecraft/world/IWorldReader.java.patch @@ -0,0 +1,22 @@ +--- a/net/minecraft/world/IWorldReader.java ++++ b/net/minecraft/world/IWorldReader.java +@@ -29,7 +29,7 @@ + + public interface IWorldReader extends IEnviromentBlockReader { + 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_) { +@@ -241,6 +241,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()); diff --git a/patches/minecraft/net/minecraft/world/Region.java.patch b/patches/minecraft/net/minecraft/world/Region.java.patch deleted file mode 100644 index 2c6985db5..000000000 --- a/patches/minecraft/net/minecraft/world/Region.java.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- a/net/minecraft/world/Region.java -+++ b/net/minecraft/world/Region.java -@@ -55,13 +55,14 @@ - - @Nullable - public TileEntity func_175625_s(BlockPos p_175625_1_) { -- return this.func_190300_a(p_175625_1_, Chunk.EnumCreateEntityType.IMMEDIATE); -+ return this.func_190300_a(p_175625_1_, Chunk.EnumCreateEntityType.CHECK); // Forge: don't modify world from other threads - } - - @Nullable - public TileEntity func_190300_a(BlockPos p_190300_1_, Chunk.EnumCreateEntityType p_190300_2_) { - int i = (p_190300_1_.func_177958_n() >> 4) - this.field_72818_a; - int j = (p_190300_1_.func_177952_p() >> 4) - this.field_72816_b; -+ if (!withinBounds(i, j)) return null; - return this.field_72817_c[i][j].func_177424_a(p_190300_1_, p_190300_2_); - } - -@@ -194,6 +195,7 @@ - public Biome func_180494_b(BlockPos p_180494_1_) { - int i = (p_180494_1_.func_177958_n() >> 4) - this.field_72818_a; - int j = (p_180494_1_.func_177952_p() >> 4) - this.field_72816_b; -+ if (!withinBounds(i, j)) return net.minecraft.init.Biomes.field_76772_c; - return this.field_72817_c[i][j].func_201600_k(p_180494_1_); - } - -@@ -220,6 +222,7 @@ - } else { - int i = (p_175629_2_.func_177958_n() >> 4) - this.field_72818_a; - int j = (p_175629_2_.func_177952_p() >> 4) - this.field_72816_b; -+ if (!withinBounds(i, j)) return p_175629_1_.field_77198_c; - return this.field_72817_c[i][j].func_177413_a(p_175629_1_, p_175629_2_); - } - } else { -@@ -228,13 +231,14 @@ - } - - public 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_); - } - - public int func_175642_b(EnumLightType p_175642_1_, BlockPos p_175642_2_) { - if (p_175642_2_.func_177956_o() >= 0 && p_175642_2_.func_177956_o() < 256) { - int i = (p_175642_2_.func_177958_n() >> 4) - this.field_72818_a; - int j = (p_175642_2_.func_177952_p() >> 4) - this.field_72816_b; -+ if (!withinBounds(i, j)) return p_175642_1_.field_77198_c; - return this.field_72817_c[i][j].func_177413_a(p_175642_1_, p_175642_2_); - } else { - return p_175642_1_.field_77198_c; -@@ -252,4 +256,8 @@ - public int func_181545_F() { - throw new RuntimeException("Not yet implemented"); - } -+ -+ private boolean withinBounds(int x, int z) { -+ return x >= 0 && x < field_72817_c.length && z >= 0 && z < field_72817_c[x].length && field_72817_c[x][z] != null; -+ } - } diff --git a/patches/minecraft/net/minecraft/world/ServerMultiWorld.java.patch b/patches/minecraft/net/minecraft/world/ServerMultiWorld.java.patch new file mode 100644 index 000000000..5ecb29821 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/ServerMultiWorld.java.patch @@ -0,0 +1,23 @@ +--- a/net/minecraft/world/ServerMultiWorld.java ++++ b/net/minecraft/world/ServerMultiWorld.java +@@ -10,11 +10,18 @@ + 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. + } + } diff --git a/patches/minecraft/net/minecraft/world/ServerWorld.java.patch b/patches/minecraft/net/minecraft/world/ServerWorld.java.patch new file mode 100644 index 000000000..9a967466e --- /dev/null +++ b/patches/minecraft/net/minecraft/world/ServerWorld.java.patch @@ -0,0 +1,295 @@ +--- a/net/minecraft/world/ServerWorld.java ++++ b/net/minecraft/world/ServerWorld.java +@@ -118,7 +118,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 field_217497_w = Lists.newArrayList(); + private final Int2ObjectMap field_217498_x = new Int2ObjectLinkedOpenHashMap<>(); +@@ -145,10 +145,14 @@ + private boolean field_211159_Q; + @Nullable + private final WanderingTraderSpawner field_217496_L; ++ /** Stores the recently processed (lighting) chunks */ ++ protected java.util.Set doneChunks = Sets.newHashSet(); ++ public List customTeleporters = new java.util.ArrayList<>(); ++ 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_1_.func_184103_al().func_72395_o() - 2, 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_1_.func_184103_al().func_72395_o() - 2, p_i50703_7_, () -> { + return p_i50703_1_.func_71218_a(DimensionType.OVERWORLD).func_217481_x(); + }); + }, p_i50703_6_, false); +@@ -166,6 +170,7 @@ + } + + this.field_217496_L = this.field_73011_w.func_186058_p() == DimensionType.OVERWORLD ? new WanderingTraderSpawner(this) : null; ++ this.initCapabilities(); + } + + public void func_72835_b(BooleanSupplier p_72835_1_) { +@@ -175,6 +180,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_82766_b("doWeatherCycle")) { + int i = this.field_72986_A.func_176133_A(); +@@ -236,6 +242,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()); +@@ -245,15 +252,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) { +@@ -265,7 +276,7 @@ + })) { + this.field_73068_P = false; + if (this.func_82736_K().func_82766_b("doDaylightCycle")) { +- long l = this.field_72986_A.func_76073_f() + 24000L; ++ long l = this.func_72820_D() + 24000L; + this.func_72877_b(l - l % 24000L); + } + +@@ -291,6 +302,7 @@ + this.field_175740_d.func_75528_a(); + iprofiler.func_219895_b("portalForcer"); + this.field_85177_Q.func_85189_a(this.func_82737_E()); ++ customTeleporters.forEach(t -> t.func_85189_a(func_82737_E())); + iprofiler.func_219895_b("raid"); + this.field_217494_c.func_215171_a(); + if (this.field_217496_L != null) { +@@ -314,6 +326,7 @@ + Entity entity = this.field_217497_w.get(i1); + this.func_217390_a((p_217473_0_) -> { + ++p_217473_0_.field_70173_aa; ++ if (p_217473_0_.canUpdate()) + p_217473_0_.func_70071_h_(); + }, entity); + if (entity.field_70128_L) { +@@ -390,7 +403,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); +@@ -408,10 +421,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_180494_b(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()); + } +@@ -498,10 +512,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) +@@ -514,7 +525,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; +@@ -557,8 +568,9 @@ + if (p_217479_1_.field_70175_ag) { + ++p_217479_1_.field_70173_aa; + this.func_217381_Z().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()) + p_217479_1_.func_70071_h_(); + this.func_217381_Z().func_76319_b(); + } +@@ -620,6 +632,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_); + } + +@@ -629,6 +646,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.field_73020_y.func_201711_g().func_202090_b(); + List list = biomeprovider.func_76932_a(); + Random random = new Random(this.func_72905_C()); +@@ -711,6 +729,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_); + } + } +@@ -769,7 +788,7 @@ + + for(Entity entity : this.field_217498_x.values()) { + if (!(entity instanceof MobEntity) || !((MobEntity)entity).func_104002_bU()) { +- EntityClassification entityclassification = entity.func_200600_R().func_220339_d(); ++ EntityClassification entityclassification = entity.getClassification(true); + if (entityclassification != EntityClassification.MISC && this.func_72863_F().func_217204_a(entity)) { + object2intmap.computeInt(entityclassification, (p_217480_0_, p_217480_1_) -> { + return 1 + (p_217480_1_ == null ? 0 : p_217480_1_); +@@ -840,6 +859,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_.field_70165_t / 16.0D), MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D), ChunkStatus.field_222617_m, p_72838_1_.field_98038_p); + if (!(ichunk instanceof Chunk)) { + return false; +@@ -891,11 +911,15 @@ + } + + 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_); +@@ -909,6 +933,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_) { +@@ -929,9 +954,13 @@ + } + } + ++ 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 new IllegalStateException("Removing entity while ticking!"); + } else { +@@ -950,7 +979,10 @@ + } + + public void func_217434_e(ServerPlayerEntity p_217434_1_) { +- p_217434_1_.func_70106_y(); ++ removePlayer(p_217434_1_, false); ++ } ++ public void removePlayer(ServerPlayerEntity p_217434_1_, boolean keepData) { ++ p_217434_1_.remove(keepData); + this.func_217467_h(p_217434_1_); + this.func_72854_c(); + } +@@ -975,10 +1007,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_.field_70165_t, p_217384_2_.field_70163_u, p_217384_2_.field_70161_v, 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_)); + } + +@@ -1014,6 +1056,7 @@ + + public Explosion func_217401_a(@Nullable Entity p_217401_1_, 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_); + } +@@ -1264,4 +1307,15 @@ + public void func_217489_a(IReputationType p_217489_1_, Entity p_217489_2_, IReputationTracking p_217489_3_) { + p_217489_3_.func_213739_a(p_217489_1_, p_217489_2_); + } ++ ++ 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 getEntities() { ++ return field_217498_x.values().stream(); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/Teleporter.java.patch b/patches/minecraft/net/minecraft/world/Teleporter.java.patch deleted file mode 100644 index f536f2c94..000000000 --- a/patches/minecraft/net/minecraft/world/Teleporter.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/net/minecraft/world/Teleporter.java -+++ b/net/minecraft/world/Teleporter.java -@@ -16,7 +16,7 @@ - import net.minecraft.util.math.MathHelper; - import net.minecraft.world.dimension.DimensionType; - --public class Teleporter { -+public class Teleporter implements net.minecraftforge.common.util.ITeleporter { - private static final BlockPortal field_196236_a = (BlockPortal)Blocks.field_150427_aO; - protected final WorldServer field_85192_a; - protected final Random field_77187_a; -@@ -335,4 +335,13 @@ - this.field_85087_d = p_i45747_3_; - } - } -+ -+ @Override -+ public void placeEntity(World world, Entity entity, float yaw) -+ { -+ if (entity instanceof EntityPlayerMP) -+ func_180266_a(entity, yaw); -+ else -+ func_180620_b(entity, yaw); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/TrackedEntity.java.patch b/patches/minecraft/net/minecraft/world/TrackedEntity.java.patch new file mode 100644 index 000000000..348221d25 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/TrackedEntity.java.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/world/TrackedEntity.java ++++ b/net/minecraft/world/TrackedEntity.java +@@ -77,9 +77,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); +@@ -183,12 +182,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> p_219452_1_) { diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index c11f9a38c..0671392e1 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -1,29 +1,35 @@ --- a/net/minecraft/world/World.java +++ b/net/minecraft/world/World.java -@@ -75,7 +75,7 @@ +@@ -62,13 +62,13 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; --public abstract class World implements IEntityReader, IWorld, IWorldReader, AutoCloseable { -+public abstract class World extends net.minecraftforge.common.capabilities.CapabilityProvider implements IEntityReader, IWorld, IWorldReader, AutoCloseable, net.minecraftforge.common.extensions.IForgeWorld { +-public abstract class World implements IEnviromentBlockReader, IWorld, AutoCloseable { ++public abstract class World extends net.minecraftforge.common.capabilities.CapabilityProvider implements IEnviromentBlockReader, IWorld, AutoCloseable, net.minecraftforge.common.extensions.IForgeWorld { protected static final Logger field_195596_d = LogManager.getLogger(); - private static final EnumFacing[] field_200007_a = EnumFacing.values(); - private int field_181546_a = 63; -@@ -114,8 +114,13 @@ - private boolean field_147481_N; + private static final Direction[] field_200007_a = Direction.values(); + public final List field_147482_g = Lists.newArrayList(); + public final List field_175730_i = Lists.newArrayList(); + protected final List field_147484_a = Lists.newArrayList(); +- protected final List field_147483_b = Lists.newArrayList(); ++ protected final java.util.Set field_147483_b = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>()); // Forge: faster "contains" makes removal much more efficient + private final long field_73001_c = 16777215L; + private final Thread field_217407_c; + private int field_73008_k; +@@ -87,8 +87,12 @@ + public final boolean field_72995_K; + protected boolean field_147481_N; private final WorldBorder field_175728_M; - int[] field_72994_J = new int['\u8000']; + public boolean restoringBlockSnapshots = false; + public boolean captureBlockSnapshots = false; + public java.util.ArrayList capturedBlockSnapshots = new java.util.ArrayList(); -+ private net.minecraftforge.common.util.WorldCapabilityData capabilityData; - protected World(ISaveHandler p_i49813_1_, @Nullable WorldSavedDataStorage p_i49813_2_, WorldInfo p_i49813_3_, Dimension p_i49813_4_, Profiler p_i49813_5_, boolean p_i49813_6_) { + protected World(WorldInfo p_i50005_1_, DimensionType p_i50005_2_, BiFunction p_i50005_3_, IProfiler p_i50005_4_, boolean p_i50005_5_) { + super(World.class); - this.field_73019_z = p_i49813_1_; - this.field_72988_C = p_i49813_2_; - this.field_72984_F = p_i49813_5_; -@@ -126,6 +131,10 @@ + 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); +@@ -99,6 +103,10 @@ } public Biome func_180494_b(BlockPos p_180494_1_) { @@ -31,19 +37,10 @@ + } + + public Biome getBiomeBody(BlockPos p_180494_1_) { - if (this.func_175667_e(p_180494_1_)) { - Chunk chunk = this.func_175726_f(p_180494_1_); - -@@ -182,7 +191,7 @@ - } - - public 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_); - } - - public Chunk func_175726_f(BlockPos p_175726_1_) { -@@ -206,23 +215,50 @@ + AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); + Chunk chunk = abstractchunkprovider.func_217205_a(p_180494_1_.func_177958_n() >> 4, p_180494_1_.func_177952_p() >> 4, false); + if (chunk != null) { +@@ -169,23 +177,51 @@ } else { Chunk chunk = this.func_175726_f(p_180501_1_); Block block = p_180501_2_.func_177230_c(); @@ -55,99 +52,107 @@ + this.capturedBlockSnapshots.add(blockSnapshot); + } + -+ IBlockState old = func_180495_p(p_180501_1_); ++ 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_); + - IBlockState iblockstate = chunk.func_177436_a(p_180501_1_, p_180501_2_, (p_180501_3_ & 64) != 0); - if (iblockstate == null) { + 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 { - IBlockState iblockstate1 = this.func_180495_p(p_180501_1_); -- if (iblockstate1.func_200016_a(this, p_180501_1_) != iblockstate.func_200016_a(this, p_180501_1_) || iblockstate1.func_185906_d() != iblockstate.func_185906_d()) { -+ if (iblockstate1.func_200016_a(this, p_180501_1_) != oldOpacity || iblockstate1.getLightValue(this, p_180501_1_) != oldLight) { - this.field_72984_F.func_76320_a("checkLight"); - this.func_175664_x(p_180501_1_); + 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.func_185906_d() != 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, iblockstate, p_180501_2_, p_180501_3_); ++ this.markAndNotifyBlock(p_180501_1_, chunk, blockstate, p_180501_2_, p_180501_3_); + } + return true; + } + } + } + -+ // Split off from original setBlockState(BlockPos, IBlockState, int) method in order to directly send client and physic updates -+ public void markAndNotifyBlock(BlockPos p_180501_1_, @Nullable Chunk chunk, IBlockState iblockstate, IBlockState p_180501_2_, int p_180501_3_) { ++ // 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(); -+ IBlockState iblockstate1 = func_180495_p(p_180501_1_); ++ BlockState blockstate1 = func_180495_p(p_180501_1_); + { + { - if (iblockstate1 == p_180501_2_) { - if (iblockstate != iblockstate1) { - this.func_175704_b(p_180501_1_, p_180501_1_); + if (blockstate1 == p_180501_2_) { + if (blockstate != blockstate1) { + this.func_217396_m(p_180501_1_); } -- if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && chunk.func_150802_k()) { -+ if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && (chunk == null || chunk.func_150802_k())) { - this.func_184138_a(p_180501_1_, iblockstate, p_180501_2_, p_180501_3_); +- 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_); } -@@ -240,8 +276,6 @@ - p_180501_2_.func_196948_b(this, p_180501_1_, i); - } +@@ -205,8 +241,6 @@ + + this.func_217393_a(p_180501_1_, blockstate, blockstate1); } - - return true; } } } -@@ -253,7 +287,7 @@ +@@ -221,13 +255,13 @@ public boolean func_175655_b(BlockPos p_175655_1_, boolean p_175655_2_) { - IBlockState iblockstate = this.func_180495_p(p_175655_1_); -- if (iblockstate.func_196958_f()) { -+ if (iblockstate.isAir(this, p_175655_1_)) { + BlockState blockstate = this.func_180495_p(p_175655_1_); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(this, p_175655_1_)) { return false; } else { IFluidState ifluidstate = this.func_204610_c(p_175655_1_); -@@ -312,6 +346,8 @@ + this.func_217379_c(2001, p_175655_1_, Block.func_196246_j(blockstate)); + if (p_175655_2_) { +- TileEntity tileentity = blockstate.func_177230_c().func_149716_u() ? this.func_175625_s(p_175655_1_) : null; ++ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_175655_1_) : null; + Block.func_220059_a(blockstate, this, p_175655_1_, tileentity); + } + +@@ -252,6 +286,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(EnumFacing.class), false).isCanceled()) ++ 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_); -@@ -321,6 +357,11 @@ +@@ -261,6 +297,11 @@ } - public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, EnumFacing p_175695_3_) { -+ java.util.EnumSet directions = java.util.EnumSet.allOf(EnumFacing.class); + public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, Direction p_175695_3_) { ++ java.util.EnumSet 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_ != EnumFacing.WEST) { + if (p_175695_3_ != Direction.WEST) { this.func_190524_a(p_175695_1_.func_177976_e(), p_175695_2_, p_175695_1_); } -@@ -358,9 +399,9 @@ +@@ -298,9 +339,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)", IRegistry.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)", 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 #" + IRegistry.field_212618_g.func_177774_c(p_190524_2_); +- 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_, iblockstate); -@@ -518,7 +559,7 @@ + CrashReportCategory.func_175750_a(crashreportcategory, p_190524_1_, blockstate); +@@ -363,7 +404,7 @@ } public boolean func_72935_r() { @@ -155,215 +160,104 @@ + return this.field_73011_w.isDaytime(); } - @Nullable -@@ -698,6 +739,12 @@ - } - - public void func_184148_a(@Nullable EntityPlayer p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) { -+ 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(); -+ p_184148_11_ = event.getPitch(); - for(int i = 0; i < this.field_73021_x.size(); ++i) { - this.field_73021_x.get(i).func_184375_a(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_); - } -@@ -742,6 +789,8 @@ - } - - public boolean func_72838_d(Entity p_72838_1_) { -+ // do not drop any items while restoring blocksnapshots. Prevents dupes -+ if (!this.field_72995_K && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false; - int i = MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D); - int j = MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D); - boolean flag = p_72838_1_.field_98038_p; -@@ -758,6 +807,7 @@ - this.func_72854_c(); - } - -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false; - this.func_72964_e(i, j).func_76612_a(p_72838_1_); - this.field_72996_f.add(p_72838_1_); - this.func_72923_a(p_72838_1_); -@@ -770,6 +820,7 @@ - this.field_73021_x.get(i).func_72703_a(p_72923_1_); - } - -+ p_72923_1_.onAddedToWorld(); - } - - public void func_72847_b(Entity p_72847_1_) { -@@ -777,9 +828,14 @@ - this.field_73021_x.get(i).func_72709_b(p_72847_1_); - } - -+ p_72847_1_.onRemovedFromWorld(); - } - - public void func_72900_e(Entity p_72900_1_) { -+ this.removeEntity(p_72900_1_, false); -+ } -+ -+ public void removeEntity(Entity p_72900_1_, boolean keepData) { - if (p_72900_1_.func_184207_aI()) { - p_72900_1_.func_184226_ay(); - } -@@ -788,7 +844,7 @@ - p_72900_1_.func_184210_p(); - } - -- p_72900_1_.func_70106_y(); -+ p_72900_1_.remove(keepData); - if (p_72900_1_ instanceof EntityPlayer) { - this.field_73010_i.remove(p_72900_1_); - this.func_72854_c(); -@@ -798,8 +854,12 @@ - } - - public void func_72973_f(Entity p_72973_1_) { -+ this.removeEntityDangerously(p_72973_1_, false); -+ } -+ -+ public void removeEntityDangerously(Entity p_72973_1_, boolean keepData) { - p_72973_1_.func_184174_b(false); -- p_72973_1_.func_70106_y(); -+ p_72973_1_.remove(keepData); - if (p_72973_1_ instanceof EntityPlayer) { - this.field_73010_i.remove(p_72973_1_); - this.func_72854_c(); -@@ -819,24 +879,31 @@ - this.field_73021_x.add(p_72954_1_); + public void func_184133_a(@Nullable PlayerEntity p_184133_1_, BlockPos p_184133_2_, SoundEvent p_184133_3_, SoundCategory p_184133_4_, float p_184133_5_, float p_184133_6_) { +@@ -390,8 +431,11 @@ + public void func_217404_b(IParticleData p_217404_1_, boolean p_217404_2_, double p_217404_3_, double p_217404_5_, double p_217404_7_, double p_217404_9_, double p_217404_11_, double p_217404_13_) { } - @OnlyIn(Dist.CLIENT) - public void func_72848_b(IWorldEventListener p_72848_1_) { - this.field_73021_x.remove(p_72848_1_); - } - - public int func_72967_a(float p_72967_1_) { -+ float f = 1.0F - this.field_73011_w.getSunBrightnessFactor(p_72967_1_); -+ return (int)(f * 11); -+ } -+ public float getSunBrightnessFactor(float p_72967_1_) { - float f = this.func_72826_c(p_72967_1_); - float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F); - f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); - f1 = 1.0F - f1; - f1 = (float)((double)f1 * (1.0D - (double)(this.func_72867_j(p_72967_1_) * 5.0F) / 16.0D)); - f1 = (float)((double)f1 * (1.0D - (double)(this.func_72819_i(p_72967_1_) * 5.0F) / 16.0D)); -- f1 = 1.0F - f1; -- return (int)(f1 * 11.0F); -+ return f1; - } - - @OnlyIn(Dist.CLIENT) public float func_72971_b(float p_72971_1_) { + return this.field_73011_w.getSunBrightness(p_72971_1_); + } + -+ @OnlyIn(Dist.CLIENT) + public float getSunBrightnessBody(float p_72971_1_) { float f = this.func_72826_c(p_72971_1_); float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.2F); f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); -@@ -848,6 +915,11 @@ +@@ -403,12 +447,15 @@ @OnlyIn(Dist.CLIENT) - public Vec3d func_72833_a(Entity p_72833_1_, float p_72833_2_) { -+ return this.field_73011_w.getSkyColor(p_72833_1_, p_72833_2_); + public Vec3d func_217382_a(BlockPos p_217382_1_, float p_217382_2_) { ++ return this.field_73011_w.getSkyColor(p_217382_1_, p_217382_2_); + } + + @OnlyIn(Dist.CLIENT) -+ public Vec3d getSkyColorBody(Entity p_72833_1_, float p_72833_2_) { - float f = this.func_72826_c(p_72833_2_); ++ public Vec3d getSkyColorBody(BlockPos p_217382_1_, float p_217382_2_) { + float f = this.func_72826_c(p_217382_2_); float f1 = MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); -@@ -855,9 +927,7 @@ - int j = MathHelper.func_76128_c(p_72833_1_.field_70163_u); - int k = MathHelper.func_76128_c(p_72833_1_.field_70161_v); - BlockPos blockpos = new BlockPos(i, j, k); -- Biome biome = this.func_180494_b(blockpos); -- float f2 = biome.func_180626_a(blockpos); -- int l = biome.func_76731_a(f2); -+ int l = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, blockpos); - float f3 = (float)(l >> 16 & 255) / 255.0F; - float f4 = (float)(l >> 8 & 255) / 255.0F; - float f5 = (float)(l & 255) / 255.0F; -@@ -904,6 +974,10 @@ +- Biome biome = this.func_180494_b(p_217382_1_); +- float f2 = biome.func_180626_a(p_217382_1_); +- int i = biome.func_76731_a(f2); ++ int i = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, p_217382_1_); + float f3 = (float)(i >> 16 & 255) / 255.0F; + float f4 = (float)(i >> 8 & 255) / 255.0F; + float f5 = (float)(i & 255) / 255.0F; +@@ -455,6 +502,11 @@ @OnlyIn(Dist.CLIENT) public Vec3d func_72824_f(float p_72824_1_) { + return this.field_73011_w.getCloudColor(p_72824_1_); + } ++ + @OnlyIn(Dist.CLIENT) + public Vec3d getCloudColorBody(float p_72824_1_) { float f = this.func_72826_c(p_72824_1_); float f1 = MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F; f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); -@@ -942,10 +1016,7 @@ +@@ -493,17 +545,24 @@ @OnlyIn(Dist.CLIENT) public float func_72880_h(float p_72880_1_) { - float f = this.func_72826_c(p_72880_1_); -- float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.25F); -- f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); -- return f1 * f1 * 0.5F; + return this.field_73011_w.getStarBrightness(p_72880_1_); ++ } ++ ++ @OnlyIn(Dist.CLIENT) ++ public float getStarBrightnessBody(float partialTicks) { ++ float f = this.func_72826_c(partialTicks); + float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.25F); + f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); + return f1 * f1 * 0.5F; } - public void func_72939_s() { -@@ -957,6 +1028,7 @@ - - try { - ++entity.field_70173_aa; -+ if (entity.canUpdate()) - entity.func_70071_h_(); - } catch (Throwable throwable2) { - CrashReport crashreport = CrashReport.func_85055_a(throwable2, "Ticking entity"); -@@ -967,6 +1039,10 @@ - entity.func_85029_a(crashreportcategory); - } - -+ if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringEntities.get()) { -+ LogManager.getLogger().fatal("{}", crashreport.func_71502_e()); -+ func_72900_e(entity); -+ } else - throw new ReportedException(crashreport); - } - -@@ -1009,11 +1085,17 @@ - this.field_72984_F.func_76320_a("tick"); - if (!entity2.field_70128_L && !(entity2 instanceof EntityPlayerMP)) { - try { -+ net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackStart(entity2); - this.func_72870_g(entity2); -+ net.minecraftforge.server.timings.TimeTracker.ENTITY_UPDATE.trackEnd(entity2); - } catch (Throwable throwable1) { - CrashReport crashreport1 = CrashReport.func_85055_a(throwable1, "Ticking entity"); - CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Entity being ticked"); - entity2.func_85029_a(crashreportcategory1); -+ if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringEntities.get()) { -+ LogManager.getLogger().fatal("{}", crashreport1.func_71502_e()); -+ func_72900_e(entity2); -+ } else - throw new ReportedException(crashreport1); - } - } -@@ -1035,30 +1117,41 @@ + public boolean func_175700_a(TileEntity p_175700_1_) { ++ if (p_175700_1_.func_145831_w() != this) p_175700_1_.func_145834_a(this); // 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 } - this.field_72984_F.func_76318_c("blockEntities"); -+ this.field_147481_N = true; //FML Move above remove to prevent CMEs + boolean flag = this.field_147482_g.add(p_175700_1_); +@@ -511,6 +570,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); +@@ -522,6 +583,7 @@ + + public void func_147448_a(Collection p_147448_1_) { + if (this.field_147481_N) { ++ p_147448_1_.stream().filter(te -> te.func_145831_w() != this).forEach(te -> te.func_145834_a(this)); // 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_) { +@@ -534,13 +596,15 @@ + 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_175730_i.removeAll(this.field_147483_b); -- this.field_147482_g.removeAll(this.field_147483_b); -+ field_147483_b.forEach(e -> e.onChunkUnloaded()); -+ // forge: faster "contains" makes this removal much more efficient -+ java.util.Set remove = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>()); -+ remove.addAll(field_147483_b); -+ this.field_175730_i.removeAll(remove); -+ this.field_147482_g.removeAll(remove); ++ 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(); } @@ -371,140 +265,95 @@ Iterator iterator = this.field_175730_i.iterator(); while(iterator.hasNext()) { - TileEntity tileentity = iterator.next(); - if (!tileentity.func_145837_r() && tileentity.func_145830_o()) { +@@ -549,8 +613,9 @@ BlockPos blockpos = tileentity.func_174877_v(); -- if (this.func_175667_e(blockpos) && this.field_175728_M.func_177746_a(blockpos)) { -+ if (this.func_175668_a(blockpos, false) && this.field_175728_M.func_177746_a(blockpos)) { //Forge: Fix TE's getting an extra tick on the client side.... + if (this.field_73020_y.func_222866_a(blockpos) && this.func_175723_af().func_177746_a(blockpos)) { try { - this.field_72984_F.func_194340_a(() -> { - return String.valueOf((Object)TileEntityType.func_200969_a(tileentity.func_200662_C())); - }); + net.minecraftforge.server.timings.TimeTracker.TILE_ENTITY_UPDATE.trackStart(tileentity); - ((ITickable)tileentity).func_73660_a(); -+ net.minecraftforge.server.timings.TimeTracker.TILE_ENTITY_UPDATE.trackEnd(tileentity); - this.field_72984_F.func_76319_b(); - } catch (Throwable throwable) { - CrashReport crashreport2 = CrashReport.func_85055_a(throwable, "Ticking block entity"); - CrashReportCategory crashreportcategory2 = crashreport2.func_85058_a("Block entity being ticked"); - tileentity.func_145828_a(crashreportcategory2); + 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(); +@@ -563,8 +628,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("{}", crashreport2.func_71502_e()); ++ LogManager.getLogger().fatal("{}", crashreport.func_71502_e()); + tileentity.func_145843_s(); + this.func_175713_t(tileentity.func_174877_v()); + } else - throw new ReportedException(crashreport2); + throw new ReportedException(crashreport); } ++ finally { ++ net.minecraftforge.server.timings.TimeTracker.TILE_ENTITY_UPDATE.trackEnd(tileentity); ++ } } -@@ -1068,7 +1161,10 @@ + } + +@@ -572,7 +645,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.EnumCreateEntityType.CHECK) == tileentity) -+ chunk.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()); } } } -@@ -1103,10 +1199,15 @@ +@@ -604,12 +680,15 @@ + + public void func_217390_a(Consumer 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_); + } } - public boolean func_175700_a(TileEntity p_175700_1_) { -+ // Forge - set the world early as vanilla doesn't set it until next tick -+ if (p_175700_1_.func_145831_w() != this) p_175700_1_.func_145834_a(this); -+ // Forge: wait to add new TE if we're currently processing existing ones -+ if (field_147481_N) return field_147484_a.add(p_175700_1_); - boolean flag = this.field_147482_g.add(p_175700_1_); - if (flag && p_175700_1_ instanceof ITickable) { - 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(); -@@ -1119,6 +1220,11 @@ - - public void func_147448_a(Collection p_147448_1_) { - if (this.field_147481_N) { -+ -+ for (TileEntity te : p_147448_1_) { -+ if (te.func_145831_w() != this) // Forge - set the world early as vanilla doesn't set it until next tick -+ te.func_145834_a(this); -+ } - this.field_147484_a.addAll(p_147448_1_); - } else { - for(TileEntity tileentity : p_147448_1_) { -@@ -1137,9 +1243,10 @@ - int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t); - int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v); - int k = 32; -- if (p_72866_2_ && !this.func_175663_a(i - 32, 0, j - 32, i + 32, 0, j + 32, true)) { -- return; -- } -+ int range = func_212416_f(i >> 4, j >> 4) ? 0 : 32; -+ boolean canUpdate = !p_72866_2_ || this.func_175663_a(i - range, 0, j - range, i + range, 0, j + range, true); -+ if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(p_72866_1_); -+ if (!canUpdate) return; - } - - p_72866_1_.field_70142_S = p_72866_1_.field_70165_t; -@@ -1153,7 +1260,7 @@ - p_72866_1_.func_70098_U(); - } else { - this.field_72984_F.func_194340_a(() -> { -- return IRegistry.field_212629_r.func_177774_c(p_72866_1_.func_200600_R()).toString(); -+ return p_72866_1_.func_200600_R().getRegistryName().toString(); - }); - p_72866_1_.func_70071_h_(); - this.field_72984_F.func_76319_b(); -@@ -1200,6 +1307,7 @@ - if (p_72866_2_ && p_72866_1_.field_70175_ag) { - for(Entity entity : p_72866_1_.func_184188_bt()) { - if (!entity.field_70128_L && entity.func_184187_bx() == p_72866_1_) { -+ if (entity.canUpdate()) - this.func_72870_g(entity); - } else { - entity.func_184210_p(); -@@ -1239,7 +1347,7 @@ +@@ -626,7 +705,7 @@ for(int l1 = k; l1 < l; ++l1) { for(int i2 = i1; i2 < j1; ++i2) { - IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2)); -- if (!iblockstate.func_196958_f()) { -+ if (!iblockstate.isAir(this, blockpos$pooledmutableblockpos)) { + BlockState blockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2)); +- if (!blockstate.func_196958_f()) { ++ if (!blockstate.isAir(this, blockpos$pooledmutableblockpos)) { boolean flag = true; return flag; } -@@ -1263,10 +1371,13 @@ +@@ -650,8 +729,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$pooledmutableblockpos.func_181079_c(k1, l1, i2)).func_177230_c(); -+ IBlockState state = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2)); -+ Block block = state.func_177230_c(); - if (block == Blocks.field_150480_ab || block == Blocks.field_150353_l) { +- if (block == Blocks.field_150480_ab || block == Blocks.field_150353_l) { ++ BlockState state = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2)); ++ if (state.isBurning(this, blockpos$pooledmutableblockpos)) { boolean flag = true; return flag; -+ } else if (state.isBurning(this, blockpos$pooledmutableblockpos)) { -+ return true; } - } - } -@@ -1346,6 +1457,7 @@ - if (p_211529_2_ != null) { - explosion.func_199592_a(p_211529_2_); +@@ -722,6 +801,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); -@@ -1439,10 +1551,13 @@ - } +@@ -782,9 +862,12 @@ public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_) { -+ p_175690_1_ = p_175690_1_.func_185334_h(); // Forge - prevent mutable BlockPos leaks 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_174878_a(p_175690_1_); @@ -513,7 +362,7 @@ Iterator iterator = this.field_147484_a.iterator(); while(iterator.hasNext()) { -@@ -1455,7 +1570,8 @@ +@@ -797,7 +880,8 @@ this.field_147484_a.add(p_175690_2_); } else { @@ -523,41 +372,29 @@ this.func_175700_a(p_175690_2_); } } -@@ -1468,6 +1584,8 @@ +@@ -810,6 +894,8 @@ if (tileentity != null && this.field_147481_N) { tileentity.func_145843_s(); this.field_147484_a.remove(tileentity); -+ if (!(tileentity instanceof ITickable)) //Forge: If they are not tickable they wont be removed in the update loop. ++ 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); -@@ -1477,6 +1595,7 @@ +@@ -819,7 +905,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 - } -@@ -1498,7 +1617,7 @@ - } + public boolean func_195588_v(BlockPos p_195588_1_) { +@@ -844,9 +930,14 @@ - public boolean func_195595_w(BlockPos p_195595_1_) { -- return this.func_195588_v(p_195595_1_) && this.func_180495_p(p_195595_1_).func_185896_q(); -+ return this.func_195588_v(p_195595_1_) && this.func_180495_p(p_195595_1_).isTopSolid(this, p_195595_1_); - } - - public void func_72966_v() { -@@ -1512,6 +1631,7 @@ public void func_72891_a(boolean p_72891_1_, boolean p_72891_2_) { - this.field_72985_G = p_72891_1_; - this.field_72992_H = p_72891_2_; -+ this.field_73011_w.setAllowedSpawnTypes(p_72891_1_, p_72891_2_); - } - - public void func_72835_b(BooleanSupplier p_72835_1_) { -@@ -1520,6 +1640,10 @@ + 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() { @@ -568,71 +405,7 @@ if (this.field_72986_A.func_76059_o()) { this.field_73004_o = 1.0F; if (this.field_72986_A.func_76061_m()) { -@@ -1534,6 +1658,10 @@ - } - - protected void func_72979_l() { -+ this.field_73011_w.updateWeather(); -+ } -+ -+ public void updateWeatherBody() { - if (this.field_73011_w.func_191066_m()) { - if (!this.field_72995_K) { - boolean flag = this.func_82736_K().func_82766_b("doWeatherCycle"); -@@ -1620,9 +1748,9 @@ - return 15; - } else { - IBlockState iblockstate = this.func_180495_p(p_175638_1_); -- int i = p_175638_2_ == EnumLightType.SKY ? 0 : iblockstate.func_185906_d(); -+ int i = p_175638_2_ == EnumLightType.SKY ? 0 : iblockstate.getLightValue(this, p_175638_1_); - int j = iblockstate.func_200016_a(this, p_175638_1_); -- if (j >= 15 && iblockstate.func_185906_d() > 0) { -+ if (false) { // Forge: fix MC-119932 - j = 1; - } - -@@ -1631,7 +1759,7 @@ - } - - if (j >= 15) { -- return 0; -+ return i; // Forge: fix MC-119932 - } else if (i >= 14) { - return i; - } else { -@@ -1656,11 +1784,12 @@ - } - - public boolean func_180500_c(EnumLightType p_180500_1_, BlockPos p_180500_2_) { -- if (!this.func_175648_a(p_180500_2_, 17, false)) { -+ if (!this.func_175648_a(p_180500_2_, 16, false)) { - return false; - } else { - int i = 0; - int j = 0; -+ int updateRange = this.func_175648_a(p_180500_2_, 18, false) ? 17 : 15; - this.field_72984_F.func_76320_a("getBrightness"); - int k = this.func_175642_b(p_180500_1_, p_180500_2_); - int l = this.func_175638_a(p_180500_2_, p_180500_1_); -@@ -1686,7 +1815,7 @@ - int j3 = MathHelper.func_76130_a(i2 - i1); - int k3 = MathHelper.func_76130_a(j2 - j1); - int l3 = MathHelper.func_76130_a(k2 - k1); -- if (j3 + k3 + l3 < 17) { -+ if (j3 + k3 + l3 < updateRange) { - try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.func_185346_s()) { - for(EnumFacing enumfacing : field_200007_a) { - int i4 = i2 + enumfacing.func_82601_c(); -@@ -1726,7 +1855,7 @@ - int l6 = Math.abs(k5 - j1); - int i7 = Math.abs(l5 - k1); - boolean flag = j < this.field_72994_J.length - 6; -- if (k6 + l6 + i7 < 17 && flag) { -+ if (k6 + l6 + i7 < updateRange && flag) { - if (this.func_175642_b(p_180500_1_, blockpos1.func_177976_e()) < j6) { - this.field_72994_J[j++] = j5 - 1 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 - k1 + 32 << 12); - } -@@ -1767,10 +1896,10 @@ +@@ -866,10 +957,10 @@ public List func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate p_175674_3_) { List list = Lists.newArrayList(); @@ -647,7 +420,22 @@ for(int i1 = i; i1 <= j; ++i1) { for(int j1 = k; j1 <= l; ++j1) { -@@ -1812,10 +1941,10 @@ +@@ -884,10 +975,10 @@ + } + + public List func_217394_a(@Nullable EntityType p_217394_1_, AxisAlignedBB p_217394_2_, Predicate p_217394_3_) { +- 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 list = Lists.newArrayList(); + + for(int i1 = i; i1 < j; ++i1) { +@@ -903,10 +994,10 @@ } public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate p_175647_3_) { @@ -662,34 +450,16 @@ List list = Lists.newArrayList(); for(int i1 = i; i1 < j; ++i1) { -@@ -1891,7 +2020,7 @@ - } +@@ -980,7 +1071,7 @@ - public void func_212420_a(Stream p_212420_1_) { -- p_212420_1_.forEach((p_212418_1_) -> { -+ p_212420_1_.filter(e -> !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(e, this))).forEach((p_212418_1_) -> { - this.field_72996_f.add(p_212418_1_); - this.func_72923_a(p_212418_1_); - }); -@@ -1958,7 +2087,7 @@ - - public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_) { - IBlockState iblockstate = this.func_180495_p(p_175651_1_); -- return iblockstate.func_185915_l() ? this.func_175676_y(p_175651_1_) : iblockstate.func_185911_a(this, p_175651_1_, p_175651_2_); -+ return iblockstate.shouldCheckWeakPower(this, p_175651_1_, p_175651_2_) ? this.func_175676_y(p_175651_1_) : iblockstate.func_185911_a(this, p_175651_1_, p_175651_2_); + 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_) { -@@ -2096,6 +2225,8 @@ - d2 *= MoreObjects.firstNonNull(p_184150_11_.apply(entityplayer1), 1.0D); - } - -+ d2 = net.minecraftforge.common.ForgeHooks.getPlayerVisibilityDistance(entityplayer1, d2, p_184150_9_); -+ - if ((p_184150_9_ < 0.0D || Math.abs(entityplayer1.field_70163_u - p_184150_3_) < p_184150_9_ * p_184150_9_) && (p_184150_7_ < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0)) { - d0 = d1; - entityplayer = entityplayer1; -@@ -2144,7 +2275,7 @@ +@@ -1025,7 +1116,7 @@ } public long func_72905_C() { @@ -698,7 +468,7 @@ } public long func_82737_E() { -@@ -2152,15 +2283,15 @@ +@@ -1033,11 +1124,11 @@ } public long func_72820_D() { @@ -711,13 +481,17 @@ + this.field_73011_w.setWorldTime(p_72877_1_); } + protected void func_217389_a() { +@@ -1049,7 +1140,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())); } -@@ -2169,7 +2300,7 @@ +@@ -1058,10 +1149,14 @@ } public void func_175652_B(BlockPos p_175652_1_) { @@ -725,26 +499,15 @@ + this.field_73011_w.setSpawnPoint(p_175652_1_); } - @OnlyIn(Dist.CLIENT) -@@ -2185,12 +2316,17 @@ - } - - if (!this.field_72996_f.contains(p_72897_1_)) { -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72897_1_, this))) - this.field_72996_f.add(p_72897_1_); - } - - } - - public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) { -+ return this.field_73011_w.canMineBlock(p_175660_1_, p_175660_2_); + 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(EntityPlayer player, BlockPos pos) { ++ public boolean canMineBlockBody(PlayerEntity player, BlockPos pos) { return true; } -@@ -2265,8 +2401,7 @@ +@@ -1129,8 +1224,7 @@ } public boolean func_180502_D(BlockPos p_180502_1_) { @@ -754,12 +517,7 @@ } @Nullable -@@ -2303,16 +2438,15 @@ - } - - public int func_72800_K() { -- return 256; -+ return this.field_73011_w.getHeight(); +@@ -1144,12 +1238,11 @@ } public int func_72940_L() { @@ -774,56 +532,31 @@ } public CrashReportCategory func_72914_a(CrashReport p_72914_1_) { -@@ -2349,16 +2483,16 @@ +@@ -1178,16 +1271,15 @@ public abstract Scoreboard func_96441_U(); public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) { -- for(EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { -+ for(EnumFacing enumfacing : EnumFacing.values()) { //Forge: TODO: change to VALUES once ATed - BlockPos blockpos = p_175666_1_.func_177972_a(enumfacing); +- 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)) { - IBlockState iblockstate = this.func_180495_p(blockpos); -- if (iblockstate.func_177230_c() == Blocks.field_196762_fd) { -- iblockstate.func_189546_a(this, blockpos, p_175666_2_, p_175666_1_); -- } else if (iblockstate.func_185915_l()) { -+ iblockstate.onNeighborChange(this, blockpos, p_175666_1_); -+ -+ if (iblockstate.isNormalCube(this, blockpos)) { - blockpos = blockpos.func_177972_a(enumfacing); - iblockstate = this.func_180495_p(blockpos); -- if (iblockstate.func_177230_c() == Blocks.field_196762_fd) { -+ if (iblockstate.getWeakChanges(this, blockpos)) { - iblockstate.func_189546_a(this, blockpos, p_175666_2_, p_175666_1_); + 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); } } -@@ -2464,4 +2598,40 @@ - public abstract RecipeManager func_199532_z(); - - public abstract NetworkTagManager func_205772_D(); -+ -+ protected void initCapabilities() { -+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = field_73011_w.initCapabilities(); -+ this.gatherCapabilities(parent); -+ net.minecraftforge.common.util.WorldCapabilityData data = func_175693_T().func_212426_a(func_201675_m().func_186058_p(), net.minecraftforge.common.util.WorldCapabilityData::new, net.minecraftforge.common.util.WorldCapabilityData.ID); -+ if (data == null) { -+ capabilityData = new net.minecraftforge.common.util.WorldCapabilityData(getCapabilities()); -+ func_175693_T().func_212424_a(func_201675_m().func_186058_p(), capabilityData.func_195925_e(), capabilityData); -+ } else { -+ capabilityData = data; -+ capabilityData.setCapabilities(field_73011_w, getCapabilities()); -+ } -+ } -+ -+ public int countEntities(net.minecraft.entity.EnumCreatureType type, int max, boolean forSpawnCount) { -+ int ret = 0; -+ for(Entity entity : this.field_72996_f) { -+ if (entity.isCreatureType(type, forSpawnCount)) { -+ if (ret++ > max) -+ return ret; -+ } -+ } -+ return ret; -+ } +@@ -1266,4 +1358,16 @@ + public BlockPos func_205770_a(Heightmap.Type p_205770_1_, BlockPos p_205770_2_) { + return new BlockPos(p_205770_2_.func_177958_n(), this.func_201676_a(p_205770_1_, p_205770_2_.func_177958_n(), p_205770_2_.func_177952_p()), p_205770_2_.func_177952_p()); + } + + private double maxEntityRadius = 2.0D; + @Override @@ -832,8 +565,8 @@ + } + @Override + public double increaseMaxEntityRadius(double value) { -+ if (value > maxEntityRadius) -+ maxEntityRadius = value; -+ return maxEntityRadius; ++ if (value > maxEntityRadius) ++ maxEntityRadius = value; ++ return maxEntityRadius; + } } diff --git a/patches/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch b/patches/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch deleted file mode 100644 index dc2a2d091..000000000 --- a/patches/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch +++ /dev/null @@ -1,79 +0,0 @@ ---- a/net/minecraft/world/WorldEntitySpawner.java -+++ b/net/minecraft/world/WorldEntitySpawner.java -@@ -72,12 +72,14 @@ - for(EnumCreatureType enumcreaturetype : EnumCreatureType.values()) { - if ((!enumcreaturetype.func_75599_d() || p_77192_3_) && (enumcreaturetype.func_75599_d() || p_77192_2_) && (!enumcreaturetype.func_82705_e() || p_77192_4_)) { - int l4 = enumcreaturetype.func_75601_b() * i / field_180268_a; -- int i5 = p_77192_1_.func_72907_a(enumcreaturetype.func_75598_a(), l4); -+ int i5 = p_77192_1_.countEntities(enumcreaturetype, l4, true); - if (i5 <= l4) { - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); - -+ java.util.ArrayList shuffled = new java.util.ArrayList<>(this.field_77193_b); -+ java.util.Collections.shuffle(shuffled); - label158: -- for(ChunkPos chunkpos1 : this.field_77193_b) { -+ for(ChunkPos chunkpos1 : shuffled) { - BlockPos blockpos = func_180621_a(p_77192_1_, chunkpos1.field_77276_a, chunkpos1.field_77275_b); - int k1 = blockpos.func_177958_n(); - int l1 = blockpos.func_177956_o(); -@@ -128,7 +130,9 @@ - } - - entityliving.func_70012_b((double)f, (double)i3, (double)f1, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); -- if ((d0 <= 16384.0D || !entityliving.func_70692_ba()) && entityliving.func_205020_a(p_77192_1_, false) && entityliving.func_205019_a(p_77192_1_)) { -+ int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(entityliving, p_77192_1_, f, i3, f1, null); -+ if ((d0 <= 16384.0D || !entityliving.func_70692_ba()) && (canSpawn == 1 || (canSpawn == 0 && entityliving.func_205020_a(p_77192_1_, false) && entityliving.func_205019_a(p_77192_1_)))) { -+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f, i3, f1, null)) - ientitylivingdata = entityliving.func_204210_a(p_77192_1_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata, (NBTTagCompound)null); - if (entityliving.func_205019_a(p_77192_1_)) { - ++j2; -@@ -138,7 +142,7 @@ - entityliving.func_70106_y(); - } - -- if (j2 >= entityliving.func_70641_bl()) { -+ if (j2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving)) { - continue label158; - } - -@@ -187,6 +191,13 @@ - - public static boolean func_209382_a(EntitySpawnPlacementRegistry.SpawnPlacementType p_209382_0_, IWorldReaderBase p_209382_1_, BlockPos p_209382_2_, @Nullable EntityType p_209382_3_) { - 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.SpawnPlacementType p_209382_0_, IWorldReaderBase p_209382_1_, BlockPos p_209382_2_, @Nullable EntityType p_209382_3_) { -+ { - IBlockState iblockstate = p_209382_1_.func_180495_p(p_209382_2_); - IFluidState ifluidstate = p_209382_1_.func_204610_c(p_209382_2_); - switch(p_209382_0_) { -@@ -195,7 +206,7 @@ - case ON_GROUND: - default: - IBlockState iblockstate1 = p_209382_1_.func_180495_p(p_209382_2_.func_177977_b()); -- if (iblockstate1.func_185896_q() || p_209382_3_ != null && EntitySpawnPlacementRegistry.func_209345_a(p_209382_3_, iblockstate1)) { -+ if (iblockstate1.canCreatureSpawn(p_209382_1_, p_209382_2_.func_177977_b(), p_209382_0_, p_209382_3_)) { - Block block = iblockstate1.func_177230_c(); - boolean flag = block != Blocks.field_150357_h && block != Blocks.field_180401_cv; - return flag && func_206851_a(iblockstate, ifluidstate) && func_206851_a(p_209382_1_.func_180495_p(p_209382_2_.func_177984_a()), p_209382_1_.func_204610_c(p_209382_2_.func_177984_a())); -@@ -203,8 +214,6 @@ - return false; - } - } -- } else { -- return false; - } - } - -@@ -239,6 +248,7 @@ - - double d0 = MathHelper.func_151237_a((double)l, (double)i + (double)entityliving.field_70130_N, (double)i + 16.0D - (double)entityliving.field_70130_N); - double d1 = MathHelper.func_151237_a((double)i1, (double)j + (double)entityliving.field_70130_N, (double)j + 16.0D - (double)entityliving.field_70130_N); -+ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(entityliving, p_77191_0_, d0, blockpos.func_177956_o(), d1, null) == -1) continue; - entityliving.func_70012_b(d0, (double)blockpos.func_177956_o(), d1, p_77191_4_.nextFloat() * 360.0F, 0.0F); - if (entityliving.func_205020_a(p_77191_0_, false) && entityliving.func_205019_a(p_77191_0_)) { - ientitylivingdata = entityliving.func_204210_a(p_77191_0_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata, (NBTTagCompound)null); diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch deleted file mode 100644 index 84e36ff95..000000000 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ /dev/null @@ -1,248 +0,0 @@ ---- a/net/minecraft/world/WorldServer.java -+++ b/net/minecraft/world/WorldServer.java -@@ -86,7 +86,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - --public class WorldServer extends World implements IThreadListener { -+public class WorldServer extends World implements IThreadListener, net.minecraftforge.common.extensions.IForgeWorldServer { - private static final Logger field_147491_a = LogManager.getLogger(); - private final MinecraftServer field_73061_a; - private final EntityTracker field_73062_L; -@@ -106,6 +106,9 @@ - protected final VillageSiege field_175740_d = new VillageSiege(this); - ObjectLinkedOpenHashSet field_147490_S = new ObjectLinkedOpenHashSet<>(); - private boolean field_211159_Q; -+ /** Stores the recently processed (lighting) chunks */ -+ protected java.util.Set doneChunks = new java.util.HashSet(); -+ public List customTeleporters = new java.util.ArrayList(); - - public WorldServer(MinecraftServer p_i49819_1_, ISaveHandler p_i49819_2_, WorldSavedDataStorage p_i49819_3_, WorldInfo p_i49819_4_, DimensionType p_i49819_5_, Profiler p_i49819_6_) { - super(p_i49819_2_, p_i49819_3_, p_i49819_4_, p_i49819_5_.func_186070_d(), p_i49819_6_, false); -@@ -122,19 +125,20 @@ - - public WorldServer func_212251_i__() { - String s = VillageCollection.func_176062_a(this.field_73011_w); -- VillageCollection villagecollection = this.func_212411_a(DimensionType.OVERWORLD, VillageCollection::new, s); -+ DimensionType key = func_201675_m().func_186058_p().isVanilla() ? DimensionType.OVERWORLD : func_201675_m().func_186058_p(); -+ VillageCollection villagecollection = this.func_212411_a(key, VillageCollection::new, s); - if (villagecollection == null) { - this.field_72982_D = new VillageCollection(this); -- this.func_212409_a(DimensionType.OVERWORLD, s, this.field_72982_D); -+ this.func_212409_a(key, s, this.field_72982_D); - } else { - this.field_72982_D = villagecollection; - this.field_72982_D.func_82566_a(this); - } - -- ScoreboardSaveData scoreboardsavedata = this.func_212411_a(DimensionType.OVERWORLD, ScoreboardSaveData::new, "scoreboard"); -+ ScoreboardSaveData scoreboardsavedata = this.func_212411_a(func_201675_m().func_186058_p(), ScoreboardSaveData::new, "scoreboard"); - if (scoreboardsavedata == null) { - scoreboardsavedata = new ScoreboardSaveData(); -- this.func_212409_a(DimensionType.OVERWORLD, "scoreboard", scoreboardsavedata); -+ this.func_212409_a(func_201675_m().func_186058_p(), "scoreboard", scoreboardsavedata); - } - - scoreboardsavedata.func_96499_a(this.field_73061_a.func_200251_aP()); -@@ -150,6 +154,7 @@ - this.func_175723_af().func_177750_a(this.field_72986_A.func_176137_E()); - } - -+ this.initCapabilities(); - return this; - } - -@@ -163,8 +168,8 @@ - this.field_73020_y.func_201711_g().func_202090_b().func_73660_a(); - if (this.func_73056_e()) { - if (this.func_82736_K().func_82766_b("doDaylightCycle")) { -- long i = this.field_72986_A.func_76073_f() + 24000L; -- this.field_72986_A.func_76068_b(i - i % 24000L); -+ long i = this.func_72820_D() + 24000L; -+ this.func_72877_b(i - i % 24000L); - } - - this.func_73053_d(); -@@ -185,7 +190,7 @@ - - this.field_72986_A.func_82572_b(this.field_72986_A.func_82573_f() + 1L); - if (this.func_82736_K().func_82766_b("doDaylightCycle")) { -- this.field_72986_A.func_76068_b(this.field_72986_A.func_76073_f() + 1L); -+ this.func_72877_b(this.func_72820_D() + 1L); - } - - this.field_72984_F.func_76318_c("tickPending"); -@@ -199,6 +204,7 @@ - this.field_175740_d.func_75528_a(); - this.field_72984_F.func_76318_c("portalForcer"); - this.field_85177_Q.func_85189_a(this.func_82737_E()); -+ customTeleporters.forEach(t -> t.func_85189_a(func_82737_E())); - this.field_72984_F.func_76319_b(); - this.func_147488_Z(); - this.field_211159_Q = false; -@@ -211,11 +217,13 @@ - @Nullable - public Biome.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) { - List list = this.func_72863_F().func_177458_a(p_175734_1_, p_175734_2_); -+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175734_1_, p_175734_2_, list); - return list.isEmpty() ? null : WeightedRandom.func_76271_a(this.field_73012_v, list); - } - - public boolean func_175732_a(EnumCreatureType p_175732_1_, Biome.SpawnListEntry p_175732_2_, BlockPos p_175732_3_) { - List list = this.func_72863_F().func_177458_a(p_175732_1_, p_175732_3_); -+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175732_1_, p_175732_3_, list); - return list != null && !list.isEmpty() ? list.contains(p_175732_2_) : false; - } - -@@ -256,10 +264,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(); - } - - public boolean func_73056_e() { -@@ -286,7 +291,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; -@@ -336,7 +341,13 @@ - boolean flag1 = this.func_72911_I(); - this.field_72984_F.func_76320_a("pollingChunks"); - -- for(Iterator iterator = this.field_73063_M.func_187300_b(); iterator.hasNext(); this.field_72984_F.func_76319_b()) { -+ //Forge: Tick forced loaded chunks as well as normal chunks. -+ Stream chunks = Stream.concat( -+ java.util.stream.StreamSupport.stream(java.util.Spliterators.spliteratorUnknownSize(this.field_73063_M.func_187300_b(), 0), false), -+ func_212412_ag().stream().map(l -> func_72964_e(ChunkPos.func_212578_a(l), ChunkPos.func_212579_b(l))) -+ ).distinct();// We need distinct so we don't double tick chunks. -+ -+ for(Iterator iterator = chunks.iterator(); iterator.hasNext(); this.field_72984_F.func_76319_b()) { - this.field_72984_F.func_76320_a("getChunk"); - Chunk chunk = iterator.next(); - int j = chunk.field_76635_g * 16; -@@ -346,7 +357,7 @@ - this.field_72984_F.func_76318_c("tickChunk"); - chunk.func_150804_b(false); - this.field_72984_F.func_76318_c("thunder"); -- if (flag && flag1 && this.field_73012_v.nextInt(100000) == 0) { -+ if (this.field_73011_w.canDoLightning(chunk) && flag && flag1 && this.field_73012_v.nextInt(100000) == 0) { - this.field_73005_l = this.field_73005_l * 3 + 1013904223; - int l = this.field_73005_l >> 2; - BlockPos blockpos = this.func_175736_a(new BlockPos(j + (l & 15), 0, k + (l >> 8 & 15))); -@@ -366,12 +377,13 @@ - } - - this.field_72984_F.func_76318_c("iceandsnow"); -- if (this.field_73012_v.nextInt(16) == 0) { -+ if (this.field_73011_w.canDoRainSnowIce(chunk) && this.field_73012_v.nextInt(16) == 0) { - this.field_73005_l = this.field_73005_l * 3 + 1013904223; - int i2 = this.field_73005_l >> 2; - BlockPos blockpos1 = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, new BlockPos(j + (i2 & 15), 0, k + (i2 >> 8 & 15))); - BlockPos blockpos2 = blockpos1.func_177977_b(); - Biome biome = this.func_180494_b(blockpos1); -+ if (this.func_175648_a(blockpos2, 1, false)) // Forge: check area to avoid loading neighbors in unloaded chunks - if (biome.func_201848_a(this, blockpos2)) { - this.func_175656_a(blockpos2, Blocks.field_150432_aD.func_176223_P()); - } -@@ -435,7 +447,7 @@ - } - - public void func_72939_s() { -- if (this.field_73010_i.isEmpty()) { -+ if (this.field_73010_i.isEmpty() && func_212412_ag().isEmpty()) { - if (this.field_80004_Q++ >= 300) { - return; - } -@@ -541,10 +553,15 @@ - - protected IChunkProvider func_72970_h() { - IChunkLoader ichunkloader = this.field_73019_z.func_75763_a(this.field_73011_w); -- return new ChunkProviderServer(this, ichunkloader, this.field_73011_w.func_186060_c(), this.field_73061_a); -+ return new ChunkProviderServer(this, ichunkloader, this.func_175624_G().createChunkGenerator(this), this.field_73061_a); - } - - public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) { -+ return super.func_175660_a(p_175660_1_, p_175660_2_); -+ } -+ -+ @Override -+ public boolean canMineBlockBody(EntityPlayer 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_); - } - -@@ -594,6 +611,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.field_73020_y.func_201711_g().func_202090_b(); - List list = biomeprovider.func_76932_a(); - Random random = new Random(this.func_72905_C()); -@@ -676,6 +694,7 @@ - p_73044_2_.func_200209_c(new TextComponentTranslation("menu.savingChunks")); - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); - chunkproviderserver.func_186027_a(p_73044_1_); - - for(Chunk chunk : Lists.newArrayList(chunkproviderserver.func_189548_a())) { -@@ -723,7 +742,7 @@ - - public void func_212420_a(Stream p_212420_1_) { - p_212420_1_.forEach((p_212421_1_) -> { -- if (this.func_184165_i(p_212421_1_)) { -+ if (this.func_184165_i(p_212421_1_) && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_212421_1_, this))) { - this.field_72996_f.add(p_212421_1_); - this.func_72923_a(p_212421_1_); - } -@@ -802,6 +821,7 @@ - - public Explosion func_211529_a(@Nullable Entity p_211529_1_, DamageSource p_211529_2_, double p_211529_3_, double p_211529_5_, double p_211529_7_, float p_211529_9_, boolean p_211529_10_, boolean p_211529_11_) { - Explosion explosion = new Explosion(this, p_211529_1_, p_211529_3_, p_211529_5_, p_211529_7_, p_211529_9_, p_211529_10_, p_211529_11_); -+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - if (p_211529_2_ != null) { - explosion.func_199592_a(p_211529_2_); - } -@@ -856,15 +876,19 @@ - this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(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 SPacketChangeGameState(2, 0.0F)); -+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(2, 0.0F), this.field_73011_w.func_186058_p()); - } else { -- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(1, 0.0F)); -+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(1, 0.0F), this.field_73011_w.func_186058_p()); - } - -- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(7, this.field_73004_o)); -- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(8, this.field_73017_q)); -+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.func_186058_p()); -+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.func_186058_p()); - } - - } -@@ -957,4 +981,8 @@ - public NetworkTagManager func_205772_D() { - return this.field_73061_a.func_199731_aO(); - } -+ -+ public java.io.File getChunkSaveLocation() { -+ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)func_72863_F().field_73247_e).field_75825_d; -+ } - } diff --git a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch deleted file mode 100644 index cdd487c49..000000000 --- a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- a/net/minecraft/world/WorldServerMulti.java -+++ b/net/minecraft/world/WorldServerMulti.java -@@ -10,9 +10,12 @@ - import net.minecraft.world.storage.ISaveHandler; - - public class WorldServerMulti extends WorldServer { -+ private final WorldServer delegate; -+ private final IBorderListener borderListener; - public WorldServerMulti(MinecraftServer p_i49820_1_, ISaveHandler p_i49820_2_, DimensionType p_i49820_3_, WorldServer p_i49820_4_, Profiler p_i49820_5_) { - super(p_i49820_1_, p_i49820_2_, p_i49820_4_.func_175693_T(), new DerivedWorldInfo(p_i49820_4_.func_72912_H()), p_i49820_3_, p_i49820_5_); -- p_i49820_4_.func_175723_af().func_177737_a(new IBorderListener() { -+ this.delegate = p_i49820_4_; -+ this.borderListener = (new IBorderListener() { - public void func_177694_a(WorldBorder p_177694_1_, double p_177694_2_) { - WorldServerMulti.this.func_175723_af().func_177750_a(p_177694_2_); - } -@@ -41,6 +44,7 @@ - WorldServerMulti.this.func_175723_af().func_177724_b(p_177695_2_); - } - }); -+ p_i49820_4_.func_175723_af().func_177737_a(this.borderListener); - } - - protected void func_73042_a() { -@@ -48,19 +52,26 @@ - - public WorldServerMulti func_212251_i__() { - String s = VillageCollection.func_176062_a(this.field_73011_w); -- VillageCollection villagecollection = this.func_212411_a(DimensionType.OVERWORLD, VillageCollection::new, s); -+ VillageCollection villagecollection = this.func_212411_a(func_201675_m().func_186058_p(), VillageCollection::new, s); - if (villagecollection == null) { - this.field_72982_D = new VillageCollection(this); -- this.func_212409_a(DimensionType.OVERWORLD, s, this.field_72982_D); -+ this.func_212409_a(func_201675_m().func_186058_p(), s, this.field_72982_D); - } else { - this.field_72982_D = villagecollection; - this.field_72982_D.func_82566_a(this); - } - -+ this.initCapabilities(); - return this; - } - - public void func_184166_c() { - this.field_73011_w.func_186057_q(); - } -+ -+ @Override -+ public void close() { -+ super.close(); -+ this.delegate.func_175723_af().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. -+ } - } diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch index 118c8b687..9266648d1 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/WorldType.java +++ b/net/minecraft/world/WorldType.java -@@ -3,7 +3,7 @@ +@@ -4,7 +4,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -9,7 +9,7 @@ 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); -@@ -22,6 +22,10 @@ +@@ -23,6 +23,10 @@ private boolean field_151361_l; private boolean field_205395_p; @@ -20,7 +20,7 @@ private WorldType(int p_i1959_1_, String p_i1959_2_) { this(p_i1959_1_, p_i1959_2_, p_i1959_2_, 0); } -@@ -31,6 +35,7 @@ +@@ -32,6 +36,7 @@ } private WorldType(int p_i49778_1_, String p_i49778_2_, String p_i49778_3_, int p_i49778_4_) { @@ -28,7 +28,7 @@ this.field_77133_f = p_i49778_2_; this.field_211890_l = p_i49778_3_; this.field_77134_g = p_i49778_4_; -@@ -39,6 +44,17 @@ +@@ -40,6 +45,17 @@ field_77139_a[p_i49778_1_] = this; } diff --git a/patches/minecraft/net/minecraft/world/biome/Biome.java.patch b/patches/minecraft/net/minecraft/world/biome/Biome.java.patch index 5ce3aa3e1..94380ccc2 100644 --- a/patches/minecraft/net/minecraft/world/biome/Biome.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/Biome.java.patch @@ -1,53 +1,62 @@ --- a/net/minecraft/world/biome/Biome.java +++ b/net/minecraft/world/biome/Biome.java -@@ -144,7 +144,7 @@ +@@ -55,7 +55,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public abstract class Biome { +public abstract class Biome extends net.minecraftforge.registries.ForgeRegistryEntry { public static final Logger field_150586_aC = LogManager.getLogger(); - public static final WorldCarver field_201907_b = new CaveWorldCarver(); - public static final WorldCarver field_201908_c = new NetherCaveWorldCarver(); -@@ -322,11 +322,11 @@ + public static final Set field_201870_ab = Sets.newHashSet(); + public static final ObjectIntIdentityMap field_185373_j = new ObjectIntIdentityMap<>(); +@@ -132,11 +132,11 @@ } - protected void func_201866_a(EnumCreatureType p_201866_1_, Biome.SpawnListEntry p_201866_2_) { + protected void func_201866_a(EntityClassification p_201866_1_, Biome.SpawnListEntry p_201866_2_) { - this.field_201880_ax.get(p_201866_1_).add(p_201866_2_); + this.field_201880_ax.computeIfAbsent(p_201866_1_, k -> Lists.newArrayList()).add(p_201866_2_); } - public List func_76747_a(EnumCreatureType p_76747_1_) { + public List func_76747_a(EntityClassification p_76747_1_) { - return this.field_201880_ax.get(p_76747_1_); + return this.field_201880_ax.computeIfAbsent(p_76747_1_, k -> Lists.newArrayList()); } public Biome.RainType func_201851_b() { -@@ -383,7 +383,7 @@ +@@ -168,7 +168,7 @@ + if (this.func_180626_a(p_201854_2_) >= 0.15F) { + return false; } else { - if (p_201850_2_.func_177956_o() >= 0 && p_201850_2_.func_177956_o() < 256 && p_201850_1_.func_175642_b(EnumLightType.BLOCK, p_201850_2_) < 10) { - IBlockState iblockstate = p_201850_1_.func_180495_p(p_201850_2_); -- if (iblockstate.func_196958_f() && Blocks.field_150433_aE.func_176223_P().func_196955_c(p_201850_1_, p_201850_2_)) { -+ if (iblockstate.isAir(p_201850_1_, p_201850_2_) && Blocks.field_150433_aE.func_176223_P().func_196955_c(p_201850_1_, p_201850_2_)) { +- if (p_201854_2_.func_177956_o() >= 0 && p_201854_2_.func_177956_o() < 256 && p_201854_1_.func_175642_b(LightType.BLOCK, p_201854_2_) < 10) { ++ if (p_201854_2_.func_177956_o() >= 0 && p_201854_2_.func_177956_o() < p_201854_1_.func_201675_m().getHeight() && p_201854_1_.func_175642_b(LightType.BLOCK, p_201854_2_) < 10) { + BlockState blockstate = p_201854_1_.func_180495_p(p_201854_2_); + IFluidState ifluidstate = p_201854_1_.func_204610_c(p_201854_2_); + if (ifluidstate.func_206886_c() == Fluids.field_204546_a && blockstate.func_177230_c() instanceof FlowingFluidBlock) { +@@ -193,7 +193,7 @@ + } else { + if (p_201850_2_.func_177956_o() >= 0 && p_201850_2_.func_177956_o() < 256 && p_201850_1_.func_175642_b(LightType.BLOCK, p_201850_2_) < 10) { + BlockState blockstate = p_201850_1_.func_180495_p(p_201850_2_); +- if (blockstate.func_196958_f() && Blocks.field_150433_aE.func_176223_P().func_196955_c(p_201850_1_, p_201850_2_)) { ++ if (blockstate.isAir(p_201850_1_, p_201850_2_) && Blocks.field_150433_aE.func_176223_P().func_196955_c(p_201850_1_, p_201850_2_)) { return true; } } -@@ -737,6 +737,18 @@ +@@ -488,6 +488,18 @@ } } + public static class FlowerEntry extends WeightedRandom.Item { -+ private final IBlockState state; -+ public FlowerEntry(IBlockState state, int weight) { ++ private final BlockState state; ++ public FlowerEntry(BlockState state, int weight) { + super(weight); + this.state = state; + } + -+ public IBlockState getState() { ++ public BlockState getState() { + return state; + } + } + public static enum TempCategory { - OCEAN, - COLD, + OCEAN("ocean"), + COLD("cold"), diff --git a/patches/minecraft/net/minecraft/world/biome/Biomes.java.patch b/patches/minecraft/net/minecraft/world/biome/Biomes.java.patch new file mode 100644 index 000000000..45b23f587 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/Biomes.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/biome/Biomes.java ++++ b/net/minecraft/world/biome/Biomes.java +@@ -4,6 +4,7 @@ + import net.minecraft.util.ResourceLocation; + import net.minecraft.util.registry.Registry; + ++@net.minecraftforge.registries.ObjectHolder("minecraft") + public abstract class Biomes { + public static final Biome field_76771_b = func_222369_a(0, "ocean", new OceanBiome()); + public static final Biome field_180279_ad = field_76771_b; diff --git a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch index 4b08b4e90..fb6822625 100644 --- a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch +++ b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/border/WorldBorder.java +++ b/net/minecraft/world/border/WorldBorder.java -@@ -125,6 +125,10 @@ +@@ -134,6 +134,10 @@ this.field_177758_a.add(p_177737_1_); } diff --git a/patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch b/patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch index aea607613..aff86bc12 100644 --- a/patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch @@ -1,29 +1,25 @@ --- a/net/minecraft/world/chunk/BlockStateContainer.java +++ b/net/minecraft/world/chunk/BlockStateContainer.java -@@ -63,8 +63,11 @@ +@@ -63,6 +63,9 @@ } private void func_186012_b(int p_186012_1_) { -- if (p_186012_1_ != this.field_186024_e) { -- this.field_186024_e = p_186012_1_; + setBits(p_186012_1_, false); + } -+ private void setBits(int bitsIn, boolean forceBits) { -+ if (bitsIn != this.field_186024_e) { -+ this.field_186024_e = bitsIn; ++ private void setBits(int p_186012_1_, boolean forceBits) { + if (p_186012_1_ != this.field_186024_e) { + this.field_186024_e = p_186012_1_; if (this.field_186024_e <= 4) { - this.field_186024_e = 4; - this.field_186022_c = new BlockStatePaletteLinear<>(this.field_205523_d, this.field_186024_e, this, this.field_205524_e); @@ -73,6 +76,8 @@ } else { this.field_186022_c = this.field_205521_b; this.field_186024_e = MathHelper.func_151241_e(this.field_205523_d.func_186804_a()); + if (forceBits) -+ this.field_186024_e = bitsIn; ++ this.field_186024_e = p_186012_1_; } this.field_186022_c.func_186041_a(this.field_205526_g); -@@ -123,12 +128,16 @@ +@@ -135,12 +140,16 @@ this.func_210459_b(); int i = p_186010_1_.readByte(); if (this.field_186024_e != i) { diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 9af1b7547..32006549a 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/chunk/Chunk.java +++ b/net/minecraft/world/chunk/Chunk.java -@@ -55,7 +55,7 @@ +@@ -56,7 +56,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,117 +9,97 @@ private static final Logger field_150817_t = LogManager.getLogger(); public static final ChunkSection field_186036_a = null; private final ChunkSection[] field_76652_q = new ChunkSection[16]; -@@ -95,6 +95,7 @@ +@@ -89,6 +89,7 @@ } - public Chunk(World p_i49379_1_, int p_i49379_2_, int p_i49379_3_, Biome[] p_i49379_4_, UpgradeData p_i49379_5_, ITickList p_i49379_6_, ITickList p_i49379_7_, long p_i49379_8_) { + public Chunk(World p_i49946_1_, ChunkPos p_i49946_2_, Biome[] p_i49946_3_, UpgradeData p_i49946_4_, ITickList p_i49946_5_, ITickList p_i49946_6_, long p_i49946_7_, @Nullable ChunkSection[] p_i49946_9_, @Nullable Consumer p_i49946_10_) { + super(Chunk.class); this.field_76645_j = new ClassInheritanceMultiMap[16]; - this.field_76637_e = p_i49379_1_; - this.field_76635_g = p_i49379_2_; + this.field_76637_e = p_i49946_1_; + this.field_212816_F = p_i49946_2_; @@ -116,6 +117,7 @@ - this.field_201621_s = p_i49379_6_; - this.field_205325_u = p_i49379_7_; - this.field_111204_q = p_i49379_8_; + field_150817_t.warn("Could not set level chunk sections, array length is {} instead of {}", p_i49946_9_.length, this.field_76652_q.length); + } + } + this.gatherCapabilities(); + } - public Chunk(World p_i48703_1_, ChunkPrimer p_i48703_2_, int p_i48703_3_, int p_i48703_4_) { -@@ -414,6 +416,7 @@ - Block block = p_177436_2_.func_177230_c(); - Block block1 = iblockstate.func_177230_c(); - ChunkSection chunksection = this.field_76652_q[j >> 4]; -+ int j1 = iblockstate.func_200016_a(this.field_76637_e, p_177436_1_); // Relocate old light value lookup here, so that it is called before TE is removed. - boolean flag = false; - if (chunksection == field_186036_a) { - if (p_177436_2_.func_196958_f()) { -@@ -432,7 +435,7 @@ - this.field_76634_f.get(Heightmap.Type.WORLD_SURFACE).func_202270_a(i, j, k, p_177436_2_); +@@ -261,14 +263,14 @@ + if (!this.field_76637_e.field_72995_K) { - iblockstate.func_196947_b(this.field_76637_e, p_177436_1_, p_177436_2_, p_177436_3_); + blockstate.func_196947_b(this.field_76637_e, p_177436_1_, p_177436_2_, p_177436_3_); - } else if (block1 != block && block1 instanceof ITileEntityProvider) { -+ } else if (block1 != block && iblockstate.hasTileEntity()) { ++ } else if (block1 != block && blockstate.hasTileEntity()) { this.field_76637_e.func_175713_t(p_177436_1_); } -@@ -443,14 +446,13 @@ - this.func_76603_b(); - } else { - int i1 = p_177436_2_.func_200016_a(this.field_76637_e, p_177436_1_); -- int j1 = iblockstate.func_200016_a(this.field_76637_e, p_177436_1_); - this.func_76615_h(i, j, k, p_177436_2_); - if (i1 != j1 && (i1 < j1 || this.func_177413_a(EnumLightType.SKY, p_177436_1_) > 0 || this.func_177413_a(EnumLightType.BLOCK, p_177436_1_) > 0)) { - this.func_76595_e(i, k); - } - } - + if (chunksection.func_177485_a(i, j & 15, k).func_177230_c() != block) { + return null; + } else { - if (block1 instanceof ITileEntityProvider) { -+ if (iblockstate.hasTileEntity()) { - TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); ++ if (blockstate.hasTileEntity()) { + TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.CreateEntityType.CHECK); if (tileentity != null) { tileentity.func_145836_u(); -@@ -461,10 +463,10 @@ - p_177436_2_.func_196945_a(this.field_76637_e, p_177436_1_, iblockstate); +@@ -279,10 +281,10 @@ + p_177436_2_.func_215705_a(this.field_76637_e, p_177436_1_, blockstate, p_177436_3_); } - if (block instanceof ITileEntityProvider) { + if (p_177436_2_.hasTileEntity()) { - TileEntity tileentity1 = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); + TileEntity tileentity1 = this.func_177424_a(p_177436_1_, Chunk.CreateEntityType.CHECK); if (tileentity1 == null) { - tileentity1 = ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e); + tileentity1 = p_177436_2_.createTileEntity(this.field_76637_e); this.field_76637_e.func_175690_a(p_177436_1_, tileentity1); } else { tileentity1.func_145836_u(); -@@ -579,11 +581,13 @@ +@@ -322,11 +324,13 @@ k = this.field_76645_j.length - 1; } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(p_76612_1_, this.field_76635_g, this.field_76647_h, p_76612_1_.field_70176_ah, p_76612_1_.field_70164_aj)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(p_76612_1_, this.field_212816_F.field_77276_a, this.field_212816_F.field_77275_b, p_76612_1_.field_70176_ah, p_76612_1_.field_70164_aj)); p_76612_1_.field_70175_ag = true; - p_76612_1_.field_70176_ah = this.field_76635_g; + p_76612_1_.field_70176_ah = this.field_212816_F.field_77276_a; p_76612_1_.field_70162_ai = k; - p_76612_1_.field_70164_aj = this.field_76647_h; + p_76612_1_.field_70164_aj = this.field_212816_F.field_77275_b; this.field_76645_j[k].add(p_76612_1_); + this.func_76630_e(); // Forge - ensure chunks are marked to save after an entity add } public void func_201607_a(Heightmap.Type p_201607_1_, long[] p_201607_2_) { -@@ -604,6 +608,7 @@ +@@ -347,6 +351,7 @@ } this.field_76645_j[p_76608_2_].remove(p_76608_1_); + this.func_76630_e(); // Forge - ensure chunks are marked to save after entity removals } - public boolean func_177444_d(BlockPos p_177444_1_) { -@@ -621,7 +626,7 @@ + public int func_201576_a(Heightmap.Type p_201576_1_, int p_201576_2_, int p_201576_3_) { +@@ -357,7 +362,7 @@ private TileEntity func_177422_i(BlockPos p_177422_1_) { - IBlockState iblockstate = this.func_180495_p(p_177422_1_); - Block block = iblockstate.func_177230_c(); + BlockState blockstate = this.func_180495_p(p_177422_1_); + Block block = blockstate.func_177230_c(); - return !block.func_149716_u() ? null : ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e); -+ return !iblockstate.hasTileEntity() ? null : iblockstate.createTileEntity(this.field_76637_e); ++ return !blockstate.hasTileEntity() ? null : blockstate.createTileEntity(this.field_76637_e); } @Nullable -@@ -632,6 +637,11 @@ +@@ -368,6 +373,10 @@ @Nullable - public TileEntity func_177424_a(BlockPos p_177424_1_, Chunk.EnumCreateEntityType p_177424_2_) { + public TileEntity func_177424_a(BlockPos p_177424_1_, Chunk.CreateEntityType p_177424_2_) { TileEntity tileentity = this.field_150816_i.get(p_177424_1_); + if (tileentity != null && tileentity.func_145837_r()) { + field_150816_i.remove(p_177424_1_); + tileentity = null; + } -+ if (tileentity == null) { - NBTTagCompound nbttagcompound = this.field_201618_i.remove(p_177424_1_); - if (nbttagcompound != null) { -@@ -647,11 +657,8 @@ + CompoundNBT compoundnbt = this.field_201618_i.remove(p_177424_1_); + if (compoundnbt != null) { +@@ -383,9 +392,6 @@ tileentity = this.func_177422_i(p_177424_1_); this.field_76637_e.func_175690_a(p_177424_1_, tileentity); - } else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED) { -- this.field_177447_w.add(p_177424_1_); -+ this.field_177447_w.add(p_177424_1_.func_185334_h()); } - } else if (tileentity.func_145837_r()) { - this.field_150816_i.remove(p_177424_1_); @@ -127,42 +107,35 @@ } return tileentity; -@@ -666,9 +673,10 @@ +@@ -400,7 +406,8 @@ } public void func_177426_a(BlockPos p_177426_1_, TileEntity p_177426_2_) { -+ if (p_177426_2_.func_145831_w() != this.field_76637_e) //Forge don't call unless it's changed, could screw up bad mods. - p_177426_2_.func_145834_a(this.field_76637_e); - p_177426_2_.func_174878_a(p_177426_1_); - if (this.func_180495_p(p_177426_1_).func_177230_c() instanceof ITileEntityProvider) { + if (this.func_180495_p(p_177426_1_).hasTileEntity()) { - if (this.field_150816_i.containsKey(p_177426_1_)) { - this.field_150816_i.get(p_177426_1_).func_145843_s(); - } -@@ -702,9 +710,11 @@ - })); - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(this)); ++ if (p_177426_2_.func_145831_w() != this.field_76637_e) //Forge don't call unless it's changed, could screw up bad mods. + p_177426_2_.func_145834_a(this.field_76637_e); + p_177426_2_.func_174878_a(p_177426_1_); + p_177426_2_.func_145829_t(); +@@ -420,9 +427,14 @@ + public CompoundNBT func_223134_j(BlockPos p_223134_1_) { + TileEntity tileentity = this.func_175625_s(p_223134_1_); + if (tileentity != null && !tileentity.func_145837_r()) { ++ try { + CompoundNBT compoundnbt1 = tileentity.func_189515_b(new CompoundNBT()); + compoundnbt1.func_74757_a("keepPacked", false); + return compoundnbt1; ++ } catch (Exception e) { ++ LogManager.getLogger().error("A TileEntity type {} has thrown an exception trying to write state. It will not persist, Report this to the mod author", tileentity.getClass().getName(), e); ++ return null; ++ } + } else { + CompoundNBT compoundnbt = this.field_201618_i.get(p_223134_1_); + if (compoundnbt != null) { +@@ -457,8 +469,8 @@ } - public void func_76623_d() { -+ java.util.Arrays.stream(field_76645_j).forEach(multimap -> com.google.common.collect.Lists.newArrayList(multimap.func_180215_b(net.minecraft.entity.player.EntityPlayer.class)).forEach(player -> field_76637_e.func_72866_a(player, false))); // FORGE - Fix for MC-92916 - this.field_76636_d = false; - - for(TileEntity tileentity : this.field_150816_i.values()) { -@@ -714,6 +724,7 @@ - for(ClassInheritanceMultiMap classinheritancemultimap : this.field_76645_j) { - this.field_76637_e.func_175681_c(classinheritancemultimap); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(this)); - - } - -@@ -722,8 +733,8 @@ - } - - public void func_177414_a(@Nullable Entity p_177414_1_, AxisAlignedBB p_177414_2_, List p_177414_3_, Predicate p_177414_4_) { + public void func_177414_a(@Nullable Entity p_177414_1_, AxisAlignedBB p_177414_2_, List p_177414_3_, @Nullable Predicate p_177414_4_) { - int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - 2.0D) / 16.0D); - int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + 2.0D) / 16.0D); + int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - this.field_76637_e.getMaxEntityRadius()) / 16.0D); @@ -170,7 +143,18 @@ i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1); j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1); -@@ -751,8 +762,8 @@ +@@ -485,8 +497,8 @@ + } + + public void func_217313_a(@Nullable EntityType p_217313_1_, AxisAlignedBB p_217313_2_, List p_217313_3_, Predicate p_217313_4_) { +- int i = MathHelper.func_76128_c((p_217313_2_.field_72338_b - 2.0D) / 16.0D); +- int j = MathHelper.func_76128_c((p_217313_2_.field_72337_e + 2.0D) / 16.0D); ++ int i = MathHelper.func_76128_c((p_217313_2_.field_72338_b - this.field_76637_e.getMaxEntityRadius()) / 16.0D); ++ int j = MathHelper.func_76128_c((p_217313_2_.field_72337_e + this.field_76637_e.getMaxEntityRadius()) / 16.0D); + i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1); + j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1); + +@@ -501,8 +513,8 @@ } public void func_177430_a(Class p_177430_1_, AxisAlignedBB p_177430_2_, List p_177430_3_, @Nullable Predicate p_177430_4_) { @@ -181,53 +165,32 @@ i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1); j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1); -@@ -791,7 +802,7 @@ +@@ -533,6 +545,11 @@ + }; + Sets.newHashSet(this.field_150816_i.keySet()).stream().filter(predicate).forEach(this.field_76637_e::func_175713_t); - while(!this.field_177447_w.isEmpty()) { - BlockPos blockpos = this.field_177447_w.poll(); -- if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.func_180495_p(blockpos).func_177230_c().func_149716_u()) { -+ if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.func_180495_p(blockpos).hasTileEntity()) { - TileEntity tileentity = this.func_177422_i(blockpos); - this.field_76637_e.func_175690_a(blockpos, tileentity); - this.field_76637_e.func_175704_b(blockpos, blockpos); -@@ -841,6 +852,10 @@ - - @OnlyIn(Dist.CLIENT) - public void func_186033_a(PacketBuffer p_186033_1_, int p_186033_2_, boolean p_186033_3_) { + for (TileEntity tileEntity : field_150816_i.values()) { + tileEntity.func_145836_u(); + tileEntity.func_195044_w(); + } - if (p_186033_3_) { - this.field_150816_i.clear(); - } else { -@@ -929,10 +944,10 @@ - for(int i1 = 0; i1 < 16; ++i1) { - BlockPos blockpos1 = blockpos.func_177982_a(k, (j << 4) + i1, l); - boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15; -- if (this.field_76652_q[j] == field_186036_a && flag || this.field_76652_q[j] != field_186036_a && this.field_76652_q[j].func_177485_a(k, i1, l).func_196958_f()) { -+ if (this.field_76652_q[j] == field_186036_a && flag || this.field_76652_q[j] != field_186036_a && this.field_76652_q[j].func_177485_a(k, i1, l).isAir(field_76637_e, blockpos1)) { - for(EnumFacing enumfacing : EnumFacing.values()) { - BlockPos blockpos2 = blockpos1.func_177972_a(enumfacing); -- if (this.field_76637_e.func_180495_p(blockpos2).func_185906_d() > 0) { -+ if (this.field_76637_e.func_180495_p(blockpos2).getLightValue(field_76637_e, blockpos2) > 0) { - this.field_76637_e.func_175664_x(blockpos2); - } - } -@@ -1097,9 +1112,9 @@ - private TileEntity func_212815_a(BlockPos p_212815_1_, NBTTagCompound p_212815_2_) { ++ + for(int i = 0; i < this.field_76652_q.length; ++i) { + ChunkSection chunksection = this.field_76652_q[i]; + if ((p_217326_3_ & 1 << i) == 0) { +@@ -703,9 +720,9 @@ + private TileEntity func_212815_a(BlockPos p_212815_1_, CompoundNBT p_212815_2_) { TileEntity tileentity; if ("DUMMY".equals(p_212815_2_.func_74779_i("id"))) { - Block block = this.func_180495_p(p_212815_1_).func_177230_c(); - if (block instanceof ITileEntityProvider) { - tileentity = ((ITileEntityProvider)block).func_196283_a_(this.field_76637_e); -+ IBlockState state = this.func_180495_p(p_212815_1_); ++ BlockState state = this.func_180495_p(p_212815_1_); + if (state.hasTileEntity()) { + tileentity = state.createTileEntity(this.field_76637_e); } else { tileentity = null; field_150817_t.warn("Tried to load a DUMMY block entity @ {} but found not block entity block {} at location", p_212815_1_, this.func_180495_p(p_212815_1_)); -@@ -1170,4 +1185,30 @@ +@@ -797,4 +814,30 @@ QUEUED, CHECK; } @@ -239,7 +202,7 @@ + */ + @java.lang.Deprecated + @javax.annotation.Nullable -+ public final NBTTagCompound writeCapsToNBT() { ++ public final CompoundNBT writeCapsToNBT() { + return this.serializeCaps(); + } + @@ -249,7 +212,7 @@ + * Only public for use in {@link AnvilChunkLoader}. + */ + @java.lang.Deprecated -+ public final void readCapsFromNBT(NBTTagCompound tag) { ++ public final void readCapsFromNBT(CompoundNBT tag) { + this.deserializeCaps(tag); + } + diff --git a/patches/minecraft/net/minecraft/world/chunk/ChunkHolder.java.patch b/patches/minecraft/net/minecraft/world/chunk/ChunkHolder.java.patch new file mode 100644 index 000000000..7dfe3eca7 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/ChunkHolder.java.patch @@ -0,0 +1,47 @@ +--- a/net/minecraft/world/chunk/ChunkHolder.java ++++ b/net/minecraft/world/chunk/ChunkHolder.java +@@ -123,7 +123,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) { +@@ -132,6 +132,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; + } + +@@ -177,20 +179,22 @@ + 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); ++ //TODO: Fix Mojang's fuckup to modded by combining all TE data into the chunk data packet... seriously... packet size explosion! + } 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); +- ++ //} Keep this in the else until we figure out a fix for mojang's derpitude on the data packet so we don't double send crap. ++ //{// Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small + 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); + } + } diff --git a/patches/minecraft/net/minecraft/world/chunk/ChunkManager.java.patch b/patches/minecraft/net/minecraft/world/chunk/ChunkManager.java.patch new file mode 100644 index 000000000..14bb7bfc3 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/ChunkManager.java.patch @@ -0,0 +1,50 @@ +--- a/net/minecraft/world/chunk/ChunkManager.java ++++ b/net/minecraft/world/chunk/ChunkManager.java +@@ -371,6 +371,7 @@ + while(p_223155_1_.getAsBoolean() && (runnable = this.field_223181_A.poll()) != null) { + runnable.run(); + } ++ if (this.field_219251_e.isEmpty()) net.minecraftforge.common.DimensionManager.unloadWorld(this.field_219255_i); + + } + +@@ -384,6 +385,7 @@ + if (this.field_219253_g.remove(p_219212_1_, p_219212_3_) && p_219185_5_ != null) { + if (p_219185_5_ instanceof Chunk) { + ((Chunk)p_219185_5_).func_177417_c(false); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload((Chunk)p_219185_5_)); + } + + this.func_219229_a(p_219185_5_); +@@ -461,6 +463,7 @@ + if (flag) { + IChunk ichunk = ChunkSerializer.func_222656_a(this.field_219255_i, this.field_219269_w, this.field_219260_n, p_223172_1_, compoundnbt); + ichunk.func_177432_b(this.field_219255_i.func_82737_E()); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(ichunk)); + return Either.left(ichunk); + } + +@@ -570,6 +573,7 @@ + if (list != null) { + list.forEach(chunk::func_76622_b); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); + } + + return chunk; +@@ -654,6 +658,7 @@ + } + + CompoundNBT compoundnbt1 = ChunkSerializer.func_222645_a(this.field_219255_i, p_219229_1_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_219229_1_, compoundnbt1)); + this.func_219100_a(chunkpos, compoundnbt1); + return true; + } catch (Exception exception) { +@@ -760,6 +765,7 @@ + for(int l = i - this.field_219247_A; l <= i + this.field_219247_A; ++l) { + for(int k = j - this.field_219247_A; k <= j + this.field_219247_A; ++k) { + ChunkPos chunkpos = new ChunkPos(l, k); ++ net.minecraftforge.event.ForgeEventFactory.fireChunkWatch(p_219234_2_, p_219234_1_, chunkpos, field_219255_i); + this.func_219199_a(p_219234_1_, chunkpos, new IPacket[2], !p_219234_2_ && !flag1, p_219234_2_ && !flag); + } + } diff --git a/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch index d683810a2..7a7fc663b 100644 --- a/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/IChunk.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/world/chunk/IChunk.java +++ b/net/minecraft/world/chunk/IChunk.java -@@ -116,4 +116,9 @@ - ITickList func_212247_j(); +@@ -175,4 +175,9 @@ + boolean func_217310_r(); - BitSet func_205749_a(GenerationStage.Carving p_205749_1_); + void func_217305_b(boolean p_217305_1_); + + @Nullable + default net.minecraft.world.IWorld getWorldForge() { diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch deleted file mode 100644 index ac5e784ce..000000000 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ /dev/null @@ -1,76 +0,0 @@ ---- a/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -+++ b/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -@@ -225,6 +225,8 @@ - this.func_202156_a((ChunkPrimer)p_75816_2_, p_75816_1_, nbttagcompound1); - } - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_75816_2_, nbttagcompound)); -+ - this.func_75824_a(chunkpos, nbttagcompound); - } catch (Exception exception) { - field_151505_a.error("Failed to save chunk", (Throwable)exception); -@@ -388,10 +390,14 @@ - for(int j = 0; j < p_75820_1_.func_177429_s().length; ++j) { - for(Entity entity : p_75820_1_.func_177429_s()[j]) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); -+ try { - if (entity.func_70039_c(nbttagcompound)) { - p_75820_1_.func_177409_g(true); - nbttaglist1.add((INBTBase)nbttagcompound); - } -+ } catch (Exception e) { -+ LogManager.getLogger().error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author", entity.func_200600_R(), e); -+ } - } - } - -@@ -402,7 +408,11 @@ - TileEntity tileentity = p_75820_1_.func_175625_s(blockpos); - if (tileentity != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); -- tileentity.func_189515_b(nbttagcompound1); -+ try { -+ tileentity.func_189515_b(nbttagcompound1); -+ } catch (Exception e) { -+ LogManager.getLogger().error("A TileEntity type {} has thrown an exception trying to write state. It will not persist, Report this to the mod author", tileentity.getClass().getName(), e); -+ } - nbttagcompound1.func_74757_a("keepPacked", false); - nbttaglist2.add((INBTBase)nbttagcompound1); - } else { -@@ -442,6 +452,16 @@ - - p_75820_3_.func_74782_a("Heightmaps", nbttagcompound2); - p_75820_3_.func_74782_a("Structures", this.func_202160_a(p_75820_1_.field_76635_g, p_75820_1_.field_76647_h, p_75820_1_.func_201609_c(), p_75820_1_.func_201604_d())); -+ -+ try -+ { -+ final NBTTagCompound capTag = p_75820_1_.writeCapsToNBT(); -+ if (capTag != null) p_75820_3_.func_74782_a("ForgeCaps", capTag); -+ } -+ catch (Exception exception) -+ { -+ org.apache.logging.log4j.LogManager.getLogger().error("A capability provider has thrown an exception trying to write state. It will not persist. Report this to the mod author", exception); -+ } - } - - private Chunk func_75823_a(IWorld p_75823_1_, NBTTagCompound p_75823_2_) { -@@ -508,6 +528,10 @@ - chunk.func_177427_f(true); - } - -+ if (p_75823_2_.func_74764_b("ForgeCaps")) { -+ chunk.readCapsFromNBT(p_75823_2_.func_74775_l("ForgeCaps")); -+ } -+ - return chunk; - } - -@@ -809,4 +833,8 @@ - - return flag; - } -+ -+ public int getPendingSaveCount() { -+ return this.field_75828_a.size(); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch new file mode 100644 index 000000000..b59145452 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/storage/ChunkSerializer.java.patch @@ -0,0 +1,41 @@ +--- a/net/minecraft/world/chunk/storage/ChunkSerializer.java ++++ b/net/minecraft/world/chunk/storage/ChunkSerializer.java +@@ -147,6 +147,7 @@ + ichunk = new Chunk(p_222656_0_.func_201672_e(), p_222656_3_, abiome, upgradedata, iticklist, iticklist1, i2, achunksection, (p_222648_1_) -> { + func_222650_a(compoundnbt, p_222648_1_); + }); ++ if (compoundnbt.func_74764_b("ForgeCaps")) ((Chunk)ichunk).readCapsFromNBT(compoundnbt.func_74775_l("ForgeCaps")); + } else { + ChunkPrimer chunkprimer = new ChunkPrimer(p_222656_3_, upgradedata, achunksection, chunkprimerticklist1, chunkprimerticklist); + ichunk = chunkprimer; +@@ -313,12 +314,22 @@ + for(int k = 0; k < chunk.func_177429_s().length; ++k) { + for(Entity entity : chunk.func_177429_s()[k]) { + CompoundNBT compoundnbt3 = new CompoundNBT(); ++ try { + if (entity.func_70039_c(compoundnbt3)) { + chunk.func_177409_g(true); + listnbt2.add(compoundnbt3); + } ++ } catch (Exception e) { ++ LogManager.getLogger().error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author", entity.func_200600_R(), e); ++ } + } + } ++ try { ++ final CompoundNBT capTag = chunk.writeCapsToNBT(); ++ if (capTag != null) compoundnbt1.func_218657_a("ForgeCaps", capTag); ++ } catch (Exception exception) { ++ LogManager.getLogger().error("A capability provider has thrown an exception trying to write state. It will not persist. Report this to the mod author", exception); ++ } + } else { + ChunkPrimer chunkprimer = (ChunkPrimer)p_222645_1_; + listnbt2.addAll(chunkprimer.func_201652_l()); +@@ -362,6 +373,7 @@ + + compoundnbt1.func_218657_a("Heightmaps", compoundnbt6); + compoundnbt1.func_218657_a("Structures", func_222649_a(chunkpos, p_222645_1_.func_201609_c(), p_222645_1_.func_201604_d())); ++ + return compoundnbt; + } + diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch index 56d821882..b2f1a1579 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -1,92 +1,103 @@ --- a/net/minecraft/world/chunk/storage/RegionFile.java +++ b/net/minecraft/world/chunk/storage/RegionFile.java -@@ -18,6 +18,10 @@ - import net.minecraft.util.Util; +@@ -19,13 +19,19 @@ + import net.minecraft.util.math.ChunkPos; - public class RegionFile { + public class RegionFile implements AutoCloseable { + // Minecraft is limited to 256 sections per chunk. So 1MB. This can easily be override. + // So we extend this to use the REAL size when the count is maxed by seeking to that section and reading the length. + private static final boolean FORGE_ENABLE_EXTENDED_SAVE = Boolean.parseBoolean(System.getProperty("forge.enableExtendedSave", "true")); + private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); private static final byte[] field_76720_a = new byte[4096]; - private final File field_76718_b; - private RandomAccessFile field_76719_c; -@@ -63,11 +67,21 @@ - for(int j1 = 0; j1 < 1024; ++j1) { - int k = this.field_76719_c.readInt(); - this.field_76716_d[j1] = k; -- if (k != 0 && (k >> 8) + (k & 255) <= this.field_76714_f.size()) { -- for(int l = 0; l < (k & 255); ++l) { -+ int length = k & 255; -+ if (length == 255) { -+ if ((k >> 8) <= this.field_76714_f.size()) { // We're maxed out, so we need to read the proper length from the section -+ this.field_76719_c.seek((k >> 8) * 4096); -+ length = (this.field_76719_c.readInt() + 4) / 4096 + 1; -+ this.field_76719_c.seek(j1 * 4 + 4); //Go back to where we were -+ } -+ } -+ if (k != 0 && (k >> 8) + length <= this.field_76714_f.size()) { -+ for (int l = 0; l < length; ++l) { - this.field_76714_f.set((k >> 8) + l, false); - } - } -+ else if (length > 0) -+ LOGGER.warn("Invalid chunk: ({}, {}) Offset: {} Length: {} runs off end file. {}", j1 % 32, (int)(j1 / 32), k >> 8, length, p_i2001_1_); - } + private final RandomAccessFile field_76719_c; + private final int[] field_76716_d = new int[1024]; + private final int[] field_76717_e = new int[1024]; + private final List field_76714_f; ++ private final File filepath; - for(int k1 = 0; k1 < 1024; ++k1) { -@@ -92,14 +106,20 @@ - } else { - int j = i >> 8; - int k = i & 255; -+ if (k == 255) { -+ this.field_76719_c.seek(j * 4096); -+ k = (this.field_76719_c.readInt() + 4) / 4096 + 1; -+ } - if (j + k > this.field_76714_f.size()) { - return null; - } else { - this.field_76719_c.seek((long)(j * 4096)); - int l = this.field_76719_c.readInt(); - if (l > 4096 * k) { -+ LOGGER.warn("Invalid chunk: ({}, {}) Offset: {} Invalid Size: {}>{} {}", p_76704_1_, p_76704_2_, j, l, k * 4096, field_76718_b); - return null; - } else if (l <= 0) { -+ LOGGER.warn("Invalid chunk: ({}, {}) Offset: {} Invalid Size: {} {}", p_76704_1_, p_76704_2_, j, l, field_76718_b); - return null; - } else { - byte b0 = this.field_76719_c.readByte(); -@@ -162,9 +182,14 @@ - int i = this.func_76707_e(p_76706_1_, p_76706_2_); + public RegionFile(File p_i2001_1_) throws IOException { ++ this.filepath = p_i2001_1_; + this.field_76719_c = new RandomAccessFile(p_i2001_1_, "rw"); + if (this.field_76719_c.length() < 4096L) { + this.field_76719_c.write(field_76720_a); +@@ -52,11 +58,21 @@ + for(int j1 = 0; j1 < 1024; ++j1) { + int k = this.field_76719_c.readInt(); + this.field_76716_d[j1] = k; +- if (k != 0 && (k >> 8) + (k & 255) <= this.field_76714_f.size()) { +- for(int l = 0; l < (k & 255); ++l) { ++ int length = k & 255; ++ if (length == 255) { ++ if ((k >> 8) <= this.field_76714_f.size()) { // We're maxed out, so we need to read the proper length from the section ++ this.field_76719_c.seek((k >> 8) * 4096); ++ length = (this.field_76719_c.readInt() + 4) / 4096 + 1; ++ this.field_76719_c.seek(j1 * 4 + 4); //Go back to where we were ++ } ++ } ++ if (k != 0 && (k >> 8) + length <= this.field_76714_f.size()) { ++ for (int l = 0; l < length; ++l) { + this.field_76714_f.set((k >> 8) + l, false); + } + } ++ else if (length > 0) ++ LOGGER.warn("Invalid chunk: ({}, {}) Offset: {} Length: {} runs off end file. {}", j1 % 32, (int)(j1 / 32), k >> 8, length, p_i2001_1_); + } + + for(int k1 = 0; k1 < 1024; ++k1) { +@@ -74,14 +90,20 @@ + } else { int j = i >> 8; int k = i & 255; + if (k == 255) { -+ this.field_76719_c.seek(j * 4096); -+ k = (this.field_76719_c.readInt() + 4) / 4096 + 1; ++ this.field_76719_c.seek(j * 4096); ++ k = (this.field_76719_c.readInt() + 4) / 4096 + 1; + } - int l = (p_76706_4_ + 5) / 4096 + 1; - if (l >= 256) { -- return; -+ if (!FORGE_ENABLE_EXTENDED_SAVE) return; -+ LOGGER.warn("Large Chunk Detected: ({}, {}) Size: {} {}", p_76706_1_, p_76706_2_, l, field_76718_b); - } - + if (j + k > this.field_76714_f.size()) { + return null; + } else { + this.field_76719_c.seek((long)(j * 4096)); + int l = this.field_76719_c.readInt(); + if (l > 4096 * k) { ++ LOGGER.warn("Invalid chunk: ({}, {}) Offset: {} Invalid Size: {}>{} {}", p_222666_1_.field_77276_a, p_222666_1_.field_77275_b, j, l, k * 4096, filepath); + return null; + } else if (l <= 0) { ++ LOGGER.warn("Invalid chunk: ({}, {}) Offset: {} Invalid Size: {} {}", p_222666_1_.field_77276_a, p_222666_1_.field_77275_b, j, l, filepath); + return null; + } else { + byte b0 = this.field_76719_c.readByte(); +@@ -134,10 +156,16 @@ + int i = this.func_222660_e(p_222664_1_); + int j = i >> 8; + int k = i & 255; ++ if (k == 255) { ++ this.field_76719_c.seek(j * 4096); ++ k = (this.field_76719_c.readInt() + 4) / 4096 + 1; ++ } + int l = (p_222664_3_ + 5) / 4096 + 1; +- if (l >= 256) { ++ if (l >= 256 && !FORGE_ENABLE_EXTENDED_SAVE) { + throw new RuntimeException(String.format("Too big to save, %d > 1048576", p_222664_3_)); + } else { ++ if (l >= 256) LOGGER.warn("Large Chunk Detected: ({}, {}) Size: {} {}", p_222664_1_.field_77276_a, p_222664_1_.field_77275_b, l, filepath); ++ if (j != 0 && k == l) { -@@ -197,7 +222,7 @@ + this.func_76712_a(j, p_222664_2_, p_222664_3_); + } else { +@@ -168,7 +196,7 @@ if (j1 >= l) { j = l1; -- this.func_76711_a(p_76706_1_, p_76706_2_, l1 << 8 | l); -+ this.func_76711_a(p_76706_1_, p_76706_2_, l1 << 8 | (l > 255 ? 255 : l)); +- this.func_222663_a(p_222664_1_, l1 << 8 | l); ++ this.func_222663_a(p_222664_1_, l1 << 8 | (l > 255 ? 255 : l)); - for(int j2 = 0; j2 < l; ++j2) { - this.field_76714_f.set(j + j2, false); -@@ -215,7 +240,7 @@ + for(int i2 = 0; i2 < l; ++i2) { + this.field_76714_f.set(j + i2, false); +@@ -185,7 +213,7 @@ + } - this.field_76715_g += 4096 * l; - this.func_76712_a(j, p_76706_3_, p_76706_4_); -- this.func_76711_a(p_76706_1_, p_76706_2_, j << 8 | l); -+ this.func_76711_a(p_76706_1_, p_76706_2_, j << 8 | (l > 255 ? 255 : l)); + this.func_76712_a(j, p_222664_2_, p_222664_3_); +- this.func_222663_a(p_222664_1_, j << 8 | l); ++ this.func_222663_a(p_222664_1_, j << 8 | (l > 255 ? 255 : l)); } } diff --git a/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch b/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch index 9d337b118..0143d0201 100644 --- a/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch +++ b/patches/minecraft/net/minecraft/world/dimension/Dimension.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/dimension/Dimension.java +++ b/net/minecraft/world/dimension/Dimension.java -@@ -13,7 +13,7 @@ +@@ -12,7 +12,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -public abstract class Dimension { +public abstract class Dimension implements net.minecraftforge.common.extensions.IForgeDimension { public static final float[] field_111203_a = new float[]{1.0F, 0.75F, 0.5F, 0.25F, 0.0F, 0.25F, 0.5F, 0.75F}; - protected World field_76579_a; - protected boolean field_76575_d; -@@ -64,7 +64,7 @@ + protected final World field_76579_a; + private final DimensionType field_222669_f; +@@ -63,7 +63,7 @@ @OnlyIn(Dist.CLIENT) public float func_76571_f() { @@ -18,7 +18,7 @@ } @OnlyIn(Dist.CLIENT) -@@ -79,7 +79,7 @@ +@@ -78,7 +78,7 @@ @OnlyIn(Dist.CLIENT) public double func_76565_k() { @@ -27,18 +27,22 @@ } public boolean func_177500_n() { -@@ -120,6 +120,7 @@ - - protected abstract void func_76572_b(); +@@ -107,6 +107,7 @@ + public void func_186059_r() { + } + @Deprecated //Forge: Use WorldType.createChunkGenerator - public abstract IChunkGenerator func_186060_c(); + public abstract ChunkGenerator func_186060_c(); @Nullable -@@ -141,4 +142,61 @@ +@@ -127,5 +128,64 @@ + @OnlyIn(Dist.CLIENT) public abstract boolean func_76568_b(int p_76568_1_, int p_76568_2_); - public abstract DimensionType func_186058_p(); +- public abstract DimensionType func_186058_p(); ++ public DimensionType func_186058_p() { ++ return this.field_222669_f; ++ } + + /*======================================= Forge Start =========================================*/ + private net.minecraftforge.client.IRenderHandler skyRenderer = null; diff --git a/patches/minecraft/net/minecraft/world/dimension/DimensionType.java.patch b/patches/minecraft/net/minecraft/world/dimension/DimensionType.java.patch index fbe77be94..442c92611 100644 --- a/patches/minecraft/net/minecraft/world/dimension/DimensionType.java.patch +++ b/patches/minecraft/net/minecraft/world/dimension/DimensionType.java.patch @@ -1,47 +1,47 @@ --- a/net/minecraft/world/dimension/DimensionType.java +++ b/net/minecraft/world/dimension/DimensionType.java -@@ -6,14 +6,17 @@ - import net.minecraft.util.ResourceLocation; - import net.minecraft.util.registry.IRegistry; +@@ -10,7 +10,7 @@ + import net.minecraft.util.registry.Registry; + import net.minecraft.world.World; --public class DimensionType { -+public class DimensionType extends net.minecraftforge.registries.ForgeRegistryEntry { - public static final DimensionType OVERWORLD = func_212677_a("overworld", new DimensionType(1, "", "", OverworldDimension::new)); - public static final DimensionType NETHER = func_212677_a("the_nether", new DimensionType(0, "_nether", "DIM-1", NetherDimension::new)); - public static final DimensionType THE_END = func_212677_a("the_end", new DimensionType(2, "_end", "DIM1", EndDimension::new)); - private final int field_186074_d; - private final String field_186076_f; +-public class DimensionType implements IDynamicSerializable { ++public class DimensionType extends net.minecraftforge.registries.ForgeRegistryEntry implements IDynamicSerializable { + public static final DimensionType OVERWORLD = func_212677_a("overworld", new DimensionType(1, "", "", OverworldDimension::new, true)); + public static final DimensionType NETHER = func_212677_a("the_nether", new DimensionType(0, "_nether", "DIM-1", NetherDimension::new, false)); + public static final DimensionType THE_END = func_212677_a("the_end", new DimensionType(2, "_end", "DIM1", EndDimension::new, false)); +@@ -19,17 +19,31 @@ private final String field_212682_f; -- private final Supplier field_201038_g; -+ private final java.util.function.Function field_201038_g; + private final BiFunction field_201038_g; + private final boolean field_218273_h; + private final boolean isVanilla; + private final net.minecraftforge.common.ModDimension modType; + private final net.minecraft.network.PacketBuffer data; - public static void func_212680_a() { - } -@@ -23,11 +26,19 @@ - return p_212677_1_; + private static DimensionType func_212677_a(String p_212677_0_, DimensionType p_212677_1_) { + return Registry.func_218343_a(Registry.field_212622_k, p_212677_1_.field_186074_d, p_212677_0_, p_212677_1_); } -- protected DimensionType(int p_i49807_1_, String p_i49807_2_, String p_i49807_3_, Supplier p_i49807_4_) { -+ public DimensionType(int p_i49807_1_, String p_i49807_2_, String p_i49807_3_, Supplier p_i49807_4_) { -+ this(p_i49807_1_, p_i49807_2_, p_i49807_3_, type -> p_i49807_4_.get(), null, null); ++ //Forge, Internal use only. Use DimensionManager instead. ++ @Deprecated + protected DimensionType(int p_i49935_1_, String p_i49935_2_, String p_i49935_3_, BiFunction p_i49935_4_, boolean p_i49935_5_) { ++ this(p_i49935_1_, p_i49935_2_, p_i49935_3_, p_i49935_4_, p_i49935_5_, null, null); + } + + //Forge, Internal use only. Use DimensionManager instead. -+ public DimensionType(int p_i49807_1_, String p_i49807_2_, String p_i49807_3_, java.util.function.Function p_i49807_4_, @Nullable net.minecraftforge.common.ModDimension modType, @Nullable net.minecraft.network.PacketBuffer data) { - this.field_186074_d = p_i49807_1_; - this.field_186076_f = p_i49807_2_; - this.field_212682_f = p_i49807_3_; - this.field_201038_g = p_i49807_4_; ++ @Deprecated ++ public DimensionType(int p_i49935_1_, String p_i49935_2_, String p_i49935_3_, BiFunction p_i49935_4_, boolean p_i49935_5_, @Nullable net.minecraftforge.common.ModDimension modType, @Nullable net.minecraft.network.PacketBuffer data) { + this.field_186074_d = p_i49935_1_; + this.field_186076_f = p_i49935_2_; + this.field_212682_f = p_i49935_3_; + this.field_201038_g = p_i49935_4_; + this.field_218273_h = p_i49935_5_; + this.isVanilla = this.field_186074_d >= 0 && this.field_186074_d <= 2; + this.modType = modType; + this.data = data; } - public static Iterable func_212681_b() { -@@ -38,8 +49,9 @@ + public static DimensionType func_218271_a(Dynamic p_218271_0_) { +@@ -44,8 +58,9 @@ return this.field_186074_d + -1; } @@ -52,12 +52,7 @@ } public File func_212679_a(File p_212679_1_) { -@@ -47,11 +59,11 @@ - } - - public Dimension func_186070_d() { -- return this.field_201038_g.get(); -+ return this.field_201038_g.apply(this); +@@ -57,7 +72,7 @@ } public String toString() { @@ -66,8 +61,8 @@ } @Nullable -@@ -59,7 +71,21 @@ - return IRegistry.field_212622_k.func_148754_a(p_186069_0_ - -1); +@@ -65,7 +80,21 @@ + return Registry.field_212622_k.func_148745_a(p_186069_0_ - -1); } + public boolean isVanilla() { @@ -86,5 +81,5 @@ + + @Nullable public static DimensionType func_193417_a(ResourceLocation p_193417_0_) { - return IRegistry.field_212622_k.func_212608_b(p_193417_0_); + return Registry.field_212622_k.func_82594_a(p_193417_0_); } diff --git a/patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch b/patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch index b8cbf8941..fb31d96a7 100644 --- a/patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch +++ b/patches/minecraft/net/minecraft/world/dimension/EndDimension.java.patch @@ -1,55 +1,32 @@ --- a/net/minecraft/world/dimension/EndDimension.java +++ b/net/minecraft/world/dimension/EndDimension.java -@@ -20,9 +20,14 @@ - public class EndDimension extends Dimension { - public static final BlockPos field_209958_g = new BlockPos(100, 50, 0); - private DragonFightManager field_186064_g; -+ private final DimensionType type; -+ public EndDimension() { this(DimensionType.THE_END); } -+ public EndDimension(DimensionType type) { -+ this.type = type; -+ } +@@ -24,8 +24,8 @@ - public void func_76572_b() { -- NBTTagCompound nbttagcompound = this.field_76579_a.func_72912_H().func_186347_a(DimensionType.THE_END); -+ NBTTagCompound nbttagcompound = this.field_76579_a.func_72912_H().func_186347_a(this.field_76579_a.field_73011_w.func_186058_p()); - this.field_186064_g = this.field_76579_a instanceof WorldServer ? new DragonFightManager((WorldServer)this.field_76579_a, nbttagcompound.func_74775_l("DragonFight")) : null; - this.field_191067_f = false; - } -@@ -99,7 +104,7 @@ + public EndDimension(World p_i49932_1_, DimensionType p_i49932_2_) { + super(p_i49932_1_, p_i49932_2_); +- CompoundNBT compoundnbt = p_i49932_1_.func_72912_H().func_186347_a(DimensionType.THE_END); +- this.field_186064_g = p_i49932_1_ instanceof ServerWorld ? new DragonFightManager((ServerWorld)p_i49932_1_, compoundnbt.func_74775_l("DragonFight")) : null; ++ CompoundNBT compoundnbt = p_i49932_1_.func_72912_H().func_186347_a(p_i49932_2_); ++ this.field_186064_g = p_i49932_1_ instanceof ServerWorld ? new DragonFightManager((ServerWorld)p_i49932_1_, compoundnbt.func_74775_l("DragonFight"), this) : null; } - public DimensionType func_186058_p() { + public ChunkGenerator func_186060_c() { +@@ -99,17 +99,13 @@ + return false; + } + +- public DimensionType func_186058_p() { - return DimensionType.THE_END; -+ return type; - } - +- } +- public void func_186057_q() { -@@ -108,7 +113,7 @@ - nbttagcompound.func_74782_a("DragonFight", this.field_186064_g.func_186088_a()); + CompoundNBT compoundnbt = new CompoundNBT(); + if (this.field_186064_g != null) { + compoundnbt.func_218657_a("DragonFight", this.field_186064_g.func_186088_a()); } -- this.field_76579_a.func_72912_H().func_186345_a(DimensionType.THE_END, nbttagcompound); -+ this.field_76579_a.func_72912_H().func_186345_a(this.field_76579_a.field_73011_w.func_186058_p(), nbttagcompound); +- this.field_76579_a.func_72912_H().func_186345_a(DimensionType.THE_END, compoundnbt); ++ this.field_76579_a.func_72912_H().func_186345_a(field_76579_a.func_201675_m().func_186058_p(), compoundnbt); } public void func_186059_r() { -@@ -122,4 +127,18 @@ - public DragonFightManager func_186063_s() { - return this.field_186064_g; - } -+ -+ @Override -+ public void func_186061_a(net.minecraft.entity.player.EntityPlayerMP player) { -+ if (field_186064_g != null) { -+ field_186064_g.addPlayer(player); -+ } -+ } -+ -+ @Override -+ public void func_186062_b(net.minecraft.entity.player.EntityPlayerMP player) { -+ if (field_186064_g != null) { -+ field_186064_g.removePlayer(player); -+ } -+ } - } diff --git a/patches/minecraft/net/minecraft/world/dimension/NetherDimension.java.patch b/patches/minecraft/net/minecraft/world/dimension/NetherDimension.java.patch index c6ec98384..b6dad12d4 100644 --- a/patches/minecraft/net/minecraft/world/dimension/NetherDimension.java.patch +++ b/patches/minecraft/net/minecraft/world/dimension/NetherDimension.java.patch @@ -1,23 +1,11 @@ --- a/net/minecraft/world/dimension/NetherDimension.java +++ b/net/minecraft/world/dimension/NetherDimension.java -@@ -15,6 +15,12 @@ - import net.minecraftforge.api.distmarker.OnlyIn; - - public class NetherDimension extends Dimension { -+ private final DimensionType type; -+ public NetherDimension() { this(DimensionType.NETHER); } -+ public NetherDimension(DimensionType type) { -+ this.type = type; -+ } -+ - public void func_76572_b() { - this.field_76575_d = true; - this.field_76576_e = true; -@@ -83,6 +89,6 @@ +@@ -82,8 +82,4 @@ + } + }; } - - public DimensionType func_186058_p() { +- +- public DimensionType func_186058_p() { - return DimensionType.NETHER; -+ return type; - } +- } } diff --git a/patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch b/patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch index eabd1883d..ec033970d 100644 --- a/patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch +++ b/patches/minecraft/net/minecraft/world/dimension/OverworldDimension.java.patch @@ -1,23 +1,13 @@ --- a/net/minecraft/world/dimension/OverworldDimension.java +++ b/net/minecraft/world/dimension/OverworldDimension.java -@@ -47,12 +47,18 @@ - import net.minecraftforge.api.distmarker.OnlyIn; +@@ -51,10 +51,6 @@ + super(p_i49933_1_, p_i49933_2_); + } - public class OverworldDimension extends Dimension { -+ private final DimensionType type; -+ public OverworldDimension() { this(DimensionType.OVERWORLD); } -+ public OverworldDimension(DimensionType type) { -+ this.type = type; -+ } -+ - public DimensionType func_186058_p() { +- public DimensionType func_186058_p() { - return DimensionType.OVERWORLD; -+ return type; - } - - public boolean func_186056_c(int p_186056_1_, int p_186056_2_) { -- return !this.field_76579_a.func_72916_c(p_186056_1_, p_186056_2_) && super.func_186056_c(p_186056_1_, p_186056_2_); -+ return (this.type != DimensionType.OVERWORLD || !this.field_76579_a.func_72916_c(p_186056_1_, p_186056_2_)) && super.func_186056_c(p_186056_1_, p_186056_2_); - } - - protected void func_76572_b() { +- } +- + public ChunkGenerator func_186060_c() { + WorldType worldtype = this.field_76579_a.func_72912_H().func_76067_t(); + ChunkGeneratorType chunkgeneratortype = ChunkGeneratorType.field_205489_f; diff --git a/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch b/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch index 13684dcda..5ca26b6c3 100644 --- a/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch +++ b/patches/minecraft/net/minecraft/world/end/DragonFightManager.java.patch @@ -1,6 +1,15 @@ --- a/net/minecraft/world/end/DragonFightManager.java +++ b/net/minecraft/world/end/DragonFightManager.java -@@ -80,6 +80,7 @@ +@@ -76,7 +76,7 @@ + private int field_186123_q; + private List field_186124_r; + +- public DragonFightManager(ServerWorld p_i46669_1_, CompoundNBT p_i46669_2_) { ++ public DragonFightManager(ServerWorld p_i46669_1_, CompoundNBT p_i46669_2_, net.minecraft.world.dimension.EndDimension dim) { + this.field_186110_d = p_i46669_1_; + if (p_i46669_2_.func_150297_b("DragonKilled", 99)) { + if (p_i46669_2_.func_186855_b("DragonUUID")) { +@@ -85,6 +85,7 @@ this.field_186117_k = p_i46669_2_.func_74767_n("DragonKilled"); this.field_186118_l = p_i46669_2_.func_74767_n("PreviouslyKilled"); @@ -8,26 +17,34 @@ if (p_i46669_2_.func_74767_n("IsRespawning")) { this.field_186122_p = DragonSpawnState.START; } -@@ -114,6 +115,7 @@ - - nbttagcompound.func_74757_a("DragonKilled", this.field_186117_k); - nbttagcompound.func_74757_a("PreviouslyKilled", this.field_186118_l); -+ nbttagcompound.func_74757_a("LegacyScanPerformed", !this.field_186120_n); // Forge: fix MC-105080 - if (this.field_186121_o != null) { - nbttagcompound.func_74782_a("ExitPortalLocation", NBTUtil.func_186859_a(this.field_186121_o)); +@@ -105,7 +106,7 @@ + } + } else { + this.field_186111_e.addAll(ContiguousSet.create(Range.closedOpen(0, 20), DiscreteDomain.integers())); +- Collections.shuffle(this.field_186111_e, new Random(p_i46669_1_.func_72905_C())); ++ Collections.shuffle(this.field_186111_e, new Random(dim.getSeed())); } -@@ -502,6 +504,14 @@ - } + this.field_186112_f = BlockPatternBuilder.func_177660_a().func_177659_a(" ", " ", " ", " # ", " ", " ", " ").func_177659_a(" ", " ", " ", " # ", " ", " ", " ").func_177659_a(" ", " ", " ", " # ", " ", " ", " ").func_177659_a(" ### ", " # # ", "# #", "# # #", "# #", " # # ", " ### ").func_177659_a(" ", " ### ", " ##### ", " ##### ", " ##### ", " ### ", " ").func_177662_a('#', CachedBlockInfo.func_177510_a(BlockMatcher.func_177642_a(Blocks.field_150357_h))).func_177661_b(); +@@ -119,6 +120,7 @@ -+ public void addPlayer(EntityPlayerMP player) { -+ this.field_186109_c.func_186760_a(player); + compoundnbt.func_74757_a("DragonKilled", this.field_186117_k); + compoundnbt.func_74757_a("PreviouslyKilled", this.field_186118_l); ++ compoundnbt.func_74757_a("LegacyScanPerformed", !this.field_186120_n); // Forge: fix MC-105080 + if (this.field_186121_o != null) { + compoundnbt.func_218657_a("ExitPortalLocation", NBTUtil.func_186859_a(this.field_186121_o)); + } +@@ -490,6 +492,13 @@ + endercrystalentity.func_184516_a((BlockPos)null); + } + } + } + ++ public void addPlayer(ServerPlayerEntity player) { ++ this.field_186109_c.func_186760_a(player); + } + -+ public void removePlayer(EntityPlayerMP player) { ++ public void removePlayer(ServerPlayerEntity player) { + this.field_186109_c.func_186761_b(player); + } -+ - class LoadManager { - private DragonFightManager.LoadState field_210826_b = DragonFightManager.LoadState.UNKNOWN; - + } diff --git a/patches/minecraft/net/minecraft/world/gen/AbstractChunkGenerator.java.patch b/patches/minecraft/net/minecraft/world/gen/AbstractChunkGenerator.java.patch deleted file mode 100644 index 455956957..000000000 --- a/patches/minecraft/net/minecraft/world/gen/AbstractChunkGenerator.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/gen/AbstractChunkGenerator.java -+++ b/net/minecraft/world/gen/AbstractChunkGenerator.java -@@ -106,6 +106,7 @@ - } - - public void func_205471_a(IChunk p_205471_1_, Biome[] p_205471_2_, SharedSeedRandom p_205471_3_, int p_205471_4_) { -+ if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, p_205471_1_, this.field_202095_a)) return; - double d0 = 0.03125D; - ChunkPos chunkpos = p_205471_1_.func_76632_l(); - int i = chunkpos.func_180334_c(); diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkGeneratorEnd.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkGeneratorEnd.java.patch deleted file mode 100644 index 9a8699037..000000000 --- a/patches/minecraft/net/minecraft/world/gen/ChunkGeneratorEnd.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- a/net/minecraft/world/gen/ChunkGeneratorEnd.java -+++ b/net/minecraft/world/gen/ChunkGeneratorEnd.java -@@ -20,9 +20,9 @@ - private NoiseGeneratorOctaves field_185969_i; - private NoiseGeneratorOctaves field_185970_j; - private NoiseGeneratorOctaves field_185971_k; -- private final NoiseGeneratorOctaves field_73214_a; -- private final NoiseGeneratorOctaves field_73212_b; -- private final NoiseGeneratorPerlin field_205478_l; -+ private NoiseGeneratorOctaves field_73214_a; -+ private NoiseGeneratorOctaves field_73212_b; -+ private NoiseGeneratorPerlin field_205478_l; - private final BlockPos field_191061_n; - private final EndGenSettings field_202116_l; - private final IBlockState field_205479_o; -@@ -42,6 +42,16 @@ - this.field_73212_b = new NoiseGeneratorOctaves(sharedseedrandom, 16); - sharedseedrandom.func_202423_a(262); - this.field_205478_l = new NoiseGeneratorPerlin(new SharedSeedRandom(this.field_202096_b), 4); -+ -+ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextEnd ctx = -+ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextEnd(field_185969_i, field_185970_j, field_185971_k, field_73214_a, field_73212_b, field_205478_l); -+ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i48956_1_, sharedseedrandom, ctx); -+ this.field_185969_i = ctx.getLPerlin1(); -+ this.field_185970_j = ctx.getLPerlin2(); -+ this.field_185971_k = ctx.getPerlin(); -+ this.field_73214_a = ctx.getDepth(); -+ this.field_73212_b = ctx.getScale(); -+ this.field_205478_l = ctx.getIsland(); - } - - public void func_202114_a(int p_202114_1_, int p_202114_2_, IChunk p_202114_3_) { -@@ -121,6 +131,10 @@ - - private double[] func_202113_a(int p_202113_1_, int p_202113_2_, int p_202113_3_, int p_202113_4_, int p_202113_5_, int p_202113_6_) { - double[] adouble = new double[p_202113_4_ * p_202113_5_ * p_202113_6_]; -+ net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, adouble, p_202113_1_, p_202113_2_, p_202113_3_, p_202113_4_, p_202113_5_, p_202113_6_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.DENY) return event.getNoisefield(); -+ - double d0 = 684.412D; - double d1 = 684.412D; - d0 = d0 * 2.0D; diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkGeneratorNether.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkGeneratorNether.java.patch deleted file mode 100644 index f08f836e4..000000000 --- a/patches/minecraft/net/minecraft/world/gen/ChunkGeneratorNether.java.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- a/net/minecraft/world/gen/ChunkGeneratorNether.java -+++ b/net/minecraft/world/gen/ChunkGeneratorNether.java -@@ -20,12 +20,12 @@ - protected static final IBlockState field_185940_a = Blocks.field_150350_a.func_176223_P(); - protected static final IBlockState field_185941_b = Blocks.field_150424_aL.func_176223_P(); - protected static final IBlockState field_185943_d = Blocks.field_150353_l.func_176223_P(); -- private final NoiseGeneratorOctaves field_185957_u; -- private final NoiseGeneratorOctaves field_185958_v; -- private final NoiseGeneratorOctaves field_185959_w; -- private final NoiseGeneratorOctaves field_73177_m; -- private final NoiseGeneratorOctaves field_185946_g; -- private final NoiseGeneratorOctaves field_185947_h; -+ private NoiseGeneratorOctaves field_185957_u; -+ private NoiseGeneratorOctaves field_185958_v; -+ private NoiseGeneratorOctaves field_185959_w; -+ private NoiseGeneratorOctaves field_73177_m; -+ private NoiseGeneratorOctaves field_185946_g; -+ private NoiseGeneratorOctaves field_185947_h; - private final NetherGenSettings field_202107_q; - private final IBlockState field_205474_p; - private final IBlockState field_205604_n; -@@ -44,6 +44,16 @@ - this.field_185946_g = new NoiseGeneratorOctaves(sharedseedrandom, 10); - this.field_185947_h = new NoiseGeneratorOctaves(sharedseedrandom, 16); - p_i48694_1_.func_181544_b(63); -+ -+ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextHell ctx = -+ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextHell(field_185957_u, field_185958_v, field_185959_w, field_73177_m, field_185946_g, field_185947_h); -+ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i48694_1_, sharedseedrandom, ctx); -+ this.field_185957_u = ctx.getLPerlin1(); -+ this.field_185958_v = ctx.getLPerlin2(); -+ this.field_185959_w = ctx.getPerlin(); -+ this.field_73177_m = ctx.getPerlin2(); -+ this.field_185946_g = ctx.getScale(); -+ this.field_185947_h = ctx.getDepth(); - } - - public void func_185936_a(int p_185936_1_, int p_185936_2_, IChunk p_185936_3_) { -@@ -155,6 +165,10 @@ - - private double[] func_202104_a(int p_202104_1_, int p_202104_2_, int p_202104_3_, int p_202104_4_, int p_202104_5_, int p_202104_6_) { - double[] adouble = new double[p_202104_4_ * p_202104_5_ * p_202104_6_]; -+ net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, adouble, p_202104_1_, p_202104_2_, p_202104_3_, p_202104_4_, p_202104_5_, p_202104_6_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.DENY) return event.getNoisefield(); -+ - double d0 = 684.412D; - double d1 = 2053.236D; - this.field_185946_g.func_202647_a(p_202104_1_, p_202104_2_, p_202104_3_, p_202104_4_, 1, p_202104_6_, 1.0D, 0.0D, 1.0D); diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkGeneratorOverworld.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkGeneratorOverworld.java.patch deleted file mode 100644 index f5ed0a52a..000000000 --- a/patches/minecraft/net/minecraft/world/gen/ChunkGeneratorOverworld.java.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/net/minecraft/world/gen/ChunkGeneratorOverworld.java -+++ b/net/minecraft/world/gen/ChunkGeneratorOverworld.java -@@ -28,8 +28,8 @@ - private NoiseGeneratorOctaves field_185993_l; - private NoiseGeneratorPerlin field_185994_m; - private final OverworldGenSettings field_186000_s; -- private final NoiseGeneratorOctaves field_185983_b; -- private final NoiseGeneratorOctaves field_185984_c; -+ private NoiseGeneratorOctaves field_185983_b; -+ private NoiseGeneratorOctaves field_185984_c; - private final WorldType field_185997_p; - private final float[] field_185999_r; - private final PhantomSpawner field_203230_r = new PhantomSpawner(); -@@ -58,6 +58,16 @@ - this.field_186000_s = p_i48957_3_; - this.field_205475_r = this.field_186000_s.func_205532_l(); - this.field_205476_s = this.field_186000_s.func_205533_m(); -+ -+ net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld ctx = -+ new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextOverworld(field_185991_j, field_185992_k, field_185993_l, field_185994_m, field_185983_b, field_185984_c); -+ ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i48957_1_, sharedseedrandom, ctx); -+ this.field_185991_j = ctx.getLPerlin1(); -+ this.field_185992_k = ctx.getLPerlin2(); -+ this.field_185993_l = ctx.getPerlin(); -+ this.field_185994_m = ctx.getHeight(); -+ this.field_185983_b = ctx.getScale(); -+ this.field_185984_c = ctx.getDepth(); - } - - public void func_202088_a(IChunk p_202088_1_) { diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch deleted file mode 100644 index f289942f1..000000000 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/gen/ChunkProviderServer.java -+++ b/net/minecraft/world/gen/ChunkProviderServer.java -@@ -250,6 +250,7 @@ - - this.field_201723_f.func_208484_a(p_73156_1_); - } -+ if (this.field_73244_f.isEmpty()) net.minecraftforge.common.DimensionManager.unloadWorld(this.field_73251_h); - - return false; - } diff --git a/patches/minecraft/net/minecraft/world/gen/IWorldGenerationBaseReader.java.patch b/patches/minecraft/net/minecraft/world/gen/IWorldGenerationBaseReader.java.patch new file mode 100644 index 000000000..36577a381 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/IWorldGenerationBaseReader.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/IWorldGenerationBaseReader.java ++++ b/net/minecraft/world/gen/IWorldGenerationBaseReader.java +@@ -8,4 +8,8 @@ + boolean func_217375_a(BlockPos p_217375_1_, Predicate p_217375_2_); + + BlockPos func_205770_a(Heightmap.Type p_205770_1_, BlockPos p_205770_2_); ++ ++ default int getMaxHeight() { ++ return this instanceof net.minecraft.world.IWorld ? ((net.minecraft.world.IWorld)this).func_201672_e().func_201675_m().getHeight() : 256; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch b/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch index 13c548ef1..fad97fb48 100644 --- a/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/WorldGenRegion.java.patch @@ -1,24 +1,36 @@ --- a/net/minecraft/world/gen/WorldGenRegion.java +++ b/net/minecraft/world/gen/WorldGenRegion.java -@@ -121,7 +121,7 @@ - } +@@ -165,11 +165,11 @@ - public 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_); - } + public boolean func_175655_b(BlockPos p_175655_1_, boolean p_175655_2_) { + BlockState blockstate = this.func_180495_p(p_175655_1_); +- if (blockstate.func_196958_f()) { ++ if (blockstate.isAir(this, p_175655_1_)) { + return false; + } else { + if (p_175655_2_) { +- TileEntity tileentity = blockstate.func_177230_c().func_149716_u() ? this.func_175625_s(p_175655_1_) : null; ++ TileEntity tileentity = blockstate.hasTileEntity() ? this.func_175625_s(p_175655_1_) : null; + Block.func_220059_a(blockstate, this.field_201689_f, p_175655_1_, tileentity); + } - public Biome func_180494_b(BlockPos p_180494_1_) { -@@ -173,7 +173,7 @@ - NBTTagCompound nbttagcompound = ichunk.func_201579_g(p_175625_1_); - if (nbttagcompound != null) { - if ("DUMMY".equals(nbttagcompound.func_74779_i("id"))) { -- tileentity = ((ITileEntityProvider)this.func_180495_p(p_175625_1_).func_177230_c()).func_196283_a_(this.field_201689_f); -+ tileentity = this.func_180495_p(p_175625_1_).createTileEntity(this.field_201689_f); +@@ -187,12 +187,12 @@ + CompoundNBT compoundnbt = ichunk.func_201579_g(p_175625_1_); + if (compoundnbt != null) { + if ("DUMMY".equals(compoundnbt.func_74779_i("id"))) { +- Block block = this.func_180495_p(p_175625_1_).func_177230_c(); +- if (!(block instanceof ITileEntityProvider)) { ++ BlockState state = this.func_180495_p(p_175625_1_); ++ if (!state.hasTileEntity()) { + return null; + } + +- tileentity = ((ITileEntityProvider)block).func_196283_a_(this.field_201689_f); ++ tileentity = state.createTileEntity(this.field_201689_f); } else { - tileentity = TileEntity.func_203403_c(nbttagcompound); + tileentity = TileEntity.func_203403_c(compoundnbt); } -@@ -184,7 +184,7 @@ +@@ -203,7 +203,7 @@ } } @@ -27,9 +39,9 @@ field_208303_a.warn("Tried to access a block entity before it was created. {}", (Object)p_175625_1_); } -@@ -196,9 +196,9 @@ - IChunk ichunk = this.func_205771_y(p_180501_1_); - IBlockState iblockstate = ichunk.func_177436_a(p_180501_1_, p_180501_2_, false); +@@ -219,9 +219,9 @@ + } + Block block = p_180501_2_.func_177230_c(); - if (block.func_149716_u()) { + if (p_180501_2_.hasTileEntity()) { @@ -37,14 +49,14 @@ - ichunk.func_177426_a(p_180501_1_, ((ITileEntityProvider)block).func_196283_a_(this)); + ichunk.func_177426_a(p_180501_1_, p_180501_2_.createTileEntity(this)); } else { - NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.func_74768_a("x", p_180501_1_.func_177958_n()); -@@ -207,7 +207,7 @@ - nbttagcompound.func_74778_a("id", "DUMMY"); - ichunk.func_201591_a(nbttagcompound); + CompoundNBT compoundnbt = new CompoundNBT(); + compoundnbt.func_74768_a("x", p_180501_1_.func_177958_n()); +@@ -230,7 +230,7 @@ + compoundnbt.func_74778_a("id", "DUMMY"); + ichunk.func_201591_a(compoundnbt); } -- } else if (iblockstate != null && iblockstate.func_177230_c().func_149716_u()) { -+ } else if (iblockstate != null && iblockstate.hasTileEntity()) { +- } else if (blockstate != null && blockstate.func_177230_c().func_149716_u()) { ++ } else if (blockstate != null && blockstate.hasTileEntity()) { ichunk.func_177425_e(p_180501_1_); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch index 99c858e88..d4198082b 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/AbstractTreeFeature.java.patch @@ -1,24 +1,133 @@ --- a/net/minecraft/world/gen/feature/AbstractTreeFeature.java +++ b/net/minecraft/world/gen/feature/AbstractTreeFeature.java -@@ -21,16 +21,13 @@ - super(p_i45448_1_); +@@ -27,10 +27,13 @@ + import net.minecraft.world.gen.feature.template.Template; + + public abstract class AbstractTreeFeature extends Feature { ++ protected net.minecraftforge.common.IPlantable sapling = (net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196674_t; ++ + public AbstractTreeFeature(Function, ? extends T> p_i49920_1_, boolean p_i49920_2_) { + super(p_i49920_1_, p_i49920_2_); } -- protected boolean func_150523_a(Block p_150523_1_) { -- IBlockState iblockstate = p_150523_1_.func_176223_P(); -- return iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E) || p_150523_1_ == Blocks.field_196658_i || Block.func_196245_f(p_150523_1_) || p_150523_1_.func_203417_a(BlockTags.field_200031_h) || p_150523_1_.func_203417_a(BlockTags.field_200030_g) || p_150523_1_ == Blocks.field_150395_bd; -+ protected boolean canGrowInto(net.minecraft.world.IBlockReader world, BlockPos pos) { -+ IBlockState iblockstate = world.func_180495_p(pos); -+ return iblockstate.isAir(world, pos) || iblockstate.func_203425_a(BlockTags.field_206952_E) || iblockstate.func_177230_c() == Blocks.field_196658_i || Block.func_196245_f(iblockstate.func_177230_c()) || iblockstate.func_203425_a(BlockTags.field_200031_h) || iblockstate.func_203425_a(BlockTags.field_200030_g) || iblockstate.func_177230_c() == Blocks.field_150395_bd; ++ @Deprecated //Forge: Moved to canBeReplacedByLog + protected static boolean func_214587_a(IWorldGenerationBaseReader p_214587_0_, BlockPos p_214587_1_) { + return p_214587_0_.func_217375_a(p_214587_1_, (p_214573_0_) -> { + Block block = p_214573_0_.func_177230_c(); +@@ -38,10 +41,23 @@ + }); } -- protected void func_175921_a(IWorld p_175921_1_, BlockPos p_175921_2_) { -- if (!Block.func_196245_f(p_175921_1_.func_180495_p(p_175921_2_).func_177230_c())) { -- this.func_202278_a(p_175921_1_, p_175921_2_, Blocks.field_150346_d.func_176223_P()); -- } ++ protected boolean canBeReplacedByLog(IWorldGenerationBaseReader reader, BlockPos pos) { ++ if (!(reader instanceof net.minecraft.world.IWorldReader)) ++ return func_214587_a(reader, pos); ++ return reader.func_217375_a(pos, state -> state.canBeReplacedByLogs((net.minecraft.world.IWorldReader)reader, pos)); ++ } ++ ++ @Deprecated //Forge: Moved to isAir + protected static boolean func_214574_b(IWorldGenerationBaseReader p_214574_0_, BlockPos p_214574_1_) { + return p_214574_0_.func_217375_a(p_214574_1_, BlockState::func_196958_f); + } + ++ protected static boolean isAir(IWorldGenerationBaseReader reader, BlockPos pos) { ++ if (!(reader instanceof net.minecraft.world.IBlockReader)) ++ return func_214574_b(reader, pos); ++ return reader.func_217375_a(pos, state -> state.isAir((net.minecraft.world.IBlockReader)reader, pos)); ++ } ++ + protected static boolean func_214578_c(IWorldGenerationBaseReader p_214578_0_, BlockPos p_214578_1_) { + return p_214578_0_.func_217375_a(p_214578_1_, (p_214590_0_) -> { + return Block.func_196245_f(p_214590_0_.func_177230_c()); +@@ -60,12 +76,20 @@ + }); + } + ++ @Deprecated //Forge: moved to canBeReplacedByLeaves + protected static boolean func_214572_g(IWorldGenerationBaseReader p_214572_0_, BlockPos p_214572_1_) { + return p_214572_0_.func_217375_a(p_214572_1_, (p_214581_0_) -> { + return p_214581_0_.func_196958_f() || p_214581_0_.func_203425_a(BlockTags.field_206952_E); + }); + } + ++ protected boolean canBeReplacedByLeaves(IWorldGenerationBaseReader reader, BlockPos pos) { ++ if (!(reader instanceof net.minecraft.world.IWorldReader)) ++ return func_214572_g(reader, pos); ++ return reader.func_217375_a(pos, state -> state.canBeReplacedByLeaves((net.minecraft.world.IWorldReader)reader, pos)); ++ } ++ ++ @Deprecated //Forge: moved to isSoil + protected static boolean func_214589_h(IWorldGenerationBaseReader p_214589_0_, BlockPos p_214589_1_) { + return p_214589_0_.func_217375_a(p_214589_1_, (p_214582_0_) -> { + Block block = p_214582_0_.func_177230_c(); +@@ -73,6 +97,13 @@ + }); + } + ++ protected boolean isSoil(IWorldGenerationBaseReader reader, BlockPos pos) { ++ if (!(reader instanceof net.minecraft.world.IBlockReader) || getSapling() == null) ++ return func_214589_h(reader, pos); ++ return reader.func_217375_a(pos, state -> state.canSustainPlant((net.minecraft.world.IBlockReader)reader, pos, Direction.UP, getSapling())); ++ } ++ ++ @Deprecated //Forge: moved to isSoilOrFarm + protected static boolean func_214585_i(IWorldGenerationBaseReader p_214585_0_, BlockPos p_214585_1_) { + return p_214585_0_.func_217375_a(p_214585_1_, (p_214586_0_) -> { + Block block = p_214586_0_.func_177230_c(); +@@ -80,6 +111,12 @@ + }); + } + ++ protected boolean isSoilOrFarm(IWorldGenerationBaseReader reader, BlockPos pos) { ++ if (!(reader instanceof net.minecraft.world.IBlockReader) || getSapling() == null) ++ return func_214585_i(reader, pos); ++ return reader.func_217375_a(pos, state -> state.canSustainPlant((net.minecraft.world.IBlockReader)reader, pos, Direction.UP, getSapling())); ++ } ++ + protected static boolean func_214576_j(IWorldGenerationBaseReader p_214576_0_, BlockPos p_214576_1_) { + return p_214576_0_.func_217375_a(p_214576_1_, (p_214588_0_) -> { + Material material = p_214588_0_.func_185904_a(); +@@ -87,6 +124,7 @@ + }); + } + ++ @Deprecated //Forge: moved to setDirtAt + protected void func_214584_a(IWorldGenerationReader p_214584_1_, BlockPos p_214584_2_) { + if (!func_214578_c(p_214584_1_, p_214584_2_)) { + this.func_202278_a(p_214584_1_, p_214584_2_, Blocks.field_150346_d.func_176223_P()); +@@ -94,6 +132,14 @@ + + } + ++ protected void setDirtAt(IWorldGenerationReader reader, BlockPos pos, BlockPos origin) { ++ if (!(reader instanceof IWorld)) { ++ func_214584_a(reader, pos); ++ return; ++ } ++ ((IWorld)reader).func_180495_p(pos).onPlantGrow((IWorld)reader, pos, origin); ++ } ++ + protected void func_202278_a(IWorldWriter p_202278_1_, BlockPos p_202278_2_, BlockState p_202278_3_) { + this.func_208521_b(p_202278_1_, p_202278_2_, p_202278_3_); + } +@@ -104,7 +150,6 @@ + if (BlockTags.field_200031_h.func_199685_a_(p_208520_4_.func_177230_c())) { + p_208520_1_.add(p_208520_3_.func_185334_h()); + } - -+ protected void setDirtAt(IWorld worldIn, BlockPos pos, BlockPos origin) { -+ worldIn.func_180495_p(pos).onPlantGrow(worldIn, pos, origin); } - protected void func_202278_a(IWorld p_202278_1_, BlockPos p_202278_2_, IBlockState p_202278_3_) { + private void func_208521_b(IWorldWriter p_208521_1_, BlockPos p_208521_2_, BlockState p_208521_3_) { +@@ -192,4 +237,13 @@ + } + + protected abstract boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_); ++ ++ protected net.minecraftforge.common.IPlantable getSapling() { ++ return sapling; ++ } ++ ++ public AbstractTreeFeature setSapling(net.minecraftforge.common.IPlantable sapling) { ++ this.sapling = sapling; ++ return this; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch index 8e2ffeac1..dfebb268a 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java.patch @@ -1,15 +1,24 @@ --- a/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java +++ b/net/minecraft/world/gen/feature/BigBrownMushroomFeature.java -@@ -33,7 +33,7 @@ +@@ -26,7 +26,7 @@ + } + + int j = p_212245_4_.func_177956_o(); +- if (j >= 1 && j + i + 1 < 256) { ++ if (j >= 1 && j + i + 1 < p_212245_1_.func_201672_e().func_201675_m().getHeight()) { + Block block = p_212245_1_.func_180495_p(p_212245_4_.func_177977_b()).func_177230_c(); + if (!Block.func_196245_f(block) && block != Blocks.field_196658_i && block != Blocks.field_150391_bh) { + return false; +@@ -39,7 +39,7 @@ for(int i1 = -l; i1 <= l; ++i1) { for(int j1 = -l; j1 <= l; ++j1) { - IBlockState iblockstate = p_212245_1_.func_180495_p(blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_196234_d(i1, k, j1)); -- if (!iblockstate.func_196958_f() && !iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (!iblockstate.isAir(p_212245_1_, blockpos$mutableblockpos) && !iblockstate.func_203425_a(BlockTags.field_206952_E)) { + BlockState blockstate = p_212245_1_.func_180495_p(blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_196234_d(i1, k, j1)); +- if (!blockstate.func_196958_f() && !blockstate.func_203425_a(BlockTags.field_206952_E)) { ++ if (!blockstate.isAir(p_212245_1_, blockpos$mutableblockpos) && !blockstate.func_203425_a(BlockTags.field_206952_E)) { return false; } } -@@ -53,7 +53,7 @@ +@@ -59,7 +59,7 @@ boolean flag4 = flag1 || flag2; if (!flag3 || !flag4) { blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_196234_d(l1, i, i2); @@ -18,12 +27,12 @@ boolean flag5 = flag9 || flag4 && l1 == -2; boolean flag6 = flag || flag4 && l1 == 2; boolean flag7 = flag1 || flag3 && i2 == -2; -@@ -68,7 +68,7 @@ +@@ -74,7 +74,7 @@ for(int j2 = 0; j2 < i; ++j2) { - blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_189534_c(EnumFacing.UP, j2); + blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_189534_c(Direction.UP, j2); - if (!p_212245_1_.func_180495_p(blockpos$mutableblockpos).func_200015_d(p_212245_1_, blockpos$mutableblockpos)) { + if (p_212245_1_.func_180495_p(blockpos$mutableblockpos).canBeReplacedByLeaves(p_212245_1_, blockpos$mutableblockpos)) { - this.func_202278_a(p_212245_1_, blockpos$mutableblockpos, iblockstate2); - } - } + if (p_212245_5_.field_222854_a) { + p_212245_1_.func_180501_a(blockpos$mutableblockpos, blockstate2, 3); + } else { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch index df778f380..192f6cdd8 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BigRedMushroomFeature.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/world/gen/feature/BigRedMushroomFeature.java +++ b/net/minecraft/world/gen/feature/BigRedMushroomFeature.java -@@ -38,7 +38,7 @@ +@@ -44,7 +44,7 @@ for(int i1 = -l; i1 <= l; ++i1) { for(int j1 = -l; j1 <= l; ++j1) { - IBlockState iblockstate = p_212245_1_.func_180495_p(blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_196234_d(i1, k, j1)); -- if (!iblockstate.func_196958_f() && !iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (!iblockstate.isAir(p_212245_1_, blockpos$mutableblockpos) && !iblockstate.func_203425_a(BlockTags.field_206952_E)) { + BlockState blockstate = p_212245_1_.func_180495_p(blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_196234_d(i1, k, j1)); +- if (!blockstate.func_196958_f() && !blockstate.func_203425_a(BlockTags.field_206952_E)) { ++ if (!blockstate.isAir(p_212245_1_, blockpos$mutableblockpos) && !blockstate.func_203425_a(BlockTags.field_206952_E)) { return false; } } -@@ -61,7 +61,7 @@ +@@ -67,7 +67,7 @@ boolean flag5 = flag2 || flag3; if (l1 >= i || flag4 != flag5) { blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_196234_d(l2, l1, k1); - if (!p_212245_1_.func_180495_p(blockpos$mutableblockpos).func_200015_d(p_212245_1_, blockpos$mutableblockpos)) { + if (p_212245_1_.func_180495_p(blockpos$mutableblockpos).canBeReplacedByLeaves(p_212245_1_, blockpos$mutableblockpos)) { - this.func_202278_a(p_212245_1_, blockpos$mutableblockpos, iblockstate1.func_206870_a(BlockHugeMushroom.field_196465_z, Boolean.valueOf(l1 >= i - 1)).func_206870_a(BlockHugeMushroom.field_196464_y, Boolean.valueOf(l2 < 0)).func_206870_a(BlockHugeMushroom.field_196461_b, Boolean.valueOf(l2 > 0)).func_206870_a(BlockHugeMushroom.field_196459_a, Boolean.valueOf(k1 < 0)).func_206870_a(BlockHugeMushroom.field_196463_c, Boolean.valueOf(k1 > 0))); + this.func_202278_a(p_212245_1_, blockpos$mutableblockpos, blockstate1.func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(l1 >= i - 1)).func_206870_a(HugeMushroomBlock.field_196464_y, Boolean.valueOf(l2 < 0)).func_206870_a(HugeMushroomBlock.field_196461_b, Boolean.valueOf(l2 > 0)).func_206870_a(HugeMushroomBlock.field_196459_a, Boolean.valueOf(k1 < 0)).func_206870_a(HugeMushroomBlock.field_196463_c, Boolean.valueOf(k1 > 0))); } } -@@ -73,7 +73,7 @@ +@@ -79,7 +79,7 @@ for(int j2 = 0; j2 < i; ++j2) { - blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_189534_c(EnumFacing.UP, j2); + blockpos$mutableblockpos.func_189533_g(p_212245_4_).func_189534_c(Direction.UP, j2); - if (!p_212245_1_.func_180495_p(blockpos$mutableblockpos).func_200015_d(p_212245_1_, blockpos$mutableblockpos)) { + if (p_212245_1_.func_180495_p(blockpos$mutableblockpos).canBeReplacedByLeaves(p_212245_1_, blockpos$mutableblockpos)) { - this.func_202278_a(p_212245_1_, blockpos$mutableblockpos, iblockstate2); - } - } + if (p_212245_5_.field_222854_a) { + p_212245_1_.func_180501_a(blockpos$mutableblockpos, blockstate2, 3); + } else { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BigTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BigTreeFeature.java.patch index 7884e39fc..8e17a5332 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BigTreeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BigTreeFeature.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/gen/feature/BigTreeFeature.java +++ b/net/minecraft/world/gen/feature/BigTreeFeature.java @@ -31,7 +31,7 @@ + for(int k = -i; k <= i; ++k) { if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_208529_3_ * p_208529_3_)) { BlockPos blockpos = p_208529_2_.func_177982_a(j, 0, k); - IBlockState iblockstate = p_208529_1_.func_180495_p(blockpos); -- if (iblockstate.func_196958_f() || iblockstate.func_185904_a() == Material.field_151584_j) { -+ if (iblockstate.isAir(p_208529_1_, blockpos) || iblockstate.func_185904_a() == Material.field_151584_j) { - this.func_202278_a(p_208529_1_, blockpos, field_208531_b); +- if (func_214572_g(p_208529_1_, blockpos)) { ++ if (canBeReplacedByLeaves(p_208529_1_, blockpos)) { + this.func_208520_a(p_208529_5_, p_208529_1_, blockpos, field_208531_b, p_208529_4_); } } @@ -86,7 +86,7 @@ BlockPos blockpos1 = p_208523_3_.func_177963_a((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); if (p_208523_5_) { - this.func_208520_a(p_208523_1_, p_208523_2_, blockpos1, field_208530_a.func_206870_a(BlockLog.field_176298_M, this.func_197170_b(p_208523_3_, blockpos1))); -- } else if (!this.func_150523_a(p_208523_2_.func_180495_p(blockpos1).func_177230_c())) { -+ } else if (!this.canGrowInto(p_208523_2_, blockpos1)) { + this.func_208520_a(p_208523_1_, p_208523_2_, blockpos1, field_208530_a.func_206870_a(LogBlock.field_176298_M, this.func_197170_b(p_208523_3_, blockpos1)), p_208523_6_); +- } else if (!func_214587_a(p_208523_2_, blockpos1)) { ++ } else if (!canBeReplacedByLog(p_208523_2_, blockpos1)) { return j; } } @@ -22,18 +22,17 @@ if (i == -1) { return false; } else { -- this.func_175921_a(p_208519_2_, p_208519_4_.func_177977_b()); +- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); + this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); int j = (int)((double)i * 0.618D); if (j >= i) { j = i - 1; -@@ -206,8 +206,7 @@ +@@ -206,7 +206,7 @@ } - private int func_208528_b(Set p_208528_1_, IWorld p_208528_2_, BlockPos p_208528_3_, int p_208528_4_) { -- Block block = p_208528_2_.func_180495_p(p_208528_3_.func_177977_b()).func_177230_c(); -- if (!Block.func_196245_f(block) && block != Blocks.field_196658_i && block != Blocks.field_150458_ak) { -+ if (!p_208528_2_.func_180495_p(p_208528_3_.func_177977_b()).canSustainPlant(p_208528_2_, p_208528_3_.func_177977_b(), net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_196674_t))) { + private int func_208528_b(Set p_208528_1_, IWorldGenerationReader p_208528_2_, BlockPos p_208528_3_, int p_208528_4_, MutableBoundingBox p_208528_5_) { +- if (!func_214585_i(p_208528_2_, p_208528_3_.func_177977_b())) { ++ if (!isSoilOrFarm(p_208528_2_, p_208528_3_.func_177977_b())) { return -1; } else { - int i = this.func_208523_a(p_208528_1_, p_208528_2_, p_208528_3_, p_208528_3_.func_177981_b(p_208528_4_ - 1), false); + int i = this.func_208523_a(p_208528_1_, p_208528_2_, p_208528_3_, p_208528_3_.func_177981_b(p_208528_4_ - 1), false, p_208528_5_); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BirchTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BirchTreeFeature.java.patch index be0ac3dcc..c56a787c7 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BirchTreeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BirchTreeFeature.java.patch @@ -1,53 +1,59 @@ --- a/net/minecraft/world/gen/feature/BirchTreeFeature.java +++ b/net/minecraft/world/gen/feature/BirchTreeFeature.java -@@ -26,7 +26,7 @@ +@@ -18,6 +18,7 @@ + public BirchTreeFeature(Function, ? extends NoFeatureConfig> p_i49917_1_, boolean p_i49917_2_, boolean p_i49917_3_) { + super(p_i49917_1_, p_i49917_2_); + this.field_150531_a = p_i49917_3_; ++ this.setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v); + } + + public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { +@@ -27,7 +28,7 @@ } boolean flag = true; - if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= 256) { -+ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.func_201672_e().func_72800_K()) { ++ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.getMaxHeight()) { for(int j = p_208519_4_.func_177956_o(); j <= p_208519_4_.func_177956_o() + 1 + i; ++j) { int k = 1; if (j == p_208519_4_.func_177956_o()) { -@@ -41,8 +41,8 @@ +@@ -42,8 +43,8 @@ for(int l = p_208519_4_.func_177958_n() - k; l <= p_208519_4_.func_177958_n() + k && flag; ++l) { for(int i1 = p_208519_4_.func_177952_p() - k; i1 <= p_208519_4_.func_177952_p() + k && flag; ++i1) { - if (j >= 0 && j < 256) { -- if (!this.func_150523_a(p_208519_2_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c())) { -+ if (j >= 0 && j < p_208519_2_.func_201672_e().func_72800_K()) { -+ if (!this.canGrowInto(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { +- if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { ++ if (j >= 0 && j < p_208519_2_.getMaxHeight()) { ++ if (!canBeReplacedByLog(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { flag = false; } } else { -@@ -55,9 +55,9 @@ +@@ -55,8 +56,8 @@ + if (!flag) { return false; - } else { -- Block block = p_208519_2_.func_180495_p(p_208519_4_.func_177977_b()).func_177230_c(); -- if ((block == Blocks.field_196658_i || Block.func_196245_f(block) || block == Blocks.field_150458_ak) && p_208519_4_.func_177956_o() < 256 - i - 1) { -- this.func_175921_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ boolean isSoil = p_208519_2_.func_180495_p(p_208519_4_.func_177977_b()).canSustainPlant(p_208519_2_, p_208519_4_.func_177977_b(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_196674_t); -+ if (isSoil && p_208519_4_.func_177956_o() < p_208519_2_.func_201672_e().func_72800_K() - i - 1) { -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); +- } else if (func_214585_i(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) { +- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); ++ } else if ((isSoil(p_208519_2_, p_208519_4_.func_177977_b())) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) { ++ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - for(int i2 = p_208519_4_.func_177956_o() - 3 + i; i2 <= p_208519_4_.func_177956_o() + i; ++i2) { - int k2 = i2 - (p_208519_4_.func_177956_o() + i); -@@ -71,7 +71,7 @@ - if (Math.abs(j1) != l2 || Math.abs(l1) != l2 || p_208519_3_.nextInt(2) != 0 && k2 != 0) { - BlockPos blockpos = new BlockPos(i3, i2, k1); - IBlockState iblockstate = p_208519_2_.func_180495_p(blockpos); -- if (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate.isAir(p_208519_2_, blockpos) || iblockstate.func_203425_a(BlockTags.field_206952_E)) { - this.func_202278_a(p_208519_2_, blockpos, field_181630_b); - } + for(int l1 = p_208519_4_.func_177956_o() - 3 + i; l1 <= p_208519_4_.func_177956_o() + i; ++l1) { + int j2 = l1 - (p_208519_4_.func_177956_o() + i); +@@ -69,7 +70,7 @@ + int k1 = j1 - p_208519_4_.func_177952_p(); + if (Math.abs(i3) != k2 || Math.abs(k1) != k2 || p_208519_3_.nextInt(2) != 0 && j2 != 0) { + BlockPos blockpos = new BlockPos(l2, l1, j1); +- if (func_214572_g(p_208519_2_, blockpos)) { ++ if (canBeReplacedByLeaves(p_208519_2_, blockpos)) { + this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, field_181630_b, p_208519_5_); } -@@ -81,7 +81,7 @@ + } +@@ -78,7 +79,7 @@ + } - for(int j2 = 0; j2 < i; ++j2) { - IBlockState iblockstate1 = p_208519_2_.func_180495_p(p_208519_4_.func_177981_b(j2)); -- if (iblockstate1.func_196958_f() || iblockstate1.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate1.isAir(p_208519_2_, p_208519_4_.func_177981_b(j2)) || iblockstate1.func_203425_a(BlockTags.field_206952_E)) { - this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(j2), field_181629_a); - } + for(int i2 = 0; i2 < i; ++i2) { +- if (func_214572_g(p_208519_2_, p_208519_4_.func_177981_b(i2))) { ++ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177981_b(i2))) { + this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(i2), field_181629_a, p_208519_5_); } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BonusChestFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BonusChestFeature.java.patch index cb578eb4b..deb19b38d 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BonusChestFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BonusChestFeature.java.patch @@ -1,43 +1,11 @@ --- a/net/minecraft/world/gen/feature/BonusChestFeature.java +++ b/net/minecraft/world/gen/feature/BonusChestFeature.java -@@ -13,7 +13,7 @@ +@@ -20,7 +20,7 @@ + } - public class BonusChestFeature extends Feature { - public boolean func_212245_a(IWorld p_212245_1_, IChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { -- for(IBlockState iblockstate = p_212245_1_.func_180495_p(p_212245_4_); (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 1; iblockstate = p_212245_1_.func_180495_p(p_212245_4_)) { -+ for(IBlockState iblockstate = p_212245_1_.func_180495_p(p_212245_4_); (iblockstate.isAir(p_212245_1_, p_212245_4_) || iblockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 1; iblockstate = p_212245_1_.func_180495_p(p_212245_4_)) { + public boolean func_212245_a(IWorld p_212245_1_, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { +- for(BlockState blockstate = p_212245_1_.func_180495_p(p_212245_4_); (blockstate.func_196958_f() || blockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 1; blockstate = p_212245_1_.func_180495_p(p_212245_4_)) { ++ for(BlockState blockstate = p_212245_1_.func_180495_p(p_212245_4_); (blockstate.isAir(p_212245_1_, p_212245_4_) || blockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 1; blockstate = p_212245_1_.func_180495_p(p_212245_4_)) { p_212245_4_ = p_212245_4_.func_177977_b(); } -@@ -24,26 +24,26 @@ - - for(int i = 0; i < 4; ++i) { - BlockPos blockpos = p_212245_4_.func_177982_a(p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4), p_212245_3_.nextInt(3) - p_212245_3_.nextInt(3), p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4)); -- if (p_212245_1_.func_175623_d(blockpos) && p_212245_1_.func_180495_p(blockpos.func_177977_b()).func_185896_q()) { -+ if (p_212245_1_.func_175623_d(blockpos) && p_212245_1_.func_180495_p(blockpos.func_177977_b()).isTopSolid(p_212245_1_.func_201672_e(), blockpos.func_177977_b())) { - p_212245_1_.func_180501_a(blockpos, Blocks.field_150486_ae.func_176223_P(), 2); - TileEntityLockableLoot.func_195479_a(p_212245_1_, p_212245_3_, blockpos, LootTableList.field_186420_b); - BlockPos blockpos1 = blockpos.func_177974_f(); - BlockPos blockpos2 = blockpos.func_177976_e(); - BlockPos blockpos3 = blockpos.func_177978_c(); - BlockPos blockpos4 = blockpos.func_177968_d(); -- if (p_212245_1_.func_175623_d(blockpos2) && p_212245_1_.func_180495_p(blockpos2.func_177977_b()).func_185896_q()) { -+ if (p_212245_1_.func_175623_d(blockpos2) && p_212245_1_.func_180495_p(blockpos2.func_177977_b()).isTopSolid(p_212245_1_.func_201672_e(), blockpos2.func_177977_b())) { - p_212245_1_.func_180501_a(blockpos2, Blocks.field_150478_aa.func_176223_P(), 2); - } - -- if (p_212245_1_.func_175623_d(blockpos1) && p_212245_1_.func_180495_p(blockpos1.func_177977_b()).func_185896_q()) { -+ if (p_212245_1_.func_175623_d(blockpos1) && p_212245_1_.func_180495_p(blockpos1.func_177977_b()).isTopSolid(p_212245_1_.func_201672_e(), blockpos1.func_177977_b())) { - p_212245_1_.func_180501_a(blockpos1, Blocks.field_150478_aa.func_176223_P(), 2); - } - -- if (p_212245_1_.func_175623_d(blockpos3) && p_212245_1_.func_180495_p(blockpos3.func_177977_b()).func_185896_q()) { -+ if (p_212245_1_.func_175623_d(blockpos3) && p_212245_1_.func_180495_p(blockpos3.func_177977_b()).isTopSolid(p_212245_1_.func_201672_e(), blockpos3.func_177977_b())) { - p_212245_1_.func_180501_a(blockpos3, Blocks.field_150478_aa.func_176223_P(), 2); - } - -- if (p_212245_1_.func_175623_d(blockpos4) && p_212245_1_.func_180495_p(blockpos4.func_177977_b()).func_185896_q()) { -+ if (p_212245_1_.func_175623_d(blockpos4) && p_212245_1_.func_180495_p(blockpos4.func_177977_b()).isTopSolid(p_212245_1_.func_201672_e(), blockpos4.func_177977_b())) { - p_212245_1_.func_180501_a(blockpos4, Blocks.field_150478_aa.func_176223_P(), 2); - } - diff --git a/patches/minecraft/net/minecraft/world/gen/feature/BushFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/BushFeature.java.patch index b313c5a05..e980e266d 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/BushFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/BushFeature.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/feature/BushFeature.java +++ b/net/minecraft/world/gen/feature/BushFeature.java -@@ -14,7 +14,7 @@ +@@ -20,7 +20,7 @@ for(int j = 0; j < 64; ++j) { BlockPos blockpos = p_212245_4_.func_177982_a(p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8), p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4), p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8)); -- if (p_212245_1_.func_175623_d(blockpos) && (!p_212245_1_.func_201675_m().func_177495_o() || blockpos.func_177956_o() < 255) && iblockstate.func_196955_c(p_212245_1_, blockpos)) { -+ if (p_212245_1_.func_175623_d(blockpos) && (!p_212245_1_.func_201675_m().func_177495_o() || blockpos.func_177956_o() < p_212245_1_.func_201672_e().func_72800_K() - 1) && iblockstate.func_196955_c(p_212245_1_, blockpos)) { - p_212245_1_.func_180501_a(blockpos, iblockstate, 2); +- if (p_212245_1_.func_175623_d(blockpos) && (!p_212245_1_.func_201675_m().func_177495_o() || blockpos.func_177956_o() < 255) && blockstate.func_196955_c(p_212245_1_, blockpos)) { ++ if (p_212245_1_.func_175623_d(blockpos) && (!p_212245_1_.func_201675_m().func_177495_o() || blockpos.func_177956_o() < p_212245_1_.func_201672_e().func_201675_m().getHeight()) && blockstate.func_196955_c(p_212245_1_, blockpos)) { + p_212245_1_.func_180501_a(blockpos, blockstate, 2); ++i; } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/CanopyTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/CanopyTreeFeature.java.patch deleted file mode 100644 index 1d6daeba2..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/CanopyTreeFeature.java.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- a/net/minecraft/world/gen/feature/CanopyTreeFeature.java -+++ b/net/minecraft/world/gen/feature/CanopyTreeFeature.java -@@ -27,15 +27,16 @@ - if (k >= 1 && k + i + 1 < 256) { - BlockPos blockpos = p_208519_4_.func_177977_b(); - Block block = p_208519_2_.func_180495_p(blockpos).func_177230_c(); -- if (block != Blocks.field_196658_i && !Block.func_196245_f(block)) { -+ boolean isSoil = p_208519_2_.func_180495_p(blockpos).canSustainPlant(p_208519_2_, blockpos, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_196680_y); -+ if (!isSoil) { - return false; - } else if (!this.func_181638_a(p_208519_2_, p_208519_4_, i)) { - return false; - } else { -- this.func_175921_a(p_208519_2_, blockpos); -- this.func_175921_a(p_208519_2_, blockpos.func_177974_f()); -- this.func_175921_a(p_208519_2_, blockpos.func_177968_d()); -- this.func_175921_a(p_208519_2_, blockpos.func_177968_d().func_177974_f()); -+ this.setDirtAt(p_208519_2_, blockpos, blockpos.func_177984_a()); -+ this.setDirtAt(p_208519_2_, blockpos.func_177974_f(), blockpos.func_177984_a()); -+ this.setDirtAt(p_208519_2_, blockpos.func_177968_d(), blockpos.func_177984_a()); -+ this.setDirtAt(p_208519_2_, blockpos.func_177968_d().func_177974_f(), blockpos.func_177984_a()); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.func_179518_a(p_208519_3_); - int i1 = i - p_208519_3_.nextInt(4); - int j1 = 2 - p_208519_3_.nextInt(3); -@@ -53,7 +54,7 @@ - int k2 = k + j2; - BlockPos blockpos1 = new BlockPos(k1, k2, l1); - IBlockState iblockstate = p_208519_2_.func_180495_p(blockpos1); -- if (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate.isAir(p_208519_2_, blockpos1) || iblockstate.func_203425_a(BlockTags.field_206952_E)) { - this.func_208533_a(p_208519_1_, p_208519_2_, blockpos1); - this.func_208533_a(p_208519_1_, p_208519_2_, blockpos1.func_177974_f()); - this.func_208533_a(p_208519_1_, p_208519_2_, blockpos1.func_177968_d()); -@@ -144,7 +145,7 @@ - - for(int j1 = -i1; j1 <= i1; ++j1) { - for(int k1 = -i1; k1 <= i1; ++k1) { -- if (!this.func_150523_a(p_181638_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1)).func_177230_c())) { -+ if (!this.canGrowInto(p_181638_1_, blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1))) { - return false; - } - } -@@ -155,7 +156,7 @@ - } - - private void func_208533_a(Set p_208533_1_, IWorld p_208533_2_, BlockPos p_208533_3_) { -- if (this.func_150523_a(p_208533_2_.func_180495_p(p_208533_3_).func_177230_c())) { -+ if (this.canGrowInto(p_208533_2_, p_208533_3_)) { - this.func_208520_a(p_208533_1_, p_208533_2_, p_208533_3_, field_181640_a); - } - -@@ -163,7 +164,7 @@ - - private void func_202414_a(IWorld p_202414_1_, int p_202414_2_, int p_202414_3_, int p_202414_4_) { - BlockPos blockpos = new BlockPos(p_202414_2_, p_202414_3_, p_202414_4_); -- if (p_202414_1_.func_180495_p(blockpos).func_196958_f()) { -+ if (p_202414_1_.func_180495_p(blockpos).isAir(p_202414_1_, blockpos)) { - this.func_202278_a(p_202414_1_, blockpos, field_181641_b); - } - diff --git a/patches/minecraft/net/minecraft/world/gen/feature/DarkOakTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/DarkOakTreeFeature.java.patch new file mode 100644 index 000000000..60cc7e5db --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/DarkOakTreeFeature.java.patch @@ -0,0 +1,67 @@ +--- a/net/minecraft/world/gen/feature/DarkOakTreeFeature.java ++++ b/net/minecraft/world/gen/feature/DarkOakTreeFeature.java +@@ -18,6 +18,7 @@ + + public DarkOakTreeFeature(Function, ? extends NoFeatureConfig> p_i49895_1_, boolean p_i49895_2_) { + super(p_i49895_1_, p_i49895_2_); ++ setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196680_y); + } + + public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { +@@ -27,15 +28,15 @@ + int l = p_208519_4_.func_177952_p(); + if (k >= 1 && k + i + 1 < 256) { + BlockPos blockpos = p_208519_4_.func_177977_b(); +- if (!func_214589_h(p_208519_2_, blockpos)) { ++ if (!isSoil(p_208519_2_, blockpos)) { + return false; + } else if (!this.func_214615_a(p_208519_2_, p_208519_4_, i)) { + return false; + } else { +- this.func_214584_a(p_208519_2_, blockpos); +- this.func_214584_a(p_208519_2_, blockpos.func_177974_f()); +- this.func_214584_a(p_208519_2_, blockpos.func_177968_d()); +- this.func_214584_a(p_208519_2_, blockpos.func_177968_d().func_177974_f()); ++ this.setDirtAt(p_208519_2_, blockpos, p_208519_4_); ++ this.setDirtAt(p_208519_2_, blockpos.func_177974_f(), p_208519_4_); ++ this.setDirtAt(p_208519_2_, blockpos.func_177968_d(), p_208519_4_); ++ this.setDirtAt(p_208519_2_, blockpos.func_177968_d().func_177974_f(), p_208519_4_); + Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_208519_3_); + int i1 = i - p_208519_3_.nextInt(4); + int j1 = 2 - p_208519_3_.nextInt(3); +@@ -52,7 +53,7 @@ + + int k2 = k + j2; + BlockPos blockpos1 = new BlockPos(k1, k2, l1); +- if (func_214572_g(p_208519_2_, blockpos1)) { ++ if (canBeReplacedByLeaves(p_208519_2_, blockpos1)) { + this.func_214616_a(p_208519_1_, p_208519_2_, blockpos1, p_208519_5_); + this.func_214616_a(p_208519_1_, p_208519_2_, blockpos1.func_177974_f(), p_208519_5_); + this.func_214616_a(p_208519_1_, p_208519_2_, blockpos1.func_177968_d(), p_208519_5_); +@@ -143,7 +144,7 @@ + + for(int j1 = -i1; j1 <= i1; ++j1) { + for(int k1 = -i1; k1 <= i1; ++k1) { +- if (!func_214587_a(p_214615_1_, blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1))) { ++ if (!canBeReplacedByLog(p_214615_1_, blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1))) { + return false; + } + } +@@ -154,7 +155,7 @@ + } + + private void func_214616_a(Set p_214616_1_, IWorldGenerationReader p_214616_2_, BlockPos p_214616_3_, MutableBoundingBox p_214616_4_) { +- if (func_214587_a(p_214616_2_, p_214616_3_)) { ++ if (canBeReplacedByLog(p_214616_2_, p_214616_3_)) { + this.func_208520_a(p_214616_1_, p_214616_2_, p_214616_3_, field_214618_a, p_214616_4_); + } + +@@ -162,7 +163,7 @@ + + private void func_214617_a(IWorldGenerationReader p_214617_1_, int p_214617_2_, int p_214617_3_, int p_214617_4_, MutableBoundingBox p_214617_5_, Set p_214617_6_) { + BlockPos blockpos = new BlockPos(p_214617_2_, p_214617_3_, p_214617_4_); +- if (func_214574_b(p_214617_1_, blockpos)) { ++ if (isAir(p_214617_1_, blockpos)) { + this.func_208520_a(p_214617_6_, p_214617_1_, blockpos, field_214619_aS, p_214617_5_); + } + diff --git a/patches/minecraft/net/minecraft/world/gen/feature/DeadBushFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/DeadBushFeature.java.patch index 7f5a6c558..b21bda1d6 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/DeadBushFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/DeadBushFeature.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/feature/DeadBushFeature.java +++ b/net/minecraft/world/gen/feature/DeadBushFeature.java -@@ -14,7 +14,7 @@ - private static final BlockDeadBush field_197166_a = (BlockDeadBush)Blocks.field_196555_aI; +@@ -20,7 +20,7 @@ + } - public boolean func_212245_a(IWorld p_212245_1_, IChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { -- for(IBlockState iblockstate = p_212245_1_.func_180495_p(p_212245_4_); (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; iblockstate = p_212245_1_.func_180495_p(p_212245_4_)) { -+ for(IBlockState iblockstate = p_212245_1_.func_180495_p(p_212245_4_); (iblockstate.isAir(p_212245_1_, p_212245_4_) || iblockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; iblockstate = p_212245_1_.func_180495_p(p_212245_4_)) { + public boolean func_212245_a(IWorld p_212245_1_, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { +- for(BlockState blockstate = p_212245_1_.func_180495_p(p_212245_4_); (blockstate.func_196958_f() || blockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; blockstate = p_212245_1_.func_180495_p(p_212245_4_)) { ++ for(BlockState blockstate = p_212245_1_.func_180495_p(p_212245_4_); (blockstate.isAir(p_212245_1_, p_212245_4_) || blockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; blockstate = p_212245_1_.func_180495_p(p_212245_4_)) { p_212245_4_ = p_212245_4_.func_177977_b(); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/DoublePlantFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/DoublePlantFeature.java.patch index d6cebab21..990d6bef0 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/DoublePlantFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/DoublePlantFeature.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/feature/DoublePlantFeature.java +++ b/net/minecraft/world/gen/feature/DoublePlantFeature.java -@@ -13,7 +13,7 @@ +@@ -19,7 +19,7 @@ for(int i = 0; i < 64; ++i) { BlockPos blockpos = p_212245_4_.func_177982_a(p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8), p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4), p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8)); - if (p_212245_1_.func_175623_d(blockpos) && blockpos.func_177956_o() < 254 && p_212245_5_.field_202435_a.func_196955_c(p_212245_1_, blockpos)) { -+ if (p_212245_1_.func_175623_d(blockpos) && blockpos.func_177956_o() < p_212245_1_.func_201672_e().func_72800_K() - 2 && p_212245_5_.field_202435_a.func_196955_c(p_212245_1_, blockpos)) { - ((BlockDoublePlant)p_212245_5_.field_202435_a.func_177230_c()).func_196390_a(p_212245_1_, blockpos, 2); ++ if (p_212245_1_.func_175623_d(blockpos) && blockpos.func_177956_o() < p_212245_1_.func_201672_e().func_201675_m().getHeight() - 2 && p_212245_5_.field_202435_a.func_196955_c(p_212245_1_, blockpos)) { + ((DoublePlantBlock)p_212245_5_.field_202435_a.func_177230_c()).func_196390_a(p_212245_1_, blockpos, 2); flag = true; } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/DungeonsFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/DungeonsFeature.java.patch index 1deeff9ae..330750594 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/DungeonsFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/DungeonsFeature.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/gen/feature/DungeonsFeature.java +++ b/net/minecraft/world/gen/feature/DungeonsFeature.java -@@ -117,6 +117,6 @@ +@@ -123,6 +123,6 @@ } private EntityType func_201043_a(Random p_201043_1_) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch deleted file mode 100644 index 92432fa4b..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/Feature.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/world/gen/feature/Feature.java -+++ b/net/minecraft/world/gen/feature/Feature.java -@@ -64,15 +64,15 @@ - public static final AbstractTreeFeature field_202339_q = new BigTreeFeature(false); - public static final AbstractTreeFeature field_202340_r = new BirchTreeFeature(false, false); - public static final AbstractTreeFeature field_202341_s = new BirchTreeFeature(false, true); -- public static final AbstractTreeFeature field_202342_t = new ShrubFeature(Blocks.field_196620_N.func_176223_P(), Blocks.field_196642_W.func_176223_P()); -- public static final AbstractTreeFeature field_202343_u = new JungleTreeFeature(false, 4, Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P(), true); -+ public static final AbstractTreeFeature field_202342_t = new ShrubFeature(Blocks.field_196620_N.func_176223_P(), Blocks.field_196642_W.func_176223_P()).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196678_w); -+ public static final AbstractTreeFeature field_202343_u = new JungleTreeFeature(false, 4, Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P(), true).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196678_w); - public static final AbstractTreeFeature field_202344_v = new PointyTaigaTreeFeature(); - public static final AbstractTreeFeature field_202345_w = new CanopyTreeFeature(false); - public static final AbstractTreeFeature field_202346_x = new SavannaTreeFeature(false); - public static final AbstractTreeFeature field_202347_y = new TallTaigaTreeFeature(false); - public static final AbstractTreeFeature field_202348_z = new SwampTreeFeature(); - public static final AbstractTreeFeature field_202301_A = new TreeFeature(false); -- public static final HugeTreesFeature field_202302_B = new MegaJungleFeature(false, 10, 20, Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P()); -+ public static final HugeTreesFeature field_202302_B = new MegaJungleFeature(false, 10, 20, Blocks.field_196620_N.func_176223_P(), Blocks.field_196648_Z.func_176223_P()).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196678_w); - public static final HugeTreesFeature field_202303_C = new MegaPineTree(false, false); - public static final HugeTreesFeature field_202304_D = new MegaPineTree(false, true); - public static final AbstractFlowersFeature field_202305_E = new DefaultFlowersFeature(); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/GlowstoneFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java.patch similarity index 66% rename from patches/minecraft/net/minecraft/world/gen/feature/GlowstoneFeature.java.patch rename to patches/minecraft/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java.patch index 0bce0778f..7ad799067 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/GlowstoneFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java.patch @@ -1,6 +1,6 @@ ---- a/net/minecraft/world/gen/feature/GlowstoneFeature.java -+++ b/net/minecraft/world/gen/feature/GlowstoneFeature.java -@@ -19,7 +19,7 @@ +--- a/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java ++++ b/net/minecraft/world/gen/feature/GlowstoneBlobFeature.java +@@ -25,7 +25,7 @@ for(int i = 0; i < 1500; ++i) { BlockPos blockpos = p_212245_4_.func_177982_a(p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8), -p_212245_3_.nextInt(12), p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8)); @@ -8,4 +8,4 @@ + if (p_212245_1_.func_180495_p(blockpos).isAir(p_212245_1_, blockpos)) { int j = 0; - for(EnumFacing enumfacing : EnumFacing.values()) { + for(Direction direction : Direction.values()) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/HellLavaFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/HellLavaFeature.java.patch deleted file mode 100644 index 4f5dd4390..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/HellLavaFeature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/feature/HellLavaFeature.java -+++ b/net/minecraft/world/gen/feature/HellLavaFeature.java -@@ -15,7 +15,7 @@ - public boolean func_212245_a(IWorld p_212245_1_, IChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, HellLavaConfig p_212245_5_) { - if (p_212245_1_.func_180495_p(p_212245_4_.func_177984_a()) != field_205173_a) { - return false; -- } else if (!p_212245_1_.func_180495_p(p_212245_4_).func_196958_f() && p_212245_1_.func_180495_p(p_212245_4_) != field_205173_a) { -+ } else if (!p_212245_1_.func_175623_d(p_212245_4_) && p_212245_1_.func_180495_p(p_212245_4_) != field_205173_a) { - return false; - } else { - int i = 0; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/HugeTreesFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/HugeTreesFeature.java.patch index c8368a53c..5ee1ad0e2 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/HugeTreesFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/HugeTreesFeature.java.patch @@ -1,76 +1,64 @@ --- a/net/minecraft/world/gen/feature/HugeTreesFeature.java +++ b/net/minecraft/world/gen/feature/HugeTreesFeature.java -@@ -14,6 +14,7 @@ - protected final IBlockState field_76520_b; - protected final IBlockState field_76521_c; - protected int field_150538_d; -+ protected net.minecraftforge.common.IPlantable sapling = (net.minecraftforge.common.IPlantable)Blocks.field_196674_t; +@@ -22,6 +22,7 @@ + this.field_150538_d = p_i51481_4_; + this.field_76520_b = p_i51481_5_; + this.field_76521_c = p_i51481_6_; ++ setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196674_t); + } - public HugeTreesFeature(boolean p_i46447_1_, int p_i46447_2_, int p_i46447_3_, IBlockState p_i46447_4_, IBlockState p_i46447_5_) { - super(p_i46447_1_); -@@ -34,7 +35,8 @@ + protected int func_150533_a(Random p_150533_1_) { +@@ -35,7 +36,7 @@ - private boolean func_175926_c(IBlockReader p_175926_1_, BlockPos p_175926_2_, int p_175926_3_) { + private boolean func_175926_c(IWorldGenerationBaseReader p_175926_1_, BlockPos p_175926_2_, int p_175926_3_) { boolean flag = true; - if (p_175926_2_.func_177956_o() >= 1 && p_175926_2_.func_177956_o() + p_175926_3_ + 1 <= 256) { -+ int worldHeight = p_175926_1_ instanceof IWorld ? ((IWorld)p_175926_1_).func_201672_e().func_72800_K() : 256; -+ if (p_175926_2_.func_177956_o() >= 1 && p_175926_2_.func_177956_o() + p_175926_3_ + 1 <= worldHeight) { ++ if (p_175926_2_.func_177956_o() >= 1 && p_175926_2_.func_177956_o() + p_175926_3_ + 1 <= p_175926_1_.getMaxHeight()) { for(int i = 0; i <= 1 + p_175926_3_; ++i) { int j = 2; if (i == 0) { -@@ -45,7 +47,7 @@ +@@ -46,7 +47,7 @@ for(int k = -j; k <= j && flag; ++k) { for(int l = -j; l <= j && flag; ++l) { -- if (p_175926_2_.func_177956_o() + i < 0 || p_175926_2_.func_177956_o() + i >= 256 || !this.func_150523_a(p_175926_1_.func_180495_p(p_175926_2_.func_177982_a(k, i, l)).func_177230_c())) { -+ if (p_175926_2_.func_177956_o() + i < 0 || p_175926_2_.func_177956_o() + i >= 256 || !this.canGrowInto(p_175926_1_, p_175926_2_.func_177982_a(k, i, l))) { +- if (p_175926_2_.func_177956_o() + i < 0 || p_175926_2_.func_177956_o() + i >= 256 || !func_214587_a(p_175926_1_, p_175926_2_.func_177982_a(k, i, l))) { ++ if (p_175926_2_.func_177956_o() + i < 0 || p_175926_2_.func_177956_o() + i >= p_175926_1_.getMaxHeight() || !canBeReplacedByLog(p_175926_1_, p_175926_2_.func_177982_a(k, i, l))) { flag = false; } } -@@ -60,12 +62,12 @@ +@@ -61,11 +62,12 @@ - private boolean func_202405_b(IWorld p_202405_1_, BlockPos p_202405_2_) { + private boolean func_202405_b(IWorldGenerationReader p_202405_1_, BlockPos p_202405_2_) { BlockPos blockpos = p_202405_2_.func_177977_b(); -- Block block = p_202405_1_.func_180495_p(blockpos).func_177230_c(); -- if ((block == Blocks.field_196658_i || Block.func_196245_f(block)) && p_202405_2_.func_177956_o() >= 2) { -- this.func_175921_a(p_202405_1_, blockpos); -- this.func_175921_a(p_202405_1_, blockpos.func_177974_f()); -- this.func_175921_a(p_202405_1_, blockpos.func_177968_d()); -- this.func_175921_a(p_202405_1_, blockpos.func_177968_d().func_177974_f()); -+ boolean isSoil = p_202405_1_.func_180495_p(blockpos).canSustainPlant(p_202405_1_, blockpos, net.minecraft.util.EnumFacing.UP, sapling); -+ if (isSoil && p_202405_2_.func_177956_o() >= 2) { -+ this.setDirtAt(p_202405_1_, blockpos, p_202405_2_); -+ this.setDirtAt(p_202405_1_, blockpos.func_177974_f(), p_202405_2_); -+ this.setDirtAt(p_202405_1_, blockpos.func_177968_d(), p_202405_2_); -+ this.setDirtAt(p_202405_1_, blockpos.func_177968_d().func_177974_f(), p_202405_2_); +- if (func_214589_h(p_202405_1_, blockpos) && p_202405_2_.func_177956_o() >= 2) { +- this.func_214584_a(p_202405_1_, blockpos); +- this.func_214584_a(p_202405_1_, blockpos.func_177974_f()); +- this.func_214584_a(p_202405_1_, blockpos.func_177968_d()); +- this.func_214584_a(p_202405_1_, blockpos.func_177968_d().func_177974_f()); ++ ++ if (isSoil(p_202405_1_, blockpos) && p_202405_2_.func_177956_o() >= 2) { ++ setDirtAt(p_202405_1_, blockpos, p_202405_2_); ++ setDirtAt(p_202405_1_, blockpos.func_177974_f(), p_202405_2_); ++ setDirtAt(p_202405_1_, blockpos.func_177968_d(), p_202405_2_); ++ setDirtAt(p_202405_1_, blockpos.func_177968_d().func_177974_f(), p_202405_2_); return true; } else { return false; -@@ -86,7 +88,7 @@ +@@ -85,7 +87,7 @@ + int i1 = Math.min(Math.abs(k), Math.abs(k - 1)); if (l + i1 < 7 && l * l + i1 * i1 <= i) { - BlockPos blockpos = p_175925_2_.func_177982_a(j, 0, k); - IBlockState iblockstate = p_175925_1_.func_180495_p(blockpos); -- if (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate.isAir(p_175925_1_, blockpos) || iblockstate.func_203425_a(BlockTags.field_206952_E)) { - this.func_202278_a(p_175925_1_, blockpos, this.field_76521_c); + BlockPos blockpos = p_222839_2_.func_177982_a(j, 0, k); +- if (func_214572_g(p_222839_1_, blockpos)) { ++ if (canBeReplacedByLeaves(p_222839_1_, blockpos)) { + this.func_208520_a(p_222839_5_, p_222839_1_, blockpos, this.field_76521_c, p_222839_4_); } } -@@ -103,7 +105,7 @@ +@@ -101,7 +103,7 @@ + for(int k = -p_222838_3_; k <= p_222838_3_; ++k) { if (j * j + k * k <= i) { - BlockPos blockpos = p_175928_2_.func_177982_a(j, 0, k); - IBlockState iblockstate = p_175928_1_.func_180495_p(blockpos); -- if (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate.isAir(p_175928_1_, blockpos) || iblockstate.func_203425_a(BlockTags.field_206952_E)) { - this.func_202278_a(p_175928_1_, blockpos, this.field_76521_c); + BlockPos blockpos = p_222838_2_.func_177982_a(j, 0, k); +- if (func_214572_g(p_222838_1_, blockpos)) { ++ if (canBeReplacedByLeaves(p_222838_1_, blockpos)) { + this.func_208520_a(p_222838_5_, p_222838_1_, blockpos, this.field_76521_c, p_222838_4_); } } -@@ -111,4 +113,9 @@ - } - - } -+ -+ public HugeTreesFeature setSapling(net.minecraftforge.common.IPlantable sapling) { -+ this.sapling = sapling; -+ return this; -+ } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch index 87bd673a6..af07d03c1 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/IceSpikeFeature.java.patch @@ -1,28 +1,28 @@ --- a/net/minecraft/world/gen/feature/IceSpikeFeature.java +++ b/net/minecraft/world/gen/feature/IceSpikeFeature.java -@@ -38,14 +38,14 @@ +@@ -44,14 +44,14 @@ if ((i1 == 0 && j1 == 0 || !(f1 * f1 + f2 * f2 > f * f)) && (i1 != -l && i1 != l && j1 != -l && j1 != l || !(p_212245_3_.nextFloat() > 0.75F))) { - IBlockState iblockstate = p_212245_1_.func_180495_p(p_212245_4_.func_177982_a(i1, k, j1)); - Block block = iblockstate.func_177230_c(); -- if (iblockstate.func_196958_f() || Block.func_196245_f(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { -+ if (iblockstate.isAir(p_212245_1_, p_212245_4_.func_177982_a(i1, k, j1)) || Block.func_196245_f(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { + BlockState blockstate = p_212245_1_.func_180495_p(p_212245_4_.func_177982_a(i1, k, j1)); + Block block = blockstate.func_177230_c(); +- if (blockstate.func_196958_f() || Block.func_196245_f(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { ++ if (blockstate.isAir(p_212245_1_, p_212245_4_.func_177982_a(i1, k, j1)) || Block.func_196245_f(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { this.func_202278_a(p_212245_1_, p_212245_4_.func_177982_a(i1, k, j1), Blocks.field_150403_cj.func_176223_P()); } if (k != 0 && l > 1) { - iblockstate = p_212245_1_.func_180495_p(p_212245_4_.func_177982_a(i1, -k, j1)); - block = iblockstate.func_177230_c(); -- if (iblockstate.func_196958_f() || Block.func_196245_f(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { -+ if (iblockstate.isAir(p_212245_1_, p_212245_4_.func_177982_a(i1, -k, j1)) || Block.func_196245_f(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { + blockstate = p_212245_1_.func_180495_p(p_212245_4_.func_177982_a(i1, -k, j1)); + block = blockstate.func_177230_c(); +- if (blockstate.func_196958_f() || Block.func_196245_f(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { ++ if (blockstate.isAir(p_212245_1_, p_212245_4_.func_177982_a(i1, -k, j1)) || Block.func_196245_f(block) || block == Blocks.field_196604_cC || block == Blocks.field_150432_aD) { this.func_202278_a(p_212245_1_, p_212245_4_.func_177982_a(i1, -k, j1), Blocks.field_150403_cj.func_176223_P()); } } -@@ -72,7 +72,7 @@ +@@ -78,7 +78,7 @@ while(blockpos.func_177956_o() > 50) { - IBlockState iblockstate1 = p_212245_1_.func_180495_p(blockpos); - Block block1 = iblockstate1.func_177230_c(); -- if (!iblockstate1.func_196958_f() && !Block.func_196245_f(block1) && block1 != Blocks.field_196604_cC && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) { -+ if (!iblockstate1.isAir(p_212245_1_, blockpos) && !Block.func_196245_f(block1) && block1 != Blocks.field_196604_cC && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) { + BlockState blockstate1 = p_212245_1_.func_180495_p(blockpos); + Block block1 = blockstate1.func_177230_c(); +- if (!blockstate1.func_196958_f() && !Block.func_196245_f(block1) && block1 != Blocks.field_196604_cC && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) { ++ if (!blockstate1.isAir(p_212245_1_, blockpos) && !Block.func_196245_f(block1) && block1 != Blocks.field_196604_cC && block1 != Blocks.field_150432_aD && block1 != Blocks.field_150403_cj) { break; } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/JungleGrassFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/JungleGrassFeature.java.patch index 2ac69da39..1a5b0b670 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/JungleGrassFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/JungleGrassFeature.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/feature/JungleGrassFeature.java +++ b/net/minecraft/world/gen/feature/JungleGrassFeature.java -@@ -17,7 +17,7 @@ - public boolean func_212245_a(IWorld p_212245_1_, IChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { - IBlockState iblockstate = this.func_202357_a(p_212245_3_); +@@ -23,7 +23,7 @@ + public boolean func_212245_a(IWorld p_212245_1_, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { + BlockState blockstate = this.func_202357_a(p_212245_3_); -- for(IBlockState iblockstate1 = p_212245_1_.func_180495_p(p_212245_4_); (iblockstate1.func_196958_f() || iblockstate1.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; iblockstate1 = p_212245_1_.func_180495_p(p_212245_4_)) { -+ for(IBlockState iblockstate1 = p_212245_1_.func_180495_p(p_212245_4_); (iblockstate1.isAir(p_212245_1_, p_212245_4_) || iblockstate1.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; iblockstate1 = p_212245_1_.func_180495_p(p_212245_4_)) { +- for(BlockState blockstate1 = p_212245_1_.func_180495_p(p_212245_4_); (blockstate1.func_196958_f() || blockstate1.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; blockstate1 = p_212245_1_.func_180495_p(p_212245_4_)) { ++ for(BlockState blockstate1 = p_212245_1_.func_180495_p(p_212245_4_); (blockstate1.isAir(p_212245_1_, p_212245_4_) || blockstate1.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; blockstate1 = p_212245_1_.func_180495_p(p_212245_4_)) { p_212245_4_ = p_212245_4_.func_177977_b(); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/JungleTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/JungleTreeFeature.java.patch new file mode 100644 index 000000000..da13ab62d --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/JungleTreeFeature.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/gen/feature/JungleTreeFeature.java ++++ b/net/minecraft/world/gen/feature/JungleTreeFeature.java +@@ -8,6 +8,7 @@ + public class JungleTreeFeature extends TreeFeature { + public JungleTreeFeature(Function, ? extends NoFeatureConfig> p_i51488_1_, boolean p_i51488_2_, int p_i51488_3_, BlockState p_i51488_4_, BlockState p_i51488_5_, boolean p_i51488_6_) { + super(p_i51488_1_, p_i51488_2_, p_i51488_3_, p_i51488_4_, p_i51488_5_, p_i51488_6_); ++ setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196678_w); + } + + protected int func_208534_a(Random p_208534_1_) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/LiquidsFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/LiquidsFeature.java.patch deleted file mode 100644 index 00caa1096..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/LiquidsFeature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/feature/LiquidsFeature.java -+++ b/net/minecraft/world/gen/feature/LiquidsFeature.java -@@ -16,7 +16,7 @@ - return false; - } else { - IBlockState iblockstate = p_212245_1_.func_180495_p(p_212245_4_); -- if (!iblockstate.func_196958_f() && !Block.func_196252_e(iblockstate.func_177230_c())) { -+ if (!iblockstate.isAir(p_212245_1_, p_212245_4_) && !Block.func_196252_e(iblockstate.func_177230_c())) { - return false; - } else { - int i = 0; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/MegaJungleFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/MegaJungleFeature.java.patch index 7eb767e28..3ad03637b 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/MegaJungleFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/MegaJungleFeature.java.patch @@ -1,38 +1,55 @@ --- a/net/minecraft/world/gen/feature/MegaJungleFeature.java +++ b/net/minecraft/world/gen/feature/MegaJungleFeature.java -@@ -44,7 +44,7 @@ +@@ -16,6 +16,7 @@ + public class MegaJungleFeature extends HugeTreesFeature { + public MegaJungleFeature(Function, ? extends NoFeatureConfig> p_i51483_1_, boolean p_i51483_2_, int p_i51483_3_, int p_i51483_4_, BlockState p_i51483_5_, BlockState p_i51483_6_) { + super(p_i51483_1_, p_i51483_2_, p_i51483_3_, p_i51483_4_, p_i51483_5_, p_i51483_6_); ++ setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196678_w); + } + + public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { +@@ -47,7 +48,7 @@ for(int i2 = 0; i2 < i; ++i2) { BlockPos blockpos = p_208519_4_.func_177981_b(i2); -- if (this.func_150523_a(p_208519_2_.func_180495_p(blockpos).func_177230_c())) { -+ if (this.canGrowInto(p_208519_2_, blockpos)) { - this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, this.field_76520_b); +- if (func_214587_a(p_208519_2_, blockpos)) { ++ if (canBeReplacedByLog(p_208519_2_, blockpos)) { + this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, this.field_76520_b, p_208519_5_); if (i2 > 0) { - this.func_202407_a(p_208519_2_, p_208519_3_, blockpos.func_177976_e(), BlockVine.field_176278_M); -@@ -54,7 +54,7 @@ + this.func_202407_a(p_208519_2_, p_208519_3_, blockpos.func_177976_e(), VineBlock.field_176278_M); +@@ -57,7 +58,7 @@ if (i2 < i - 1) { BlockPos blockpos1 = blockpos.func_177974_f(); -- if (this.func_150523_a(p_208519_2_.func_180495_p(blockpos1).func_177230_c())) { -+ if (this.canGrowInto(p_208519_2_, blockpos1)) { - this.func_208520_a(p_208519_1_, p_208519_2_, blockpos1, this.field_76520_b); +- if (func_214587_a(p_208519_2_, blockpos1)) { ++ if (canBeReplacedByLog(p_208519_2_, blockpos1)) { + this.func_208520_a(p_208519_1_, p_208519_2_, blockpos1, this.field_76520_b, p_208519_5_); if (i2 > 0) { - this.func_202407_a(p_208519_2_, p_208519_3_, blockpos1.func_177974_f(), BlockVine.field_176280_O); -@@ -63,7 +63,7 @@ + this.func_202407_a(p_208519_2_, p_208519_3_, blockpos1.func_177974_f(), VineBlock.field_176280_O); +@@ -66,7 +67,7 @@ } BlockPos blockpos2 = blockpos.func_177968_d().func_177974_f(); -- if (this.func_150523_a(p_208519_2_.func_180495_p(blockpos2).func_177230_c())) { -+ if (this.canGrowInto(p_208519_2_, blockpos2)) { - this.func_208520_a(p_208519_1_, p_208519_2_, blockpos2, this.field_76520_b); +- if (func_214587_a(p_208519_2_, blockpos2)) { ++ if (canBeReplacedByLog(p_208519_2_, blockpos2)) { + this.func_208520_a(p_208519_1_, p_208519_2_, blockpos2, this.field_76520_b, p_208519_5_); if (i2 > 0) { - this.func_202407_a(p_208519_2_, p_208519_3_, blockpos2.func_177974_f(), BlockVine.field_176280_O); -@@ -72,7 +72,7 @@ + this.func_202407_a(p_208519_2_, p_208519_3_, blockpos2.func_177974_f(), VineBlock.field_176280_O); +@@ -75,7 +76,7 @@ } BlockPos blockpos3 = blockpos.func_177968_d(); -- if (this.func_150523_a(p_208519_2_.func_180495_p(blockpos3).func_177230_c())) { -+ if (this.canGrowInto(p_208519_2_, blockpos3)) { - this.func_208520_a(p_208519_1_, p_208519_2_, blockpos3, this.field_76520_b); +- if (func_214587_a(p_208519_2_, blockpos3)) { ++ if (canBeReplacedByLog(p_208519_2_, blockpos3)) { + this.func_208520_a(p_208519_1_, p_208519_2_, blockpos3, this.field_76520_b, p_208519_5_); if (i2 > 0) { - this.func_202407_a(p_208519_2_, p_208519_3_, blockpos3.func_177976_e(), BlockVine.field_176278_M); + this.func_202407_a(p_208519_2_, p_208519_3_, blockpos3.func_177976_e(), VineBlock.field_176278_M); +@@ -90,7 +91,7 @@ + } + + private void func_202407_a(IWorldGenerationReader p_202407_1_, Random p_202407_2_, BlockPos p_202407_3_, BooleanProperty p_202407_4_) { +- if (p_202407_2_.nextInt(3) > 0 && func_214574_b(p_202407_1_, p_202407_3_)) { ++ if (p_202407_2_.nextInt(3) > 0 && isAir(p_202407_1_, p_202407_3_)) { + this.func_202278_a(p_202407_1_, p_202407_3_, Blocks.field_150395_bd.func_176223_P().func_206870_a(p_202407_4_, Boolean.valueOf(true))); + } + diff --git a/patches/minecraft/net/minecraft/world/gen/feature/MegaPineTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/MegaPineTree.java.patch index 9b539078a..70ca62669 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/MegaPineTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/MegaPineTree.java.patch @@ -1,39 +1,50 @@ --- a/net/minecraft/world/gen/feature/MegaPineTree.java +++ b/net/minecraft/world/gen/feature/MegaPineTree.java -@@ -30,23 +30,23 @@ +@@ -20,6 +20,7 @@ + public MegaPineTree(Function, ? extends NoFeatureConfig> p_i51482_1_, boolean p_i51482_2_, boolean p_i51482_3_) { + super(p_i51482_1_, p_i51482_2_, 13, 15, field_181633_e, field_181634_f); + this.field_150542_e = p_i51482_3_; ++ setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u); + } + + public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { +@@ -30,20 +31,20 @@ + this.func_214596_a(p_208519_2_, p_208519_4_.func_177958_n(), p_208519_4_.func_177952_p(), p_208519_4_.func_177956_o() + i, 0, p_208519_3_, p_208519_5_, p_208519_1_); for(int j = 0; j < i; ++j) { - IBlockState iblockstate = p_208519_2_.func_180495_p(p_208519_4_.func_177981_b(j)); -- if (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate.isAir(p_208519_2_, p_208519_4_.func_177981_b(j)) || iblockstate.func_203425_a(BlockTags.field_206952_E)) { - this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(j), this.field_76520_b); +- if (func_214572_g(p_208519_2_, p_208519_4_.func_177981_b(j))) { ++ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177981_b(j))) { + this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(j), this.field_76520_b, p_208519_5_); } if (j < i - 1) { - iblockstate = p_208519_2_.func_180495_p(p_208519_4_.func_177982_a(1, j, 0)); -- if (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate.isAir(p_208519_2_, p_208519_4_.func_177982_a(1, j, 0)) || iblockstate.func_203425_a(BlockTags.field_206952_E)) { - this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177982_a(1, j, 0), this.field_76520_b); +- if (func_214572_g(p_208519_2_, p_208519_4_.func_177982_a(1, j, 0))) { ++ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177982_a(1, j, 0))) { + this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177982_a(1, j, 0), this.field_76520_b, p_208519_5_); } - iblockstate = p_208519_2_.func_180495_p(p_208519_4_.func_177982_a(1, j, 1)); -- if (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate.isAir(p_208519_2_, p_208519_4_.func_177982_a(1, j, 1)) || iblockstate.func_203425_a(BlockTags.field_206952_E)) { - this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177982_a(1, j, 1), this.field_76520_b); +- if (func_214572_g(p_208519_2_, p_208519_4_.func_177982_a(1, j, 1))) { ++ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177982_a(1, j, 1))) { + this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177982_a(1, j, 1), this.field_76520_b, p_208519_5_); } - iblockstate = p_208519_2_.func_180495_p(p_208519_4_.func_177982_a(0, j, 1)); -- if (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate.isAir(p_208519_2_, p_208519_4_.func_177982_a(0, j, 1)) || iblockstate.func_203425_a(BlockTags.field_206952_E)) { - this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177982_a(0, j, 1), this.field_76520_b); +- if (func_214572_g(p_208519_2_, p_208519_4_.func_177982_a(0, j, 1))) { ++ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177982_a(0, j, 1))) { + this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177982_a(0, j, 1), this.field_76520_b, p_208519_5_); } } -@@ -108,7 +108,7 @@ +@@ -98,12 +99,12 @@ + private void func_175934_c(IWorldGenerationReader p_175934_1_, BlockPos p_175934_2_) { + for(int i = 2; i >= -3; --i) { + BlockPos blockpos = p_175934_2_.func_177981_b(i); +- if (func_214589_h(p_175934_1_, blockpos)) { ++ if (isSoil(p_175934_1_, blockpos)) { + this.func_202278_a(p_175934_1_, blockpos, field_181635_g); break; } -- if (!iblockstate.func_196958_f() && i < 0) { -+ if (!iblockstate.isAir(p_175934_1_, blockpos) && i < 0) { +- if (!func_214574_b(p_175934_1_, blockpos) && i < 0) { ++ if (!isAir(p_175934_1_, blockpos) && i < 0) { break; } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/NetherSpringFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/NetherSpringFeature.java.patch new file mode 100644 index 000000000..9e627f496 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/NetherSpringFeature.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/feature/NetherSpringFeature.java ++++ b/net/minecraft/world/gen/feature/NetherSpringFeature.java +@@ -21,7 +21,7 @@ + public boolean func_212245_a(IWorld p_212245_1_, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, HellLavaConfig p_212245_5_) { + if (p_212245_1_.func_180495_p(p_212245_4_.func_177984_a()) != field_214552_a) { + return false; +- } else if (!p_212245_1_.func_180495_p(p_212245_4_).func_196958_f() && p_212245_1_.func_180495_p(p_212245_4_) != field_214552_a) { ++ } else if (!p_212245_1_.func_180495_p(p_212245_4_).isAir(p_212245_1_, p_212245_4_) && p_212245_1_.func_180495_p(p_212245_4_) != field_214552_a) { + return false; + } else { + int i = 0; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/PointyTaigaTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/PointyTaigaTreeFeature.java.patch index 80aec93ad..e4e295c47 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/PointyTaigaTreeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/PointyTaigaTreeFeature.java.patch @@ -1,44 +1,59 @@ --- a/net/minecraft/world/gen/feature/PointyTaigaTreeFeature.java +++ b/net/minecraft/world/gen/feature/PointyTaigaTreeFeature.java -@@ -37,8 +37,8 @@ +@@ -16,6 +16,7 @@ + + public PointyTaigaTreeFeature(Function, ? extends NoFeatureConfig> p_i51469_1_) { + super(p_i51469_1_, false); ++ setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u); + } + + public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { +@@ -23,7 +24,7 @@ + int j = i - p_208519_3_.nextInt(2) - 3; + int k = i - j; + int l = 1 + p_208519_3_.nextInt(k + 1); +- if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= 256) { ++ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.getMaxHeight()) { + boolean flag = true; + + for(int i1 = p_208519_4_.func_177956_o(); i1 <= p_208519_4_.func_177956_o() + 1 + i && flag; ++i1) { +@@ -38,8 +39,8 @@ for(int k1 = p_208519_4_.func_177958_n() - j1; k1 <= p_208519_4_.func_177958_n() + j1 && flag; ++k1) { for(int l1 = p_208519_4_.func_177952_p() - j1; l1 <= p_208519_4_.func_177952_p() + j1 && flag; ++l1) { - if (i1 >= 0 && i1 < 256) { -- if (!this.func_150523_a(p_208519_2_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).func_177230_c())) { -+ if (i1 >= 0 && i1 < p_208519_2_.func_201672_e().func_72800_K()) { -+ if (!this.canGrowInto(p_208519_2_, blockpos$mutableblockpos.func_181079_c(k1, i1, l1))) { +- if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(k1, i1, l1))) { ++ if (i1 >= 0 && i1 < p_208519_2_.getMaxHeight()) { ++ if (!canBeReplacedByLog(p_208519_2_, blockpos$mutableblockpos.func_181079_c(k1, i1, l1))) { flag = false; } } else { -@@ -51,9 +51,9 @@ +@@ -51,8 +52,8 @@ + if (!flag) { return false; - } else { -- Block block = p_208519_2_.func_180495_p(p_208519_4_.func_177977_b()).func_177230_c(); -- if ((block == Blocks.field_196658_i || Block.func_196245_f(block)) && p_208519_4_.func_177956_o() < 256 - i - 1) { -- this.func_175921_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ boolean isSoil = p_208519_2_.func_180495_p(p_208519_4_.func_177977_b()).canSustainPlant(p_208519_2_, p_208519_4_.func_177977_b(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_196675_u); -+ if (isSoil && p_208519_4_.func_177956_o() < p_208519_2_.func_201672_e().func_72800_K() - i - 1) { -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - int k2 = 0; +- } else if (func_214589_h(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) { +- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); ++ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) { ++ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); + int j2 = 0; - for(int l2 = p_208519_4_.func_177956_o() + i; l2 >= p_208519_4_.func_177956_o() + j; --l2) { -@@ -64,7 +64,7 @@ - int j2 = i2 - p_208519_4_.func_177952_p(); - if (Math.abs(k3) != k2 || Math.abs(j2) != k2 || k2 <= 0) { - BlockPos blockpos = new BlockPos(j3, l2, i2); -- if (!p_208519_2_.func_180495_p(blockpos).func_200015_d(p_208519_2_, blockpos)) { -+ if (p_208519_2_.func_180495_p(blockpos).canBeReplacedByLeaves(p_208519_2_, blockpos)) { - this.func_202278_a(p_208519_2_, blockpos, field_181637_b); - } + for(int k2 = p_208519_4_.func_177956_o() + i; k2 >= p_208519_4_.func_177956_o() + j; --k2) { +@@ -63,7 +64,7 @@ + int i2 = k3 - p_208519_4_.func_177952_p(); + if (Math.abs(j3) != j2 || Math.abs(i2) != j2 || j2 <= 0) { + BlockPos blockpos = new BlockPos(i3, k2, k3); +- if (func_214572_g(p_208519_2_, blockpos)) { ++ if (canBeReplacedByLeaves(p_208519_2_, blockpos)) { + this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, field_181637_b, p_208519_5_); } -@@ -80,7 +80,7 @@ + } +@@ -78,7 +79,7 @@ + } - for(int i3 = 0; i3 < i - 1; ++i3) { - IBlockState iblockstate = p_208519_2_.func_180495_p(p_208519_4_.func_177981_b(i3)); -- if (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate.isAir(p_208519_2_, p_208519_4_.func_177981_b(i3)) || iblockstate.func_203425_a(BlockTags.field_206952_E)) { - this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(i3), field_181636_a); - } + for(int l2 = 0; l2 < i - 1; ++l2) { +- if (func_214572_g(p_208519_2_, p_208519_4_.func_177981_b(l2))) { ++ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177981_b(l2))) { + this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(l2), field_181636_a, p_208519_5_); } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/ReedFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/ReedFeature.java.patch deleted file mode 100644 index 0313e1df8..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/ReedFeature.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/gen/feature/ReedFeature.java -+++ b/net/minecraft/world/gen/feature/ReedFeature.java -@@ -18,7 +18,6 @@ - BlockPos blockpos1 = blockpos.func_177977_b(); - if (p_212245_1_.func_204610_c(blockpos1.func_177976_e()).func_206884_a(FluidTags.field_206959_a) || p_212245_1_.func_204610_c(blockpos1.func_177974_f()).func_206884_a(FluidTags.field_206959_a) || p_212245_1_.func_204610_c(blockpos1.func_177978_c()).func_206884_a(FluidTags.field_206959_a) || p_212245_1_.func_204610_c(blockpos1.func_177968_d()).func_206884_a(FluidTags.field_206959_a)) { - int k = 2 + p_212245_3_.nextInt(p_212245_3_.nextInt(3) + 1); -- - for(int l = 0; l < k; ++l) { - if (Blocks.field_196608_cF.func_176223_P().func_196955_c(p_212245_1_, blockpos)) { - p_212245_1_.func_180501_a(blockpos.func_177981_b(l), Blocks.field_196608_cF.func_176223_P(), 2); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/SavannaTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/SavannaTreeFeature.java.patch index c62139829..7b68f90e7 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/SavannaTreeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/SavannaTreeFeature.java.patch @@ -1,62 +1,60 @@ --- a/net/minecraft/world/gen/feature/SavannaTreeFeature.java +++ b/net/minecraft/world/gen/feature/SavannaTreeFeature.java -@@ -21,7 +21,7 @@ - public boolean func_208519_a(Set p_208519_1_, IWorld p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_) { +@@ -23,7 +23,7 @@ + public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { int i = p_208519_3_.nextInt(3) + p_208519_3_.nextInt(3) + 5; boolean flag = true; - if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= 256) { -+ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.func_201672_e().func_72800_K()) { ++ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.getMaxHeight()) { for(int j = p_208519_4_.func_177956_o(); j <= p_208519_4_.func_177956_o() + 1 + i; ++j) { int k = 1; if (j == p_208519_4_.func_177956_o()) { -@@ -36,8 +36,8 @@ +@@ -38,8 +38,8 @@ for(int l = p_208519_4_.func_177958_n() - k; l <= p_208519_4_.func_177958_n() + k && flag; ++l) { for(int i1 = p_208519_4_.func_177952_p() - k; i1 <= p_208519_4_.func_177952_p() + k && flag; ++i1) { - if (j >= 0 && j < 256) { -- if (!this.func_150523_a(p_208519_2_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c())) { -+ if (j >= 0 && j < p_208519_2_.func_201672_e().func_72800_K()) { -+ if (!this.canGrowInto(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { +- if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { ++ if (j >= 0 && j < p_208519_2_.getMaxHeight()) { ++ if (!canBeReplacedByLog(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { flag = false; } } else { -@@ -50,9 +50,9 @@ +@@ -51,8 +51,8 @@ + if (!flag) { return false; - } else { -- Block block = p_208519_2_.func_180495_p(p_208519_4_.func_177977_b()).func_177230_c(); -- if ((block == Blocks.field_196658_i || Block.func_196245_f(block)) && p_208519_4_.func_177956_o() < 256 - i - 1) { -- this.func_175921_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ boolean isSoil = p_208519_2_.func_180495_p(p_208519_4_.func_177977_b()).canSustainPlant(p_208519_2_, p_208519_4_.func_177977_b(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_196679_x); -+ if (isSoil && p_208519_4_.func_177956_o() < p_208519_2_.func_201672_e().func_72800_K() - i - 1) { -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.func_179518_a(p_208519_3_); - int k2 = i - p_208519_3_.nextInt(4) - 1; - int l2 = 3 - p_208519_3_.nextInt(3); -@@ -70,7 +70,7 @@ +- } else if (func_214589_h(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) { +- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); ++ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) { ++ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); + Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_208519_3_); + int k2 = i - p_208519_3_.nextInt(4) - 1; + int l2 = 3 - p_208519_3_.nextInt(3); +@@ -69,7 +69,7 @@ + } - BlockPos blockpos = new BlockPos(i3, i2, j1); - IBlockState iblockstate = p_208519_2_.func_180495_p(blockpos); -- if (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate.isAir(p_208519_2_, blockpos) || iblockstate.func_203425_a(BlockTags.field_206952_E)) { - this.func_208532_a(p_208519_1_, p_208519_2_, blockpos); - k1 = i2; - } -@@ -113,7 +113,7 @@ - j1 += enumfacing1.func_82599_e(); - BlockPos blockpos1 = new BlockPos(i3, j2, j1); - IBlockState iblockstate1 = p_208519_2_.func_180495_p(blockpos1); -- if (iblockstate1.func_196958_f() || iblockstate1.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate1.isAir(p_208519_2_, blockpos1) || iblockstate1.func_203425_a(BlockTags.field_206952_E)) { - this.func_208532_a(p_208519_1_, p_208519_2_, blockpos1); - k1 = j2; - } -@@ -159,7 +159,7 @@ + BlockPos blockpos = new BlockPos(i3, l1, j3); +- if (func_214572_g(p_208519_2_, blockpos)) { ++ if (canBeReplacedByLeaves(p_208519_2_, blockpos)) { + this.func_208532_a(p_208519_1_, p_208519_2_, blockpos, p_208519_5_); + j1 = l1; + } +@@ -111,7 +111,7 @@ + i3 += direction1.func_82601_c(); + j3 += direction1.func_82599_e(); + BlockPos blockpos1 = new BlockPos(i3, j2, j3); +- if (func_214572_g(p_208519_2_, blockpos1)) { ++ if (canBeReplacedByLeaves(p_208519_2_, blockpos1)) { + this.func_208532_a(p_208519_1_, p_208519_2_, blockpos1, p_208519_5_); + j1 = j2; + } +@@ -155,7 +155,7 @@ + } - private void func_175924_b(IWorld p_175924_1_, BlockPos p_175924_2_) { - IBlockState iblockstate = p_175924_1_.func_180495_p(p_175924_2_); -- if (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate.canBeReplacedByLeaves(p_175924_1_, p_175924_2_)) { - this.func_202278_a(p_175924_1_, p_175924_2_, field_181644_b); + private void func_175924_b(Set p_175924_1_, IWorldGenerationReader p_175924_2_, BlockPos p_175924_3_, MutableBoundingBox p_175924_4_) { +- if (func_214572_g(p_175924_2_, p_175924_3_)) { ++ if (canBeReplacedByLeaves(p_175924_2_, p_175924_3_)) { + this.func_208520_a(p_175924_1_, p_175924_2_, p_175924_3_, field_181644_b, p_175924_4_); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/ShrubFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/ShrubFeature.java.patch index 4cbd4a76f..ea4e78575 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/ShrubFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/ShrubFeature.java.patch @@ -1,44 +1,25 @@ --- a/net/minecraft/world/gen/feature/ShrubFeature.java +++ b/net/minecraft/world/gen/feature/ShrubFeature.java -@@ -12,6 +12,7 @@ - public class ShrubFeature extends AbstractTreeFeature { - private final IBlockState field_150528_a; - private final IBlockState field_150527_b; -+ protected net.minecraftforge.common.IPlantable sapling = (net.minecraftforge.common.IPlantable)Blocks.field_196674_t; - - public ShrubFeature(IBlockState p_i46450_1_, IBlockState p_i46450_2_) { - super(false); -@@ -20,12 +21,11 @@ +@@ -18,11 +18,12 @@ + super(p_i49868_1_, false); + this.field_150527_b = p_i49868_2_; + this.field_150528_a = p_i49868_3_; ++ setSapling((net.minecraftforge.common.IPlantable)net.minecraft.block.Blocks.field_196678_w); } - public boolean func_208519_a(Set p_208519_1_, IWorld p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_) { -- for(IBlockState iblockstate = p_208519_2_.func_180495_p(p_208519_4_); (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) && p_208519_4_.func_177956_o() > 0; iblockstate = p_208519_2_.func_180495_p(p_208519_4_)) { -+ for(IBlockState iblockstate = p_208519_2_.func_180495_p(p_208519_4_); (iblockstate.isAir(p_208519_2_, p_208519_4_) || iblockstate.func_203425_a(BlockTags.field_206952_E)) && p_208519_4_.func_177956_o() > 0; iblockstate = p_208519_2_.func_180495_p(p_208519_4_)) { - p_208519_4_ = p_208519_4_.func_177977_b(); - } - -- Block block = p_208519_2_.func_180495_p(p_208519_4_).func_177230_c(); -- if (Block.func_196245_f(block) || block == Blocks.field_196658_i) { -+ if (p_208519_2_.func_180495_p(p_208519_4_).canSustainPlant(p_208519_2_, p_208519_4_, net.minecraft.util.EnumFacing.UP, sapling)) { + public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { + p_208519_4_ = p_208519_2_.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, p_208519_4_).func_177977_b(); +- if (func_214589_h(p_208519_2_, p_208519_4_)) { ++ if (isSoil(p_208519_2_, p_208519_4_)) { p_208519_4_ = p_208519_4_.func_177984_a(); - this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_, this.field_150527_b); + this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_, this.field_150527_b, p_208519_5_); -@@ -41,7 +41,7 @@ +@@ -37,7 +38,7 @@ + int k1 = j1 - p_208519_4_.func_177952_p(); if (Math.abs(i1) != k || Math.abs(k1) != k || p_208519_3_.nextInt(2) != 0) { BlockPos blockpos = new BlockPos(l, i, j1); - IBlockState iblockstate1 = p_208519_2_.func_180495_p(blockpos); -- if (iblockstate1.func_196958_f() || iblockstate1.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate1.canBeReplacedByLeaves(p_208519_2_, blockpos)) { - this.func_202278_a(p_208519_2_, blockpos, this.field_150528_a); +- if (func_214572_g(p_208519_2_, blockpos)) { ++ if (canBeReplacedByLog(p_208519_2_, blockpos)) { + this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, this.field_150528_a, p_208519_5_); } } -@@ -52,4 +52,9 @@ - - return true; - } -+ -+ public ShrubFeature setSapling(net.minecraftforge.common.IPlantable sapling) { -+ this.sapling = sapling; -+ return this; -+ } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch new file mode 100644 index 000000000..98cad8742 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/SpringFeature.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/feature/SpringFeature.java ++++ b/net/minecraft/world/gen/feature/SpringFeature.java +@@ -22,7 +22,7 @@ + return false; + } else { + BlockState blockstate = p_212245_1_.func_180495_p(p_212245_4_); +- if (!blockstate.func_196958_f() && !Block.func_196252_e(blockstate.func_177230_c())) { ++ if (!blockstate.isAir(p_212245_1_, p_212245_4_) && !Block.func_196252_e(blockstate.func_177230_c())) { + return false; + } else { + int i = 0; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/SwampTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/SwampTreeFeature.java.patch index 96c3c7f64..e509dd984 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/SwampTreeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/SwampTreeFeature.java.patch @@ -1,87 +1,85 @@ --- a/net/minecraft/world/gen/feature/SwampTreeFeature.java +++ b/net/minecraft/world/gen/feature/SwampTreeFeature.java -@@ -27,7 +27,7 @@ - } - +@@ -25,7 +25,7 @@ + int i = p_208519_3_.nextInt(4) + 5; + p_208519_4_ = p_208519_2_.func_205770_a(Heightmap.Type.OCEAN_FLOOR, p_208519_4_); boolean flag = true; - if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= 256) { -+ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.func_201672_e().func_72800_K()) { ++ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.getMaxHeight()) { for(int j = p_208519_4_.func_177956_o(); j <= p_208519_4_.func_177956_o() + 1 + i; ++j) { int k = 1; if (j == p_208519_4_.func_177956_o()) { -@@ -42,10 +42,10 @@ +@@ -40,9 +40,9 @@ for(int l = p_208519_4_.func_177958_n() - k; l <= p_208519_4_.func_177958_n() + k && flag; ++l) { for(int i1 = p_208519_4_.func_177952_p() - k; i1 <= p_208519_4_.func_177952_p() + k && flag; ++i1) { - if (j >= 0 && j < 256) { -+ if (j >= 0 && j < p_208519_2_.func_201672_e().func_72800_K()) { - IBlockState iblockstate = p_208519_2_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)); - Block block = iblockstate.func_177230_c(); -- if (!iblockstate.func_196958_f() && !iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (!iblockstate.isAir(p_208519_2_, blockpos$mutableblockpos) && !iblockstate.func_203425_a(BlockTags.field_206952_E)) { - if (block == Blocks.field_150355_j) { ++ if (j >= 0 && j < p_208519_2_.getMaxHeight()) { + blockpos$mutableblockpos.func_181079_c(l, j, i1); +- if (!func_214572_g(p_208519_2_, blockpos$mutableblockpos)) { ++ if (!canBeReplacedByLeaves(p_208519_2_, blockpos$mutableblockpos)) { + if (func_214571_e(p_208519_2_, blockpos$mutableblockpos)) { if (j > p_208519_4_.func_177956_o()) { flag = false; -@@ -64,9 +64,8 @@ +@@ -60,8 +60,8 @@ + if (!flag) { return false; - } else { -- Block block1 = p_208519_2_.func_180495_p(p_208519_4_.func_177977_b()).func_177230_c(); -- if ((block1 == Blocks.field_196658_i || Block.func_196245_f(block1)) && p_208519_4_.func_177956_o() < 256 - i - 1) { -- this.func_175921_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ if (p_208519_2_.func_180495_p(p_208519_4_.func_177977_b()).canSustainPlant(p_208519_2_, p_208519_4_.func_177977_b(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_196674_t) && p_208519_4_.func_177956_o() < p_208519_2_.func_201672_e().func_72800_K() - i - 1) { -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); +- } else if (func_214589_h(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) { +- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); ++ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) { ++ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - for(int k1 = p_208519_4_.func_177956_o() - 3 + i; k1 <= p_208519_4_.func_177956_o() + i; ++k1) { - int j2 = k1 - (p_208519_4_.func_177956_o() + i); -@@ -79,7 +78,7 @@ - int j1 = i4 - p_208519_4_.func_177952_p(); - if (Math.abs(k3) != l2 || Math.abs(j1) != l2 || p_208519_3_.nextInt(2) != 0 && j2 != 0) { - BlockPos blockpos = new BlockPos(j3, k1, i4); -- if (!p_208519_2_.func_180495_p(blockpos).func_200015_d(p_208519_2_, blockpos)) { -+ if (p_208519_2_.func_180495_p(blockpos).canBeReplacedByLeaves(p_208519_2_, blockpos)) { - this.func_202278_a(p_208519_2_, blockpos, field_181649_b); - } + for(int l1 = p_208519_4_.func_177956_o() - 3 + i; l1 <= p_208519_4_.func_177956_o() + i; ++l1) { + int k2 = l1 - (p_208519_4_.func_177956_o() + i); +@@ -74,7 +74,7 @@ + int k1 = j1 - p_208519_4_.func_177952_p(); + if (Math.abs(l3) != i3 || Math.abs(k1) != i3 || p_208519_3_.nextInt(2) != 0 && k2 != 0) { + BlockPos blockpos = new BlockPos(k3, l1, j1); +- if (func_214572_g(p_208519_2_, blockpos) || func_214576_j(p_208519_2_, blockpos)) { ++ if (canBeReplacedByLeaves(p_208519_2_, blockpos) || func_214576_j(p_208519_2_, blockpos)) { + this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, field_181649_b, p_208519_5_); } -@@ -90,7 +89,7 @@ - for(int l1 = 0; l1 < i; ++l1) { - IBlockState iblockstate1 = p_208519_2_.func_180495_p(p_208519_4_.func_177981_b(l1)); - Block block2 = iblockstate1.func_177230_c(); -- if (iblockstate1.func_196958_f() || iblockstate1.func_203425_a(BlockTags.field_206952_E) || block2 == Blocks.field_150355_j) { -+ if (iblockstate1.isAir(p_208519_2_, p_208519_4_.func_177981_b(l1)) || iblockstate1.func_203425_a(BlockTags.field_206952_E) || block2 == Blocks.field_150355_j) { - this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(l1), field_181648_a); - } + } +@@ -84,7 +84,7 @@ + + for(int i2 = 0; i2 < i; ++i2) { + BlockPos blockpos3 = p_208519_4_.func_177981_b(i2); +- if (func_214572_g(p_208519_2_, blockpos3) || func_214571_e(p_208519_2_, blockpos3)) { ++ if (canBeReplacedByLeaves(p_208519_2_, blockpos3) || func_214571_e(p_208519_2_, blockpos3)) { + this.func_208520_a(p_208519_1_, p_208519_2_, blockpos3, field_181648_a, p_208519_5_); } -@@ -108,19 +107,19 @@ - BlockPos blockpos4 = blockpos$mutableblockpos1.func_177974_f(); - BlockPos blockpos1 = blockpos$mutableblockpos1.func_177978_c(); - BlockPos blockpos2 = blockpos$mutableblockpos1.func_177968_d(); -- if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_180495_p(blockpos3).func_196958_f()) { -+ if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_175623_d(blockpos3)) { - this.func_181647_a(p_208519_2_, blockpos3, BlockVine.field_176278_M); - } - -- if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_180495_p(blockpos4).func_196958_f()) { -+ if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_175623_d(blockpos4)) { - this.func_181647_a(p_208519_2_, blockpos4, BlockVine.field_176280_O); - } - -- if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_180495_p(blockpos1).func_196958_f()) { -+ if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_175623_d(blockpos1)) { - this.func_181647_a(p_208519_2_, blockpos1, BlockVine.field_176279_N); - } - -- if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_180495_p(blockpos2).func_196958_f()) { -+ if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_175623_d(blockpos2)) { - this.func_181647_a(p_208519_2_, blockpos2, BlockVine.field_176273_b); - } + } +@@ -102,19 +102,19 @@ + BlockPos blockpos5 = blockpos$mutableblockpos1.func_177974_f(); + BlockPos blockpos1 = blockpos$mutableblockpos1.func_177978_c(); + BlockPos blockpos2 = blockpos$mutableblockpos1.func_177968_d(); +- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos4)) { ++ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos4)) { + this.func_181647_a(p_208519_2_, blockpos4, VineBlock.field_176278_M); } -@@ -143,7 +142,7 @@ - this.func_202278_a(p_181647_1_, p_181647_2_, iblockstate); + +- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos5)) { ++ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos5)) { + this.func_181647_a(p_208519_2_, blockpos5, VineBlock.field_176280_O); + } + +- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos1)) { ++ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos1)) { + this.func_181647_a(p_208519_2_, blockpos1, VineBlock.field_176279_N); + } + +- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos2)) { ++ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos2)) { + this.func_181647_a(p_208519_2_, blockpos2, VineBlock.field_176273_b); + } + } +@@ -136,7 +136,7 @@ + this.func_202278_a(p_181647_1_, p_181647_2_, blockstate); int i = 4; -- for(BlockPos blockpos = p_181647_2_.func_177977_b(); p_181647_1_.func_180495_p(blockpos).func_196958_f() && i > 0; --i) { -+ for(BlockPos blockpos = p_181647_2_.func_177977_b(); p_181647_1_.func_175623_d(blockpos) && i > 0; --i) { - this.func_202278_a(p_181647_1_, blockpos, iblockstate); +- for(BlockPos blockpos = p_181647_2_.func_177977_b(); func_214574_b(p_181647_1_, blockpos) && i > 0; --i) { ++ for(BlockPos blockpos = p_181647_2_.func_177977_b(); isAir(p_181647_1_, blockpos) && i > 0; --i) { + this.func_202278_a(p_181647_1_, blockpos, blockstate); blockpos = blockpos.func_177977_b(); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/TaigaGrassFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/TaigaGrassFeature.java.patch index c1bc7c2e3..e41929ab5 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/TaigaGrassFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/TaigaGrassFeature.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/feature/TaigaGrassFeature.java +++ b/net/minecraft/world/gen/feature/TaigaGrassFeature.java -@@ -17,7 +17,7 @@ - public boolean func_212245_a(IWorld p_212245_1_, IChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { - IBlockState iblockstate = this.func_202388_a(p_212245_3_); +@@ -23,7 +23,7 @@ + public boolean func_212245_a(IWorld p_212245_1_, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { + BlockState blockstate = this.func_202388_a(p_212245_3_); -- for(IBlockState iblockstate1 = p_212245_1_.func_180495_p(p_212245_4_); (iblockstate1.func_196958_f() || iblockstate1.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; iblockstate1 = p_212245_1_.func_180495_p(p_212245_4_)) { -+ for(IBlockState iblockstate1 = p_212245_1_.func_180495_p(p_212245_4_); (iblockstate1.isAir(p_212245_1_, p_212245_4_) || iblockstate1.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; iblockstate1 = p_212245_1_.func_180495_p(p_212245_4_)) { +- for(BlockState blockstate1 = p_212245_1_.func_180495_p(p_212245_4_); (blockstate1.func_196958_f() || blockstate1.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; blockstate1 = p_212245_1_.func_180495_p(p_212245_4_)) { ++ for(BlockState blockstate1 = p_212245_1_.func_180495_p(p_212245_4_); (blockstate1.isAir(p_212245_1_, p_212245_4_) || blockstate1.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; blockstate1 = p_212245_1_.func_180495_p(p_212245_4_)) { p_212245_4_ = p_212245_4_.func_177977_b(); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/TallGrassFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/TallGrassFeature.java.patch deleted file mode 100644 index f0dab05b2..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/TallGrassFeature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/feature/TallGrassFeature.java -+++ b/net/minecraft/world/gen/feature/TallGrassFeature.java -@@ -10,7 +10,7 @@ - - public class TallGrassFeature extends Feature { - public boolean func_212245_a(IWorld p_212245_1_, IChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, TallGrassConfig p_212245_5_) { -- for(IBlockState iblockstate = p_212245_1_.func_180495_p(p_212245_4_); (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; iblockstate = p_212245_1_.func_180495_p(p_212245_4_)) { -+ for(IBlockState iblockstate = p_212245_1_.func_180495_p(p_212245_4_); (iblockstate.isAir(p_212245_1_, p_212245_4_) || iblockstate.func_203425_a(BlockTags.field_206952_E)) && p_212245_4_.func_177956_o() > 0; iblockstate = p_212245_1_.func_180495_p(p_212245_4_)) { - p_212245_4_ = p_212245_4_.func_177977_b(); - } - diff --git a/patches/minecraft/net/minecraft/world/gen/feature/TallTaigaTreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/TallTaigaTreeFeature.java.patch index 9d83ab8b8..ec8e8e320 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/TallTaigaTreeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/TallTaigaTreeFeature.java.patch @@ -1,53 +1,60 @@ --- a/net/minecraft/world/gen/feature/TallTaigaTreeFeature.java +++ b/net/minecraft/world/gen/feature/TallTaigaTreeFeature.java -@@ -23,7 +23,7 @@ +@@ -16,6 +16,7 @@ + + public TallTaigaTreeFeature(Function, ? extends NoFeatureConfig> p_i51429_1_, boolean p_i51429_2_) { + super(p_i51429_1_, p_i51429_2_); ++ setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u); + } + + public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { +@@ -24,7 +25,7 @@ int k = i - j; int l = 2 + p_208519_3_.nextInt(2); boolean flag = true; - if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= 256) { -+ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.func_201672_e().func_72800_K()) { ++ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.getMaxHeight()) { for(int i1 = p_208519_4_.func_177956_o(); i1 <= p_208519_4_.func_177956_o() + 1 + i && flag; ++i1) { int j1; if (i1 - p_208519_4_.func_177956_o() < j) { -@@ -36,9 +36,9 @@ +@@ -37,9 +38,9 @@ for(int k1 = p_208519_4_.func_177958_n() - j1; k1 <= p_208519_4_.func_177958_n() + j1 && flag; ++k1) { for(int l1 = p_208519_4_.func_177952_p() - j1; l1 <= p_208519_4_.func_177952_p() + j1 && flag; ++l1) { - if (i1 >= 0 && i1 < 256) { -+ if (i1 >= 0 && i1 < p_208519_2_.func_201672_e().func_72800_K()) { - IBlockState iblockstate = p_208519_2_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)); -- if (!iblockstate.func_196958_f() && !iblockstate.func_203425_a(BlockTags.field_206952_E)) { -+ if (!iblockstate.isAir(p_208519_2_, blockpos$mutableblockpos) && !iblockstate.func_203425_a(BlockTags.field_206952_E)) { ++ if (i1 >= 0 && i1 < p_208519_2_.getMaxHeight()) { + blockpos$mutableblockpos.func_181079_c(k1, i1, l1); +- if (!func_214572_g(p_208519_2_, blockpos$mutableblockpos)) { ++ if (!canBeReplacedByLeaves(p_208519_2_, blockpos$mutableblockpos)) { flag = false; } } else { -@@ -51,9 +51,8 @@ +@@ -51,8 +52,8 @@ + if (!flag) { return false; - } else { -- Block block = p_208519_2_.func_180495_p(p_208519_4_.func_177977_b()).func_177230_c(); -- if ((block == Blocks.field_196658_i || Block.func_196245_f(block) || block == Blocks.field_150458_ak) && p_208519_4_.func_177956_o() < 256 - i - 1) { -- this.func_175921_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ if (p_208519_2_.func_180495_p(p_208519_4_.func_177977_b()).canSustainPlant(p_208519_2_, p_208519_4_.func_177977_b(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_196675_u) && p_208519_4_.func_177956_o() < p_208519_2_.func_201672_e().func_72800_K() - i - 1) { -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - int i3 = p_208519_3_.nextInt(2); - int j3 = 1; - int k3 = 0; -@@ -68,7 +67,7 @@ - int l2 = k2 - p_208519_4_.func_177952_p(); - if (Math.abs(j2) != i3 || Math.abs(l2) != i3 || i3 <= 0) { - BlockPos blockpos = new BlockPos(i2, j4, k2); -- if (!p_208519_2_.func_180495_p(blockpos).func_200015_d(p_208519_2_, blockpos)) { -+ if (p_208519_2_.func_180495_p(blockpos).canBeReplacedByLeaves(p_208519_2_, blockpos)) { - this.func_202278_a(p_208519_2_, blockpos, field_181646_b); - } +- } else if (func_214585_i(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) { +- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); ++ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) { ++ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); + int i3 = p_208519_3_.nextInt(2); + int j3 = 1; + int k3 = 0; +@@ -67,7 +68,7 @@ + int l2 = k2 - p_208519_4_.func_177952_p(); + if (Math.abs(j2) != i3 || Math.abs(l2) != i3 || i3 <= 0) { + BlockPos blockpos = new BlockPos(i2, j4, k2); +- if (func_214572_g(p_208519_2_, blockpos) || func_214576_j(p_208519_2_, blockpos)) { ++ if (canBeReplacedByLeaves(p_208519_2_, blockpos) || func_214576_j(p_208519_2_, blockpos)) { + this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, field_181646_b, p_208519_5_); } -@@ -91,7 +90,7 @@ + } +@@ -89,7 +90,7 @@ + int i4 = p_208519_3_.nextInt(3); - for(int k4 = 0; k4 < i - i4; ++k4) { - IBlockState iblockstate1 = p_208519_2_.func_180495_p(p_208519_4_.func_177981_b(k4)); -- if (iblockstate1.func_196958_f() || iblockstate1.func_203425_a(BlockTags.field_206952_E)) { -+ if (iblockstate1.isAir(p_208519_2_, p_208519_4_.func_177981_b(k4)) || iblockstate1.func_203425_a(BlockTags.field_206952_E)) { - this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(k4), field_181645_a); - } + for(int k4 = 0; k4 < i - i4; ++k4) { +- if (func_214572_g(p_208519_2_, p_208519_4_.func_177981_b(k4))) { ++ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177981_b(k4))) { + this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(k4), field_181645_a, p_208519_5_); } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/TreeFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/TreeFeature.java.patch index dcffe8676..8007b9f7c 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/TreeFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/TreeFeature.java.patch @@ -1,101 +1,103 @@ --- a/net/minecraft/world/gen/feature/TreeFeature.java +++ b/net/minecraft/world/gen/feature/TreeFeature.java -@@ -21,6 +21,7 @@ - private final boolean field_76531_b; - private final IBlockState field_76532_c; - private final IBlockState field_76530_d; -+ protected net.minecraftforge.common.IPlantable sapling = (net.minecraftforge.common.IPlantable)Blocks.field_196674_t; - - public TreeFeature(boolean p_i2027_1_) { - this(p_i2027_1_, 4, field_181653_a, field_181654_b, false); -@@ -37,7 +38,7 @@ - public boolean func_208519_a(Set p_208519_1_, IWorld p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_) { +@@ -38,7 +38,7 @@ + public boolean func_208519_a(Set p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) { int i = this.func_208534_a(p_208519_3_); boolean flag = true; - if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= 256) { -+ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.func_201672_e().func_72800_K()) { ++ if (p_208519_4_.func_177956_o() >= 1 && p_208519_4_.func_177956_o() + i + 1 <= p_208519_2_.getMaxHeight()) { for(int j = p_208519_4_.func_177956_o(); j <= p_208519_4_.func_177956_o() + 1 + i; ++j) { int k = 1; if (j == p_208519_4_.func_177956_o()) { -@@ -52,8 +53,8 @@ +@@ -53,8 +53,8 @@ for(int l = p_208519_4_.func_177958_n() - k; l <= p_208519_4_.func_177958_n() + k && flag; ++l) { for(int i1 = p_208519_4_.func_177952_p() - k; i1 <= p_208519_4_.func_177952_p() + k && flag; ++i1) { - if (j >= 0 && j < 256) { -- if (!this.func_150523_a(p_208519_2_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c())) { -+ if (j >= 0 && j < p_208519_2_.func_201672_e().func_72800_K()) { -+ if (!this.canGrowInto(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { +- if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { ++ if (j >= 0 && j < p_208519_2_.getMaxHeight()) { ++ if (!canBeReplacedByLog(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { flag = false; } } else { -@@ -66,9 +67,8 @@ +@@ -66,8 +66,8 @@ + if (!flag) { return false; - } else { -- Block block = p_208519_2_.func_180495_p(p_208519_4_.func_177977_b()).func_177230_c(); -- if ((block == Blocks.field_196658_i || Block.func_196245_f(block) || block == Blocks.field_150458_ak) && p_208519_4_.func_177956_o() < 256 - i - 1) { -- this.func_175921_a(p_208519_2_, p_208519_4_.func_177977_b()); -+ if (p_208519_2_.func_180495_p(p_208519_4_.func_177977_b()).canSustainPlant(p_208519_2_, p_208519_4_.func_177977_b(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_196674_t) && p_208519_4_.func_177956_o() < p_208519_2_.func_201672_e().func_72800_K() - i - 1) { -+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); - int k2 = 3; - int l2 = 0; +- } else if (func_214585_i(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) { +- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b()); ++ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) { ++ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_); + int j2 = 3; + int k2 = 0; -@@ -85,7 +85,7 @@ - BlockPos blockpos = new BlockPos(k1, i3, i2); - IBlockState iblockstate = p_208519_2_.func_180495_p(blockpos); - Material material = iblockstate.func_185904_a(); -- if (iblockstate.func_196958_f() || iblockstate.func_203425_a(BlockTags.field_206952_E) || material == Material.field_151582_l) { -+ if (iblockstate.canBeReplacedByLeaves(p_208519_2_, blockpos) || material == Material.field_151582_l) { - this.func_202278_a(p_208519_2_, blockpos, this.field_76530_d); +@@ -82,7 +82,7 @@ + int i2 = l1 - p_208519_4_.func_177952_p(); + if (Math.abs(k1) != j4 || Math.abs(i2) != j4 || p_208519_3_.nextInt(2) != 0 && l3 != 0) { + BlockPos blockpos = new BlockPos(j1, l2, l1); +- if (func_214572_g(p_208519_2_, blockpos) || func_214576_j(p_208519_2_, blockpos)) { ++ if (canBeReplacedByLeaves(p_208519_2_, blockpos) || func_214576_j(p_208519_2_, blockpos)) { + this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, this.field_76530_d, p_208519_5_); + } + } +@@ -91,22 +91,22 @@ + } + + for(int i3 = 0; i3 < i; ++i3) { +- if (func_214572_g(p_208519_2_, p_208519_4_.func_177981_b(i3)) || func_214576_j(p_208519_2_, p_208519_4_.func_177981_b(i3))) { ++ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177981_b(i3)) || func_214576_j(p_208519_2_, p_208519_4_.func_177981_b(i3))) { + this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(i3), this.field_76532_c, p_208519_5_); + if (this.field_76531_b && i3 > 0) { +- if (p_208519_3_.nextInt(3) > 0 && func_214574_b(p_208519_2_, p_208519_4_.func_177982_a(-1, i3, 0))) { ++ if (p_208519_3_.nextInt(3) > 0 && isAir(p_208519_2_, p_208519_4_.func_177982_a(-1, i3, 0))) { + this.func_181651_a(p_208519_2_, p_208519_4_.func_177982_a(-1, i3, 0), VineBlock.field_176278_M); + } + +- if (p_208519_3_.nextInt(3) > 0 && func_214574_b(p_208519_2_, p_208519_4_.func_177982_a(1, i3, 0))) { ++ if (p_208519_3_.nextInt(3) > 0 && isAir(p_208519_2_, p_208519_4_.func_177982_a(1, i3, 0))) { + this.func_181651_a(p_208519_2_, p_208519_4_.func_177982_a(1, i3, 0), VineBlock.field_176280_O); + } + +- if (p_208519_3_.nextInt(3) > 0 && func_214574_b(p_208519_2_, p_208519_4_.func_177982_a(0, i3, -1))) { ++ if (p_208519_3_.nextInt(3) > 0 && isAir(p_208519_2_, p_208519_4_.func_177982_a(0, i3, -1))) { + this.func_181651_a(p_208519_2_, p_208519_4_.func_177982_a(0, i3, -1), VineBlock.field_176279_N); + } + +- if (p_208519_3_.nextInt(3) > 0 && func_214574_b(p_208519_2_, p_208519_4_.func_177982_a(0, i3, 1))) { ++ if (p_208519_3_.nextInt(3) > 0 && isAir(p_208519_2_, p_208519_4_.func_177982_a(0, i3, 1))) { + this.func_181651_a(p_208519_2_, p_208519_4_.func_177982_a(0, i3, 1), VineBlock.field_176273_b); + } + } +@@ -127,19 +127,19 @@ + BlockPos blockpos4 = blockpos$mutableblockpos1.func_177974_f(); + BlockPos blockpos1 = blockpos$mutableblockpos1.func_177978_c(); + BlockPos blockpos2 = blockpos$mutableblockpos1.func_177968_d(); +- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos3)) { ++ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos3)) { + this.func_181650_b(p_208519_2_, blockpos3, VineBlock.field_176278_M); + } + +- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos4)) { ++ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos4)) { + this.func_181650_b(p_208519_2_, blockpos4, VineBlock.field_176280_O); + } + +- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos1)) { ++ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos1)) { + this.func_181650_b(p_208519_2_, blockpos1, VineBlock.field_176279_N); + } + +- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos2)) { ++ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos2)) { + this.func_181650_b(p_208519_2_, blockpos2, VineBlock.field_176273_b); } } -@@ -96,7 +96,7 @@ - for(int j3 = 0; j3 < i; ++j3) { - IBlockState iblockstate1 = p_208519_2_.func_180495_p(p_208519_4_.func_177981_b(j3)); - Material material1 = iblockstate1.func_185904_a(); -- if (iblockstate1.func_196958_f() || iblockstate1.func_203425_a(BlockTags.field_206952_E) || material1 == Material.field_151582_l) { -+ if (iblockstate1.canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177981_b(j3)) || material1 == Material.field_151582_l) { - this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(j3), this.field_76532_c); - if (this.field_76531_b && j3 > 0) { - if (p_208519_3_.nextInt(3) > 0 && p_208519_2_.func_175623_d(p_208519_4_.func_177982_a(-1, j3, 0))) { -@@ -132,19 +132,19 @@ - BlockPos blockpos2 = blockpos$mutableblockpos1.func_177974_f(); - BlockPos blockpos3 = blockpos$mutableblockpos1.func_177978_c(); - BlockPos blockpos4 = blockpos$mutableblockpos1.func_177968_d(); -- if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_180495_p(blockpos1).func_196958_f()) { -+ if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_175623_d(blockpos1)) { - this.func_181650_b(p_208519_2_, blockpos1, BlockVine.field_176278_M); - } - -- if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_180495_p(blockpos2).func_196958_f()) { -+ if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_175623_d(blockpos2)) { - this.func_181650_b(p_208519_2_, blockpos2, BlockVine.field_176280_O); - } - -- if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_180495_p(blockpos3).func_196958_f()) { -+ if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_175623_d(blockpos3)) { - this.func_181650_b(p_208519_2_, blockpos3, BlockVine.field_176279_N); - } - -- if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_180495_p(blockpos4).func_196958_f()) { -+ if (p_208519_3_.nextInt(4) == 0 && p_208519_2_.func_175623_d(blockpos4)) { - this.func_181650_b(p_208519_2_, blockpos4, BlockVine.field_176273_b); - } - } -@@ -190,10 +190,15 @@ +@@ -184,7 +184,7 @@ this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); int i = 4; -- for(BlockPos blockpos = p_181650_2_.func_177977_b(); p_181650_1_.func_180495_p(blockpos).func_196958_f() && i > 0; --i) { -+ for(BlockPos blockpos = p_181650_2_.func_177977_b(); p_181650_1_.func_175623_d(blockpos) && i > 0; --i) { +- for(BlockPos blockpos = p_181650_2_.func_177977_b(); func_214574_b(p_181650_1_, blockpos) && i > 0; --i) { ++ for(BlockPos blockpos = p_181650_2_.func_177977_b(); isAir(p_181650_1_, blockpos) && i > 0; --i) { this.func_181651_a(p_181650_1_, blockpos, p_181650_3_); blockpos = blockpos.func_177977_b(); } - - } -+ -+ public TreeFeature setSapling(net.minecraftforge.common.IPlantable sapling) { -+ this.sapling = sapling; -+ return this; -+ } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/VinesFeature.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/VinesFeature.java.patch index f6808db67..8bae2413a 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/VinesFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/VinesFeature.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/gen/feature/VinesFeature.java +++ b/net/minecraft/world/gen/feature/VinesFeature.java -@@ -14,7 +14,7 @@ - public boolean func_212245_a(IWorld p_212245_1_, IChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { +@@ -21,7 +21,7 @@ + public boolean func_212245_a(IWorld p_212245_1_, ChunkGenerator p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_) { BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(p_212245_4_); - for(int i = p_212245_4_.func_177956_o(); i < 256; ++i) { -+ for(int i = p_212245_4_.func_177956_o(); i < p_212245_1_.func_201672_e().func_72800_K(); ++i) { ++ for(int i = p_212245_4_.func_177956_o(); i < p_212245_1_.func_201672_e().func_201675_m().getHeight(); ++i) { blockpos$mutableblockpos.func_189533_g(p_212245_4_); blockpos$mutableblockpos.func_196234_d(p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4), 0, p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4)); blockpos$mutableblockpos.func_185336_p(i); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/EndCityStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/EndCityStructure.java.patch deleted file mode 100644 index bd64c6884..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/EndCityStructure.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/net/minecraft/world/gen/feature/structure/EndCityStructure.java -+++ b/net/minecraft/world/gen/feature/structure/EndCityStructure.java -@@ -110,5 +110,15 @@ - public boolean func_75069_d() { - return this.field_186163_c; - } -+ -+ //Forge: Fix losing of 'valid' flag on world reload. TODO: Remove in 1.14 as vanilla fixed. -+ public void func_143022_a(net.minecraft.nbt.NBTTagCompound tag) { -+ super.func_143022_a(tag); -+ tag.func_74757_a("Valid", this.field_186163_c); -+ } -+ public void func_143017_b(net.minecraft.nbt.NBTTagCompound tag) { -+ super.func_143017_b(tag); -+ this.field_186163_c = tag.func_74764_b("Valid") && tag.func_74767_n("Valid"); -+ } - } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/StructurePiece.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/StructurePiece.java.patch index 299cef93f..928b47db4 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/StructurePiece.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/StructurePiece.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/gen/feature/structure/StructurePiece.java +++ b/net/minecraft/world/gen/feature/structure/StructurePiece.java -@@ -48,6 +48,9 @@ +@@ -55,6 +55,9 @@ } - public final NBTTagCompound func_143010_b() { -+ if (StructureIO.func_143036_a(this) == null) { // FORGE: Friendlier error then the Null String error below. -+ throw new RuntimeException("StructureComponent \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + public final CompoundNBT func_143010_b() { ++ if (Registry.field_218362_C.func_177774_c(this.func_214807_k()) == null) { // FORGE: Friendlier error then the Null String error below. ++ throw new RuntimeException("StructurePiece \"" + this.getClass().getName() + "\": \"" + this.func_214807_k() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + } - NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.func_74778_a("id", StructureIO.func_143036_a(this)); - nbttagcompound.func_74782_a("BB", this.field_74887_e.func_151535_h()); + CompoundNBT compoundnbt = new CompoundNBT(); + compoundnbt.func_74778_a("id", Registry.field_218362_C.func_177774_c(this.func_214807_k()).toString()); + compoundnbt.func_218657_a("BB", this.field_74887_e.func_151535_h()); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/StructureStart.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/StructureStart.java.patch index 7063d5b1e..7403f42e1 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/StructureStart.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/structure/StructureStart.java.patch @@ -1,22 +1,12 @@ --- a/net/minecraft/world/gen/feature/structure/StructureStart.java +++ b/net/minecraft/world/gen/feature/structure/StructureStart.java -@@ -72,6 +72,9 @@ - public NBTTagCompound func_143021_a(int p_143021_1_, int p_143021_2_) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); +@@ -80,6 +80,9 @@ + public CompoundNBT func_143021_a(int p_143021_1_, int p_143021_2_) { + CompoundNBT compoundnbt = new CompoundNBT(); if (this.func_75069_d()) { -+ if (StructureIO.func_143033_a(this) == null) { // FORGE: This is just a more friendly error instead of the 'Null String' below -+ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); ++ if (Registry.field_218361_B.func_177774_c(this.func_214627_k()) == null) { // FORGE: This is just a more friendly error instead of the 'Null String' below ++ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\": \"" + this.func_214627_k() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + } - nbttagcompound.func_74778_a("id", StructureIO.func_143033_a(this)); - nbttagcompound.func_74778_a("biome", IRegistry.field_212624_m.func_177774_c(this.field_202505_e).toString()); - nbttagcompound.func_74768_a("ChunkX", p_143021_1_); -@@ -109,7 +112,8 @@ - NBTTagList nbttaglist = p_143020_2_.func_150295_c("Children", 10); - - for(int i = 0; i < nbttaglist.size(); ++i) { -- this.field_75075_a.add(StructureIO.func_143032_b(nbttaglist.func_150305_b(i), p_143020_1_)); -+ StructurePiece tmp = StructureIO.func_143032_b(nbttaglist.func_150305_b(i), p_143020_1_); -+ if (tmp != null) this.field_75075_a.add(tmp); //Forge: Prevent NPEs further down the line when a componenet can't be loaded. - } - - this.func_143017_b(p_143020_2_); + compoundnbt.func_74778_a("id", Registry.field_218361_B.func_177774_c(this.func_214627_k()).toString()); + compoundnbt.func_74778_a("biome", Registry.field_212624_m.func_177774_c(this.field_202505_e).toString()); + compoundnbt.func_74768_a("ChunkX", p_143021_1_); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/VillagePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/VillagePieces.java.patch deleted file mode 100644 index ae015ba5b..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/VillagePieces.java.patch +++ /dev/null @@ -1,103 +0,0 @@ ---- a/net/minecraft/world/gen/feature/structure/VillagePieces.java -+++ b/net/minecraft/world/gen/feature/structure/VillagePieces.java -@@ -64,6 +64,7 @@ - list.add(new VillagePieces.PieceWeight(VillagePieces.Field2.class, 3, MathHelper.func_76136_a(p_75084_0_, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); - list.add(new VillagePieces.PieceWeight(VillagePieces.House2.class, 15, MathHelper.func_76136_a(p_75084_0_, 0, 1 + p_75084_1_))); - list.add(new VillagePieces.PieceWeight(VillagePieces.House3.class, 8, MathHelper.func_76136_a(p_75084_0_, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.addExtraVillageComponents(list, p_75084_0_, p_75084_1_); - Iterator iterator = list.iterator(); - - while(iterator.hasNext()) { -@@ -111,6 +112,8 @@ - villagepieces$village = VillagePieces.House2.func_175855_a(p_176065_0_, p_176065_2_, p_176065_3_, p_176065_4_, p_176065_5_, p_176065_6_, p_176065_7_, p_176065_8_); - } else if (oclass == VillagePieces.House3.class) { - villagepieces$village = VillagePieces.House3.func_175849_a(p_176065_0_, p_176065_2_, p_176065_3_, p_176065_4_, p_176065_5_, p_176065_6_, p_176065_7_, p_176065_8_); -+ } else { -+ villagepieces$village = net.minecraftforge.fml.common.registry.VillagerRegistry.getVillageComponent(p_176065_1_, p_176065_0_, p_176065_2_, p_176065_3_, p_176065_4_, p_176065_5_, p_176065_6_, p_176065_7_, p_176065_8_); - } - - return villagepieces$village; -@@ -1288,17 +1291,24 @@ - public List field_74931_h; - public List field_74932_i = Lists.newArrayList(); - public List field_74930_j = Lists.newArrayList(); -+ public @javax.annotation.Nullable net.minecraft.world.biome.Biome biome; - - public Start() { - } - - public Start(int p_i48769_1_, Random p_i48769_2_, int p_i48769_3_, int p_i48769_4_, List p_i48769_5_, VillageConfig p_i48769_6_) { -+ this(p_i48769_1_, p_i48769_2_, p_i48769_3_, p_i48769_4_, p_i48769_5_, p_i48769_6_, null); -+ } -+ -+ public Start(int p_i48769_1_, Random p_i48769_2_, int p_i48769_3_, int p_i48769_4_, List p_i48769_5_, VillageConfig p_i48769_6_, net.minecraft.world.biome.Biome biome) { - super((VillagePieces.Start)null, 0, p_i48769_2_, p_i48769_3_, p_i48769_4_); - this.field_74931_h = p_i48769_5_; - this.field_74928_c = p_i48769_6_.field_202461_a; - this.field_189928_h = p_i48769_6_.field_202462_b; - this.func_202579_a(this.field_189928_h); - this.field_189929_i = p_i48769_2_.nextInt(50) == 0; -+ this.biome = biome; -+ this.startPiece = this; - } - } - -@@ -1363,11 +1373,12 @@ - } - } - -- abstract static class Village extends StructurePiece { -+ public abstract static class Village extends StructurePiece { - protected int field_143015_k = -1; - private int field_74896_a; - protected VillagePieces.Type field_189928_h; - protected boolean field_189929_i; -+ protected VillagePieces.Start startPiece; - - public Village() { - } -@@ -1377,6 +1388,7 @@ - if (p_i2107_1_ != null) { - this.field_189928_h = p_i2107_1_.field_189928_h; - this.field_189929_i = p_i2107_1_.field_189929_i; -+ this.startPiece = p_i2107_1_; - } - - } -@@ -1480,13 +1492,14 @@ - EntityZombieVillager entityzombievillager = new EntityZombieVillager(p_74893_1_.func_201672_e()); - entityzombievillager.func_70012_b((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F); - entityzombievillager.func_204210_a(p_74893_1_.func_175649_E(new BlockPos(entityzombievillager)), (IEntityLivingData)null, (NBTTagCompound)null); -- entityzombievillager.func_190733_a(this.func_180779_c(i, 0)); -+ entityzombievillager.setProfession(this.chooseForgeProfession(i, net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER.orElseThrow(() -> new IllegalStateException("Farmer profession not initialized?")))); - entityzombievillager.func_110163_bv(); - p_74893_1_.func_72838_d(entityzombievillager); - } else { - EntityVillager entityvillager = new EntityVillager(p_74893_1_.func_201672_e()); - entityvillager.func_70012_b((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F); -- entityvillager.func_70938_b(this.func_180779_c(i, p_74893_1_.func_201674_k().nextInt(6))); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(entityvillager, p_74893_1_.func_201674_k()); -+ entityvillager.setProfession(this.chooseForgeProfession(i, entityvillager.getProfessionForge())); - entityvillager.func_190672_a(p_74893_1_.func_175649_E(new BlockPos(entityvillager)), (IEntityLivingData)null, (NBTTagCompound)null, false); - p_74893_1_.func_72838_d(entityvillager); - } -@@ -1495,11 +1508,19 @@ - } - } - -+ @Deprecated // Use Forge version below - protected int func_180779_c(int p_180779_1_, int p_180779_2_) { - return p_180779_2_; - } -+ -+ protected net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession chooseForgeProfession(int count, net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof) { -+ return net.minecraftforge.fml.common.registry.VillagerRegistry.getById(func_180779_c(count, net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof))); -+ } - - protected IBlockState func_175847_a(IBlockState p_175847_1_) { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID event = new net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, p_175847_1_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.DENY) return event.getReplacement(); - Block block = p_175847_1_.func_177230_c(); - if (this.field_189928_h == VillagePieces.Type.SANDSTONE) { - if (block.func_203417_a(BlockTags.field_200031_h) || block == Blocks.field_150347_e) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/VillageStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/VillageStructure.java.patch deleted file mode 100644 index 9c04beb37..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/VillageStructure.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/feature/structure/VillageStructure.java -+++ b/net/minecraft/world/gen/feature/structure/VillageStructure.java -@@ -67,7 +67,7 @@ - super(p_i48753_4_, p_i48753_5_, p_i48753_6_, p_i48753_3_, p_i48753_1_.func_72905_C()); - VillageConfig villageconfig = (VillageConfig)p_i48753_2_.func_202087_b(p_i48753_6_, Feature.field_202328_f); - List list = VillagePieces.func_75084_a(p_i48753_3_, villageconfig.field_202461_a); -- VillagePieces.Start villagepieces$start = new VillagePieces.Start(0, p_i48753_3_, (p_i48753_4_ << 4) + 2, (p_i48753_5_ << 4) + 2, list, villageconfig); -+ VillagePieces.Start villagepieces$start = new VillagePieces.Start(0, p_i48753_3_, (p_i48753_4_ << 4) + 2, (p_i48753_5_ << 4) + 2, list, villageconfig, p_i48753_6_); - this.field_75075_a.add(villagepieces$start); - villagepieces$start.func_74861_a(villagepieces$start, this.field_75075_a, p_i48753_3_); - List list1 = villagepieces$start.field_74930_j; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/structure/WoodlandMansionStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/structure/WoodlandMansionStructure.java.patch deleted file mode 100644 index 401edcdd7..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/structure/WoodlandMansionStructure.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/net/minecraft/world/gen/feature/structure/WoodlandMansionStructure.java -+++ b/net/minecraft/world/gen/feature/structure/WoodlandMansionStructure.java -@@ -143,5 +143,15 @@ - public boolean func_75069_d() { - return this.field_191093_c; - } -+ -+ //Forge: Fix losing of 'valid' flag on world reload. TODO: Remove in 1.14 as vanilla fixed. -+ public void func_143022_a(net.minecraft.nbt.NBTTagCompound tag) { -+ super.func_143022_a(tag); -+ tag.func_74757_a("Valid", this.field_191093_c); -+ } -+ public void func_143017_b(net.minecraft.nbt.NBTTagCompound tag) { -+ super.func_143017_b(tag); -+ this.field_191093_c = tag.func_74764_b("Valid") && tag.func_74767_n("Valid"); -+ } - } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/template/Template.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/template/Template.java.patch deleted file mode 100644 index 6a65e685e..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/template/Template.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/world/gen/feature/template/Template.java -+++ b/net/minecraft/world/gen/feature/template/Template.java -@@ -185,6 +185,8 @@ - - for(Template.BlockInfo template$blockinfo : list) { - BlockPos blockpos = func_186266_a(p_189960_4_, template$blockinfo.field_186242_a).func_177971_a(p_189960_2_); -+ // Forge: skip processing blocks outside BB to prevent cascading worldgen issues -+ if (mutableboundingbox != null && !mutableboundingbox.func_175898_b(blockpos)) continue; - Template.BlockInfo template$blockinfo1 = p_189960_3_ != null ? p_189960_3_.func_189943_a(p_189960_1_, blockpos, template$blockinfo) : template$blockinfo; - if (template$blockinfo1 != null) { - Block block1 = template$blockinfo1.field_186243_b.func_177230_c(); -@@ -477,7 +479,7 @@ - - for(int l = 1; l < this.field_204769_a.size(); ++l) { - Template.BasicPalette template$basicpalette1 = list.get(l); -- template$basicpalette1.func_189956_a((this.field_204769_a.get(j).get(j)).field_186243_b, k); -+ template$basicpalette1.func_189956_a((this.field_204769_a.get(l).get(j)).field_186243_b, k); //Forge: j -> l, Fixes vanilla typo causing AIOOB writing template with multiple pellets. - } - } - diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch similarity index 78% rename from patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch rename to patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch index 6d4e5ca79..ed7fb2cae 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/BiomeLayer.java.patch @@ -1,9 +1,9 @@ ---- a/net/minecraft/world/gen/layer/GenLayerBiome.java -+++ b/net/minecraft/world/gen/layer/GenLayerBiome.java +--- a/net/minecraft/world/gen/layer/BiomeLayer.java ++++ b/net/minecraft/world/gen/layer/BiomeLayer.java @@ -24,17 +24,33 @@ - private static final int field_202740_n = IRegistry.field_212624_m.func_148757_b(Biomes.field_76780_h); - private static final int field_202741_o = IRegistry.field_212624_m.func_148757_b(Biomes.field_76768_g); - private static final int field_202742_p = IRegistry.field_212624_m.func_148757_b(Biomes.field_150584_S); + 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}; @@ -14,7 +14,7 @@ private final OverworldGenSettings field_175973_g; - private int[] field_151623_c = field_202744_r; - public GenLayerBiome(WorldType p_i48641_1_, OverworldGenSettings p_i48641_2_) { + public BiomeLayer(WorldType p_i48641_1_, OverworldGenSettings p_i48641_2_) { + for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) { + com.google.common.collect.ImmutableList biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type); + int idx = type.ordinal(); @@ -46,24 +46,24 @@ } - return this.field_151623_c[p_202726_1_.func_202696_a(this.field_151623_c.length)]; -+ return IRegistry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT, p_202726_1_).biome); ++ 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 IRegistry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM, p_202726_1_).biome); ++ 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 IRegistry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL, p_202726_1_).biome); ++ 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 IRegistry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY, p_202726_1_).biome); ++ return Registry.field_212624_m.func_148757_b(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY, p_202726_1_).biome); default: return field_202735_i; } @@ -72,7 +72,7 @@ } } + -+ protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType type, IContext context) { ++ protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType type, INoiseRandom context) { + java.util.List 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; diff --git a/patches/minecraft/net/minecraft/world/gen/layer/LayerUtil.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/LayerUtil.java.patch index 3fdf5bc26..3102fc5ec 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/LayerUtil.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/LayerUtil.java.patch @@ -1,26 +1,27 @@ --- a/net/minecraft/world/gen/layer/LayerUtil.java +++ b/net/minecraft/world/gen/layer/LayerUtil.java -@@ -69,11 +69,11 @@ +@@ -69,12 +69,11 @@ i = 6; } + i = getModdedBiomeSize(p_202828_0_, i); + - IAreaFactory lvt_7_1_ = func_202829_a(1000L, GenLayerZoom.NORMAL, iareafactory, 0, p_202828_2_); - lvt_7_1_ = GenLayerRiverInit.INSTANCE.func_202713_a((IContextExtended)p_202828_2_.apply(100L), lvt_7_1_); -- IAreaFactory lvt_8_1_ = (new GenLayerBiome(p_202828_0_, p_202828_1_)).func_202713_a(p_202828_2_.apply(200L), iareafactory); -- lvt_8_1_ = func_202829_a(1000L, GenLayerZoom.NORMAL, lvt_8_1_, 2, p_202828_2_); -- lvt_8_1_ = GenLayerBiomeEdge.INSTANCE.func_202713_a((IContextExtended)p_202828_2_.apply(1000L), lvt_8_1_); + IAreaFactory lvt_7_1_ = func_202829_a(1000L, ZoomLayer.NORMAL, iareafactory, 0, p_202828_2_); + lvt_7_1_ = StartRiverLayer.INSTANCE.func_202713_a((IExtendedNoiseRandom)p_202828_2_.apply(100L), lvt_7_1_); +- IAreaFactory lvt_8_1_ = (new BiomeLayer(p_202828_0_, p_202828_1_)).func_202713_a(p_202828_2_.apply(200L), iareafactory); +- lvt_8_1_ = AddBambooForestLayer.INSTANCE.func_202713_a((IExtendedNoiseRandom)p_202828_2_.apply(1001L), lvt_8_1_); +- lvt_8_1_ = func_202829_a(1000L, ZoomLayer.NORMAL, lvt_8_1_, 2, p_202828_2_); +- lvt_8_1_ = EdgeBiomeLayer.INSTANCE.func_202713_a((IExtendedNoiseRandom)p_202828_2_.apply(1000L), lvt_8_1_); + IAreaFactory lvt_8_1_ = p_202828_0_.getBiomeLayer(iareafactory, p_202828_1_, p_202828_2_); - IAreaFactory lvt_9_1_ = func_202829_a(1000L, GenLayerZoom.NORMAL, lvt_7_1_, 2, p_202828_2_); - lvt_8_1_ = GenLayerHills.INSTANCE.func_202707_a((IContextExtended)p_202828_2_.apply(1000L), lvt_8_1_, lvt_9_1_); - lvt_7_1_ = func_202829_a(1000L, GenLayerZoom.NORMAL, lvt_7_1_, 2, p_202828_2_); -@@ -135,6 +135,15 @@ + IAreaFactory lvt_9_1_ = func_202829_a(1000L, ZoomLayer.NORMAL, lvt_7_1_, 2, p_202828_2_); + lvt_8_1_ = HillsLayer.INSTANCE.func_202707_a((IExtendedNoiseRandom)p_202828_2_.apply(1000L), lvt_8_1_, lvt_9_1_); + lvt_7_1_ = func_202829_a(1000L, ZoomLayer.NORMAL, lvt_7_1_, 2, p_202828_2_); +@@ -134,6 +133,15 @@ } } + /* ======================================== FORGE START =====================================*/ -+ public static int getModdedBiomeSize(net.minecraft.world.WorldType worldType, int original) ++ public static int getModdedBiomeSize(WorldType worldType, int original) + { + net.minecraftforge.event.terraingen.WorldTypeEvent.BiomeSize event = new net.minecraftforge.event.terraingen.WorldTypeEvent.BiomeSize(worldType, original); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); diff --git a/patches/minecraft/net/minecraft/world/gen/tasks/ProtoChunkScheduler.java.patch b/patches/minecraft/net/minecraft/world/gen/tasks/ProtoChunkScheduler.java.patch deleted file mode 100644 index ef32ffbd9..000000000 --- a/patches/minecraft/net/minecraft/world/gen/tasks/ProtoChunkScheduler.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/gen/tasks/ProtoChunkScheduler.java -+++ b/net/minecraft/world/gen/tasks/ProtoChunkScheduler.java -@@ -21,6 +21,8 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -+import net.minecraft.util.Scheduler.FutureWrapper; -+ - public class ProtoChunkScheduler extends Scheduler { - private static final Logger field_202873_b = LogManager.getLogger(); - private final World field_202874_c; diff --git a/patches/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch b/patches/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch deleted file mode 100644 index 9734005c5..000000000 --- a/patches/minecraft/net/minecraft/world/lighting/BlockLightEngine.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/lighting/BlockLightEngine.java -+++ b/net/minecraft/world/lighting/BlockLightEngine.java -@@ -12,7 +12,7 @@ - - public void func_202677_a(WorldGenRegion p_202677_1_, IChunk p_202677_2_) { - for(BlockPos blockpos : p_202677_2_.func_201582_h()) { -- this.func_202667_a(p_202677_1_, blockpos, this.func_202670_c(p_202677_1_, blockpos)); -+ this.func_202667_a(p_202677_1_, blockpos, this.func_202670_c((net.minecraft.world.IBlockReader)p_202677_1_, blockpos)); //Forge add typecast to fix obf issue. - this.func_202659_a(p_202677_2_.func_76632_l(), blockpos, this.func_202666_a(p_202677_1_, blockpos)); - } - diff --git a/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch b/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch new file mode 100644 index 000000000..5aa1f3eb9 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/spawner/AbstractSpawner.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/world/spawner/AbstractSpawner.java ++++ b/net/minecraft/world/spawner/AbstractSpawner.java +@@ -126,7 +126,7 @@ + entity.func_70012_b(entity.field_70165_t, entity.field_70163_u, entity.field_70161_v, 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.field_70165_t, (float)entity.field_70163_u, (float)entity.field_70161_v, this)) { + continue; + } + +@@ -282,4 +282,9 @@ + public double func_177223_e() { + return this.field_98284_d; + } ++ ++ @Nullable ++ public Entity getSpawnerEntity() { ++ return null; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch b/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch new file mode 100644 index 000000000..2da3bc6e5 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/spawner/WorldEntitySpawner.java.patch @@ -0,0 +1,96 @@ +--- a/net/minecraft/world/spawner/WorldEntitySpawner.java ++++ b/net/minecraft/world/spawner/WorldEntitySpawner.java +@@ -82,7 +82,7 @@ + } + + if (biome$spawnlistentry == null) { +- biome$spawnlistentry = func_222264_a(chunkgenerator, p_222263_0_, p_222263_1_.field_73012_v, blockpos$mutableblockpos); ++ biome$spawnlistentry = getSpawnList(chunkgenerator, p_222263_0_, p_222263_1_.field_73012_v, blockpos$mutableblockpos, p_222263_1_); + if (biome$spawnlistentry == null) { + break label116; + } +@@ -95,7 +95,7 @@ + } + + EntityType entitytype = biome$spawnlistentry.field_200702_b; +- if (!entitytype.func_200720_b() || !func_222261_a(chunkgenerator, p_222263_0_, biome$spawnlistentry, blockpos$mutableblockpos)) { ++ if (!entitytype.func_200720_b() || !getSpawnList(chunkgenerator, p_222263_0_, biome$spawnlistentry, blockpos$mutableblockpos, p_222263_1_)) { + break label108; + } + +@@ -118,15 +118,17 @@ + } + + mobentity.func_70012_b((double)f, (double)k, (double)f1, p_222263_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); +- if (playerentity.func_70092_e((double)f, (double)k, (double)f1) > 16384.0D && mobentity.func_213397_c(playerentity.func_70092_e((double)f, (double)k, (double)f1)) || !mobentity.func_213380_a(p_222263_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_222263_1_)) { ++ int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_222263_1_, f, k, f1, null); ++ if (playerentity.func_70092_e((double)f, (double)k, (double)f1) > 16384.0D && (canSpawn == 1 || (canSpawn == 0 && mobentity.func_213397_c(playerentity.func_70092_e((double)f, (double)k, (double)f1)))) || !mobentity.func_213380_a(p_222263_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_222263_1_)) { + break label108; + } + ++ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mobentity, p_222263_1_, f, k, f1, null)) + ilivingentitydata = mobentity.func_213386_a(p_222263_1_, p_222263_1_.func_175649_E(new BlockPos(mobentity)), SpawnReason.NATURAL, ilivingentitydata, (CompoundNBT)null); + ++i; + ++j2; + p_222263_1_.func_217376_c(mobentity); +- if (i >= mobentity.func_70641_bl()) { ++ if (i >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(mobentity)) { + return; + } + +@@ -149,13 +151,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 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 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_); + } + +@@ -182,6 +186,13 @@ + + public static boolean func_209382_a(EntitySpawnPlacementRegistry.PlacementType p_209382_0_, IWorldReader p_209382_1_, BlockPos p_209382_2_, @Nullable EntityType p_209382_3_) { + 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(); +@@ -192,14 +203,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; + } + } + +@@ -242,6 +251,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) == -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); diff --git a/patches/minecraft/net/minecraft/world/storage/DimensionSavedDataManager.java.patch b/patches/minecraft/net/minecraft/world/storage/DimensionSavedDataManager.java.patch index a56c933a6..70c93465b 100644 --- a/patches/minecraft/net/minecraft/world/storage/DimensionSavedDataManager.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/DimensionSavedDataManager.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/storage/DimensionSavedDataManager.java +++ b/net/minecraft/world/storage/DimensionSavedDataManager.java -@@ -38,6 +38,7 @@ +@@ -47,6 +47,7 @@ @Nullable - public T func_201067_a(Function p_201067_1_, String p_201067_2_) { - WorldSavedData worldsaveddata = this.field_212778_c.get(p_201067_2_); + public T func_215753_b(Supplier p_215753_1_, String p_215753_2_) { + 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_212780_e != null) { + if (worldsaveddata == null) { try { - File file1 = this.field_212780_e.func_212423_a(this.field_212777_b, p_201067_2_); -@@ -45,6 +46,9 @@ - worldsaveddata = (WorldSavedData)p_201067_1_.apply(p_201067_2_); - worldsaveddata.func_76184_a(func_212774_a(this.field_212780_e, this.field_212777_b, p_201067_2_, 1631).func_74775_l("data")); - this.field_212778_c.put(p_201067_2_, worldsaveddata); + File file1 = this.func_215754_a(p_215753_2_); +@@ -55,6 +56,9 @@ + CompoundNBT compoundnbt = this.func_215755_a(p_215753_2_, SharedConstants.func_215069_a().getWorldVersion()); + worldsaveddata.func_76184_a(compoundnbt.func_74775_l("data")); + this.field_212778_c.put(p_215753_2_, worldsaveddata); + } else { -+ this.field_212778_c.put(p_201067_2_, net.minecraftforge.common.util.DummyWorldSaveData.DUMMY); ++ this.field_212778_c.put(p_215753_2_, net.minecraftforge.common.util.DummyWorldSaveData.DUMMY); + return null; } } catch (Exception exception) { - field_212776_a.error("Error loading saved data: {}", p_201067_2_, exception); + field_212776_a.error("Error loading saved data: {}", p_215753_2_, exception); diff --git a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch index 8bc790ddd..cddaae593 100644 --- a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/storage/MapData.java +++ b/net/minecraft/world/storage/MapData.java -@@ -198,8 +198,8 @@ +@@ -210,8 +210,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)); diff --git a/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch new file mode 100644 index 000000000..b5aad3d86 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch @@ -0,0 +1,27 @@ +--- 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; diff --git a/patches/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch deleted file mode 100644 index ffd4299c5..000000000 --- a/patches/minecraft/net/minecraft/world/storage/SaveFormatOld.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/net/minecraft/world/storage/SaveFormatOld.java -+++ b/net/minecraft/world/storage/SaveFormatOld.java -@@ -86,13 +86,23 @@ - - @Nullable - public static WorldInfo func_186353_a(File p_186353_0_, DataFixer p_186353_1_) { -+ return getWorldData(p_186353_0_, p_186353_1_, null); -+ } -+ -+ @Nullable -+ public static WorldInfo getWorldData(File p_186353_0_, DataFixer p_186353_1_, @Nullable SaveHandler saveHandler) { - try { - NBTTagCompound nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(p_186353_0_)); - NBTTagCompound nbttagcompound1 = nbttagcompound.func_74775_l("Data"); - NBTTagCompound nbttagcompound2 = nbttagcompound1.func_150297_b("Player", 10) ? nbttagcompound1.func_74775_l("Player") : null; - nbttagcompound1.func_82580_o("Player"); - int i = nbttagcompound1.func_150297_b("DataVersion", 99) ? nbttagcompound1.func_74762_e("DataVersion") : -1; -- return new WorldInfo(NBTUtil.func_210822_a(p_186353_1_, DataFixTypes.LEVEL, nbttagcompound1, i), p_186353_1_, i, nbttagcompound2); -+ WorldInfo ret = new WorldInfo(NBTUtil.func_210822_a(p_186353_1_, DataFixTypes.LEVEL, nbttagcompound1, i), p_186353_1_, i, nbttagcompound2); -+ if (saveHandler != null) -+ net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataLoad(saveHandler, ret, nbttagcompound); -+ return ret; -+ } catch (net.minecraftforge.fml.StartupQuery.AbortedException e) { -+ throw e; - } catch (Exception exception) { - field_151479_b.error("Exception reading {}", p_186353_0_, exception); - return null; diff --git a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch index 7faa995a5..977ff5d36 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -1,65 +1,69 @@ --- a/net/minecraft/world/storage/SaveHandler.java +++ b/net/minecraft/world/storage/SaveHandler.java -@@ -94,14 +94,14 @@ +@@ -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_75770_b, "level.dat"); + File file1 = new File(this.field_215774_c, "level.dat"); if (file1.exists()) { -- WorldInfo worldinfo = SaveFormatOld.func_186353_a(file1, this.field_186341_a); -+ WorldInfo worldinfo = SaveFormatOld.getWorldData(file1, this.field_186341_a, this); +- 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_75770_b, "level.dat_old"); -- return file1.exists() ? SaveFormatOld.func_186353_a(file1, this.field_186341_a) : null; -+ return file1.exists() ? SaveFormatOld.getWorldData(file1, this.field_186341_a, this) : null; + 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_75755_a(WorldInfo p_75755_1_, @Nullable NBTTagCompound p_75755_2_) { -@@ -109,6 +109,8 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.func_74782_a("Data", nbttagcompound); - -+ net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataSave(this, p_75755_1_, nbttagcompound1); -+ - try { - File file1 = new File(this.field_75770_b, "level.dat_new"); - File file2 = new File(this.field_75770_b, "level.dat_old"); -@@ -148,6 +150,7 @@ + public void func_75761_a(WorldInfo p_75761_1_) { +@@ -142,6 +144,7 @@ } file1.renameTo(file2); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, this.field_75771_c, p_75753_1_.func_110124_au().toString()); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, field_215775_d, p_75753_1_.func_110124_au().toString()); } catch (Exception var5) { - field_151478_a.warn("Failed to save player data for {}", (Object)p_75753_1_.func_200200_C_().getString()); + field_215773_b.warn("Failed to save player data for {}", (Object)p_75753_1_.func_200200_C_().getString()); } -@@ -171,6 +174,7 @@ - int i = nbttagcompound.func_150297_b("DataVersion", 3) ? nbttagcompound.func_74762_e("DataVersion") : -1; - p_75752_1_.func_70020_e(NBTUtil.func_210822_a(this.field_186341_a, DataFixTypes.PLAYER, nbttagcompound, i)); +@@ -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_75771_c, p_75752_1_.func_110124_au().toString()); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, field_215775_d, p_75752_1_.func_110124_au().toString()); - return nbttagcompound; + return compoundnbt; } -@@ -210,4 +214,20 @@ +@@ -191,4 +195,24 @@ public DataFixer func_197718_i() { - return this.field_186341_a; + return this.field_215772_a; } + -+ public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player) { ++ public CompoundNBT getPlayerNBT(net.minecraft.entity.player.ServerPlayerEntity player) { + try { -+ File file1 = new File(this.field_75771_c, player.func_189512_bd() + ".dat"); ++ File file1 = new File(this.field_215775_d, player.func_189512_bd() + ".dat"); + if (file1.exists() && file1.isFile()) { -+ NBTTagCompound nbt = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); ++ CompoundNBT nbt = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); + if (nbt != null) { -+ nbt = NBTUtil.func_210822_a(this.field_186341_a, DataFixTypes.PLAYER, nbt, nbt.func_150297_b("DataVersion", 3) ? nbt.func_74762_e("DataVersion") : -1); ++ 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_151478_a.warn("Failed to load player data for " + player.func_200200_C_()); ++ field_215773_b.warn("Failed to load player data for " + player.func_200200_C_()); + } + return null; ++ } ++ ++ public File getPlayerFolder() { ++ return field_215775_d; + } } diff --git a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch index b53e17b67..83666be1d 100644 --- a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/storage/WorldInfo.java +++ b/net/minecraft/world/storage/WorldInfo.java -@@ -325,6 +325,7 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); +@@ -349,6 +349,7 @@ + CompoundNBT compoundnbt1 = new CompoundNBT(); - for(Entry entry : this.field_186348_N.entrySet()) { + for(Entry entry : this.field_186348_N.entrySet()) { + if (entry.getValue() == null || entry.getValue().isEmpty()) continue; - nbttagcompound1.func_74782_a(String.valueOf(entry.getKey().func_186068_a()), entry.getValue()); + compoundnbt1.func_218657_a(String.valueOf(entry.getKey().func_186068_a()), entry.getValue()); } diff --git a/patches/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch b/patches/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch index 05a74366f..0e8ce906d 100644 --- a/patches/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/WorldSavedData.java.patch @@ -1,26 +1,26 @@ --- a/net/minecraft/world/storage/WorldSavedData.java +++ b/net/minecraft/world/storage/WorldSavedData.java -@@ -2,7 +2,7 @@ - - import net.minecraft.nbt.NBTTagCompound; +@@ -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 { ++public abstract class WorldSavedData implements net.minecraftforge.common.util.INBTSerializable { + private static final Logger field_215159_a = LogManager.getLogger(); private final String field_76190_i; private boolean field_76189_a; - -@@ -29,4 +29,14 @@ - public String func_195925_e() { - return this.field_76190_i; +@@ -53,4 +53,14 @@ + this.func_76186_a(false); + } } + + @Override -+ public void deserializeNBT(NBTTagCompound nbt) { ++ public void deserializeNBT(CompoundNBT nbt) { + func_76184_a(nbt); + } + + @Override -+ public NBTTagCompound serializeNBT() { -+ return func_189551_b(new NBTTagCompound()); ++ public CompoundNBT serializeNBT() { ++ return func_189551_b(new CompoundNBT()); + } } diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootContext.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/LootContext.java.patch index edc8abc32..34c13b68f 100644 --- a/patches/minecraft/net/minecraft/world/storage/loot/LootContext.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/loot/LootContext.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/world/storage/loot/LootContext.java +++ b/net/minecraft/world/storage/loot/LootContext.java -@@ -91,6 +91,10 @@ - } +@@ -76,6 +76,10 @@ + return this.field_186499_b; } + public int getLootingModifier() { -+ return net.minecraftforge.common.ForgeHooks.getLootingLevel(func_186493_a(), func_186492_c(), field_186503_f); ++ return net.minecraftforge.common.ForgeHooks.getLootingLevel(func_216031_c(LootParameters.field_216281_a), func_216031_c(LootParameters.field_216284_d), func_216031_c(LootParameters.field_216283_c)); + } + public static class Builder { - private final WorldServer field_186474_a; - private float field_186475_b; + private final ServerWorld field_186474_a; + private final Map, Object> field_216025_b = Maps.newIdentityHashMap(); diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootEntryEmpty.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/LootEntryEmpty.java.patch deleted file mode 100644 index ef6af5a83..000000000 --- a/patches/minecraft/net/minecraft/world/storage/loot/LootEntryEmpty.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/world/storage/loot/LootEntryEmpty.java -+++ b/net/minecraft/world/storage/loot/LootEntryEmpty.java -@@ -9,8 +9,8 @@ - import net.minecraft.world.storage.loot.conditions.LootCondition; - - public class LootEntryEmpty extends LootEntry { -- public LootEntryEmpty(int p_i46645_1_, int p_i46645_2_, LootCondition[] p_i46645_3_) { -- super(p_i46645_1_, p_i46645_2_, p_i46645_3_); -+ public LootEntryEmpty(int p_i46645_1_, int p_i46645_2_, LootCondition[] p_i46645_3_, String entryName) { -+ super(p_i46645_1_, p_i46645_2_, p_i46645_3_, entryName); - } - - public void func_186363_a(Collection p_186363_1_, Random p_186363_2_, LootContext p_186363_3_) { -@@ -20,6 +20,6 @@ - } - - public static LootEntryEmpty func_186372_a(JsonObject p_186372_0_, JsonDeserializationContext p_186372_1_, int p_186372_2_, int p_186372_3_, LootCondition[] p_186372_4_) { -- return new LootEntryEmpty(p_186372_2_, p_186372_3_, p_186372_4_); -+ return new LootEntryEmpty(p_186372_2_, p_186372_3_, p_186372_4_, net.minecraftforge.common.ForgeHooks.readLootEntryName(p_186372_0_, "empty")); - } - } diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootEntryTable.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/LootEntryTable.java.patch deleted file mode 100644 index 2b16160a3..000000000 --- a/patches/minecraft/net/minecraft/world/storage/loot/LootEntryTable.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/world/storage/loot/LootEntryTable.java -+++ b/net/minecraft/world/storage/loot/LootEntryTable.java -@@ -13,8 +13,8 @@ - public class LootEntryTable extends LootEntry { - protected final ResourceLocation field_186371_a; - -- public LootEntryTable(ResourceLocation p_i46639_1_, int p_i46639_2_, int p_i46639_3_, LootCondition[] p_i46639_4_) { -- super(p_i46639_2_, p_i46639_3_, p_i46639_4_); -+ public LootEntryTable(ResourceLocation p_i46639_1_, int p_i46639_2_, int p_i46639_3_, LootCondition[] p_i46639_4_, String entryName) { -+ super(p_i46639_2_, p_i46639_3_, p_i46639_4_, entryName); - this.field_186371_a = p_i46639_1_; - } - -@@ -29,6 +29,6 @@ - - public static LootEntryTable func_186370_a(JsonObject p_186370_0_, JsonDeserializationContext p_186370_1_, int p_186370_2_, int p_186370_3_, LootCondition[] p_186370_4_) { - ResourceLocation resourcelocation = new ResourceLocation(JsonUtils.func_151200_h(p_186370_0_, "name")); -- return new LootEntryTable(resourcelocation, p_186370_2_, p_186370_3_, p_186370_4_); -+ return new LootEntryTable(resourcelocation, p_186370_2_, p_186370_3_, p_186370_4_, net.minecraftforge.common.ForgeHooks.readLootEntryName(p_186370_0_, "loot_table")); - } - } diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch index 72bfcbfb4..903e7c85f 100644 --- a/patches/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch @@ -1,42 +1,78 @@ --- a/net/minecraft/world/storage/loot/LootPool.java +++ b/net/minecraft/world/storage/loot/LootPool.java -@@ -20,14 +20,16 @@ - import org.apache.commons.lang3.ArrayUtils; +@@ -28,17 +28,19 @@ + import org.apache.commons.lang3.mutable.MutableInt; public class LootPool { - private final LootEntry[] field_186453_a; -- private final LootCondition[] field_186454_b; +- private final ILootCondition[] field_186454_b; + private final String name; + private final List field_186453_a; -+ private final List field_186454_b; - private RandomValueRange field_186455_c; ++ private final List field_186454_b; + private final Predicate field_216101_c; + private final ILootFunction[] field_216102_d; + private final BiFunction field_216103_e; + private IRandomRange field_186455_c; private RandomValueRange field_186456_d; -- public LootPool(LootEntry[] p_i46643_1_, LootCondition[] p_i46643_2_, RandomValueRange p_i46643_3_, RandomValueRange p_i46643_4_) { -- this.field_186453_a = p_i46643_1_; -- this.field_186454_b = p_i46643_2_; -+ public LootPool(LootEntry[] p_i46643_1_, LootCondition[] p_i46643_2_, RandomValueRange p_i46643_3_, RandomValueRange p_i46643_4_, String name) { +- private LootPool(LootEntry[] p_i51268_1_, ILootCondition[] p_i51268_2_, ILootFunction[] p_i51268_3_, IRandomRange p_i51268_4_, RandomValueRange p_i51268_5_) { +- this.field_186453_a = p_i51268_1_; +- this.field_186454_b = p_i51268_2_; ++ private LootPool(LootEntry[] p_i51268_1_, ILootCondition[] p_i51268_2_, ILootFunction[] p_i51268_3_, IRandomRange p_i51268_4_, RandomValueRange p_i51268_5_, String name) { + this.name = name; -+ this.field_186453_a = Lists.newArrayList(p_i46643_1_); -+ this.field_186454_b = Lists.newArrayList(p_i46643_2_); - this.field_186455_c = p_i46643_3_; - this.field_186456_d = p_i46643_4_; - } -@@ -61,7 +63,7 @@ ++ this.field_186453_a = Lists.newArrayList(p_i51268_1_); ++ this.field_186454_b = Lists.newArrayList(p_i51268_2_); + 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_); +@@ -95,16 +97,16 @@ } - public void func_186449_b(Collection p_186449_1_, Random p_186449_2_, LootContext p_186449_3_) { -- if (LootConditionManager.func_186638_a(this.field_186454_b, p_186449_2_, p_186449_3_)) { -+ if (LootConditionManager.testAllConditions(this.field_186454_b, p_186449_2_, p_186449_3_)) { - int i = this.field_186455_c.func_186511_a(p_186449_2_) + MathHelper.func_76141_d(this.field_186456_d.func_186507_b(p_186449_2_) * p_186449_3_.func_186491_f()); + public void func_216099_a(ValidationResults p_216099_1_, Function p_216099_2_, Set p_216099_3_, LootParameterSet p_216099_4_) { +- for(int i = 0; i < this.field_186454_b.length; ++i) { +- this.field_186454_b[i].func_215856_a(p_216099_1_.func_216108_b(".condition[" + i + "]"), p_216099_2_, p_216099_3_, p_216099_4_); ++ for(int i = 0; i < this.field_186454_b.size(); ++i) { ++ this.field_186454_b.get(i).func_215856_a(p_216099_1_.func_216108_b(".condition[" + i + "]"), p_216099_2_, p_216099_3_, p_216099_4_); + } - for(int j = 0; j < i; ++j) { -@@ -71,6 +73,43 @@ + for(int j = 0; j < this.field_216102_d.length; ++j) { + this.field_216102_d[j].func_215856_a(p_216099_1_.func_216108_b(".functions[" + j + "]"), p_216099_2_, p_216099_3_, p_216099_4_); + } + +- for(int k = 0; k < this.field_186453_a.length; ++k) { +- this.field_186453_a[k].func_216142_a(p_216099_1_.func_216108_b(".entries[" + k + "]"), p_216099_2_, p_216099_3_, p_216099_4_); ++ for(int k = 0; k < this.field_186453_a.size(); ++k) { ++ this.field_186453_a.get(k).func_216142_a(p_216099_1_.func_216108_b(".entries[" + k + "]"), p_216099_2_, p_216099_3_, p_216099_4_); + } + + } +@@ -119,6 +121,7 @@ + private final List 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); ++ private String name; + + public LootPool.Builder func_216046_a(IRandomRange p_216046_1_) { + this.field_216050_d = p_216046_1_; +@@ -144,15 +147,56 @@ + return this; + } + ++ public LootPool.Builder name(String name) { ++ this.name = name; ++ return this; ++ } ++ + public LootPool func_216044_b() { + if (this.field_216050_d == null) { + throw new IllegalArgumentException("Rolls not set"); + } else { +- return new LootPool(this.field_216047_a.toArray(new LootEntry[0]), this.field_216048_b.toArray(new ILootCondition[0]), this.field_216049_c.toArray(new ILootFunction[0]), this.field_216050_d, this.field_216051_e); ++ return new LootPool(this.field_216047_a.toArray(new LootEntry[0]), this.field_216048_b.toArray(new ILootCondition[0]), this.field_216049_c.toArray(new ILootFunction[0]), this.field_216050_d, this.field_216051_e, name); + } } } -+ -+ + //======================== FORGE START ============================================= + private boolean isFrozen = false; + public void freeze() { this.isFrozen = true; } @@ -46,18 +82,19 @@ + throw new RuntimeException("Attempted to modify LootPool after being frozen!"); + } + public String getName(){ return this.name; } -+ public RandomValueRange getRolls() { return this.field_186455_c; } -+ public RandomValueRange getBonusRolls() { return this.field_186456_d; } ++ 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 field_186453_a.stream().filter(e -> name.equals(e.getEntryName())).findFirst().orElse(null); ++ return lootEntries.stream().filter(e -> name.equals(e.getEntryName())).findFirst().orElse(null); + } + public LootEntry removeEntry(String name) { + checkFrozen(); -+ for (LootEntry entry : this.field_186453_a) { ++ for (LootEntry entry : this.lootEntries) { + if (name.equals(entry.getEntryName())) { -+ this.field_186453_a.remove(entry); ++ this.lootEntries.remove(entry); + return entry; + } + } @@ -65,30 +102,30 @@ + } + public void addEntry(LootEntry entry) { + checkFrozen(); -+ if (field_186453_a.stream().anyMatch(e -> e == entry || e.getEntryName().equals(entry.getEntryName()))) ++ 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.field_186453_a.add(entry); ++ this.lootEntries.add(entry); + } -+ //TODO: Allow modifications of conditions? If so need a way to uniquely identify them. ++ */ + //======================== FORGE END =============================================== + public static class Serializer implements JsonDeserializer, JsonSerializer { 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"); -@@ -78,18 +117,20 @@ - LootCondition[] alootcondition = JsonUtils.func_188177_a(jsonobject, "conditions", new LootCondition[0], p_deserialize_3_, LootCondition[].class); - RandomValueRange randomvaluerange = JsonUtils.func_188174_a(jsonobject, "rolls", p_deserialize_3_, RandomValueRange.class); - RandomValueRange randomvaluerange1 = JsonUtils.func_188177_a(jsonobject, "bonus_rolls", new RandomValueRange(0.0F, 0.0F), p_deserialize_3_, RandomValueRange.class); -- return new LootPool(alootentry, alootcondition, randomvaluerange, randomvaluerange1); -+ return new LootPool(alootentry, alootcondition, randomvaluerange, randomvaluerange1, net.minecraftforge.common.ForgeHooks.readPoolName(jsonobject)); + JsonObject jsonobject = JSONUtils.func_151210_l(p_deserialize_1_, "loot pool"); +@@ -161,18 +205,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); +- return new LootPool(alootentry, ailootcondition, ailootfunction, irandomrange, randomvaluerange); ++ return new LootPool(alootentry, ailootcondition, ailootfunction, irandomrange, randomvaluerange, net.minecraftforge.common.ForgeHooks.readPoolName(jsonobject)); } public JsonElement serialize(LootPool p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) { JsonObject jsonobject = new JsonObject(); + if (p_serialize_1_.name != null && !p_serialize_1_.name.startsWith("custom#")) + jsonobject.add("name", p_serialize_3_.serialize(p_serialize_1_.name)); + jsonobject.add("rolls", RandomRanges.func_216131_a(p_serialize_1_.field_186455_c, p_serialize_3_)); jsonobject.add("entries", p_serialize_3_.serialize(p_serialize_1_.field_186453_a)); - jsonobject.add("rolls", p_serialize_3_.serialize(p_serialize_1_.field_186455_c)); if (p_serialize_1_.field_186456_d.func_186509_a() != 0.0F && p_serialize_1_.field_186456_d.func_186512_b() != 0.0F) { jsonobject.add("bonus_rolls", p_serialize_3_.serialize(p_serialize_1_.field_186456_d)); } diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch index 9a28d3ba7..3a6dda3eb 100644 --- a/patches/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch @@ -1,20 +1,34 @@ --- a/net/minecraft/world/storage/loot/LootTable.java +++ b/net/minecraft/world/storage/loot/LootTable.java -@@ -23,10 +23,10 @@ - public class LootTable { - private static final Logger field_186465_b = LogManager.getLogger(); - public static final LootTable field_186464_a = new LootTable(new LootPool[0]); +@@ -33,13 +33,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; + private final LootParameterSet field_216127_d; - private final LootPool[] field_186466_c; + private final List field_186466_c; + private final ILootFunction[] field_216128_f; + private final BiFunction field_216129_g; - public LootTable(LootPool[] p_i46641_1_) { -- this.field_186466_c = p_i46641_1_; -+ this.field_186466_c = Lists.newArrayList(p_i46641_1_); + private LootTable(LootParameterSet p_i51265_1_, LootPool[] p_i51265_2_, ILootFunction[] p_i51265_3_) { + this.field_216127_d = p_i51265_1_; +- this.field_186466_c = p_i51265_2_; ++ this.field_186466_c = Lists.newArrayList(p_i51265_2_); + this.field_216128_f = p_i51265_3_; + this.field_216129_g = LootFunctionManager.func_216241_a(p_i51265_3_); + } +@@ -92,8 +92,8 @@ } - public List func_186462_a(Random p_186462_1_, LootContext p_186462_2_) { -@@ -112,6 +112,41 @@ - return list; + public void func_216117_a(ValidationResults p_216117_1_, Function p_216117_2_, Set p_216117_3_, LootParameterSet p_216117_4_) { +- for(int i = 0; i < this.field_186466_c.length; ++i) { +- this.field_186466_c[i].func_216099_a(p_216117_1_.func_216108_b(".pools[" + i + "]"), p_216117_2_, p_216117_3_, p_216117_4_); ++ for(int i = 0; i < this.field_186466_c.size(); ++i) { ++ this.field_186466_c.get(i).func_216099_a(p_216117_1_.func_216108_b(".pools[" + i + "]"), p_216117_2_, p_216117_3_, p_216117_4_); + } + + for(int j = 0; j < this.field_216128_f.length; ++j) { +@@ -204,6 +204,41 @@ + } } + //======================== FORGE START ============================================= @@ -54,4 +68,13 @@ + public static class Serializer implements JsonDeserializer, JsonSerializer { 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"); + JsonObject jsonobject = JSONUtils.func_151210_l(p_deserialize_1_, "loot table"); +@@ -229,7 +264,7 @@ + } + } + +- if (p_serialize_1_.field_186466_c.length > 0) { ++ if (!p_serialize_1_.field_186466_c.isEmpty()) { + jsonobject.add("pools", p_serialize_3_.serialize(p_serialize_1_.field_186466_c)); + } + diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch index 9a53b626e..c81bee0b1 100644 --- a/patches/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/storage/loot/LootTableManager.java +++ b/net/minecraft/world/storage/loot/LootTableManager.java -@@ -39,7 +39,7 @@ +@@ -45,7 +45,7 @@ ResourceLocation resourcelocation1 = new ResourceLocation(resourcelocation.func_110624_b(), s.substring(field_195435_a, s.length() - field_195436_b)); try (IResource iresource = p_195410_1_.func_199002_a(resourcelocation)) { -- LootTable loottable = JsonUtils.func_188178_a(field_186526_b, IOUtils.toString(iresource.func_199027_b(), StandardCharsets.UTF_8), LootTable.class); -+ LootTable loottable =net.minecraftforge.common.ForgeHooks.loadLootTable(field_186526_b, resourcelocation, IOUtils.toString(iresource.func_199027_b(), StandardCharsets.UTF_8), iresource.func_199026_d().equals("Default"), this); +- LootTable loottable = JSONUtils.func_188178_a(field_186526_b, IOUtils.toString(iresource.func_199027_b(), StandardCharsets.UTF_8), LootTable.class); ++ LootTable loottable = net.minecraftforge.common.ForgeHooks.loadLootTable(field_186526_b, resourcelocation, IOUtils.toString(iresource.func_199027_b(), StandardCharsets.UTF_8), iresource.func_199026_d().equals("Default"), this); if (loottable != null) { this.field_186527_c.put(resourcelocation1, loottable); } diff --git a/patches/minecraft/net/minecraft/world/storage/loot/conditions/LootConditionManager.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/conditions/LootConditionManager.java.patch deleted file mode 100644 index 86db39c0e..000000000 --- a/patches/minecraft/net/minecraft/world/storage/loot/conditions/LootConditionManager.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/world/storage/loot/conditions/LootConditionManager.java -+++ b/net/minecraft/world/storage/loot/conditions/LootConditionManager.java -@@ -34,6 +34,10 @@ - } - } - -+ public static boolean testAllConditions(@Nullable Iterable conditions, Random rand, LootContext context) { -+ return conditions == null || java.util.stream.StreamSupport.stream(conditions.spliterator(), false).allMatch(c -> c.func_186618_a(rand, context)); -+ } -+ - public static boolean func_186638_a(@Nullable LootCondition[] p_186638_0_, Random p_186638_1_, LootContext p_186638_2_) { - if (p_186638_0_ == null) { - return true; diff --git a/patches/minecraft/net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java.patch index 9fc72d76e..8778953e2 100644 --- a/patches/minecraft/net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java.patch @@ -1,15 +1,16 @@ --- a/net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java +++ b/net/minecraft/world/storage/loot/conditions/RandomChanceWithLooting.java -@@ -20,11 +20,7 @@ +@@ -28,12 +28,7 @@ } - public boolean func_186618_a(Random p_186618_1_, LootContext p_186618_2_) { + public boolean test(LootContext p_test_1_) { +- Entity entity = p_test_1_.func_216031_c(LootParameters.field_216284_d); - int i = 0; -- if (p_186618_2_.func_186492_c() instanceof EntityLivingBase) { -- i = EnchantmentHelper.func_185283_h((EntityLivingBase)p_186618_2_.func_186492_c()); +- if (entity instanceof LivingEntity) { +- i = EnchantmentHelper.func_185283_h((LivingEntity)entity); - } - -+ int i = p_186618_2_.getLootingModifier(); - return p_186618_1_.nextFloat() < this.field_186627_a + (float)i * this.field_186628_b; ++ int i = p_test_1_.getLootingModifier(); + return p_test_1_.func_216032_b().nextFloat() < this.field_186627_a + (float)i * this.field_186628_b; } diff --git a/patches/minecraft/net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java.patch index 059351740..8ef92e431 100644 --- a/patches/minecraft/net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java +++ b/net/minecraft/world/storage/loot/functions/LootingEnchantBonus.java -@@ -27,7 +27,7 @@ - public ItemStack func_186553_a(ItemStack p_186553_1_, Random p_186553_2_, LootContext p_186553_3_) { - Entity entity = p_186553_3_.func_186492_c(); - if (entity instanceof EntityLivingBase) { -- int i = EnchantmentHelper.func_185283_h((EntityLivingBase)entity); -+ int i = p_186553_3_.getLootingModifier(); +@@ -39,7 +39,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) { +- int i = EnchantmentHelper.func_185283_h((LivingEntity)entity); ++ int i = p_215859_2_.getLootingModifier(); if (i == 0) { - return p_186553_1_; + return p_215859_1_; } diff --git a/patches/minecraft/net/minecraft/world/storage/loot/functions/Smelt.java.patch b/patches/minecraft/net/minecraft/world/storage/loot/functions/Smelt.java.patch deleted file mode 100644 index 1717733bc..000000000 --- a/patches/minecraft/net/minecraft/world/storage/loot/functions/Smelt.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/world/storage/loot/functions/Smelt.java -+++ b/net/minecraft/world/storage/loot/functions/Smelt.java -@@ -42,8 +42,8 @@ - - @Nullable - public static IRecipe func_202880_a(LootContext p_202880_0_, ItemStack p_202880_1_) { -- for(IRecipe irecipe : p_202880_0_.func_202879_g().func_199532_z().func_199510_b()) { -- if (irecipe instanceof FurnaceRecipe && irecipe.func_192400_c().get(0).test(p_202880_1_)) { -+ for(IRecipe irecipe : p_202880_0_.func_202879_g().func_199532_z().getRecipes(net.minecraftforge.common.crafting.VanillaRecipeTypes.SMELTING)) { -+ if (irecipe.func_192400_c().get(0).test(p_202880_1_)) { - return irecipe; - } - } diff --git a/patches_old/minecraft/net/minecraft/block/Block.java.patch b/patches_old/minecraft/net/minecraft/block/Block.java.patch new file mode 100644 index 000000000..cf5d34c92 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/block/Block.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/Block.java ++++ b/net/minecraft/block/Block.java +@@ -543,7 +555,7 @@ + } + } + +- return raytraceresult; ++ return p_180636_0_.func_177230_c().getRayTraceResult(p_180636_0_, p_180636_1_, p_180636_2_, p_180636_3_, p_180636_4_, raytraceresult); + } + + public void func_180652_a(World p_180652_1_, BlockPos p_180652_2_, Explosion p_180652_3_) { \ No newline at end of file diff --git a/patches/minecraft/net/minecraft/block/BlockChest.java.patch b/patches_old/minecraft/net/minecraft/block/ChestBlock.java.patch similarity index 78% rename from patches/minecraft/net/minecraft/block/BlockChest.java.patch rename to patches_old/minecraft/net/minecraft/block/ChestBlock.java.patch index a9f7af1b4..150eaa751 100644 --- a/patches/minecraft/net/minecraft/block/BlockChest.java.patch +++ b/patches_old/minecraft/net/minecraft/block/ChestBlock.java.patch @@ -1,11 +1,11 @@ ---- a/net/minecraft/block/BlockChest.java -+++ b/net/minecraft/block/BlockChest.java +--- a/net/minecraft/block/ChestBlock.java ++++ b/net/minecraft/block/ChestBlock.java @@ -258,7 +258,7 @@ } private boolean func_176456_n(IBlockReader p_176456_1_, BlockPos p_176456_2_) { - return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).func_185915_l(); -+ return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).doesSideBlockChestOpening(p_176456_1_, p_176456_2_.func_177984_a(), EnumFacing.DOWN); ++ return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).doesSideBlockChestOpening(p_176456_1_, p_176456_2_.func_177984_a(), Direction.DOWN); } private boolean func_176453_o(World p_176453_1_, BlockPos p_176453_2_) { diff --git a/patches_old/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch b/patches_old/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch new file mode 100644 index 000000000..4b9f5aa98 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/multiplayer/PlayerController.java.patch @@ -0,0 +1,116 @@ +--- a/net/minecraft/client/multiplayer/PlayerController.java ++++ b/net/minecraft/client/multiplayer/PlayerController.java +@@ -118,24 +120,23 @@ + } else if (iblockstate.func_196958_f()) { + return false; + } else { +- block.func_176208_a(world, p_187103_1_, iblockstate, this.field_78776_a.field_71439_g); + IFluidState ifluidstate = world.func_204610_c(p_187103_1_); +- boolean flag = world.func_180501_a(p_187103_1_, ifluidstate.func_206883_i(), 11); +- if (flag) { +- block.func_176206_d(world, p_187103_1_, iblockstate); +- } + + this.field_178895_c = new BlockPos(this.field_178895_c.func_177958_n(), -1, this.field_178895_c.func_177952_p()); + if (!this.field_78779_k.func_77145_d()) { + ItemStack itemstack1 = this.field_78776_a.field_71439_g.func_184614_ca(); ++ ItemStack copyBeforeUse = itemstack1.func_77946_l(); + if (!itemstack1.func_190926_b()) { + itemstack1.func_179548_a(world, iblockstate, p_187103_1_, this.field_78776_a.field_71439_g); + if (itemstack1.func_190926_b()) { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_78776_a.field_71439_g, copyBeforeUse, Hand.MAIN_HAND); + this.field_78776_a.field_71439_g.func_184611_a(Hand.MAIN_HAND, ItemStack.field_190927_a); + } + } + } + ++ boolean flag = iblockstate.removedByPlayer(world, p_187103_1_, field_78776_a.field_71439_g, false, ifluidstate); ++ if (flag) block.func_176206_d(world, p_187103_1_, iblockstate); + return flag; + } + } +@@ -166,21 +167,25 @@ + if (this.field_78779_k.func_77145_d()) { + this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_), 1.0F); + this.field_78774_b.func_147297_a(new CPlayerDiggingPacket(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_)); ++ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(this.field_78776_a.field_71439_g, func_78757_d() + 1)).isCanceled()) + func_178891_a(this.field_78776_a, this, p_180511_1_, p_180511_2_); + this.field_78781_i = 5; + } else if (!this.field_78778_j || !this.func_178893_a(p_180511_1_)) { + if (this.field_78778_j) { + this.field_78774_b.func_147297_a(new CPlayerDiggingPacket(CPlayerDiggingPacket.Action.ABORT_DESTROY_BLOCK, this.field_178895_c, p_180511_2_)); + } ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(this.field_78776_a.field_71439_g, func_78757_d() + 1)); + + BlockState iblockstate = this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_); + this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, iblockstate, 0.0F); + this.field_78774_b.func_147297_a(new CPlayerDiggingPacket(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_)); + boolean flag = !iblockstate.func_196958_f(); + if (flag && this.field_78770_f == 0.0F) { ++ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) + iblockstate.func_196942_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71439_g); + } + ++ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; + if (flag && iblockstate.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180511_1_) >= 1.0F) { + this.func_187103_a(p_180511_1_); + } else { +@@ -294,17 +300,35 @@ + float f = (float)(p_187099_5_.field_72450_a - (double)p_187099_3_.func_177958_n()); + float f1 = (float)(p_187099_5_.field_72448_b - (double)p_187099_3_.func_177956_o()); + float f2 = (float)(p_187099_5_.field_72449_c - (double)p_187099_3_.func_177952_p()); ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks ++ .onRightClickBlock(p_187099_1_, p_187099_6_, p_187099_3_, p_187099_4_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(p_187099_1_, func_78757_d() + 1)); ++ if (event.isCanceled()) { ++ // Give the server a chance to fire event as well. That way server event is not dependant on client event. ++ this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); ++ return event.getCancellationResult(); ++ } + if (this.field_78779_k == GameType.SPECTATOR) { + this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); + return ActionResultType.SUCCESS; + } else { +- boolean flag = !p_187099_1_.func_184614_ca().func_190926_b() || !p_187099_1_.func_184592_cb().func_190926_b(); ++ ActionResultType ret = itemstack.onItemUseFirst(new ItemUseContext(p_187099_1_, p_187099_1_.func_184586_b(p_187099_6_), p_187099_3_, p_187099_4_, f, f1, f2)); ++ if (ret != ActionResultType.PASS) { ++ // The server needs to process the item use as well. Otherwise onItemUseFirst won't ever be called on the server without causing weird bugs ++ this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); ++ return ret; ++ } ++ boolean flag = !(p_187099_1_.func_184614_ca().doesSneakBypassUse(p_187099_2_, p_187099_3_, p_187099_1_) && p_187099_1_.func_184592_cb().doesSneakBypassUse(p_187099_2_, p_187099_3_, p_187099_1_)); + boolean flag1 = p_187099_1_.func_70093_af() && flag; +- if (!flag1 && p_187099_2_.func_180495_p(p_187099_3_).func_196943_a(p_187099_2_, p_187099_3_, p_187099_1_, p_187099_6_, p_187099_4_, f, f1, f2)) { ++ if (!flag1 || event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW) { ++ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) { ++ if (p_187099_2_.func_180495_p(p_187099_3_).func_196943_a(p_187099_2_, p_187099_3_, p_187099_1_, p_187099_6_, p_187099_4_, f, f1, f2)) { ++ this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); ++ return ActionResultType.SUCCESS; ++ } ++ } ++ } ++ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) { + this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); +- return ActionResultType.SUCCESS; +- } else { +- this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); + if (!itemstack.func_190926_b() && !p_187099_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) { + ItemUseContext itemusecontext = new ItemUseContext(p_187099_1_, p_187099_1_.func_184586_b(p_187099_6_), p_187099_3_, p_187099_4_, f, f1, f2); + ActionResultType enumactionresult; +@@ -313,7 +337,9 @@ + enumactionresult = itemstack.func_196084_a(itemusecontext); + itemstack.func_190920_e(i); + } else { ++ ItemStack copyForUse = itemstack.func_77946_l(); + enumactionresult = itemstack.func_196084_a(itemusecontext); ++ if (itemstack.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187099_1_, copyForUse, p_187099_6_); + } + + return enumactionresult; +@@ -321,6 +347,7 @@ + return ActionResultType.PASS; + } + } ++ return ActionResultType.PASS; + } + } + } \ No newline at end of file diff --git a/patches_old/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch b/patches_old/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch new file mode 100644 index 000000000..6fa2b2946 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/client/renderer/GameRenderer.java ++++ b/net/minecraft/client/renderer/GameRenderer.java +@@ -487,8 +489,16 @@ + } + + if (!this.field_78531_r.field_71474_y.field_74325_U) { +- GlStateManager.func_179114_b(entity.func_195050_f(p_78467_1_), 1.0F, 0.0F, 0.0F); +- GlStateManager.func_179114_b(entity.func_195046_g(p_78467_1_) + 180.0F, 0.0F, 1.0F, 0.0F); ++ float yaw = entity.func_195046_g(p_78467_1_) + 180F; ++ float pitch = entity.func_195050_f(p_78467_1_); ++ float roll = 0.0F; ++ BlockState state = ActiveRenderInfo.func_186703_a(this.field_78531_r.field_71441_e, entity, p_78467_1_); ++ IFluidState fluidState = ActiveRenderInfo.func_206243_b(this.field_78531_r.field_71441_e, entity, p_78467_1_); ++ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, state, fluidState, p_78467_1_, yaw, pitch, roll); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ GlStateManager.func_179114_b(event.getRoll(), 0.0F, 0.0F, 1.0F); ++ GlStateManager.func_179114_b(event.getPitch(), 1.0F, 0.0F, 0.0F); ++ GlStateManager.func_179114_b(event.getYaw(), 0.0F, 1.0F, 0.0F); + } + + GlStateManager.func_179109_b(0.0F, -f, 0.0F); diff --git a/patches_old/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch b/patches_old/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch new file mode 100644 index 000000000..7ab619e81 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/renderer/texture/AtlasTexture.java.patch @@ -0,0 +1,53 @@ +--- a/net/minecraft/client/renderer/texture/AtlasTexture.java ++++ b/net/minecraft/client/renderer/texture/AtlasTexture.java +@@ -57,8 +58,14 @@ + int j = Integer.MAX_VALUE; + int k = 1 << this.field_147636_j; + +- for(ResourceLocation resourcelocation : this.field_195427_i) { ++ field_147635_d.info("Max texture size: {}", i); ++ try (net.minecraftforge.fml.common.progress.ProgressBar textureLoadingBar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Texture loading", this.field_195427_i.size())) { ++ loadedSprites.clear(); ++ for(ResourceLocation resourcelocation : Sets.newHashSet(this.field_195427_i)) { ++ textureLoadingBar.step(this.func_195420_b(resourcelocation).toString()); + if (!this.field_94249_f.func_195668_m().equals(resourcelocation)) { ++ j = loadTexture(stitcher, p_195421_1_, resourcelocation, j, k); ++ if (true) continue; // Forge: skip the rest of this if statement, we're using loadTexture instead + ResourceLocation resourcelocation1 = this.func_195420_b(resourcelocation); + + TextureAtlasSprite textureatlassprite; +@@ -84,9 +91,11 @@ + stitcher.func_110934_a(textureatlassprite); + } + } ++ } // Forge: end progress bar + + int l = Math.min(j, k); + int i1 = MathHelper.func_151239_c(l); +@@ -94,18 +103,25 @@ + + this.field_94249_f.func_147963_d(this.field_147636_j); + stitcher.func_110934_a(this.field_94249_f); ++ try (net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Texture creation", 2)) { + + try { ++ bar.step("Stitching"); + stitcher.func_94305_f(); + } catch (StitcherException stitcherexception) { + throw stitcherexception; + } + + field_147635_d.info("Created: {}x{} {}-atlas", stitcher.func_110935_a(), stitcher.func_110936_b(), this.field_94254_c); ++ bar.step("Allocating GL texture"); + TextureUtil.func_180600_a(this.func_110552_b(), this.field_147636_j, stitcher.func_110935_a(), stitcher.func_110936_b()); + ++ }; // Forge: end progress bar ++ try (net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Texture mipmap and upload", stitcher.func_94309_g().size())) { + for(TextureAtlasSprite textureatlassprite1 : stitcher.func_94309_g()) { +- if (textureatlassprite1 == this.field_94249_f || this.func_195422_a(p_195421_1_, textureatlassprite1)) { ++ bar.step(textureatlassprite1.func_195668_m().toString()); ++ // FORGE: Sprite loading is now done during stitching, short-circuit this check ++ if (true || textureatlassprite1 == this.field_94249_f || this.func_195422_a(p_195421_1_, textureatlassprite1)) { + this.field_94252_e.put(textureatlassprite1.func_195668_m(), textureatlassprite1); + + try { diff --git a/patches_old/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches_old/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch new file mode 100644 index 000000000..f599b6235 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -0,0 +1,28 @@ +--- a/net/minecraft/client/renderer/texture/TextureManager.java ++++ b/net/minecraft/client/renderer/texture/TextureManager.java +@@ -113,11 +114,13 @@ + + public void func_195410_a(IResourceManager p_195410_1_) { + MissingTextureSprite.func_195676_d(); ++ try (net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Reloading Texture Manager", this.field_110585_a.entrySet().size(), true)) { + Iterator> iterator = this.field_110585_a.entrySet().iterator(); + + while(iterator.hasNext()) { + Entry entry = iterator.next(); + ResourceLocation resourcelocation = entry.getKey(); ++ bar.step(resourcelocation.toString()); + ITextureObject itextureobject = entry.getValue(); + if (itextureobject == MissingTextureSprite.func_195676_d() && !resourcelocation.equals(MissingTextureSprite.func_195675_b())) { + iterator.remove(); +@@ -125,6 +128,11 @@ + this.func_110579_a(entry.getKey(), itextureobject); + } + } ++ }; // Forge: end progress bar ++ } + ++ @Override ++ public net.minecraftforge.resource.IResourceType getResourceType() { ++ return net.minecraftforge.resource.VanillaResourceType.TEXTURES; + } + } diff --git a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches_old/minecraft/net/minecraft/client/shader/Framebuffer.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch rename to patches_old/minecraft/net/minecraft/client/shader/Framebuffer.java.patch diff --git a/patches_old/minecraft/net/minecraft/entity/Entity.java.patch b/patches_old/minecraft/net/minecraft/entity/Entity.java.patch new file mode 100644 index 000000000..669dda096 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/Entity.java.patch @@ -0,0 +1,63 @@ +@@ -2054,6 +2083,14 @@ + + @Nullable + public Entity func_212321_a(DimensionType p_212321_1_) { ++ if (this.field_70170_p.field_72995_K || this.field_70128_L) return null; ++ return changeDimension(p_212321_1_, this.func_184102_h().func_71218_a(p_212321_1_).func_85176_s()); ++ } ++ ++ @Nullable ++ @Override ++ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_212321_1_)) return null; + if (!this.field_70170_p.field_72995_K && !this.field_70128_L) { + this.field_70170_p.field_72984_F.func_76320_a("changeDimension"); + MinecraftServer minecraftserver = this.func_184102_h(); +@@ -2061,25 +2098,25 @@ + ServerWorld worldserver = minecraftserver.func_71218_a(dimensiontype); + ServerWorld worldserver1 = minecraftserver.func_71218_a(p_212321_1_); + this.field_71093_bK = p_212321_1_; +- if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END) { ++ if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END && teleporter.isVanilla()) { + worldserver1 = minecraftserver.func_71218_a(DimensionType.OVERWORLD); + this.field_71093_bK = DimensionType.OVERWORLD; + } + +- this.field_70170_p.func_72900_e(this); +- this.field_70128_L = false; ++ this.field_70170_p.removeEntity(this, true); //Forge: Keep data until we copy. ++ this.revive(); + this.field_70170_p.field_72984_F.func_76320_a("reposition"); + BlockPos blockpos; +- if (p_212321_1_ == DimensionType.THE_END) { ++ if (p_212321_1_ == DimensionType.THE_END && teleporter.isVanilla()) { + blockpos = worldserver1.func_180504_m(); + } else { +@@ -2088,8 +2125,7 @@ + d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872); + float f = this.field_70177_z; + this.func_70012_b(d0, this.field_70163_u, d1, 90.0F, 0.0F); +- Teleporter teleporter = worldserver1.func_85176_s(); +- teleporter.func_180620_b(this, f); ++ teleporter.placeEntity(worldserver1, this, f); + blockpos = new BlockPos(this); + } + +@@ -2098,7 +2134,7 @@ + Entity entity = this.func_200600_R().func_200721_a(worldserver1); + if (entity != null) { + entity.func_180432_n(this); +- if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END) { ++ if (dimensiontype == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END && teleporter.isVanilla()) { + BlockPos blockpos1 = worldserver1.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.func_175694_M()); + entity.func_174828_a(blockpos1, entity.field_70177_z, entity.field_70125_A); + } else { +@@ -2112,7 +2148,7 @@ + worldserver1.func_72866_a(entity, false); + } + +- this.field_70128_L = true; ++ this.remove(false); //Forge: now invalidate old entity + this.field_70170_p.field_72984_F.func_76319_b(); + worldserver.func_82742_i(); + worldserver1.func_82742_i(); diff --git a/patches_old/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch new file mode 100644 index 000000000..71fcce42c --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/item/EnderPearlEntity.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/entity/item/EnderPearlEntity.java ++++ b/net/minecraft/entity/item/EnderPearlEntity.java +@@ -110,12 +114,13 @@ + + } + ++ @Override + @Nullable +- public Entity func_212321_a(DimensionType p_212321_1_) { ++ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { + if (this.field_70192_c.field_71093_bK != p_212321_1_) { + this.field_70192_c = null; + } + +- return super.func_212321_a(p_212321_1_); ++ return super.changeDimension(p_212321_1_, teleporter); + } + } diff --git a/patches_old/minecraft/net/minecraft/entity/item/ItemEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/item/ItemEntity.java.patch new file mode 100644 index 000000000..90ff432bc --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/item/ItemEntity.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/entity/item/ItemEntity.java ++++ b/net/minecraft/entity/item/ItemEntity.java +@@ -286,9 +313,10 @@ + return false; + } + ++ @Override + @Nullable +- public Entity func_212321_a(DimensionType p_212321_1_) { +- Entity entity = super.func_212321_a(p_212321_1_); ++ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { ++ Entity entity = super.changeDimension(p_212321_1_, teleporter); + if (!this.field_70170_p.field_72995_K && entity instanceof ItemEntity) { + ((ItemEntity)entity).func_85054_d(); + } \ No newline at end of file diff --git a/patches_old/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch b/patches_old/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch new file mode 100644 index 000000000..786774eaa --- /dev/null +++ b/patches_old/minecraft/net/minecraft/entity/player/ServerPlayerEntity.java.patch @@ -0,0 +1,29 @@ +@@ -537,8 +540,10 @@ + return this.field_71133_b.func_71219_W(); + } + ++ @Override + @Nullable +- public Entity func_212321_a(DimensionType p_212321_1_) { ++ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) { + this.field_184851_cj = true; + if (this.field_71093_bK == DimensionType.OVERWORLD && p_212321_1_ == DimensionType.NETHER) { + this.field_193110_cw = new Vec3d(this.field_70165_t, this.field_70163_u, this.field_70161_v); +@@ -546,7 +551,7 @@ + this.field_193110_cw = null; + } + +- if (this.field_71093_bK == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END) { ++ if (this.field_71093_bK == DimensionType.THE_END && p_212321_1_ == DimensionType.THE_END && teleporter.isVanilla()) { + this.field_70170_p.func_72900_e(this); + if (!this.field_71136_j) { + this.field_71136_j = true; +@@ -560,7 +565,7 @@ + p_212321_1_ = DimensionType.THE_END; + } + +- this.field_71133_b.func_184103_al().func_187242_a(this, p_212321_1_); ++ this.field_71133_b.func_184103_al().changePlayerDimension(this, p_212321_1_, teleporter); + this.field_71135_a.func_147359_a(new SPlaySoundEventPacket(1032, BlockPos.field_177992_a, 0, false)); + this.field_71144_ck = -1; + this.field_71149_ch = -1.0F; diff --git a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches_old/minecraft/net/minecraft/item/ItemSeedFood.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch rename to patches_old/minecraft/net/minecraft/item/ItemSeedFood.java.patch index b1bf743eb..d4fa5d3bf 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ b/patches_old/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -6,20 +6,20 @@ -public class ItemSeedFood extends ItemFood { +public class ItemSeedFood extends ItemFood implements net.minecraftforge.common.IPlantable { - private final IBlockState field_195972_b; + private final BlockState field_195972_b; public ItemSeedFood(int p_i48473_1_, float p_i48473_2_, Block p_i48473_3_, Item.Properties p_i48473_4_) { @@ -21,7 +21,7 @@ - public EnumActionResult func_195939_a(ItemUseContext p_195939_1_) { + public ActionResultType func_195939_a(ItemUseContext p_195939_1_) { IWorld iworld = p_195939_1_.func_195991_k(); BlockPos blockpos = p_195939_1_.func_195995_a().func_177984_a(); -- if (p_195939_1_.func_196000_l() == EnumFacing.UP && iworld.func_175623_d(blockpos) && this.field_195972_b.func_196955_c(iworld, blockpos)) { -+ if (p_195939_1_.func_196000_l() == EnumFacing.UP && iworld.func_175623_d(blockpos) && this.field_195972_b.func_196955_c(iworld, blockpos) && iworld.func_180495_p(p_195939_1_.func_195995_a()).canSustainPlant(iworld, p_195939_1_.func_195995_a(), EnumFacing.UP, this)) { +- if (p_195939_1_.func_196000_l() == Direction.UP && iworld.func_175623_d(blockpos) && this.field_195972_b.func_196955_c(iworld, blockpos)) { ++ if (p_195939_1_.func_196000_l() == Direction.UP && iworld.func_175623_d(blockpos) && this.field_195972_b.func_196955_c(iworld, blockpos) && iworld.func_180495_p(p_195939_1_.func_195995_a()).canSustainPlant(iworld, p_195939_1_.func_195995_a(), Direction.UP, this)) { iworld.func_180501_a(blockpos, this.field_195972_b, 11); - EntityPlayer entityplayer = p_195939_1_.func_195999_j(); + PlayerEntity entityplayer = p_195939_1_.func_195999_j(); ItemStack itemstack = p_195939_1_.func_195996_i(); @@ -35,4 +35,14 @@ - return EnumActionResult.PASS; + return ActionResultType.PASS; } } + @@ -29,7 +29,7 @@ + } + + @Override -+ public IBlockState getPlant(net.minecraft.world.IBlockReader world, BlockPos pos) { ++ public BlockState getPlant(net.minecraft.world.IBlockReader world, BlockPos pos) { + return this.field_195972_b; + } } diff --git a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches_old/minecraft/net/minecraft/item/ItemSeeds.java.patch similarity index 52% rename from patches/minecraft/net/minecraft/item/ItemSeeds.java.patch rename to patches_old/minecraft/net/minecraft/item/ItemSeeds.java.patch index 867a923c8..5431c02e9 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ b/patches_old/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -6,30 +6,30 @@ -public class ItemSeeds extends Item { +public class ItemSeeds extends Item implements net.minecraftforge.common.IPlantable { - private final IBlockState field_195978_a; + private final BlockState field_195978_a; public ItemSeeds(Block p_i48472_1_, Item.Properties p_i48472_2_) { @@ -21,7 +21,7 @@ - public EnumActionResult func_195939_a(ItemUseContext p_195939_1_) { + public ActionResultType func_195939_a(ItemUseContext p_195939_1_) { IWorld iworld = p_195939_1_.func_195991_k(); BlockPos blockpos = p_195939_1_.func_195995_a().func_177984_a(); -- if (p_195939_1_.func_196000_l() == EnumFacing.UP && iworld.func_175623_d(blockpos) && this.field_195978_a.func_196955_c(iworld, blockpos)) { -+ if (p_195939_1_.func_196000_l() == EnumFacing.UP && iworld.func_175623_d(blockpos) && this.field_195978_a.func_196955_c(iworld, blockpos) && iworld.func_180495_p(p_195939_1_.func_195995_a()).canSustainPlant(iworld, p_195939_1_.func_195995_a(), EnumFacing.UP, this)) { +- if (p_195939_1_.func_196000_l() == Direction.UP && iworld.func_175623_d(blockpos) && this.field_195978_a.func_196955_c(iworld, blockpos)) { ++ if (p_195939_1_.func_196000_l() == Direction.UP && iworld.func_175623_d(blockpos) && this.field_195978_a.func_196955_c(iworld, blockpos) && iworld.func_180495_p(p_195939_1_.func_195995_a()).canSustainPlant(iworld, p_195939_1_.func_195995_a(), Direction.UP, this)) { iworld.func_180501_a(blockpos, this.field_195978_a, 11); ItemStack itemstack = p_195939_1_.func_195996_i(); - EntityPlayer entityplayer = p_195939_1_.func_195999_j(); + PlayerEntity entityplayer = p_195939_1_.func_195999_j(); @@ -35,4 +35,14 @@ - return EnumActionResult.FAIL; + return ActionResultType.FAIL; } } + + @Override + public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockReader world, BlockPos pos) { -+ return this.field_195978_a.func_177230_c() == net.minecraft.init.Blocks.field_150388_bm ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; ++ return this.field_195978_a.func_177230_c() == net.minecraft.block.Blocks.field_150388_bm ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; + } + + @Override -+ public IBlockState getPlant(net.minecraft.world.IBlockReader world, BlockPos pos) { ++ public BlockState getPlant(net.minecraft.world.IBlockReader world, BlockPos pos) { + return this.field_195978_a; + } } diff --git a/patches_old/minecraft/net/minecraft/resources/SimpleReloadableResourceManager.java.patch b/patches_old/minecraft/net/minecraft/resources/SimpleReloadableResourceManager.java.patch new file mode 100644 index 000000000..9ec8a60a3 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/resources/SimpleReloadableResourceManager.java.patch @@ -0,0 +1,27 @@ +--- a/net/minecraft/resources/SimpleReloadableResourceManager.java ++++ b/net/minecraft/resources/SimpleReloadableResourceManager.java +@@ -86,35 +85,46 @@ + public void func_199006_a(IResourceManagerReloadListener p_199006_1_) { ++ try (net.minecraftforge.fml.common.progress.ProgressBar resReload = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Loading Resource", 1)) { ++ resReload.step(p_199006_1_.getClass()); + this.field_199015_d.add(p_199006_1_); + if (field_199012_a.isDebugEnabled()) { + field_199012_a.info(this.func_199007_b(p_199006_1_)); + } else { + p_199006_1_.func_195410_a(this); + } ++ }; // Forge: end progress bar + + } + + private void func_199010_c() { ++ try (net.minecraftforge.fml.common.progress.ProgressBar resReload = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Reloading", this.field_199015_d.size())) { + for(IResourceManagerReloadListener iresourcemanagerreloadlistener : this.field_199015_d) { ++ resReload.step(iresourcemanagerreloadlistener.getClass()); ++ if (!net.minecraftforge.resource.SelectiveReloadStateHandler.INSTANCE.test(iresourcemanagerreloadlistener)) continue; // Forge: Selective reloading for vanilla listeners + iresourcemanagerreloadlistener.func_195410_a(this); + } ++ }; // Forge: end progress bar + + } + diff --git a/patches_old/minecraft/net/minecraft/world/ServerWorld.java.patch b/patches_old/minecraft/net/minecraft/world/ServerWorld.java.patch new file mode 100644 index 000000000..1f81327d3 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/ServerWorld.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/ServerWorld.java ++++ b/net/minecraft/world/ServerWorld.java +@@ -725,7 +744,7 @@ + + public void func_212420_a(Stream p_212420_1_) { + p_212420_1_.forEach((p_212421_1_) -> { +- if (this.func_184165_i(p_212421_1_)) { ++ if (this.func_184165_i(p_212421_1_) && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_212421_1_, this))) { + this.field_72996_f.add(p_212421_1_); + this.func_72923_a(p_212421_1_); + } \ No newline at end of file diff --git a/patches_old/minecraft/net/minecraft/world/World.java.patch b/patches_old/minecraft/net/minecraft/world/World.java.patch new file mode 100644 index 000000000..eba270866 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/World.java.patch @@ -0,0 +1,151 @@ +--- a/net/minecraft/world/World.java ++++ b/net/minecraft/world/World.java +@@ -742,6 +789,8 @@ + } + + public boolean func_72838_d(Entity p_72838_1_) { ++ // do not drop any items while restoring blocksnapshots. Prevents dupes ++ if (!this.field_72995_K && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.ItemEntity && this.restoringBlockSnapshots))) return false; + int i = MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D); + int j = MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D); + boolean flag = p_72838_1_.field_98038_p; +@@ -777,9 +828,14 @@ + public void func_72900_e(Entity p_72900_1_) { ++ this.removeEntity(p_72900_1_, false); ++ } ++ ++ public void removeEntity(Entity p_72900_1_, boolean keepData) { + if (p_72900_1_.func_184207_aI()) { + p_72900_1_.func_184226_ay(); + } +@@ -788,7 +844,7 @@ + p_72900_1_.func_184210_p(); + } + +- p_72900_1_.func_70106_y(); ++ p_72900_1_.remove(keepData); + if (p_72900_1_ instanceof PlayerEntity) { + this.field_73010_i.remove(p_72900_1_); + this.func_72854_c(); +@@ -798,8 +854,12 @@ + } + + public void func_72973_f(Entity p_72973_1_) { ++ this.removeEntityDangerously(p_72973_1_, false); ++ } ++ ++ public void removeEntityDangerously(Entity p_72973_1_, boolean keepData) { + p_72973_1_.func_184174_b(false); +- p_72973_1_.func_70106_y(); ++ p_72973_1_.remove(keepData); + if (p_72973_1_ instanceof PlayerEntity) { + this.field_73010_i.remove(p_72973_1_); + this.func_72854_c(); +@@ -819,24 +879,31 @@ + this.field_73021_x.add(p_72954_1_); + } + +- @OnlyIn(Dist.CLIENT) + public void func_72848_b(IWorldEventListener p_72848_1_) { + this.field_73021_x.remove(p_72848_1_); + } + + public int func_72967_a(float p_72967_1_) { ++ float f = 1.0F - this.field_73011_w.getSunBrightnessFactor(p_72967_1_); ++ return (int)(f * 11); ++ } ++ public float getSunBrightnessFactor(float p_72967_1_) { + float f = this.func_72826_c(p_72967_1_); + float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F); + f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); + f1 = 1.0F - f1; + f1 = (float)((double)f1 * (1.0D - (double)(this.func_72867_j(p_72967_1_) * 5.0F) / 16.0D)); + f1 = (float)((double)f1 * (1.0D - (double)(this.func_72819_i(p_72967_1_) * 5.0F) / 16.0D)); +- f1 = 1.0F - f1; +- return (int)(f1 * 11.0F); ++ return f1; + } +@@ -967,6 +1039,10 @@ + entity.func_85029_a(crashreportcategory); + } + + if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringEntities.get()) { + LogManager.getLogger().fatal("{}", crashreport.func_71502_e()); + func_72900_e(entity); + } else + throw new ReportedException(crashreport); + } + +@@ -1009,11 +1085,17 @@ + } catch (Throwable throwable1) { + CrashReport crashreport1 = CrashReport.func_85055_a(throwable1, "Ticking entity"); + CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Entity being ticked"); + entity2.func_85029_a(crashreportcategory1); ++ if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringEntities.get()) { ++ LogManager.getLogger().fatal("{}", crashreport1.func_71502_e()); ++ func_72900_e(entity2); ++ } else + throw new ReportedException(crashreport1); + } + } +@@ -1891,7 +2020,7 @@ + } + + public void func_212420_a(Stream p_212420_1_) { +- p_212420_1_.forEach((p_212418_1_) -> { ++ p_212420_1_.filter(e -> !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(e, this))).forEach((p_212418_1_) -> { + this.field_72996_f.add(p_212418_1_); + this.func_72923_a(p_212418_1_); + }); +@@ -2096,6 +2225,8 @@ + d2 *= MoreObjects.firstNonNull(p_184150_11_.apply(entityplayer1), 1.0D); + } + ++ d2 = net.minecraftforge.common.ForgeHooks.getPlayerVisibilityDistance(entityplayer1, d2, p_184150_9_); ++ + if ((p_184150_9_ < 0.0D || Math.abs(entityplayer1.field_70163_u - p_184150_3_) < p_184150_9_ * p_184150_9_) && (p_184150_7_ < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0)) { + d0 = d1; + entityplayer = entityplayer1; +@@ -2185,12 +2316,17 @@ + } + + if (!this.field_72996_f.contains(p_72897_1_)) { ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72897_1_, this))) + this.field_72996_f.add(p_72897_1_); + } +@@ -2303,16 +2438,15 @@ + } + + public int func_72800_K() { +- return 256; ++ return this.field_73011_w.getHeight(); + } +@@ -2464,4 +2598,40 @@ + public abstract RecipeManager func_199532_z(); + + public abstract NetworkTagManager func_205772_D(); ++ ++ protected void initCapabilities() { ++ net.minecraftforge.common.capabilities.ICapabilityProvider parent = field_73011_w.initCapabilities(); ++ this.gatherCapabilities(parent); ++ net.minecraftforge.common.util.WorldCapabilityData data = func_175693_T().func_212426_a(func_201675_m().func_186058_p(), net.minecraftforge.common.util.WorldCapabilityData::new, net.minecraftforge.common.util.WorldCapabilityData.ID); ++ if (data == null) { ++ capabilityData = new net.minecraftforge.common.util.WorldCapabilityData(getCapabilities()); ++ func_175693_T().func_212424_a(func_201675_m().func_186058_p(), capabilityData.func_195925_e(), capabilityData); ++ } else { ++ capabilityData = data; ++ capabilityData.setCapabilities(field_73011_w, getCapabilities()); ++ } ++ } ++ ++ public int countEntities(net.minecraft.entity.EntityClassification type, int max, boolean forSpawnCount) { ++ int ret = 0; ++ for(Entity entity : this.field_72996_f) { ++ if (entity.isCreatureType(type, forSpawnCount)) { ++ if (ret++ > max) ++ return ret; ++ } ++ } ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/MinableFeature.java.patch b/patches_old/minecraft/net/minecraft/world/gen/feature/OreFeature.java.patch similarity index 86% rename from patches/minecraft/net/minecraft/world/gen/feature/MinableFeature.java.patch rename to patches_old/minecraft/net/minecraft/world/gen/feature/OreFeature.java.patch index 04341dd62..2d8f9dfa5 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/MinableFeature.java.patch +++ b/patches_old/minecraft/net/minecraft/world/gen/feature/OreFeature.java.patch @@ -1,5 +1,5 @@ ---- a/net/minecraft/world/gen/feature/MinableFeature.java -+++ b/net/minecraft/world/gen/feature/MinableFeature.java +--- a/net/minecraft/world/gen/feature/OreFeature.java ++++ b/net/minecraft/world/gen/feature/OreFeature.java @@ -103,7 +103,7 @@ if (!bitset.get(k2)) { bitset.set(k2); diff --git a/patches_old/minecraft/net/minecraft/world/storage/loot/EmptyLootEntry.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/EmptyLootEntry.java.patch new file mode 100644 index 000000000..93251543a --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/storage/loot/EmptyLootEntry.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/world/storage/loot/EmptyLootEntry.java ++++ b/net/minecraft/world/storage/loot/EmptyLootEntry.java +@@ -9,8 +9,8 @@ + import net.minecraft.world.storage.loot.conditions.ILootCondition; + + public class EmptyLootEntry extends ILootGenerator { +- public EmptyLootEntry(int p_i46645_1_, int p_i46645_2_, ILootCondition[] p_i46645_3_) { +- super(p_i46645_1_, p_i46645_2_, p_i46645_3_); ++ public EmptyLootEntry(int p_i46645_1_, int p_i46645_2_, ILootCondition[] p_i46645_3_, String entryName) { ++ super(p_i46645_1_, p_i46645_2_, p_i46645_3_, entryName); + } + + public void func_186363_a(Collection p_186363_1_, Random p_186363_2_, LootContext p_186363_3_) { +@@ -20,6 +20,6 @@ + } + + public static EmptyLootEntry func_186372_a(JsonObject p_186372_0_, JsonDeserializationContext p_186372_1_, int p_186372_2_, int p_186372_3_, ILootCondition[] p_186372_4_) { +- return new EmptyLootEntry(p_186372_2_, p_186372_3_, p_186372_4_); ++ return new EmptyLootEntry(p_186372_2_, p_186372_3_, p_186372_4_, net.minecraftforge.common.ForgeHooks.readLootEntryName(p_186372_0_, "empty")); + } + } diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootEntry.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/ILootGenerator.java.patch similarity index 55% rename from patches/minecraft/net/minecraft/world/storage/loot/LootEntry.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/loot/ILootGenerator.java.patch index 7b1756e56..5a9f69108 100644 --- a/patches/minecraft/net/minecraft/world/storage/loot/LootEntry.java.patch +++ b/patches_old/minecraft/net/minecraft/world/storage/loot/ILootGenerator.java.patch @@ -1,13 +1,19 @@ ---- a/net/minecraft/world/storage/loot/LootEntry.java -+++ b/net/minecraft/world/storage/loot/LootEntry.java -@@ -20,13 +20,17 @@ +--- a/net/minecraft/world/storage/loot/ILootGenerator.java ++++ b/net/minecraft/world/storage/loot/ILootGenerator.java +@@ -15,20 +15,24 @@ + import net.minecraft.util.JSONUtils; + import net.minecraft.util.math.MathHelper; + import net.minecraft.world.storage.loot.conditions.ILootCondition; + import net.minecraft.world.storage.loot.LootEntry.Serializer; + + public abstract class ILootGenerator { protected final int field_186364_c; protected final int field_186365_d; - protected final LootCondition[] field_186366_e; + protected final ILootCondition[] field_186366_e; + protected final String entryName; -- protected LootEntry(int p_i46642_1_, int p_i46642_2_, LootCondition[] p_i46642_3_) { -+ protected LootEntry(int p_i46642_1_, int p_i46642_2_, LootCondition[] p_i46642_3_, String entryName) { +- protected ILootGenerator(int p_i46642_1_, int p_i46642_2_, ILootCondition[] p_i46642_3_) { ++ protected ILootGenerator(int p_i46642_1_, int p_i46642_2_, ILootCondition[] p_i46642_3_, String entryName) { this.field_186364_c = p_i46642_1_; this.field_186365_d = p_i46642_2_; this.field_186366_e = p_i46642_3_; @@ -19,19 +25,19 @@ public int func_186361_a(float p_186361_1_) { return Math.max(MathHelper.func_76141_d((float)this.field_186364_c + (float)this.field_186365_d * p_186361_1_), 0); } -@@ -48,6 +52,9 @@ - alootcondition = new LootCondition[0]; +@@ -50,6 +54,9 @@ + alootcondition = new ILootCondition[0]; } -+ LootEntry ret = net.minecraftforge.common.ForgeHooks.deserializeJsonLootEntry(s, jsonobject, i, j, alootcondition); ++ ILootGenerator ret = net.minecraftforge.common.ForgeHooks.deserializeJsonLootEntry(s, jsonobject, i, j, alootcondition); + if (ret != null) return ret; + if ("item".equals(s)) { - return LootEntryItem.func_186367_a(jsonobject, p_deserialize_3_, i, j, alootcondition); + return ItemLootEntry.func_186367_a(jsonobject, p_deserialize_3_, i, j, alootcondition); } else if ("loot_table".equals(s)) { -@@ -61,12 +68,17 @@ +@@ -63,12 +70,17 @@ - public JsonElement serialize(LootEntry p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) { + public JsonElement serialize(ILootGenerator p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) { JsonObject jsonobject = new JsonObject(); + if (p_serialize_1_.entryName != null && !p_serialize_1_.entryName.startsWith("custom#")) + jsonobject.addProperty("entryName", p_serialize_1_.entryName); @@ -44,6 +50,6 @@ + String type = net.minecraftforge.common.ForgeHooks.getLootEntryType(p_serialize_1_); + if (type != null) jsonobject.addProperty("type", type); + else - if (p_serialize_1_ instanceof LootEntryItem) { + if (p_serialize_1_ instanceof ItemLootEntry) { jsonobject.addProperty("type", "item"); - } else if (p_serialize_1_ instanceof LootEntryTable) { + } else if (p_serialize_1_ instanceof TableLootEntry) { diff --git a/patches/minecraft/net/minecraft/world/storage/loot/LootEntryItem.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/ItemLootEntry.java.patch similarity index 54% rename from patches/minecraft/net/minecraft/world/storage/loot/LootEntryItem.java.patch rename to patches_old/minecraft/net/minecraft/world/storage/loot/ItemLootEntry.java.patch index c889d8519..fc386c5b6 100644 --- a/patches/minecraft/net/minecraft/world/storage/loot/LootEntryItem.java.patch +++ b/patches_old/minecraft/net/minecraft/world/storage/loot/ItemLootEntry.java.patch @@ -1,12 +1,12 @@ ---- a/net/minecraft/world/storage/loot/LootEntryItem.java -+++ b/net/minecraft/world/storage/loot/LootEntryItem.java +--- a/net/minecraft/world/storage/loot/ItemLootEntry.java ++++ b/net/minecraft/world/storage/loot/ItemLootEntry.java @@ -18,8 +18,8 @@ protected final Item field_186368_a; - protected final LootFunction[] field_186369_b; + protected final ILootFunction[] field_186369_b; -- public LootEntryItem(Item p_i46644_1_, int p_i46644_2_, int p_i46644_3_, LootFunction[] p_i46644_4_, LootCondition[] p_i46644_5_) { +- public ItemLootEntry(Item p_i46644_1_, int p_i46644_2_, int p_i46644_3_, ILootFunction[] p_i46644_4_, ILootCondition[] p_i46644_5_) { - super(p_i46644_2_, p_i46644_3_, p_i46644_5_); -+ public LootEntryItem(Item p_i46644_1_, int p_i46644_2_, int p_i46644_3_, LootFunction[] p_i46644_4_, LootCondition[] p_i46644_5_, String entryName) { ++ public ItemLootEntry(Item p_i46644_1_, int p_i46644_2_, int p_i46644_3_, ILootFunction[] p_i46644_4_, ILootCondition[] p_i46644_5_, String entryName) { + super(p_i46644_2_, p_i46644_3_, p_i46644_5_, entryName); this.field_186368_a = p_i46644_1_; this.field_186369_b = p_i46644_4_; @@ -21,10 +21,10 @@ } else { int i = itemstack.func_190916_E(); @@ -72,6 +72,6 @@ - alootfunction = new LootFunction[0]; + alootfunction = new ILootFunction[0]; } -- return new LootEntryItem(item, p_186367_2_, p_186367_3_, alootfunction, p_186367_4_); -+ return new LootEntryItem(item, p_186367_2_, p_186367_3_, alootfunction, p_186367_4_, net.minecraftforge.common.ForgeHooks.readLootEntryName(p_186367_0_, "item")); +- return new ItemLootEntry(item, p_186367_2_, p_186367_3_, alootfunction, p_186367_4_); ++ return new ItemLootEntry(item, p_186367_2_, p_186367_3_, alootfunction, p_186367_4_, net.minecraftforge.common.ForgeHooks.readLootEntryName(p_186367_0_, "item")); } } diff --git a/patches_old/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch new file mode 100644 index 000000000..5015332cf --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/storage/loot/LootPool.java.patch @@ -0,0 +1,100 @@ +--- a/net/minecraft/world/storage/loot/LootPool.java ++++ b/net/minecraft/world/storage/loot/LootPool.java +@@ -20,14 +20,16 @@ + import org.apache.commons.lang3.ArrayUtils; + + public class LootPool { +- private final ILootGenerator[] field_186453_a; +- private final ILootCondition[] field_186454_b; ++ private final String name; ++ private final List field_186453_a; ++ private final List field_186454_b; + private RandomValueRange field_186455_c; + private RandomValueRange field_186456_d; + +- public LootPool(ILootGenerator[] p_i46643_1_, ILootCondition[] p_i46643_2_, RandomValueRange p_i46643_3_, RandomValueRange p_i46643_4_) { +- this.field_186453_a = p_i46643_1_; +- this.field_186454_b = p_i46643_2_; ++ public LootPool(ILootGenerator[] p_i46643_1_, ILootCondition[] p_i46643_2_, RandomValueRange p_i46643_3_, RandomValueRange p_i46643_4_, String name) { ++ this.name = name; ++ this.field_186453_a = Lists.newArrayList(p_i46643_1_); ++ this.field_186454_b = Lists.newArrayList(p_i46643_2_); + this.field_186455_c = p_i46643_3_; + this.field_186456_d = p_i46643_4_; + } +@@ -61,7 +63,7 @@ + } + + public void func_186449_b(Collection p_186449_1_, Random p_186449_2_, LootContext p_186449_3_) { +- if (LootConditionManager.func_186638_a(this.field_186454_b, p_186449_2_, p_186449_3_)) { ++ if (LootConditionManager.testAllConditions(this.field_186454_b, p_186449_2_, p_186449_3_)) { + int i = this.field_186455_c.func_186511_a(p_186449_2_) + MathHelper.func_76141_d(this.field_186456_d.func_186507_b(p_186449_2_) * p_186449_3_.func_186491_f()); + + for(int j = 0; j < i; ++j) { +@@ -71,6 +73,43 @@ + } + } + ++ ++ ++ //======================== 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 RandomValueRange getRolls() { return this.field_186455_c; } ++ public RandomValueRange 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 ILootGenerator getEntry(String name) { ++ return field_186453_a.stream().filter(e -> name.equals(e.getEntryName())).findFirst().orElse(null); ++ } ++ public ILootGenerator removeEntry(String name) { ++ checkFrozen(); ++ for (ILootGenerator entry : this.field_186453_a) { ++ if (name.equals(entry.getEntryName())) { ++ this.field_186453_a.remove(entry); ++ return entry; ++ } ++ } ++ return null; ++ } ++ public void addEntry(ILootGenerator entry) { ++ checkFrozen(); ++ if (field_186453_a.stream().anyMatch(e -> e == entry || e.getEntryName().equals(entry.getEntryName()))) ++ throw new RuntimeException("Attempted to add a duplicate entry to pool: " + entry.getEntryName()); ++ this.field_186453_a.add(entry); ++ } ++ //TODO: Allow modifications of conditions? If so need a way to uniquely identify them. ++ //======================== FORGE END =============================================== ++ + public static class Serializer implements JsonDeserializer, JsonSerializer { + 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"); +@@ -78,18 +117,20 @@ + ILootCondition[] alootcondition = JSONUtils.func_188177_a(jsonobject, "conditions", new ILootCondition[0], p_deserialize_3_, ILootCondition[].class); + RandomValueRange randomvaluerange = JSONUtils.func_188174_a(jsonobject, "rolls", p_deserialize_3_, RandomValueRange.class); + RandomValueRange randomvaluerange1 = JSONUtils.func_188177_a(jsonobject, "bonus_rolls", new RandomValueRange(0.0F, 0.0F), p_deserialize_3_, RandomValueRange.class); +- return new LootPool(alootentry, alootcondition, randomvaluerange, randomvaluerange1); ++ return new LootPool(alootentry, alootcondition, randomvaluerange, randomvaluerange1, net.minecraftforge.common.ForgeHooks.readPoolName(jsonobject)); + } + + public JsonElement serialize(LootPool p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) { + JsonObject jsonobject = new JsonObject(); ++ if (p_serialize_1_.name != null && !p_serialize_1_.name.startsWith("custom#")) ++ jsonobject.add("name", p_serialize_3_.serialize(p_serialize_1_.name)); + jsonobject.add("entries", p_serialize_3_.serialize(p_serialize_1_.field_186453_a)); + jsonobject.add("rolls", p_serialize_3_.serialize(p_serialize_1_.field_186455_c)); + if (p_serialize_1_.field_186456_d.func_186509_a() != 0.0F && p_serialize_1_.field_186456_d.func_186512_b() != 0.0F) { + jsonobject.add("bonus_rolls", p_serialize_3_.serialize(p_serialize_1_.field_186456_d)); + } + +- if (!ArrayUtils.isEmpty((Object[])p_serialize_1_.field_186454_b)) { ++ if (!p_serialize_1_.field_186454_b.isEmpty()) { + jsonobject.add("conditions", p_serialize_3_.serialize(p_serialize_1_.field_186454_b)); + } + diff --git a/patches_old/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch new file mode 100644 index 000000000..911a164f7 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/storage/loot/LootTable.java.patch @@ -0,0 +1,57 @@ +--- a/net/minecraft/world/storage/loot/LootTable.java ++++ b/net/minecraft/world/storage/loot/LootTable.java +@@ -23,10 +23,10 @@ + public class LootTable { + private static final Logger field_186465_b = LogManager.getLogger(); + public static final LootTable field_186464_a = new LootTable(new LootPool[0]); +- private final LootPool[] field_186466_c; ++ private final List field_186466_c; + + public LootTable(LootPool[] p_i46641_1_) { +- this.field_186466_c = p_i46641_1_; ++ this.field_186466_c = Lists.newArrayList(p_i46641_1_); + } + + public List func_186462_a(Random p_186462_1_, LootContext p_186462_2_) { +@@ -112,6 +112,41 @@ + return list; + } + ++ //======================== FORGE START ============================================= ++ private boolean isFrozen = false; ++ public void freeze() { ++ this.isFrozen = true; ++ this.field_186466_c.forEach(LootPool::freeze); ++ } ++ public boolean isFrozen(){ return this.isFrozen; } ++ private void checkFrozen() { ++ if (this.isFrozen()) ++ throw new RuntimeException("Attempted to modify LootTable after being finalized!"); ++ } ++ ++ public LootPool getPool(String name) { ++ return field_186466_c.stream().filter(e -> name.equals(e.getName())).findFirst().orElse(null); ++ } ++ ++ public LootPool removePool(String name) { ++ checkFrozen(); ++ for (LootPool pool : this.field_186466_c) { ++ if (name.equals(pool.getName())) { ++ this.field_186466_c.remove(pool); ++ return pool; ++ } ++ } ++ return null; ++ } ++ ++ public void addPool(LootPool pool) { ++ checkFrozen(); ++ if (field_186466_c.stream().anyMatch(e -> e == pool || e.getName().equals(pool.getName()))) ++ throw new RuntimeException("Attempted to add a duplicate pool to loot table: " + pool.getName()); ++ this.field_186466_c.add(pool); ++ } ++ //======================== FORGE END =============================================== ++ + public static class Serializer implements JsonDeserializer, JsonSerializer { + 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"); diff --git a/patches_old/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch new file mode 100644 index 000000000..b06e4a344 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/storage/loot/LootTableManager.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/storage/loot/LootTableManager.java ++++ b/net/minecraft/world/storage/loot/LootTableManager.java +@@ -39,7 +39,7 @@ + ResourceLocation resourcelocation1 = new ResourceLocation(resourcelocation.func_110624_b(), s.substring(field_195435_a, s.length() - field_195436_b)); + + try (IResource iresource = p_195410_1_.func_199002_a(resourcelocation)) { +- LootTable loottable = JSONUtils.func_188178_a(field_186526_b, IOUtils.toString(iresource.func_199027_b(), StandardCharsets.UTF_8), LootTable.class); ++ LootTable loottable =net.minecraftforge.common.ForgeHooks.loadLootTable(field_186526_b, resourcelocation, IOUtils.toString(iresource.func_199027_b(), StandardCharsets.UTF_8), iresource.func_199026_d().equals("Default"), this); + if (loottable != null) { + this.field_186527_c.put(resourcelocation1, loottable); + } diff --git a/patches_old/minecraft/net/minecraft/world/storage/loot/TableLootEntry.java.patch b/patches_old/minecraft/net/minecraft/world/storage/loot/TableLootEntry.java.patch new file mode 100644 index 000000000..d6fb3e2a6 --- /dev/null +++ b/patches_old/minecraft/net/minecraft/world/storage/loot/TableLootEntry.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/world/storage/loot/TableLootEntry.java ++++ b/net/minecraft/world/storage/loot/TableLootEntry.java +@@ -13,8 +13,8 @@ + public class TableLootEntry extends ILootGenerator { + protected final ResourceLocation field_186371_a; + +- public TableLootEntry(ResourceLocation p_i46639_1_, int p_i46639_2_, int p_i46639_3_, ILootCondition[] p_i46639_4_) { +- super(p_i46639_2_, p_i46639_3_, p_i46639_4_); ++ public TableLootEntry(ResourceLocation p_i46639_1_, int p_i46639_2_, int p_i46639_3_, ILootCondition[] p_i46639_4_, String entryName) { ++ super(p_i46639_2_, p_i46639_3_, p_i46639_4_, entryName); + this.field_186371_a = p_i46639_1_; + } + +@@ -29,6 +29,6 @@ + + public static TableLootEntry func_186370_a(JsonObject p_186370_0_, JsonDeserializationContext p_186370_1_, int p_186370_2_, int p_186370_3_, ILootCondition[] p_186370_4_) { + ResourceLocation resourcelocation = new ResourceLocation(JSONUtils.func_151200_h(p_186370_0_, "name")); +- return new TableLootEntry(resourcelocation, p_186370_2_, p_186370_3_, p_186370_4_); ++ return new TableLootEntry(resourcelocation, p_186370_2_, p_186370_3_, p_186370_4_, net.minecraftforge.common.ForgeHooks.readLootEntryName(p_186370_0_, "loot_table")); + } + } diff --git a/src/main/java/net/minecraftforge/client/CloudRenderer.java b/src/main/java/net/minecraftforge/client/CloudRenderer.java index 763be1e0d..643b9b546 100644 --- a/src/main/java/net/minecraftforge/client/CloudRenderer.java +++ b/src/main/java/net/minecraftforge/client/CloudRenderer.java @@ -25,17 +25,19 @@ import java.util.function.Predicate; import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.platform.GLX; +import com.mojang.blaze3d.platform.GlStateManager; + import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.world.ClientWorld; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GLAllocation; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexBuffer; import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.settings.CloudOption; import net.minecraft.entity.Entity; import net.minecraft.resources.IReloadableResourceManager; import net.minecraft.resources.IResourceManager; @@ -68,7 +70,7 @@ public class CloudRenderer implements ISelectiveResourceReloadListener private int displayList = -1; private VertexBuffer vbo; - private int cloudMode = -1; + private CloudOption cloudMode = CloudOption.OFF; private int renderDistance = -1; private DynamicTexture COLOR_TEX = null; @@ -79,12 +81,12 @@ public class CloudRenderer implements ISelectiveResourceReloadListener public CloudRenderer() { // Resource manager should always be reloadable. - ((IReloadableResourceManager) mc.getResourceManager()).addReloadListener(this); + ((IReloadableResourceManager) mc.getResourceManager()).func_219534_a(this); } private int getScale() { - return cloudMode == 2 ? 12 : 8; + return cloudMode == CloudOption.FANCY ? 12 : 8; } private float ceilToScale(float value) @@ -95,7 +97,7 @@ public class CloudRenderer implements ISelectiveResourceReloadListener private void vertices(BufferBuilder buffer) { - boolean fancy = cloudMode == 2; // Defines whether to hide all but the bottom. + boolean fancy = cloudMode == CloudOption.FANCY; // Defines whether to hide all but the bottom. float scale = getScale(); float CULL_DIST = 2 * scale; @@ -238,14 +240,14 @@ public class CloudRenderer implements ISelectiveResourceReloadListener Tessellator tess = Tessellator.getInstance(); BufferBuilder buffer = tess.getBuffer(); - if (OpenGlHelper.useVbo()) + if (GLX.useVbo()) vbo = new VertexBuffer(FORMAT); else GlStateManager.newList(displayList = GLAllocation.generateDisplayLists(1), GL11.GL_COMPILE); vertices(buffer); - if (OpenGlHelper.useVbo()) + if (GLX.useVbo()) { buffer.finishDrawing(); buffer.reset(); @@ -265,25 +267,25 @@ public class CloudRenderer implements ISelectiveResourceReloadListener private boolean isBuilt() { - return OpenGlHelper.useVbo() ? vbo != null : displayList >= 0; + return GLX.useVbo() ? vbo != null : displayList >= 0; } public void checkSettings() { boolean newEnabled = ForgeConfig.CLIENT.forgeCloudsEnabled.get() - && mc.gameSettings.shouldRenderClouds() != 0 + && mc.gameSettings.func_216842_e() != CloudOption.OFF && mc.world != null && mc.world.dimension.isSurfaceWorld(); if (isBuilt() && (!newEnabled - || mc.gameSettings.shouldRenderClouds() != cloudMode + || mc.gameSettings.func_216842_e() != cloudMode || mc.gameSettings.renderDistanceChunks != renderDistance)) { dispose(); } - cloudMode = mc.gameSettings.shouldRenderClouds(); + cloudMode = mc.gameSettings.func_216842_e(); renderDistance = mc.gameSettings.renderDistanceChunks; if (newEnabled && !isBuilt()) @@ -310,7 +312,7 @@ public class CloudRenderer implements ISelectiveResourceReloadListener int scale = getScale(); - if (cloudMode == 2) + if (cloudMode == CloudOption.FANCY) z += 0.33 * scale; // Integer UVs to translate the texture matrix by. @@ -354,18 +356,18 @@ public class CloudRenderer implements ISelectiveResourceReloadListener | (int) (b * 255)); COLOR_TEX.updateDynamicTexture(); - GlStateManager.activeTexture(OpenGlHelper.GL_TEXTURE1); + GlStateManager.activeTexture(GLX.GL_TEXTURE1); GlStateManager.bindTexture(COLOR_TEX.getGlTextureId()); - GlStateManager.enableTexture2D(); + GlStateManager.enableTexture(); // Bind the clouds texture last so the shader's sampler2D is correct. - GlStateManager.activeTexture(OpenGlHelper.GL_TEXTURE0); + GlStateManager.activeTexture(GLX.GL_TEXTURE0); mc.textureManager.bindTexture(texture); ByteBuffer buffer = Tessellator.getInstance().getBuffer().getByteBuffer(); // Set up pointers for the display list/VBO. - if (OpenGlHelper.useVbo()) + if (GLX.useVbo()) { vbo.bindBuffer(); @@ -387,7 +389,7 @@ public class CloudRenderer implements ISelectiveResourceReloadListener // Depth pass to prevent insides rendering from the outside. GlStateManager.colorMask(false, false, false, false); - if (OpenGlHelper.useVbo()) + if (GLX.useVbo()) vbo.drawArrays(GL11.GL_QUADS); else GlStateManager.callList(displayList); @@ -400,20 +402,20 @@ public class CloudRenderer implements ISelectiveResourceReloadListener { GlStateManager.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); GlStateManager.lineWidth(2.0F); - GlStateManager.disableTexture2D(); + GlStateManager.disableTexture(); GlStateManager.depthMask(false); GlStateManager.disableFog(); - if (OpenGlHelper.useVbo()) + if (GLX.useVbo()) vbo.drawArrays(GL11.GL_QUADS); else GlStateManager.callList(displayList); GlStateManager.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); GlStateManager.depthMask(true); - GlStateManager.enableTexture2D(); + GlStateManager.enableTexture(); GlStateManager.enableFog(); } - if (OpenGlHelper.useVbo()) + if (GLX.useVbo()) { vbo.drawArrays(GL11.GL_QUADS); vbo.unbindBuffer(); // Unbind buffer and disable pointers. @@ -429,9 +431,9 @@ public class CloudRenderer implements ISelectiveResourceReloadListener buffer.position(0); // Disable our coloring. - GlStateManager.activeTexture(OpenGlHelper.GL_TEXTURE1); - GlStateManager.disableTexture2D(); - GlStateManager.activeTexture(OpenGlHelper.GL_TEXTURE0); + GlStateManager.activeTexture(GLX.GL_TEXTURE1); + GlStateManager.disableTexture(); + GlStateManager.activeTexture(GLX.GL_TEXTURE0); // Reset texture matrix. GlStateManager.matrixMode(GL11.GL_TEXTURE); @@ -451,8 +453,8 @@ public class CloudRenderer implements ISelectiveResourceReloadListener if (mc.textureManager != null) { mc.textureManager.bindTexture(texture); - texW = GlStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); - texH = GlStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT); + texW = GlStateManager.getTexLevelParameter(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); + texH = GlStateManager.getTexLevelParameter(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT); } } @@ -478,7 +480,7 @@ public class CloudRenderer implements ISelectiveResourceReloadListener getCloudRenderer().checkSettings(); } - public static boolean renderClouds(int cloudTicks, float partialTicks, WorldClient world, Minecraft client) + public static boolean renderClouds(int cloudTicks, float partialTicks, ClientWorld world, Minecraft client) { IRenderHandler renderer = world.dimension.getCloudRenderer(); if (renderer != null) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 2e3b605fb..362ea4400 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -34,6 +34,8 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Random; +import java.util.function.Consumer; +import java.util.function.Function; import javax.annotation.Nonnull; import javax.vecmath.Matrix3f; @@ -51,22 +53,24 @@ import org.apache.logging.log4j.core.impl.ReusableLogEventFactory; import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; -import net.minecraft.block.state.IBlockState; +import com.mojang.blaze3d.platform.GLX; +import com.mojang.blaze3d.platform.GlStateManager; + +import net.minecraft.block.BlockState; import net.minecraft.client.GameSettings; import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.ISound; -import net.minecraft.client.audio.SoundManager; -import net.minecraft.client.gui.BossInfoClient; +import net.minecraft.client.audio.SoundEngine; +import net.minecraft.client.gui.ClientBossInfo; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiMainMenu; -import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.screen.MainMenuScreen; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.FogRenderer; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; @@ -81,31 +85,31 @@ import net.minecraft.client.renderer.model.ModelRotation; import net.minecraft.client.renderer.model.SimpleBakedModel; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.color.ItemColors; -import net.minecraft.client.renderer.entity.model.ModelBiped; +import net.minecraft.client.renderer.entity.model.BipedModel; import net.minecraft.client.renderer.texture.NativeImage; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage; +import net.minecraft.client.renderer.vertex.VertexFormatElement.Usage; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.IFluidState; -import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.MovementInput; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.registry.IRegistry; import net.minecraft.util.text.TextFormatting; +import net.minecraft.world.IEnviromentBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; @@ -147,15 +151,15 @@ public class ForgeHooksClient //private static final ResourceLocation ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png"); - public static String getArmorTexture(Entity entity, ItemStack armor, String _default, EntityEquipmentSlot slot, String type) + public static String getArmorTexture(Entity entity, ItemStack armor, String _default, EquipmentSlotType slot, String type) { String result = armor.getItem().getArmorTexture(armor, entity, slot, type); return result != null ? result : _default; } - public static boolean onDrawBlockHighlight(WorldRenderer context, EntityPlayer player, RayTraceResult target, int subID, float partialTicks) + public static boolean onDrawBlockHighlight(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks) { - return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent(context, player, target, subID, partialTicks)); + return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent(context, info, target, subID, partialTicks)); } public static void dispatchRenderLast(WorldRenderer context, float partialTicks) @@ -168,19 +172,19 @@ public class ForgeHooksClient return MinecraftForge.EVENT_BUS.post(new RenderHandEvent(context, partialTicks)); } - public static boolean renderSpecificFirstPersonHand(EnumHand hand, float partialTicks, float interpPitch, float swingProgress, float equipProgress, ItemStack stack) + public static boolean renderSpecificFirstPersonHand(Hand hand, float partialTicks, float interpPitch, float swingProgress, float equipProgress, ItemStack stack) { return MinecraftForge.EVENT_BUS.post(new RenderSpecificHandEvent(hand, partialTicks, interpPitch, swingProgress, equipProgress, stack)); } - public static void onTextureStitchedPre(TextureMap map) + public static void onTextureStitchedPre(AtlasTexture map) { MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Pre(map)); // ModelLoader.White.INSTANCE.register(map); // TODO Custom TAS ModelDynBucket.LoaderDynBucket.INSTANCE.register(map); } - public static void onTextureStitchedPost(TextureMap map) + public static void onTextureStitchedPost(AtlasTexture map) { MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map)); } @@ -195,12 +199,6 @@ public class ForgeHooksClient MinecraftForge.EVENT_BUS.post(new ColorHandlerEvent.Item(itemColors, blockColors)); } - static int renderPass = -1; - public static void setRenderPass(int pass) - { - renderPass = pass; - } - static final ThreadLocal renderLayer = new ThreadLocal(); public static void setRenderLayer(BlockRenderLayer layer) @@ -208,9 +206,9 @@ public class ForgeHooksClient renderLayer.set(layer); } - public static ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot slot, ModelBiped _default) + public static > A getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlotType slot, A _default) { - ModelBiped model = itemStack.getItem().getArmorModel(entityLiving, itemStack, slot, _default); + A model = itemStack.getItem().getArmorModel(entityLiving, itemStack, slot, _default); return model == null ? _default : model; } @@ -240,15 +238,15 @@ public class ForgeHooksClient return MinecraftForge.EVENT_BUS.post(new MouseEvent()); } */ - public static float getOffsetFOV(EntityPlayer entity, float fov) + public static float getOffsetFOV(PlayerEntity entity, float fov) { FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov); MinecraftForge.EVENT_BUS.post(fovUpdateEvent); return fovUpdateEvent.getNewfov(); } - public static double getFOVModifier(GameRenderer renderer, Entity entity, IBlockState blockState, IFluidState fluidState, double renderPartialTicks, double fov) { - EntityViewRenderEvent.FOVModifier event = new EntityViewRenderEvent.FOVModifier(renderer, entity, blockState, fluidState, renderPartialTicks, fov); + public static double getFOVModifier(GameRenderer renderer, ActiveRenderInfo info, double renderPartialTicks, double fov) { + EntityViewRenderEvent.FOVModifier event = new EntityViewRenderEvent.FOVModifier(renderer, info, renderPartialTicks, fov); MinecraftForge.EVENT_BUS.post(event); return event.getFOV(); } @@ -309,7 +307,7 @@ public class ForgeHooksClient //RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance); } - public static void renderMainMenu(GuiMainMenu gui, FontRenderer font, int width, int height) + public static void renderMainMenu(MainMenuScreen gui, FontRenderer font, int width, int height) { VersionChecker.Status status = ForgeVersion.getStatus(); if (status == BETA || status == BETA_OUTDATED) @@ -339,7 +337,7 @@ public class ForgeHooksClient } } - public static ISound playSound(SoundManager manager, ISound sound) + public static ISound playSound(SoundEngine manager, ISound sound) { PlaySoundEvent e = new PlaySoundEvent(manager, sound); MinecraftForge.EVENT_BUS.post(e); @@ -354,23 +352,23 @@ public class ForgeHooksClient return worldRenderPass; } - public static void drawScreen(GuiScreen screen, int mouseX, int mouseY, float partialTicks) + public static void drawScreen(Screen screen, int mouseX, int mouseY, float partialTicks) { if (!MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Pre(screen, mouseX, mouseY, partialTicks))) screen.render(mouseX, mouseY, partialTicks); MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Post(screen, mouseX, mouseY, partialTicks)); } - public static float getFogDensity(FogRenderer fogRenderer, GameRenderer renderer, Entity entity, IBlockState state, IFluidState fluidState, float partial, float density) + public static float getFogDensity(FogRenderer fogRenderer, GameRenderer renderer, ActiveRenderInfo info, float partial, float density) { - EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(fogRenderer, renderer, entity, state, fluidState, partial, density); + EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(fogRenderer, renderer, info, partial, density); if (MinecraftForge.EVENT_BUS.post(event)) return event.getDensity(); return -1; } - public static void onFogRender(FogRenderer fogRenderer, GameRenderer renderer, Entity entity, IBlockState state, IFluidState fluidState, float partial, int mode, float distance) + public static void onFogRender(FogRenderer fogRenderer, GameRenderer renderer, ActiveRenderInfo info, float partial, int mode, float distance) { - MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(fogRenderer, renderer, entity, state, fluidState, partial, mode, distance)); + MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(fogRenderer, renderer, info, partial, mode, distance)); } public static void onModelBake(ModelManager modelManager, Map modelRegistry, ModelLoader modelLoader) @@ -443,7 +441,7 @@ public class ForgeHooksClient // moved and expanded from WorldVertexBufferUploader.draw - public static void preDraw(EnumUsage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer) + public static void preDraw(Usage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer) { VertexFormatElement attr = format.getElement(element); int count = attr.getElementCount(); @@ -468,10 +466,10 @@ public class ForgeHooksClient glEnableClientState(GL_COLOR_ARRAY); break; case UV: - OpenGlHelper.glClientActiveTexture(OpenGlHelper.GL_TEXTURE0 + attr.getIndex()); + GLX.glClientActiveTexture(GLX.GL_TEXTURE0 + attr.getIndex()); glTexCoordPointer(count, constant, stride, buffer); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - OpenGlHelper.glClientActiveTexture(OpenGlHelper.GL_TEXTURE0); + GLX.glClientActiveTexture(GLX.GL_TEXTURE0); break; case PADDING: break; @@ -484,7 +482,7 @@ public class ForgeHooksClient } } - public static void postDraw(EnumUsage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer) + public static void postDraw(Usage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer) { VertexFormatElement attr = format.getElement(element); switch(attrType) @@ -498,12 +496,12 @@ public class ForgeHooksClient case COLOR: glDisableClientState(GL_COLOR_ARRAY); // is this really needed? - GlStateManager.resetColor(); + GlStateManager.clearCurrentColor(); break; case UV: - OpenGlHelper.glClientActiveTexture(OpenGlHelper.GL_TEXTURE0 + attr.getIndex()); + GLX.glClientActiveTexture(GLX.GL_TEXTURE0 + attr.getIndex()); glDisableClientState(GL_TEXTURE_COORD_ARRAY); - OpenGlHelper.glClientActiveTexture(OpenGlHelper.GL_TEXTURE0); + GLX.glClientActiveTexture(GLX.GL_TEXTURE0); break; case PADDING: break; @@ -525,7 +523,7 @@ public class ForgeHooksClient public static Matrix4f getMatrix(ModelRotation modelRotation) { - Matrix4f ret = new Matrix4f(TRSRTransformation.toVecmath(modelRotation.getMatrix()), new Vector3f(), 1), tmp = new Matrix4f(); + Matrix4f ret = new Matrix4f(TRSRTransformation.toVecmath(modelRotation.func_217650_a()), new Vector3f(), 1), tmp = new Matrix4f(); tmp.setIdentity(); tmp.m03 = tmp.m13 = tmp.m23 = .5f; ret.mul(tmp, ret); @@ -568,19 +566,19 @@ public class ForgeHooksClient { setVertexFormat(FORMAT); } - boolean hasLighting() + boolean hasLighting() { return dataLength[1] >= 2; } @Override - protected void processQuad() + protected void processQuad() { // Reset light data blockLight = 0; skyLight = 0; // Compute average light for all 4 vertices - for (int i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { blockLight += (int) ((quadData[1][i][0] * 0xFFFF) / 0x20); skyLight += (int) ((quadData[1][i][1] * 0xFFFF) / 0x20); @@ -596,7 +594,7 @@ public class ForgeHooksClient public void setQuadTint(int tint) {} @Override - public void setQuadOrientation(EnumFacing orientation) {} + public void setQuadOrientation(Direction orientation) {} @Override public void setApplyDiffuseLighting(boolean diffuse) {} @@ -613,7 +611,7 @@ public class ForgeHooksClient Random random = new Random(); long seed = 42L; - for (EnumFacing enumfacing : EnumFacing.values()) + for (Direction enumfacing : Direction.values()) { random.setSeed(seed); allquads.addAll(model.getQuads(null, enumfacing, random)); @@ -638,7 +636,7 @@ public class ForgeHooksClient // If the current segment contains lighting data boolean hasLighting = false; - for (int i = 0; i < allquads.size(); i++) + for (int i = 0; i < allquads.size(); i++) { BakedQuad q = allquads.get(i); @@ -660,7 +658,7 @@ public class ForgeHooksClient boolean shade = q.shouldApplyDiffuseLighting(); boolean lightingDirty = segmentBlockLight != bl || segmentSkyLight != sl; - boolean shadeDirty = shade != segmentShading; + boolean shadeDirty = shade != segmentShading; // If lighting or color data has changed, draw the segment and flush it if (lightingDirty || shadeDirty) @@ -685,7 +683,7 @@ public class ForgeHooksClient // Clean up render state if necessary if (hasLighting) { - OpenGlHelper.glMultiTexCoord2f(OpenGlHelper.GL_TEXTURE0, OpenGlHelper.lastBrightnessX, OpenGlHelper.lastBrightnessY); + GLX.glMultiTexCoord2f(GLX.GL_TEXTURE0, GLX.lastBrightnessX, GLX.lastBrightnessY); GlStateManager.enableLighting(); } } @@ -695,8 +693,8 @@ public class ForgeHooksClient BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM); - float lastBl = OpenGlHelper.lastBrightnessX; - float lastSl = OpenGlHelper.lastBrightnessY; + float lastBl = GLX.lastBrightnessX; + float lastSl = GLX.lastBrightnessY; if (updateShading) { @@ -711,19 +709,19 @@ public class ForgeHooksClient GlStateManager.disableLighting(); } } - + if (updateLighting) { // Force lightmap coords to simulate synthetic lighting - OpenGlHelper.glMultiTexCoord2f(OpenGlHelper.GL_TEXTURE0, Math.max(bl, lastBl), Math.max(sl, lastSl)); + GLX.glMultiTexCoord2f(GLX.GL_TEXTURE0, Math.max(bl, lastBl), Math.max(sl, lastSl)); } ri.renderQuads(bufferbuilder, segment, baseColor, stack); Tessellator.getInstance().draw(); // Preserve this as it represents the "world" lighting - OpenGlHelper.lastBrightnessX = lastBl; - OpenGlHelper.lastBrightnessY = lastSl; + GLX.lastBrightnessX = lastBl; + GLX.lastBrightnessY = lastSl; segment.clear(); } @@ -731,7 +729,7 @@ public class ForgeHooksClient /** * internal, relies on fixed format of FaceBakery */ - public static void fillNormal(int[] faceData, EnumFacing facing) + public static void fillNormal(int[] faceData, Direction facing) { Vector3f v1 = getVertexPos(faceData, 3); Vector3f t = getVertexPos(faceData, 1); @@ -796,10 +794,10 @@ public class ForgeHooksClient } } - public static IBakedModel getDamageModel(IBakedModel ibakedmodel, TextureAtlasSprite texture, IBlockState state, IWorldReader world, BlockPos pos) + public static IBakedModel getDamageModel(IBakedModel ibakedmodel, TextureAtlasSprite texture, BlockState state, IEnviromentBlockReader world, BlockPos pos, long randomPosition) { state = state.getBlock().getExtendedState(state, world, pos); - return (new SimpleBakedModel.Builder(state, ibakedmodel, texture, new Random(), 42)).build(); + return (new SimpleBakedModel.Builder(state, ibakedmodel, texture, new Random(), randomPosition)).build(); } private static int slotMainHand = 0; @@ -821,7 +819,7 @@ public class ForgeHooksClient return from.getItem().shouldCauseReequipAnimation(from, to, changed); } - public static BlockFaceUV applyUVLock(BlockFaceUV blockFaceUV, EnumFacing originalSide, ITransformation rotation) + public static BlockFaceUV applyUVLock(BlockFaceUV blockFaceUV, Direction originalSide, ITransformation rotation) { TRSRTransformation global = new TRSRTransformation(rotation.getMatrixVec()); Matrix4f uv = global.getUVLockTransform(originalSide).getMatrixVec(); @@ -863,7 +861,7 @@ public class ForgeHooksClient return new BlockFaceUV(new float[]{ uMin, vMin, uMax, vMax }, angle); } - public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(MainWindow res, BossInfoClient bossInfo, int x, int y, int increment) + public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(MainWindow res, ClientBossInfo bossInfo, int x, int y, int increment) { RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO, bossInfo, x, y, increment); @@ -892,102 +890,102 @@ public class ForgeHooksClient return Pair.of(model, mat); } - public static void onInputUpdate(EntityPlayer player, MovementInput movementInput) + public static void onInputUpdate(PlayerEntity player, MovementInput movementInput) { MinecraftForge.EVENT_BUS.post(new InputUpdateEvent(player, movementInput)); } public static void refreshResources(Minecraft mc, VanillaResourceType... types) { SelectiveReloadStateHandler.INSTANCE.beginReload(ReloadRequirements.include(types)); - mc.refreshResources(); + mc.func_213237_g(); SelectiveReloadStateHandler.INSTANCE.endReload(); } - public static boolean onGuiMouseClickedPre(GuiScreen guiScreen, double mouseX, double mouseY, int button) + public static boolean onGuiMouseClickedPre(Screen guiScreen, double mouseX, double mouseY, int button) { Event event = new GuiScreenEvent.MouseClickedEvent.Pre(guiScreen, mouseX, mouseY, button); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiMouseClickedPost(GuiScreen guiScreen, double mouseX, double mouseY, int button) + public static boolean onGuiMouseClickedPost(Screen guiScreen, double mouseX, double mouseY, int button) { Event event = new GuiScreenEvent.MouseClickedEvent.Post(guiScreen, mouseX, mouseY, button); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiMouseReleasedPre(GuiScreen guiScreen, double mouseX, double mouseY, int button) + public static boolean onGuiMouseReleasedPre(Screen guiScreen, double mouseX, double mouseY, int button) { Event event = new GuiScreenEvent.MouseReleasedEvent.Pre(guiScreen, mouseX, mouseY, button); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiMouseReleasedPost(GuiScreen guiScreen, double mouseX, double mouseY, int button) + public static boolean onGuiMouseReleasedPost(Screen guiScreen, double mouseX, double mouseY, int button) { Event event = new GuiScreenEvent.MouseReleasedEvent.Post(guiScreen, mouseX, mouseY, button); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiMouseDragPre(GuiScreen guiScreen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) + public static boolean onGuiMouseDragPre(Screen guiScreen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) { Event event = new GuiScreenEvent.MouseDragEvent.Pre(guiScreen, mouseX, mouseY, mouseButton, dragX, dragY); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiMouseDragPost(GuiScreen guiScreen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) + public static boolean onGuiMouseDragPost(Screen guiScreen, double mouseX, double mouseY, int mouseButton, double dragX, double dragY) { Event event = new GuiScreenEvent.MouseDragEvent.Post(guiScreen, mouseX, mouseY, mouseButton, dragX, dragY); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiMouseScrollPre(MouseHelper mouseHelper, GuiScreen guiScreen, double scrollDelta) + public static boolean onGuiMouseScrollPre(MouseHelper mouseHelper, Screen guiScreen, double scrollDelta) { - MainWindow mainWindow = guiScreen.mc.mainWindow; + MainWindow mainWindow = guiScreen.getMinecraft().mainWindow; double mouseX = mouseHelper.getMouseX() * (double) mainWindow.getScaledWidth() / (double) mainWindow.getWidth(); double mouseY = mouseHelper.getMouseY() * (double) mainWindow.getScaledHeight() / (double) mainWindow.getHeight(); Event event = new GuiScreenEvent.MouseScrollEvent.Pre(guiScreen, mouseX, mouseY, scrollDelta); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiMouseScrollPost(MouseHelper mouseHelper, GuiScreen guiScreen, double scrollDelta) + public static boolean onGuiMouseScrollPost(MouseHelper mouseHelper, Screen guiScreen, double scrollDelta) { - MainWindow mainWindow = guiScreen.mc.mainWindow; + MainWindow mainWindow = guiScreen.getMinecraft().mainWindow; double mouseX = mouseHelper.getMouseX() * (double) mainWindow.getScaledWidth() / (double) mainWindow.getWidth(); double mouseY = mouseHelper.getMouseY() * (double) mainWindow.getScaledHeight() / (double) mainWindow.getHeight(); Event event = new GuiScreenEvent.MouseScrollEvent.Post(guiScreen, mouseX, mouseY, scrollDelta); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiKeyPressedPre(GuiScreen guiScreen, int keyCode, int scanCode, int modifiers) + public static boolean onGuiKeyPressedPre(Screen guiScreen, int keyCode, int scanCode, int modifiers) { Event event = new GuiScreenEvent.KeyboardKeyPressedEvent.Pre(guiScreen, keyCode, scanCode, modifiers); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiKeyPressedPost(GuiScreen guiScreen, int keyCode, int scanCode, int modifiers) + public static boolean onGuiKeyPressedPost(Screen guiScreen, int keyCode, int scanCode, int modifiers) { Event event = new GuiScreenEvent.KeyboardKeyPressedEvent.Post(guiScreen, keyCode, scanCode, modifiers); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiKeyReleasedPre(GuiScreen guiScreen, int keyCode, int scanCode, int modifiers) + public static boolean onGuiKeyReleasedPre(Screen guiScreen, int keyCode, int scanCode, int modifiers) { Event event = new GuiScreenEvent.KeyboardKeyReleasedEvent.Pre(guiScreen, keyCode, scanCode, modifiers); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiKeyReleasedPost(GuiScreen guiScreen, int keyCode, int scanCode, int modifiers) + public static boolean onGuiKeyReleasedPost(Screen guiScreen, int keyCode, int scanCode, int modifiers) { Event event = new GuiScreenEvent.KeyboardKeyReleasedEvent.Post(guiScreen, keyCode, scanCode, modifiers); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiCharTypedPre(GuiScreen guiScreen, char codePoint, int modifiers) + public static boolean onGuiCharTypedPre(Screen guiScreen, char codePoint, int modifiers) { Event event = new GuiScreenEvent.KeyboardCharTypedEvent.Pre(guiScreen, codePoint, modifiers); return MinecraftForge.EVENT_BUS.post(event); } - public static boolean onGuiCharTypedPost(GuiScreen guiScreen, char codePoint, int modifiers) + public static boolean onGuiCharTypedPost(Screen guiScreen, char codePoint, int modifiers) { Event event = new GuiScreenEvent.KeyboardCharTypedEvent.Post(guiScreen, codePoint, modifiers); return MinecraftForge.EVENT_BUS.post(event); diff --git a/src/main/java/net/minecraftforge/client/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/ForgeIngameGui.java similarity index 83% rename from src/main/java/net/minecraftforge/client/GuiIngameForge.java rename to src/main/java/net/minecraftforge/client/ForgeIngameGui.java index 2c13b332b..e99e2cb4f 100644 --- a/src/main/java/net/minecraftforge/client/GuiIngameForge.java +++ b/src/main/java/net/minecraftforge/client/ForgeIngameGui.java @@ -26,20 +26,18 @@ import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiIngame; -import net.minecraft.client.gui.GuiOverlayDebug; -import net.minecraft.client.network.NetHandlerPlayClient; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.gui.AbstractGui; +import net.minecraft.client.gui.IngameGui; +import net.minecraft.client.gui.overlay.DebugOverlayGui; +import net.minecraft.client.network.play.ClientPlayNetHandler; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.LivingEntity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.IAttributeInstance; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.MobEffects; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.block.Blocks; +import net.minecraft.potion.Effects; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.ScoreObjective; @@ -51,16 +49,17 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; import net.minecraft.util.Util; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RayTraceFluidMode; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.GameType; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.common.MinecraftForge; +import com.mojang.blaze3d.platform.GlStateManager; + import org.lwjgl.opengl.GL11; -public class GuiIngameForge extends GuiIngame +public class ForgeIngameGui extends IngameGui { //private static final ResourceLocation VIGNETTE = new ResourceLocation("textures/misc/vignette.png"); //private static final ResourceLocation WIDGITS = new ResourceLocation("textures/gui/widgets.png"); @@ -74,6 +73,7 @@ public class GuiIngameForge extends GuiIngame public static boolean renderVignette = true; public static boolean renderHelmet = true; public static boolean renderPortal = true; + public static boolean renderSpectatorTooltip = true; public static boolean renderHotbar = true; public static boolean renderCrosshairs = true; public static boolean renderBossHealth = true; @@ -94,7 +94,7 @@ public class GuiIngameForge extends GuiIngame //private static final String MC_VERSION = MinecraftForge.MC_VERSION; private GuiOverlayDebugForge debugOverlay; - public GuiIngameForge(Minecraft mc) + public ForgeIngameGui(Minecraft mc) { super(mc); debugOverlay = new GuiOverlayDebugForge(mc); @@ -106,7 +106,7 @@ public class GuiIngameForge extends GuiIngame this.scaledWidth = this.mc.mainWindow.getScaledWidth(); this.scaledHeight = this.mc.mainWindow.getScaledHeight(); eventParent = new RenderGameOverlayEvent(partialTicks, this.mc.mainWindow); - renderHealthMount = mc.player.getRidingEntity() instanceof EntityLivingBase; + renderHealthMount = mc.player.getRidingEntity() instanceof LivingEntity; renderFood = mc.player.getRidingEntity() == null; renderJumpBar = mc.player.isRidingHorse(); @@ -130,23 +130,30 @@ public class GuiIngameForge extends GuiIngame if (renderHelmet) renderHelmet(partialTicks); - if (renderPortal && !mc.player.isPotionActive(MobEffects.NAUSEA)) + if (renderPortal && !mc.player.isPotionActive(Effects.NAUSEA)) { renderPortal(partialTicks); } - if (renderHotbar) renderHotbar(partialTicks); + if (this.mc.playerController.getCurrentGameType() == GameType.SPECTATOR) + { + if (renderSpectatorTooltip) spectatorGui.renderTooltip(partialTicks); + } + else if (!this.mc.gameSettings.hideGUI) + { + if (renderHotbar) renderHotbar(partialTicks); + } if (!this.mc.gameSettings.hideGUI) { GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - zLevel = -90.0F; + blitOffset = -90; rand.setSeed((long)(ticks * 312871)); - if (renderCrosshairs) renderAttackIndicator(partialTicks); + if (renderCrosshairs) renderAttackIndicator(); if (renderBossHealth) renderBossHealth(); GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - if (this.mc.playerController.shouldDrawHUD() && this.mc.getRenderViewEntity() instanceof EntityPlayer) + if (this.mc.playerController.shouldDrawHUD() && this.mc.getRenderViewEntity() instanceof PlayerEntity) { if (renderHealth) renderHealth(this.scaledWidth, this.scaledHeight); if (renderArmor) renderArmor(this.scaledWidth, this.scaledHeight); @@ -212,13 +219,13 @@ public class GuiIngameForge extends GuiIngame } @Override - protected void renderAttackIndicator(float partialTicks) + protected void renderAttackIndicator() { if (pre(CROSSHAIRS)) return; - bind(Gui.ICONS); + bind(AbstractGui.GUI_ICONS_LOCATION); GlStateManager.enableBlend(); GlStateManager.enableAlphaTest(); - super.renderAttackIndicator(partialTicks); + super.renderAttackIndicator(); post(CROSSHAIRS); } @@ -237,17 +244,16 @@ public class GuiIngameForge extends GuiIngame post(SUBTITLES); } - //@Override protected void renderBossHealth() { if (pre(BOSSHEALTH)) return; - bind(Gui.ICONS); + bind(AbstractGui.GUI_ICONS_LOCATION); GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - mc.profiler.startSection("bossHealth"); + mc.func_213239_aq().startSection("bossHealth"); GlStateManager.enableBlend(); - this.overlayBoss.renderBossHealth(); + this.overlayBoss.render(); GlStateManager.disableBlend(); - mc.profiler.endSection(); + mc.func_213239_aq().endSection(); post(BOSSHEALTH); } @@ -290,7 +296,7 @@ public class GuiIngameForge extends GuiIngame protected void renderArmor(int width, int height) { if (pre(ARMOR)) return; - mc.profiler.startSection("armor"); + mc.func_213239_aq().startSection("armor"); GlStateManager.enableBlend(); int left = width / 2 - 91; @@ -301,22 +307,22 @@ public class GuiIngameForge extends GuiIngame { if (i < level) { - drawTexturedModalRect(left, top, 34, 9, 9, 9); + blit(left, top, 34, 9, 9, 9); } else if (i == level) { - drawTexturedModalRect(left, top, 25, 9, 9, 9); + blit(left, top, 25, 9, 9, 9); } else if (i > level) { - drawTexturedModalRect(left, top, 16, 9, 9, 9); + blit(left, top, 16, 9, 9, 9); } left += 8; } left_height += 10; GlStateManager.disableBlend(); - mc.profiler.endSection(); + mc.func_213239_aq().endSection(); post(ARMOR); } @@ -361,8 +367,8 @@ public class GuiIngameForge extends GuiIngame protected void renderAir(int width, int height) { if (pre(AIR)) return; - mc.profiler.startSection("air"); - EntityPlayer player = (EntityPlayer)this.mc.getRenderViewEntity(); + mc.func_213239_aq().startSection("air"); + PlayerEntity player = (PlayerEntity)this.mc.getRenderViewEntity(); GlStateManager.enableBlend(); int left = width / 2 + 91; int top = height - right_height; @@ -375,24 +381,24 @@ public class GuiIngameForge extends GuiIngame for (int i = 0; i < full + partial; ++i) { - drawTexturedModalRect(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9); + blit(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9); } right_height += 10; } GlStateManager.disableBlend(); - mc.profiler.endSection(); + mc.func_213239_aq().endSection(); post(AIR); } public void renderHealth(int width, int height) { - bind(ICONS); + bind(GUI_ICONS_LOCATION); if (pre(HEALTH)) return; - mc.profiler.startSection("health"); + mc.func_213239_aq().startSection("health"); GlStateManager.enableBlend(); - EntityPlayer player = (EntityPlayer)this.mc.getRenderViewEntity(); + PlayerEntity player = (PlayerEntity)this.mc.getRenderViewEntity(); int health = MathHelper.ceil(player.getHealth()); boolean highlight = healthUpdateCounter > (long)ticks && (healthUpdateCounter - (long)ticks) / 3L %2L == 1L; @@ -432,7 +438,7 @@ public class GuiIngameForge extends GuiIngame if (rowHeight != 10) left_height += 10 - rowHeight; int regen = -1; - if (player.isPotionActive(MobEffects.REGENERATION)) + if (player.isPotionActive(Effects.REGENERATION)) { regen = ticks % 25; } @@ -440,8 +446,8 @@ public class GuiIngameForge extends GuiIngame final int TOP = 9 * (mc.world.getWorldInfo().isHardcore() ? 5 : 0); final int BACKGROUND = (highlight ? 25 : 16); int MARGIN = 16; - if (player.isPotionActive(MobEffects.POISON)) MARGIN += 36; - else if (player.isPotionActive(MobEffects.WITHER)) MARGIN += 72; + if (player.isPotionActive(Effects.POISON)) MARGIN += 36; + else if (player.isPotionActive(Effects.WITHER)) MARGIN += 72; float absorbRemaining = absorb; for (int i = MathHelper.ceil((healthMax + absorb) / 2.0F) - 1; i >= 0; --i) @@ -454,49 +460,49 @@ public class GuiIngameForge extends GuiIngame if (health <= 4) y += rand.nextInt(2); if (i == regen) y -= 2; - drawTexturedModalRect(x, y, BACKGROUND, TOP, 9, 9); + blit(x, y, BACKGROUND, TOP, 9, 9); if (highlight) { if (i * 2 + 1 < healthLast) - drawTexturedModalRect(x, y, MARGIN + 54, TOP, 9, 9); //6 + blit(x, y, MARGIN + 54, TOP, 9, 9); //6 else if (i * 2 + 1 == healthLast) - drawTexturedModalRect(x, y, MARGIN + 63, TOP, 9, 9); //7 + blit(x, y, MARGIN + 63, TOP, 9, 9); //7 } if (absorbRemaining > 0.0F) { if (absorbRemaining == absorb && absorb % 2.0F == 1.0F) { - drawTexturedModalRect(x, y, MARGIN + 153, TOP, 9, 9); //17 + blit(x, y, MARGIN + 153, TOP, 9, 9); //17 absorbRemaining -= 1.0F; } else { - drawTexturedModalRect(x, y, MARGIN + 144, TOP, 9, 9); //16 + blit(x, y, MARGIN + 144, TOP, 9, 9); //16 absorbRemaining -= 2.0F; } } else { if (i * 2 + 1 < health) - drawTexturedModalRect(x, y, MARGIN + 36, TOP, 9, 9); //4 + blit(x, y, MARGIN + 36, TOP, 9, 9); //4 else if (i * 2 + 1 == health) - drawTexturedModalRect(x, y, MARGIN + 45, TOP, 9, 9); //5 + blit(x, y, MARGIN + 45, TOP, 9, 9); //5 } } GlStateManager.disableBlend(); - mc.profiler.endSection(); + mc.func_213239_aq().endSection(); post(HEALTH); } public void renderFood(int width, int height) { if (pre(FOOD)) return; - mc.profiler.startSection("food"); + mc.func_213239_aq().startSection("food"); - EntityPlayer player = (EntityPlayer)this.mc.getRenderViewEntity(); + PlayerEntity player = (PlayerEntity)this.mc.getRenderViewEntity(); GlStateManager.enableBlend(); int left = width / 2 + 91; int top = height - right_height; @@ -514,7 +520,7 @@ public class GuiIngameForge extends GuiIngame int icon = 16; byte background = 0; - if (mc.player.isPotionActive(MobEffects.HUNGER)) + if (mc.player.isPotionActive(Effects.HUNGER)) { icon += 36; background = 13; @@ -526,15 +532,15 @@ public class GuiIngameForge extends GuiIngame y = top + (rand.nextInt(3) - 1); } - drawTexturedModalRect(x, y, 16 + background * 9, 27, 9, 9); + blit(x, y, 16 + background * 9, 27, 9, 9); if (idx < level) - drawTexturedModalRect(x, y, icon + 36, 27, 9, 9); + blit(x, y, icon + 36, 27, 9, 9); else if (idx == level) - drawTexturedModalRect(x, y, icon + 45, 27, 9, 9); + blit(x, y, icon + 45, 27, 9, 9); } GlStateManager.disableBlend(); - mc.profiler.endSection(); + mc.func_213239_aq().endSection(); post(FOOD); } @@ -542,7 +548,7 @@ public class GuiIngameForge extends GuiIngame { if (mc.player.getSleepTimer() > 0) { - mc.profiler.startSection("sleep"); + mc.func_213239_aq().startSection("sleep"); GlStateManager.disableDepthTest(); GlStateManager.disableAlphaTest(); int sleepTime = mc.player.getSleepTimer(); @@ -554,16 +560,16 @@ public class GuiIngameForge extends GuiIngame } int color = (int)(220.0F * opacity) << 24 | 1052704; - drawRect(0, 0, width, height, color); + fill(0, 0, width, height, color); GlStateManager.enableAlphaTest(); GlStateManager.enableDepthTest(); - mc.profiler.endSection(); + mc.func_213239_aq().endSection(); } } protected void renderExperience(int x) { - bind(ICONS); + bind(GUI_ICONS_LOCATION); if (pre(EXPERIENCE)) return; GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableBlend(); @@ -581,7 +587,7 @@ public class GuiIngameForge extends GuiIngame @Override public void renderHorseJumpBar(int x) { - bind(ICONS); + bind(GUI_ICONS_LOCATION); if (pre(JUMPBAR)) return; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableBlend(); @@ -589,7 +595,7 @@ public class GuiIngameForge extends GuiIngame super.renderHorseJumpBar(x); GlStateManager.enableBlend(); - mc.profiler.endSection(); + mc.func_213239_aq().endSection(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); post(JUMPBAR); @@ -597,8 +603,8 @@ public class GuiIngameForge extends GuiIngame protected void renderHUDText(int width, int height) { - mc.profiler.startSection("forgeHudText"); - OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + mc.func_213239_aq().startSection("forgeHudText"); + GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); ArrayList listL = new ArrayList(); ArrayList listR = new ArrayList(); @@ -630,7 +636,7 @@ public class GuiIngameForge extends GuiIngame for (String msg : listL) { if (msg == null) continue; - drawRect(1, top - 1, 2 + fontrenderer.getStringWidth(msg) + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752); + fill(1, top - 1, 2 + fontrenderer.getStringWidth(msg) + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752); fontrenderer.drawStringWithShadow(msg, 2, top, 14737632); top += fontrenderer.FONT_HEIGHT; } @@ -641,13 +647,13 @@ public class GuiIngameForge extends GuiIngame if (msg == null) continue; int w = fontrenderer.getStringWidth(msg); int left = width - 2 - w; - drawRect(left - 1, top - 1, left + w + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752); + fill(left - 1, top - 1, left + w + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752); fontrenderer.drawStringWithShadow(msg, left, top, 14737632); top += fontrenderer.FONT_HEIGHT; } } - mc.profiler.endSection(); + mc.func_213239_aq().endSection(); post(TEXT); } @@ -655,7 +661,7 @@ public class GuiIngameForge extends GuiIngame { if (this.mc.gameSettings.showDebugInfo && this.mc.gameSettings.showLagometer && !pre(FPS_GRAPH)) { - this.debugOverlay.renderLagometer(); + this.debugOverlay.render(); post(FPS_GRAPH); } } @@ -664,7 +670,7 @@ public class GuiIngameForge extends GuiIngame { if (overlayMessageTime > 0) { - mc.profiler.startSection("overlayMessage"); + mc.func_213239_aq().startSection("overlayMessage"); float hue = (float)overlayMessageTime - partialTicks; int opacity = (int)(hue * 256.0F / 20.0F); if (opacity > 255) opacity = 255; @@ -681,7 +687,7 @@ public class GuiIngameForge extends GuiIngame GlStateManager.popMatrix(); } - mc.profiler.endSection(); + mc.func_213239_aq().endSection(); } } @@ -689,7 +695,7 @@ public class GuiIngameForge extends GuiIngame { if (titlesTimer > 0) { - mc.profiler.startSection("titleAndSubtitle"); + mc.func_213239_aq().startSection("titleAndSubtitle"); float age = (float)this.titlesTimer - partialTicks; int opacity = 255; @@ -721,37 +727,37 @@ public class GuiIngameForge extends GuiIngame GlStateManager.popMatrix(); } - this.mc.profiler.endSection(); + this.mc.func_213239_aq().endSection(); } } protected void renderChat(int width, int height) { - mc.profiler.startSection("chat"); + mc.func_213239_aq().startSection("chat"); RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48); if (MinecraftForge.EVENT_BUS.post(event)) return; GlStateManager.pushMatrix(); GlStateManager.translatef((float) event.getPosX(), (float) event.getPosY(), 0.0F); - persistantChatGUI.drawChat(ticks); + persistantChatGUI.render(ticks); GlStateManager.popMatrix(); post(CHAT); - mc.profiler.endSection(); + mc.func_213239_aq().endSection(); } protected void renderPlayerList(int width, int height) { ScoreObjective scoreobjective = this.mc.world.getScoreboard().getObjectiveInDisplaySlot(0); - NetHandlerPlayClient handler = mc.player.connection; + ClientPlayNetHandler handler = mc.player.connection; if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.getPlayerInfoMap().size() > 1 || scoreobjective != null)) { this.overlayPlayerList.setVisible(true); if (pre(PLAYER_LIST)) return; - this.overlayPlayerList.renderPlayerlist(width, this.mc.world.getScoreboard(), scoreobjective); + this.overlayPlayerList.render(width, this.mc.world.getScoreboard(), scoreobjective); post(PLAYER_LIST); } else @@ -762,20 +768,20 @@ public class GuiIngameForge extends GuiIngame protected void renderHealthMount(int width, int height) { - EntityPlayer player = (EntityPlayer)mc.getRenderViewEntity(); + PlayerEntity player = (PlayerEntity)mc.getRenderViewEntity(); Entity tmp = player.getRidingEntity(); - if (!(tmp instanceof EntityLivingBase)) return; + if (!(tmp instanceof LivingEntity)) return; - bind(ICONS); + bind(GUI_ICONS_LOCATION); if (pre(HEALTHMOUNT)) return; boolean unused = false; int left_align = width / 2 + 91; - mc.profiler.endStartSection("mountHealth"); + mc.func_213239_aq().func_219895_b("mountHealth"); GlStateManager.enableBlend(); - EntityLivingBase mount = (EntityLivingBase)tmp; + LivingEntity mount = (LivingEntity)tmp; int health = (int)Math.ceil((double)mount.getHealth()); float healthMax = mount.getMaxHealth(); int hearts = (int)(healthMax + 0.5F) / 2; @@ -797,12 +803,12 @@ public class GuiIngameForge extends GuiIngame for (int i = 0; i < rowCount; ++i) { int x = left_align - i * 8 - 9; - drawTexturedModalRect(x, top, BACKGROUND, 9, 9, 9); + blit(x, top, BACKGROUND, 9, 9, 9); if (i * 2 + 1 + heart < health) - drawTexturedModalRect(x, top, FULL, 9, 9, 9); + blit(x, top, FULL, 9, 9, 9); else if (i * 2 + 1 + heart == health) - drawTexturedModalRect(x, top, HALF, 9, 9, 9); + blit(x, top, HALF, 9, 9, 9); } right_height += 10; @@ -825,7 +831,7 @@ public class GuiIngameForge extends GuiIngame mc.getTextureManager().bindTexture(res); } - private class GuiOverlayDebugForge extends GuiOverlayDebug + private class GuiOverlayDebugForge extends DebugOverlayGui { private Minecraft mc; private GuiOverlayDebugForge(Minecraft mc) @@ -836,8 +842,8 @@ public class GuiIngameForge extends GuiIngame public void update() { Entity entity = this.mc.getRenderViewEntity(); - this.rayTraceBlock = entity.rayTrace(20.0D, 0.0F, RayTraceFluidMode.NEVER); - this.rayTraceFluid = entity.rayTrace(20.0D, 0.0F, RayTraceFluidMode.ALWAYS); + this.rayTraceBlock = entity.func_213324_a(20.0D, 0.0F, false); + this.rayTraceFluid = entity.func_213324_a(20.0D, 0.0F, true); } @Override protected void renderDebugInfoLeft(){} @Override protected void renderDebugInfoRight(){} diff --git a/src/main/java/net/minecraftforge/client/IRenderHandler.java b/src/main/java/net/minecraftforge/client/IRenderHandler.java index 53a6416f4..1a5a116bf 100644 --- a/src/main/java/net/minecraftforge/client/IRenderHandler.java +++ b/src/main/java/net/minecraftforge/client/IRenderHandler.java @@ -21,12 +21,12 @@ package net.minecraftforge.client; import net.minecraftforge.api.distmarker.Dist; import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.world.ClientWorld; import net.minecraftforge.api.distmarker.OnlyIn; @FunctionalInterface public interface IRenderHandler { @OnlyIn(Dist.CLIENT) - public abstract void render(float partialTicks, WorldClient world, Minecraft mc); + public abstract void render(float partialTicks, ClientWorld world, Minecraft mc); } diff --git a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java index bb16ac1b2..58ad9460c 100644 --- a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java +++ b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java @@ -41,9 +41,8 @@ import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; -import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.chunk.RenderChunkCache; +import net.minecraft.client.renderer.chunk.ChunkRenderCache; import net.minecraft.client.renderer.texture.NativeImage; import net.minecraft.resources.IResource; import net.minecraft.resources.IResourceManager; @@ -57,11 +56,6 @@ import net.minecraftforge.client.model.data.IModelData; public class MinecraftForgeClient { - public static int getRenderPass() - { - return ForgeHooksClient.renderPass; - } - public static BlockRenderLayer getRenderLayer() { return ForgeHooksClient.renderLayer.get(); @@ -113,20 +107,20 @@ public class MinecraftForgeClient } } - private static final LoadingCache, RenderChunkCache> regionCache = CacheBuilder.newBuilder() + private static final LoadingCache, ChunkRenderCache> regionCache = CacheBuilder.newBuilder() .maximumSize(500) .concurrencyLevel(5) .expireAfterAccess(1, TimeUnit.SECONDS) - .build(new CacheLoader, RenderChunkCache>() + .build(new CacheLoader, ChunkRenderCache>() { @Override - public RenderChunkCache load(Pair key) + public ChunkRenderCache load(Pair key) { - return RenderChunkCache.func_212397_a(key.getLeft(), key.getRight().add(-1, -1, -1), key.getRight().add(16, 16, 16), 1); + return ChunkRenderCache.generateCache(key.getLeft(), key.getRight().add(-1, -1, -1), key.getRight().add(16, 16, 16), 1); } }); - public static void onRebuildChunk(World world, BlockPos position, RenderChunkCache cache) + public static void onRebuildChunk(World world, BlockPos position, ChunkRenderCache cache) { if (cache == null) regionCache.invalidate(Pair.of(world, position)); @@ -134,7 +128,7 @@ public class MinecraftForgeClient regionCache.put(Pair.of(world, position), cache); } - public static RenderChunkCache getRegionRenderCache(World world, BlockPos pos) + public static ChunkRenderCache getRegionRenderCache(World world, BlockPos pos) { int x = pos.getX() & ~0xF; int y = pos.getY() & ~0xF; diff --git a/src/main/java/net/minecraftforge/client/event/ClientChatEvent.java b/src/main/java/net/minecraftforge/client/event/ClientChatEvent.java index 8eb16e468..c93bb366d 100644 --- a/src/main/java/net/minecraftforge/client/event/ClientChatEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ClientChatEvent.java @@ -24,7 +24,6 @@ import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.common.MinecraftForge; -import net.minecraft.client.gui.GuiScreen; /** * ClientChatEvent is fired whenever the client is about to send a chat message or command to the server.
diff --git a/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java b/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java index 653ecb3be..59685b1c4 100644 --- a/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java +++ b/src/main/java/net/minecraftforge/client/event/DrawBlockHighlightEvent.java @@ -21,30 +21,30 @@ package net.minecraftforge.client.event; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.WorldRenderer; @Cancelable public class DrawBlockHighlightEvent extends Event { private final WorldRenderer context; - private final EntityPlayer player; + private final ActiveRenderInfo info; private final RayTraceResult target; private final int subID; private final float partialTicks; - public DrawBlockHighlightEvent(WorldRenderer context, EntityPlayer player, RayTraceResult target, int subID, float partialTicks) + public DrawBlockHighlightEvent(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks) { this.context = context; - this.player = player; + this.info = info; this.target = target; this.subID = subID; this.partialTicks= partialTicks; } public WorldRenderer getContext() { return context; } - public EntityPlayer getPlayer() { return player; } + public ActiveRenderInfo getInfo() { return info; } public RayTraceResult getTarget() { return target; } public int getSubID() { return subID; } public float getPartialTicks() { return partialTicks; } diff --git a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java index b3ec1dd50..fb87eab7c 100644 --- a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java +++ b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java @@ -19,8 +19,9 @@ package net.minecraftforge.client.event; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.FogRenderer; import net.minecraft.entity.Entity; import net.minecraft.fluid.IFluidState; @@ -36,59 +37,45 @@ import net.minecraftforge.eventbus.api.Event.HasResult; public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus.api.Event { private final GameRenderer renderer; - private final Entity entity; - private final IBlockState state; - private final IFluidState fluidState; + private final ActiveRenderInfo info; private final double renderPartialTicks; - public EntityViewRenderEvent(GameRenderer renderer, Entity entity, IBlockState state, IFluidState fluidState, double renderPartialTicks) + public EntityViewRenderEvent(GameRenderer renderer, ActiveRenderInfo info, double renderPartialTicks) { this.renderer = renderer; - this.entity = entity; - this.state = state; - this.fluidState = fluidState; + this.info = info; this.renderPartialTicks = renderPartialTicks; } public GameRenderer getRenderer() { - return renderer; - } - - public Entity getEntity() - { - return entity; + return renderer; } - public IBlockState getBlockState() + public ActiveRenderInfo getInfo() { - return state; - } - - public IFluidState getFluidState() - { - return fluidState; + return info; } public double getRenderPartialTicks() { return renderPartialTicks; } - + private static class FogEvent extends EntityViewRenderEvent { private final FogRenderer fogRenderer; - - protected FogEvent(FogRenderer fogRenderer, GameRenderer renderer, Entity entity, IBlockState state, IFluidState fluidState, double renderPartialTicks) + + protected FogEvent(FogRenderer fogRenderer, GameRenderer renderer, ActiveRenderInfo info, double renderPartialTicks) { - super(renderer, entity, state, fluidState, renderPartialTicks); + super(renderer, info, renderPartialTicks); this.fogRenderer = fogRenderer; } - + public FogRenderer getFogRenderer() { return fogRenderer; } } - /** + /** * Event that allows any feature to customize the fog density the player sees. * NOTE: In order to make this event have an effect, you must cancel the event */ @@ -97,9 +84,9 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus. { private float density; - public FogDensity(FogRenderer fogRenderer, GameRenderer renderer, Entity entity, IBlockState state, IFluidState fluidState, double renderPartialTicks, float density) + public FogDensity(FogRenderer fogRenderer, GameRenderer renderer, ActiveRenderInfo info, double renderPartialTicks, float density) { - super(fogRenderer, renderer, entity, state, fluidState, renderPartialTicks); + super(fogRenderer, renderer, info, renderPartialTicks); this.setDensity(density); } @@ -123,9 +110,9 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus. private final int fogMode; private final float farPlaneDistance; - public RenderFogEvent(FogRenderer fogRenderer, GameRenderer renderer, Entity entity, IBlockState state, IFluidState fluidState, double renderPartialTicks, int fogMode, float farPlaneDistance) + public RenderFogEvent(FogRenderer fogRenderer, GameRenderer renderer, ActiveRenderInfo info, double renderPartialTicks, int fogMode, float farPlaneDistance) { - super(fogRenderer, renderer, entity, state, fluidState, renderPartialTicks); + super(fogRenderer, renderer, info, renderPartialTicks); this.fogMode = fogMode; this.farPlaneDistance = farPlaneDistance; } @@ -146,14 +133,14 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus. * NOTE: Any change made to one of the color variables will affect the result seen in-game. */ public static class FogColors extends FogEvent - { + { private float red; private float green; private float blue; - public FogColors(FogRenderer fogRenderer, GameRenderer renderer, Entity entity, IBlockState state, IFluidState fluidState, double renderPartialTicks, float red, float green, float blue) + public FogColors(FogRenderer fogRenderer, GameRenderer renderer, ActiveRenderInfo info, double renderPartialTicks, float red, float green, float blue) { - super(fogRenderer, renderer, entity, state, fluidState, renderPartialTicks); + super(fogRenderer, renderer, info, renderPartialTicks); this.setRed(red); this.setGreen(green); this.setBlue(blue); @@ -166,8 +153,8 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus. public float getBlue() { return blue; } public void setBlue(float blue) { this.blue = blue; } } - - /** + + /** * Event that allows mods to alter the angles of the player's camera. Mainly useful for applying roll. */ public static class CameraSetup extends EntityViewRenderEvent @@ -176,9 +163,9 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus. private float pitch; private float roll; - public CameraSetup(GameRenderer renderer, Entity entity, IBlockState state, IFluidState fluidState, double renderPartialTicks, float yaw, float pitch, float roll) + public CameraSetup(GameRenderer renderer, ActiveRenderInfo info, double renderPartialTicks, float yaw, float pitch, float roll) { - super(renderer, entity, state, fluidState, renderPartialTicks); + super(renderer, info, renderPartialTicks); this.setYaw(yaw); this.setPitch(pitch); this.setRoll(roll); @@ -191,7 +178,7 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus. public float getRoll() { return roll; } public void setRoll(float roll) { this.roll = roll; } } - + /** * Event that allows mods to alter the raw FOV itself. * This directly affects to the FOV without being modified. @@ -199,9 +186,9 @@ public abstract class EntityViewRenderEvent extends net.minecraftforge.eventbus. public static class FOVModifier extends EntityViewRenderEvent { private double fov; - - public FOVModifier(GameRenderer renderer, Entity entity, IBlockState state, IFluidState fluidState, double renderPartialTicks, double fov) { - super(renderer, entity, state, fluidState, renderPartialTicks); + + public FOVModifier(GameRenderer renderer, ActiveRenderInfo info, double renderPartialTicks, double fov) { + super(renderer, info, renderPartialTicks); this.setFOV(fov); } diff --git a/src/main/java/net/minecraftforge/client/event/FOVUpdateEvent.java b/src/main/java/net/minecraftforge/client/event/FOVUpdateEvent.java index cd3cbbb14..29e3d0649 100644 --- a/src/main/java/net/minecraftforge/client/event/FOVUpdateEvent.java +++ b/src/main/java/net/minecraftforge/client/event/FOVUpdateEvent.java @@ -19,7 +19,7 @@ package net.minecraftforge.client.event; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraftforge.eventbus.api.Event; /** @@ -28,18 +28,18 @@ import net.minecraftforge.eventbus.api.Event; */ public class FOVUpdateEvent extends Event { - private final EntityPlayer entity; + private final PlayerEntity entity; private final float fov; private float newfov; - public FOVUpdateEvent(EntityPlayer entity, float fov) + public FOVUpdateEvent(PlayerEntity entity, float fov) { this.entity = entity; this.fov = fov; this.setNewfov(fov); } - public EntityPlayer getEntity() + public PlayerEntity getEntity() { return entity; } diff --git a/src/main/java/net/minecraftforge/client/event/GuiContainerEvent.java b/src/main/java/net/minecraftforge/client/event/GuiContainerEvent.java index ae1eb44f2..de2ef74ee 100644 --- a/src/main/java/net/minecraftforge/client/event/GuiContainerEvent.java +++ b/src/main/java/net/minecraftforge/client/event/GuiContainerEvent.java @@ -19,7 +19,7 @@ package net.minecraftforge.client.event; -import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.gui.screen.inventory.ContainerScreen; import net.minecraftforge.eventbus.api.Event; /** @@ -28,14 +28,14 @@ import net.minecraftforge.eventbus.api.Event; public class GuiContainerEvent extends Event { - private final GuiContainer guiContainer; + private final ContainerScreen guiContainer; - public GuiContainerEvent(GuiContainer guiContainer) + public GuiContainerEvent(ContainerScreen guiContainer) { this.guiContainer = guiContainer; } - public GuiContainer getGuiContainer() + public ContainerScreen getGuiContainer() { return guiContainer; } @@ -58,7 +58,7 @@ public class GuiContainerEvent extends Event * @param mouseX The current X position of the players mouse. * @param mouseY The current Y position of the players mouse. */ - public DrawForeground(GuiContainer guiContainer, int mouseX, int mouseY) + public DrawForeground(ContainerScreen guiContainer, int mouseX, int mouseY) { super(guiContainer); this.mouseX = mouseX; @@ -92,7 +92,7 @@ public class GuiContainerEvent extends Event * @param mouseX The current X position of the players mouse. * @param mouseY The current Y position of the players mouse. */ - public DrawBackground(GuiContainer guiContainer, int mouseX, int mouseY) + public DrawBackground(ContainerScreen guiContainer, int mouseX, int mouseY) { super(guiContainer); this.mouseX = mouseX; diff --git a/src/main/java/net/minecraftforge/client/event/GuiOpenEvent.java b/src/main/java/net/minecraftforge/client/event/GuiOpenEvent.java index 57407eb0a..6723b2b29 100644 --- a/src/main/java/net/minecraftforge/client/event/GuiOpenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/GuiOpenEvent.java @@ -21,7 +21,7 @@ package net.minecraftforge.client.event; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; -import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.screen.Screen; /** * This event is called before any Gui will open. @@ -33,18 +33,18 @@ import net.minecraft.client.gui.GuiScreen; @net.minecraftforge.eventbus.api.Cancelable public class GuiOpenEvent extends net.minecraftforge.eventbus.api.Event { - private GuiScreen gui; - public GuiOpenEvent(GuiScreen gui) + private Screen gui; + public GuiOpenEvent(Screen gui) { this.setGui(gui); } - public GuiScreen getGui() + public Screen getGui() { return gui; } - public void setGui(GuiScreen gui) + public void setGui(Screen gui) { this.gui = gui; } diff --git a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java index 18d66c934..53c99c220 100644 --- a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java @@ -26,12 +26,11 @@ import java.util.function.Consumer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.IGuiEventListener; -import net.minecraft.client.renderer.InventoryEffectRenderer; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.widget.Widget; +import net.minecraft.client.gui.widget.button.Button; +import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.InputMappings; import net.minecraftforge.eventbus.api.Cancelable; @@ -47,9 +46,9 @@ import org.lwjgl.glfw.GLFW; @OnlyIn(Dist.CLIENT) public class GuiScreenEvent extends Event { - private final GuiScreen gui; + private final Screen gui; - public GuiScreenEvent(GuiScreen gui) + public GuiScreenEvent(Screen gui) { this.gui = gui; } @@ -57,42 +56,42 @@ public class GuiScreenEvent extends Event /** * The GuiScreen object generating this event. */ - public GuiScreen getGui() + public Screen getGui() { return gui; } public static class InitGuiEvent extends GuiScreenEvent { - private Consumer addButton; - private Consumer removeButton; + private Consumer add; + private Consumer remove; - private List buttonList; + private List list; - public InitGuiEvent(GuiScreen gui, List buttonList, Consumer addButton, Consumer removeButton) + public InitGuiEvent(Screen gui, List list, Consumer add, Consumer remove) { super(gui); - this.buttonList = Collections.unmodifiableList(buttonList); - this.addButton = addButton; - this.removeButton = removeButton; + this.list = Collections.unmodifiableList(list); + this.add = add; + this.remove = remove; } /** * Unmodifiable reference to the list of buttons on the {@link #gui}. */ - public List getButtonList() + public List getWidgetList() { - return buttonList; + return list; } - public void addButton(GuiButton button) + public void addWidget(Widget button) { - addButton.accept(button); + add.accept(button); } - public void removeButton(GuiButton button) + public void removeWidget(Widget button) { - removeButton.accept(button); + remove.accept(button); } /** @@ -107,9 +106,9 @@ public class GuiScreenEvent extends Event @Cancelable public static class Pre extends InitGuiEvent { - public Pre(GuiScreen gui, List buttonList, Consumer addButton, Consumer removeButton) + public Pre(Screen gui, List list, Consumer add, Consumer remove) { - super(gui, buttonList, addButton, removeButton); + super(gui, list, add, remove); } } @@ -119,9 +118,9 @@ public class GuiScreenEvent extends Event */ public static class Post extends InitGuiEvent { - public Post(GuiScreen gui, List buttonList, Consumer addButton, Consumer removeButton) + public Post(Screen gui, List list, Consumer add, Consumer remove) { - super(gui, buttonList, addButton, removeButton); + super(gui, list, add, remove); } } } @@ -132,7 +131,7 @@ public class GuiScreenEvent extends Event private final int mouseY; private final float renderPartialTicks; - public DrawScreenEvent(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks) + public DrawScreenEvent(Screen gui, int mouseX, int mouseY, float renderPartialTicks) { super(gui); this.mouseX = mouseX; @@ -171,7 +170,7 @@ public class GuiScreenEvent extends Event @Cancelable public static class Pre extends DrawScreenEvent { - public Pre(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks) + public Pre(Screen gui, int mouseX, int mouseY, float renderPartialTicks) { super(gui, mouseX, mouseY, renderPartialTicks); } @@ -182,7 +181,7 @@ public class GuiScreenEvent extends Event */ public static class Post extends DrawScreenEvent { - public Post(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks) + public Post(Screen gui, int mouseX, int mouseY, float renderPartialTicks) { super(gui, mouseX, mouseY, renderPartialTicks); } @@ -195,7 +194,7 @@ public class GuiScreenEvent extends Event */ public static class BackgroundDrawnEvent extends GuiScreenEvent { - public BackgroundDrawnEvent(GuiScreen gui) + public BackgroundDrawnEvent(Screen gui) { super(gui); } @@ -209,7 +208,7 @@ public class GuiScreenEvent extends Event @Cancelable public static class PotionShiftEvent extends GuiScreenEvent { - public PotionShiftEvent(GuiScreen gui) + public PotionShiftEvent(Screen gui) { super(gui); } @@ -217,25 +216,25 @@ public class GuiScreenEvent extends Event public static class ActionPerformedEvent extends GuiScreenEvent { - private GuiButton button; - private List buttonList; + private Button button; + private List